@nocobase/plugin-action-duplicate 2.1.0-alpha.4 → 2.1.0-alpha.40
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -1
- package/dist/client/locale/index.d.ts +2 -1
- package/dist/{client/models → client-v2}/DuplicateActionModel.d.ts +2 -2
- package/dist/client-v2/index.d.ts +14 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +9 -0
- package/dist/externalVersion.js +7 -6
- package/package.json +7 -3
- /package/dist/{client/models → client-v2}/utils.d.ts +0 -0
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>
|
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@nocobase/client"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@formily/react"),require("lodash"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-duplicate",["@formily/core","@nocobase/client","react","@emotion/css","@nocobase/flow-engine","@formily/react","lodash","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-action-duplicate"]=t(require("@formily/core"),require("@nocobase/client"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@formily/react"),require("lodash"),require("antd"),require("react-i18next")):e["@nocobase/plugin-action-duplicate"]=t(e["@formily/core"],e["@nocobase/client"],e.react,e["@emotion/css"],e["@nocobase/flow-engine"],e["@formily/react"],e.lodash,e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,l,a,c){return function(){"use strict";var u={73:function(e,t,n){let r=n(239),o=Symbol("max"),i=Symbol("length"),l=Symbol("lengthCalculator"),a=Symbol("allowStale"),c=Symbol("maxAge"),u=Symbol("dispose"),s=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),f=Symbol("updateAgeOnGet"),h=()=>1,m=(e,t,n)=>{let r=e[p].get(t);if(r){let t=r.value;if(y(e,t)){if(b(e,r),!e[a])return}else n&&(e[f]&&(r.value.now=Date.now()),e[d].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[c])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[c]&&n>e[c]},v=e=>{if(e[i]>e[o])for(let t=e[d].tail;e[i]>e[o]&&null!==t;){let n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){let n=t.value;e[u]&&e[u](n.key,n.value),e[i]-=n.length,e[p].delete(n.key),e[d].removeNode(t)}};class g{constructor(e,t,n,r,o){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=o||0}}let x=(e,t,n,r)=>{let o=n.value;y(e,o)&&(b(e,n),e[a]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw TypeError("max must be a non-negative number");this[o]=e.max||1/0;let t=e.length||h;if(this[l]="function"!=typeof t?h:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw TypeError("maxAge must be a number");this[c]=e.maxAge||0,this[u]=e.dispose,this[s]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw TypeError("max must be a non-negative number");this[o]=e||1/0,v(this)}get max(){return this[o]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw TypeError("maxAge must be a non-negative number");this[c]=e,v(this)}get maxAge(){return this[c]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[l]&&(this[l]=e,this[i]=0,this[d].forEach(e=>{e.length=this[l](e.value,e.key),this[i]+=e.length})),v(this)}get lengthCalculator(){return this[l]}get length(){return this[i]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let n=this[d].tail;null!==n;){let r=n.prev;x(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[d].head;null!==n;){let r=n.next;x(this,e,n,t),n=r}}keys(){return this[d].toArray().map(e=>e.key)}values(){return this[d].toArray().map(e=>e.value)}reset(){this[u]&&this[d]&&this[d].length&&this[d].forEach(e=>this[u](e.key,e.value)),this[p]=new Map,this[d]=new r,this[i]=0}dump(){return this[d].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[d]}set(e,t,n){if((n=n||this[c])&&"number"!=typeof n)throw TypeError("maxAge must be a number");let r=n?Date.now():0,a=this[l](t,e);if(this[p].has(e)){if(a>this[o])return b(this,this[p].get(e)),!1;let l=this[p].get(e).value;return this[u]&&!this[s]&&this[u](e,l.value),l.now=r,l.maxAge=n,l.value=t,this[i]+=a-l.length,l.length=a,this.get(e),v(this),!0}let f=new g(e,t,a,r,n);return f.length>this[o]?(this[u]&&this[u](e,t),!1):(this[i]+=f.length,this[d].unshift(f),this[p].set(e,this[d].head),v(this),!0)}has(e){return!!this[p].has(e)&&!y(this,this[p].get(e).value)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){let e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[p].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],o=r.e||0;if(0===o)this.set(r.k,r.v);else{let e=o-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[p].forEach((e,t)=>m(this,t,!1))}}},377:function(e){e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},239:function(e,t,n){function r(e){var t=this;if(t instanceof r||(t=new r),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var n=0,o=arguments.length;n<o;n++)t.push(arguments[n]);return t}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=r,r.Node=o,r.create=r,r.prototype.removeNode=function(e){if(e.list!==this)throw Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},r.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},r.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},r.prototype.push=function(){for(var e,t,n=0,r=arguments.length;n<r;n++){e=this,t=arguments[n],e.tail=new o(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}return this.length},r.prototype.unshift=function(){for(var e,t,n=0,r=arguments.length;n<r;n++){e=this,t=arguments[n],e.head=new o(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}return this.length},r.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},r.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},r.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},r.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},r.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},r.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},r.prototype.map=function(e,t){t=t||this;for(var n=new r,o=this.head;null!==o;)n.push(e.call(t,o.value,this)),o=o.next;return n},r.prototype.mapReverse=function(e,t){t=t||this;for(var n=new r,o=this.tail;null!==o;)n.push(e.call(t,o.value,this)),o=o.prev;return n},r.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=0;null!==r;o++)n=e(n,r.value,o),r=r.next;return n},r.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;null!==r;o--)n=e(n,r.value,o),r=r.prev;return n},r.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},r.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},r.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=0,i=this.head;null!==i&&o<e;o++)i=i.next;for(;null!==i&&o<t;o++,i=i.next)n.push(i.value);return n},r.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=this.length,i=this.tail;null!==i&&o>t;o--)i=i.prev;for(;null!==i&&o>e;o--,i=i.prev)n.push(i.value);return n},r.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,i=this.head;null!==i&&r<e;r++)i=i.next;for(var l=[],r=0;i&&r<t;r++)l.push(i.value),i=this.removeNode(i);null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev);for(var r=0;r<n.length;r++)i=function(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return null===r.next&&(e.tail=r),null===r.prev&&(e.head=r),e.length++,r}(this,i,n[r]);return l},r.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};try{n(377)(r)}catch(e){}},964:function(e){e.exports=r},563:function(t){t.exports=e},505:function(e){e.exports=i},772:function(e){e.exports=t},667:function(e){e.exports=o},721:function(e){e.exports=a},467:function(e){e.exports=l},156:function(e){e.exports=n},238:function(e){e.exports=c}},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return u[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return!function(){d.r(p),d.d(p,{actionDesignerCss:function(){return O},DuplicateAction:function(){return k},PluginActionDuplicateClient:function(){return eP},default:function(){return eA}});var e=d(772),t=d(964),n=d(505),r=d(721),o=d(467),i=d.n(o),l=d(156),a=d.n(l),c=d(238);function u(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 s(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(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){f(e,t,n[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||g(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){if(e){if("string"==typeof e)return u(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 u(e,t)}}function x(){var e=b(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n '&.nb-in-template': {\n background: 'var(--colorTemplateBgSettingsHover)';\n }\n ,\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n"]);return x=function(){return e},e}function w(){var e=b(["\n .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n "]);return w=function(){return e},e}var O=(0,t.css)(x()),k=a().forwardRef(function(o,d){var p,b,x,k,S,D,P=o.onlyIcon,A=y(o,["onlyIcon"]),C=o.children,j=o.icon,M=o.title,E=y(o,["children","icon","title"]),T=r.App.useApp().message,F=(0,n.useField)(),I=(0,n.useFieldSchema)(),q=(0,e.useAPIClient)(),_=F.disabled||o.disabled,R=(0,e.useDesignable)().designable,L=v((0,l.useState)(!1),2),K=L[0],B=L[1],N=v((0,l.useState)(!1),2),V=N[0],z=N[1],$=v((0,l.useState)(!1),2),G=$[0],U=$[1],H=(0,e.useBlockRequestContext)(),J=H.service,Q=H.__parent,W=H.block,X=H.resource,Y=I["x-component-props"],Z=Y.duplicateFields,ee=Y.duplicateMode,et=void 0===ee?"quickDulicate":ee,en=Y.duplicateCollection,er=(0,e.useRecord)(),eo=(0,e.useCollectionParentRecordData)(),ei=(0,e.useCollection)(),el=er.id,ea=er.__collection,ec=(0,e.useActionContext)(),eu=(0,e.useCollection_deprecated)().name,es=(0,e.useCollectionManager_deprecated)().getCollectionFields,ed=(0,c.useTranslation)().t,ep=es(ea||eu),ef=(0,e.useFormBlockContext)(),eh=(0,e.useACLActionParamsContext)(),em=(0,e.useDataSourceKey)(),ey=(0,e.useDataSourceHeaders)(em),ev={key:"duplicate",dataId:Array.isArray(ei.filterTargetKey)?(k=Object).assign.apply(k,[{}].concat(function(e){if(Array.isArray(e))return u(e)}(p=ei.filterTargetKey.map(function(e){return f({},e,er[e])}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(p)||g(p)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):er[ei.filterTargetKey]||el,default:!0,fields:(null==Z?void 0:Z.filter(function(e){return ep.find(function(t){return e.includes(t.name)})}))||[],collection:ea||eu},eb="Action.Link"===I["x-component"],eg=(b=function(){var t,n,r,o,i;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:z(!0),l.label=1;case 1:return l.trys.push([1,7,,8]),[4,(0,e.fetchTemplateData)(q,ev,ey)];case 2:return t=l.sent(),[4,X.create({values:h({},t)})];case 3:if(l.sent(),T.success(ed("Saved successfully")),"form"!==W)return[3,4];return null==Q||null==(r=Q.service)||null==(n=r.refresh)||n.call(r),[3,6];case 4:return[4,null==J||null==(o=J.refresh)?void 0:o.call(J)];case 5:l.sent(),l.label=6;case 6:return z(!1),[3,8];case 7:return i=l.sent(),z(!1),console.error(i),[3,8];case 8:return[2]}})},x=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=b.apply(e,t);function i(e){s(o,n,r,i,l,"next",e)}function l(e){s(o,n,r,i,l,"throw",e)}i(void 0)})},function(){return x.apply(this,arguments)}),ex=function(){_||V||!eh||((null==Z?void 0:Z.length)>0?"quickDulicate"===et?eg():B(!0):T.error(ed("Please configure the duplicate fields")))};return a().createElement("div",{ref:d,className:(0,t.cx)(O,f({},(0,t.css)(w()),eb))},a().createElement(e.FormBlockContext.Provider,{value:m(h({},ef),{duplicateData:{display:!1,enabled:!0,defaultTemplate:ev}})},a().createElement("div",null,eb?a().createElement("a",{className:"nb-action-link",role:o.role,"aria-label":o["aria-label"],disabled:_,style:m(h({},E.style),{opacity:R&&(null==F||null==(S=F.data)?void 0:S.hidden)&&.1,cursor:V?"not-allowed":"pointer",position:"relative"}),onClick:ex},a().createElement(r.Tooltip,{title:M},a().createElement("span",{style:{marginRight:3}},j&&"string"==typeof j?a().createElement(e.Icon,{type:j}):j)),P?C[1]:V?ed("Duplicating"):C||ed("Duplicate")):a().createElement(r.Button,m(h({role:o.role,"aria-label":o["aria-label"],disabled:_,style:{opacity:R&&(null==F||null==(D=F.data)?void 0:D.hidden)&&.1}},A),{onClick:ex}),V?ed("Duplicating"):C||ed("Duplicate")),a().createElement(e.TabsContextProvider,null,a().createElement(e.CollectionProvider_deprecated,{name:en||eu},a().createElement(e.RecordProvider,{record:m(h({},eo),{__collection:en||ea})},a().createElement(e.ActionContextProvider,{value:m(h({},ec),{visible:K,setVisible:B,formValueChanged:G,setFormValueChanged:U})},a().createElement(e.PopupSettingsProvider,{enableURL:!1},a().createElement(e.RefreshComponentProvider,{refresh:i().noop},a().createElement(e.NocoBaseRecursionField,{schema:I,basePath:F.address,onlyRenderProperties:!0}))))))))))}),S=d(563);function D(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 P(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function A(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){P(i,r,o,l,a,"next",e)}function a(e){P(i,r,o,l,a,"throw",e)}l(void 0)})}}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(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){C(e,t,n[t])})}return e}function M(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var T=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var r,o=(r=(0,l.useState)(e.defaultCheckedKeys||[]),function(e){if(Array.isArray(e))return e}(r)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(r,2)||function(e,t){if(e){if("string"==typeof e)return D(e,2);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 D(e,t)}}(r,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.")}()),i=o[0],a=o[1],c=function(e){a(e),t.value=e};t.onCheck=c;var u=(0,n.useForm)();return M(j({},e),{checkedKeys:i,onCheck:c,treeData:null==e?void 0:e.treeData.map(function(e){if("quickDulicate"===u.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return M(j({},e),{disabled:!1})});return M(j({},e),{disabled:!1,children:n})}return e})})})),F=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],o=r.children,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(r,["children"]);t.push(i.key),o&&F(o,t)}return t},I=function(e){return e.reduceProperties(function(e,t){return"FormBlockProvider"===t["x-decorator"]?t:I(t)},null)},q=[{name:"Customize",Component:function(e){return e.children},children:[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t=(0,e.useCollection_deprecated)().name;return M(j({},(0,e.useSchemaToolbar)().linkageRulesProps),{collectionName:t})}},{name:"duplicationMode",Component:function(){var t,r,i,u,s=(0,e.useDesignable)().dn,d=(0,c.useTranslation)().t,p=(0,n.useField)(),f=(0,n.useFieldSchema)(),h=(0,e.useCollection_deprecated)().name,m=(0,e.useCollectionState)(h),y=m.collectionList,v=m.getEnableFieldTree,b=m.getOnLoadData,g=m.getOnCheck,x=(0,o.cloneDeep)((null==(t=f["x-component-props"])?void 0:t.duplicateFields)||[]),w=(0,e.useRecord)(),O=(0,l.useCallback)(function(e,t,n){n.query("duplicateFields").take(function(r){r.componentProps.treeData=e,r.componentProps.defaultCheckedKeys=t,r.setInitialValue(t),null==r||r.onCheck(t),n.setValues(M(j({},n.values),{treeData:e}))})},[]);return a().createElement(e.SchemaSettingsModalItem,{title:d("Duplicate mode"),components:{Tree:T},scope:{getEnableFieldTree:v,collectionName:(null==(r=f["x-component-props"])?void 0:r.duplicateCollection)||(null==w?void 0:w.__collection)||h,currentCollection:(null==w?void 0:w.__collection)||h,getOnLoadData:b,getOnCheck:g,treeData:null==(i=f["x-component-props"])?void 0:i.treeData,duplicateValues:x,onFieldInputValueChange:S.onFieldInputValueChange},schema:{type:"object",title:d("Duplicate mode"),properties:{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",title:d("Duplicate mode"),default:(null==(u=f["x-component-props"])?void 0:u.duplicateMode)||"quickDulicate",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:d("If collection inherits, choose inherited collections as templates"),default:"{{ collectionName }}","x-display":y.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:y},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":"Action.Link","x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var t,n=(0,l.useMemo)(function(){return I(f)},[f]);return(0,e.useSyncFromForm)(n,(null==(t=f["x-component-props"])?void 0:t.duplicateCollection)||(null==w?void 0:w.__collection)||h,O)}},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return A(function(){return E(this,function(t){return e.query("duplicateFields").take(function(e){var t,n=F(e.componentProps.treeData,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)}),[2]})})()}}}}},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return A(function(){return E(this,function(t){return e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])}),[2]})})()}}}}},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:d("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":T,"x-component-props":{defaultCheckedKeys:x,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",onCheck:"{{ getOnCheck($self) }}",rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection",".duplicateMode"],fulfill:{state:{disabled:"{{ !$deps[0] }}",componentProps:{treeData:"{{ getEnableFieldTree($deps[0], $self,treeData) }}"}}}}]}}},onSubmit:function(e){var t,n,r=e.duplicateMode,o=e.collection,i=e.duplicateFields,l=e.treeData,a=Array.isArray(i)?i:i.checked||[];p.componentProps.duplicateMode=r,p.componentProps.duplicateFields=a,f["x-component-props"]=f["x-component-props"]||{},f["x-component-props"].duplicateMode=r,f["x-component-props"].duplicateFields=a,f["x-component-props"].duplicateCollection=o,f["x-component-props"].treeData=l||(null==(t=p.componentProps)?void 0:t.treeData),s.emit("patch",{schema:(C(n={},"x-uid",f["x-uid"]),C(n,"x-component-props",j({},f["x-component-props"])),n)}),s.refresh()}})},useVisible:function(){return"duplicate"===(0,n.useFieldSchema)()["x-action"]}},{name:"openMode",Component:e.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var t=(0,e.useOpenModeContext)().hideOpenMode,n=(0,c.useTranslation)().t;return{openMode:!t,openSize:!t,modeOptions:(0,l.useMemo)(function(){return[{label:n("Drawer"),value:"drawer"},{label:n("Dialog"),value:"modal"}]},[n])}}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}],_=new e.SchemaSettings({name:"ActionSettings:duplicate",items:q}),R=new e.SchemaSettings({name:"actionSettings:duplicate",items:q}),L=function(t){return a().createElement(e.ACLActionProvider,null,t.children)},K=function(t){var n,r,o={type:"void","x-action":"duplicate","x-acl-action":"create",title:'{{ t("Duplicate") }}',"x-component":"Action.Link","x-decorator":"DuplicateActionDecorator","x-component-props":{openMode:(0,e.useOpenModeContext)().defaultOpenMode,component:"DuplicateAction"},properties:{drawer:{type:"void",title:'{{ t("Duplicate") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}};return a().createElement(e.ActionInitializerItem,(n=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}({},t),r=r={schema:o},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n))},B=function(t){return a().createElement(e.SchemaComponentOptions,{components:{DuplicateActionInitializer:K,DuplicateAction:k}},t.children)},N=d(667),V=d(73),z=d.n(V);function $(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 G(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function U(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}function H(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function J(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $(e,void 0);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 $(e,t)}}(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.")}()}var Q=function(e){var t=e.tag,n=e.type,o=e.displayType;return a().createElement("div",null,a().createElement(r.Tag,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[n]},a().createElement("span",null,t)," ",void 0===o||o?"(".concat({reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[n],")"):""))},W=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"];function X(e){var t=e.node,n=e.traverseAssociations,r=e.traverseFields,o=e.systemKeys,i=e.dataSource,l=e.setDataSource,a=function(e,t){for(var n=J(e);n.length;){var r=n.shift();if(r.key===t.key)return r;r.children&&n.push.apply(n,J(r.children))}}(i,t),c=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?c=n(t.field.target,{exclude:o,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(c=r(t.field.target,{exclude:["id"].concat(J(o.filter(function(e){return"sort"!==e}))),prefix:t.key,maxDepth:1})),c.length?a.children=c:a.isLeaf=!0,l(J(i)),c}var Y=function(e,t,n){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=function(i,l){var c=l.exclude,u=void 0===c?[]:c,s=l.depth,d=void 0===s?0:s,p=l.maxDepth,f=l.prefix,h=void 0===f?"":f;return d>p?[]:J(e.getCollection(n,i).fields.values()).map(function(e){if(!u.includes(e.name)&&e.interface&&!(0===d&&["sort","password","sequence"].includes(e.type))){var n,i={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},l=H(U({},i),{role:"button",title:a().createElement(Q,H(U({},i),{displayType:!0})),key:h?"".concat(h,".").concat(e.name):e.name,isLeaf:!0,field:e});return["belongsTo","belongsToMany"].includes(e.type)?(i.type="reference",l.type="reference",l.title=a().createElement(Q,H(U({},i),{type:"reference",displayType:!0})),l.isLeaf=!1,l.children=o(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:W})):["hasOne","hasMany"].includes(e.type)&&(l.isLeaf=!1,l.children=r(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:["id"].concat(J(W.filter(function(e){return"sort"!==e})))})),l}}).filter(Boolean)},o=function(r,i){var l,c=i.prefix,u=i.maxDepth,s=i.depth,d=void 0===s?0:s,p=i.exclude,f=void 0===p?[]:p;return d>u||!e.getCollection(n,r)?[]:J(null==(l=e.getCollection(n,r))?void 0:l.fields.values()).map(function(e){if(e.target&&e.interface&&!f.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=c?"".concat(c,".").concat(e.name):e.name;return{role:"button",title:a().createElement(Q,H(U({},r),{displayType:!0})),key:i,isLeaf:!1,field:e,children:o(e.target,{prefix:i,depth:d+1,maxDepth:u,exclude:f})}}}).filter(Boolean)};return{getEnableFieldTree:function(e){try{return r(e,{exclude:["id"].concat(J(W)),maxDepth:1})}catch(e){return console.error(e),[]}},getOnLoadData:function(e,t){return function(n){return new Promise(function(i){if(n.children.length)return n.children.forEach(function(n){X({node:n,traverseAssociations:o,traverseFields:r,systemKeys:W,dataSource:e,setDataSource:t})}),i(void 0);X({node:n,traverseAssociations:o,traverseFields:r,systemKeys:W,dataSource:e,setDataSource:t}),i(void 0)})}},getOnCheck:function(e){return function(t){e.value=t}}}},Z=function(e,t,n,r,o){var i,l,c=(new(z())({max:100}),function(r,o,i){var l=o.exclude,s=void 0===l?[]:l,d=o.depth,p=void 0===d?0:d,f=o.maxDepth,h=o.prefix,m=void 0===h?"":h,y=o.disabled,v=void 0!==y&&y;return p>f?[]:(e.getCollection(n,r)?J(e.getCollection(n,r).fields.values()):[]).map(function(e){if(!s.includes(e.name)&&e.interface&&!["sort","password","sequence"].includes(e.type)){var n,r={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},o=H(U({},r),{title:a().createElement(Q,r),key:m?"".concat(m,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:v}),l=i.find(function(e){return e.name===o.key});if(!["belongsTo","belongsToMany"].includes(e.type)||l&&(null==l?void 0:l.updateAssociation)){if(["hasOne","hasMany"].includes(e.type)||(null==l?void 0:l.updateAssociation)){var d=!1;!["hasOne","hasMany"].includes(e.type)||(null==l?void 0:l.updateAssociation)||(d=!0),o.disabled=!0,o.isLeaf=!1,o.children=c(e.target,{depth:p+1,maxDepth:f,prefix:o.key,exclude:["id"].concat(J(W)),disabled:d},i)}}else r.type="reference",o.type="reference",o.title=a().createElement(Q,H(U({},r),{type:"reference"})),o.isLeaf=!1,o.children=u(e.target,{depth:p+1,maxDepth:f,prefix:o.key,exclude:W});return o}}).filter(Boolean)}),u=(l=new(z())({max:100}),function(r,o){var i=o.prefix,c=o.maxDepth,s=o.depth,d=void 0===s?0:s,p=o.exclude,f=void 0===p?[]:p,h="".concat(r,"-").concat(f.join(","),"-").concat(d,"-").concat(c,"-").concat(i),m=l.get(h);if(m)return m;if(d>c)return[];var y=(e.getCollection(n,r)?J(e.getCollection(n,r).fields.values()):[]).map(function(e){if(e.target&&e.interface&&!f.includes(e.name)){var n,r,o={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},l=i?"".concat(i,".").concat(e.name):e.name;return{type:"preloading",tag:t(null==(r=e.uiSchema)?void 0:r.title)||e.name,title:a().createElement(Q,o),key:l,isLeaf:!1,field:e,children:u(e.target,{prefix:l,depth:d+1,maxDepth:c,exclude:f})}}}).filter(Boolean);return l.set(h,y),y}),s=function(e,t){if(!e)return[];try{return c(e,{exclude:["id"].concat(J(W)),maxDepth:1,disabled:!1},t)}catch(e){return console.error(e),[]}};return{run:function(e){var t;return(t=function(){var t,n,i,l;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){return t=new Set([]),n=new Set([]),(i=function(e,r){e.mapSubModels(r,function(e){var r,o,l;e.collectionField&&!(["hasOne","hasMany"].includes(e.collectionField.type)||(null==(r=e.subModels.field)?void 0:r.updateAssociation))&&n.add(e.fieldPath),e.collectionField&&e.collectionField.isAssociationField()&&(t.add({name:e.fieldPath,updateAssociation:null==(o=e.subModels.field)?void 0:o.updateAssociation}),(null==(l=e.subModels.field)?void 0:l.updateAssociation)&&(e.subModels.field.subModels.grid?i(e.subModels.field.subModels.grid,"items"):e.subModels.field.subModels.subTableColumns?i(e.subModels.field,"subTableColumns"):e.subModels.field.subModels.columns&&i(e.subModels.field,"columns")))})})(e,"items"),l=s(r,J(t)),o&&o(l,J(n)),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function l(e){G(i,r,o,l,a,"next",e)}function a(e){G(i,r,o,l,a,"throw",e)}l(void 0)})})()}}},ee="action-duplicate";function et(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 en(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function er(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){en(i,r,o,l,a,"next",e)}function a(e){en(i,r,o,l,a,"throw",e)}l(void 0)})}}function eo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ei(e){return(ei=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function el(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){eo(e,t,n[t])})}return e}function ea(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ec(e,t){return(ec=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||ed(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function es(e){return function(e){if(Array.isArray(e))return et(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ed(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 ed(e,t){if(e){if("string"==typeof e)return et(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 et(e,t)}}function ep(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ep=function(){return!!e})()}function ef(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var eh=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){var r=e.loadData;(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var o=eu((0,l.useState)((null==e?void 0:e.treeData)||[]),2),i=o[0],a=o[1],c=eu((0,l.useState)(e.defaultCheckedKeys||[]),2),u=c[0],s=c[1],d=function(e){s(e),t.value=e};t.onCheck=d;var p=(0,n.useForm)();return(0,l.useEffect)(function(){var n=e.getEnableFieldTree(p.values.collection);a(n),t.dataSource=n},[p.values.collection]),(0,l.useEffect)(function(){a(t.dataSource)},[t.dataSource]),ea(el({},e),{checkedKeys:u,onCheck:d,loadData:r(i,a),treeData:i.map(function(e){if("quickDulicate"===p.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return ea(el({},e),{disabled:!1})});return ea(el({},e),{disabled:!1,children:n})}return e})})}));function em(t){var n=t.options,r=(0,N.useFlowViewContext)(),o=(0,e.useRequest)(er(function(){return ef(this,function(e){switch(e.label){case 0:return[4,r.engine.loadOrCreateModel(n,{delegateToParent:!1,delegate:r})];case 1:return[2,e.sent()]}})}),{refreshDeps:[r,n]}),i=o.data;return!o.loading&&(null==i?void 0:i.uid)?a().createElement(N.FlowModelRenderer,{model:i,fallback:a().createElement(e.SkeletonFallback,{style:{margin:16}})}):a().createElement(e.SkeletonFallback,{style:{margin:16}})}function ey(e){var t=e.model,n=(0,N.useFlowContext)(),r=n.view,o=r.Header,i=r.type;t._closeView=n.view.close;var l=n.t("Duplicate record");return a().createElement("div",null,a().createElement(o,{title:"dialog"===i?a().createElement("div",{style:{padding:"".concat(n.themeToken.paddingLG,"px ").concat(n.themeToken.paddingLG,"px 0"),marginBottom:-n.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"}},l):l}),a().createElement(em,{options:{parentId:n.view.inputArgs.parentId,subKey:"deplicate.edit-form-grid-block",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel"}}))}var ev=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=ei(t),eo(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,ep()?Reflect.construct(t,r||[],ei(this).constructor):t.apply(this,r)),"duplicateLoading",!1),eo(e,"defaultProps",{type:"link",title:(0,N.tExpr)("Duplicate"),duplicateFields:[]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ec(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onClick",value:function(e){"quickDulicate"===this.props.duplicateMode?this.dispatchEvent("quickCreateClick",el({event:e},this.getInputArgs()),{debounce:!0}):this.dispatchEvent("openDuplicatePopup",el({event:e},this.getInputArgs()),{debounce:!0})}},{key:"getTitle",value:function(){return this.duplicateLoading?this.context.t("Duplicating"):this.props.title||this.context.t("Duplicate")}}],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}(e.ActionModel);function eb(e,t){return eg.apply(this,arguments)}function eg(){return(eg=er(function(e,t){var n,r;return ef(this,function(o){switch(o.label){case 0:if(!(null==t?void 0:t.dataId)||(null==(n=t.fields)?void 0:n.length)===0)return[2];return[4,e.runAction("get",{params:{filterByTk:t.dataId,fields:t.fields,isTemplate:!0}})];case 1:return[2,null==(r=o.sent())?void 0:r.data]}})})).apply(this,arguments)}function ex(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function ew(e,t,n){return(ew=eD()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ek(o,n.prototype),o}).apply(null,arguments)}eo(ev,"scene",e.ActionSceneEnum.record),ev.define({label:(0,N.tExpr)("Duplicate"),sort:60}),ev.registerFlow({key:"duplicateModeSettings",steps:{duplicateMode:{title:(0,N.tExpr)("Duplicate mode",{ns:ee}),uiSchema:function(e){var t,r,i,l=e.t,c=(e.dataSourceManager.getDataSource("main").collectionManager.getAllCollectionsInheritChain(e.blockModel.collection.name)||[]).map(function(t){var n;return{label:null==(n=e.dataSourceManager.getDataSource("main").collectionManager.getCollection(t))?void 0:n.title,value:t}}),u=(0,o.cloneDeep)((null==(t=e.model.props)?void 0:t.duplicateFields)||[]),s=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],o=r.children,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(r,["children"]);t.push(i.key),o&&s(o,t)}return t},d=Y(e.dataSourceManager,l,e.blockModel.collection.dataSourceKey),p=d.getEnableFieldTree,f=d.getOnLoadData,h=d.getOnCheck;return e.model.flowEngine.flowSettings.registerScopes({collectionName:(null==(r=e.record)?void 0:r.__collection)||e.blockModel.collection.name,currentCollection:(null==(i=e.record)?void 0:i.__collection)||e.blockModel.collection.name,getOnLoadData:f,getOnCheck:h,treeData:[],duplicateValues:u,onFieldInputValueChange:S.onFieldInputValueChange}),{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:l("If collection inherits, choose inherited collections as templates"),"x-display":c.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:c},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}},function(t){if("quickDulicate"===t.form.values.duplicateMode){var n;t.form.setValuesIn("collection",(null==(n=e.record)?void 0:n.__collection)||e.blockModel.collection.name)}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":function(){var t,r,o,i,c=null==(r=(o=e.model).getStepParams)||null==(t=r.call(o,"popupSettings","openView"))?void 0:t.uid,u=(0,n.useForm)(),s=Z(e.dataSourceManager,e.t,e.blockModel.collection.dataSourceKey,(null==(i=e.record)?void 0:i.__collection)||e.blockModel.collection.name,function(t,n){u.query("duplicateFields").take(function(r){r.dataSource=t,r.componentProps.defaultCheckedKeys=n,r.setInitialValue(n),null==r||r.onCheck(n),e.message.success(l("Sync successfully"))})}).run;return a().createElement("a",{onClick:er(function(){var t,n,r;return ef(this,function(o){switch(o.label){case 0:if(!c)return[3,3];return[4,e.engine.loadModel({parentId:c,refresh:!0})];case 1:return t=o.sent(),[4,e.engine.loadModel({parentId:t.subModels.tabs[0].uid})];case 2:if(!(n=o.sent()))return[2];return s(n.subModels.items[0].subModels.grid),[3,5];case 3:return[4,e.engine.loadModel({parentId:e.model.uid,refresh:!0})];case 4:if(!(r=o.sent()))return[2];s(r.subModels.items[0].subModels.grid),o.label=5;case 5:return[2]}})}),style:{float:"right",position:"relative",zIndex:1200}},l("Sync from form fields"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{onClick:function(){e.query("duplicateFields").take(function(e){var t,n=s(e.dataSource,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)})},style:{float:"right",position:"relative",zIndex:1200}},l("Select all"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}]},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},onClick:function(){e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])})}},l("UnSelect all"))},"x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}]},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:l("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":eh,"x-component-props":{defaultCheckedKeys:u,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:f,onCheck:"{{ getOnCheck($self) }}",getEnableFieldTree:p,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"}}}]}}},defaultParams:function(e){var t;return{duplicateMode:"quickDulicate",collection:(null==(t=e.record)?void 0:t.__collection)||e.blockModel.collection.name}},handler:function(e,t){return er(function(){var n,r,o,i,l;return ef(this,function(a){return n=t.duplicateMode,r=t.duplicateFields,o=t.collection,i=t.treeData,l=Array.isArray(r)?r:(null==r?void 0:r.checked)||[],e.model.setProps({duplicateMode:n,duplicateFields:l,duplicateCollection:o,treeData:i}),[2]})})()}}}}),ev.registerFlow({key:"duplicateSettings",title:(0,N.tExpr)("Duplicate mode settings"),on:"quickCreateClick",steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"!==(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,N.tExpr)("Duplicate record"),content:(0,N.tExpr)("Are you sure you want to duplicate it?")}},duplicate:{handler:function(e,t){return er(function(){var n,r,o,i,l,a,c,u;return ef(this,function(s){switch(s.label){case 0:if(!(null==(o=void 0===(r=e.model.props.duplicateFields)?[]:r)?void 0:o.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:ee})),[2];if(e.model.duplicateLoading)return[2];return e.model.duplicateLoading=!0,e.model.rerender(),i=e.blockModel.collection.filterTargetKey,l={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(es(i.map(function(t){return eo({},t,e.record[t])})))):e.record[i]||e.record.id,default:!0,fields:(null==o?void 0:o.filter(function(t){return es(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},a=e.createResource(N.MultiRecordResource),c=e.blockModel.collection.dataSourceKey,a.setDataSourceKey(c),a.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,eb(a,l)];case 1:return u=s.sent(),[4,e.blockModel.resource.create(el({},u),t.requestConfig)];case 2:return s.sent(),e.message.success(e.t("Saved successfully")),e.model.duplicateLoading=!1,e.model.rerender(),[2]}})})()}}}}),ev.registerFlow({key:"popupSettings",on:{eventName:"openDuplicatePopup"},sort:300,steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,N.tExpr)("Duplicate record"),content:(0,N.tExpr)("Are you sure you want to duplicate it?")}},openView:{title:(0,N.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},use:"openView",defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){return er(function(){var n,r,o,i,l,c,u,s,d,p,f,h,m,y,v,b,g,x,w,O;return ef(this,function(k){switch(k.label){case 0:return[4,e.model.dispatchEvent("beforeRender")];case 1:if(k.sent(),!(null==(l=void 0===(i=e.model.props.duplicateFields)?[]:i)?void 0:l.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:ee})),[2];return c={drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}},u=(null==(r=e.inputArgs)?void 0:r.mode)||(null==t?void 0:t.mode)||"drawer",s=(null==(o=e.inputArgs)?void 0:o.size)||(null==t?void 0:t.size)||"medium",d=e.blockModel.collection.filterTargetKey,p={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(es(d.map(function(t){return eo({},t,e.record[t])})))):e.record[d]||e.record.id,default:!0,fields:(null==l?void 0:l.filter(function(t){return es(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},f=e.createResource(N.MultiRecordResource),h=e.blockModel.collection.dataSourceKey,f.setDataSourceKey(h),f.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,eb(f,p)];case 2:if(m=k.sent(),y="string"==typeof(null==t?void 0:t.popupTemplateUid)?t.popupTemplateUid.trim():"",v="string"==typeof(null==t?void 0:t.uid)?t.uid.trim():"",b=!!y||!!v&&v!==e.model.uid,g=(null==t?void 0:t.viewUid)||e.blockModel.uid,x=(null==t?void 0:t.dataSourceKey)||e.blockModel.collection.dataSourceKey,w=(null==t?void 0:t.collectionName)||e.record.__collection||e.blockModel.collection.name,!b)return[3,4];return O=ea(el({},t||{}),{navigation:!1,scene:"new",formData:m,viewUid:g,dataSourceKey:x,collectionName:w}),v&&(O.uid=v),[4,e.runAction("openView",O)];case 3:return k.sent(),[2];case 4:return e.viewer.open({type:u,width:c[u][s],inheritContext:!1,target:e.layoutContentElement,inputArgs:{parentId:e.model.uid,scene:"new",dataSourceKey:x,collectionName:w,formData:m,viewUid:g},content:function(){return a().createElement(ey,{model:e.model})},styles:{content:el({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===u?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}}),[2]}})})()}}}});function eO(e){return(eO=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ek(e,t){return(ek=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eS(e){var t="function"==typeof Map?new Map:void 0;return(eS=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return ew(e,arguments,eO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ek(n,e)})(e)}function eD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eD=function(){return!!e})()}var eP=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eO(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,eD()?Reflect.construct(e,t||[],eO(this).constructor):e.apply(this,t))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&ek(r,t),n=[{key:"load",value:function(){var t,n=this;return(t=function(){var t;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){return n.app.use(B),n.app.addComponents({DuplicateActionInitializer:K,DuplicateAction:k,DuplicateActionDecorator:L}),n.app.schemaSettingsManager.add(_),n.app.schemaSettingsManager.add(R),t={title:'{{t("Duplicate")}}',Component:"DuplicateActionInitializer",schema:{"x-component":"Action.Link","x-action":"duplicate","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:duplicate","x-decorator":"DuplicateActionDecorator","x-component-props":{type:"primary"}},useVisible:function(){return(0,e.useActionAvailable)("create")}},n.app.schemaInitializerManager.addItem("table:configureItemActions","actions.duplicate",t),n.app.flowEngine.registerModels({DuplicateActionModel:ev}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function l(e){ex(i,r,o,l,a,"next",e)}function a(e){ex(i,r,o,l,a,"throw",e)}l(void 0)})})()}}],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)}}(r.prototype,n),r}(eS(e.Plugin)),eA=eP}(),p}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-duplicate",["ahooks","react-i18next","@emotion/css","@nocobase/client-v2","@formily/core","react","antd","@nocobase/client","@formily/react","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-action-duplicate"]=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-action-duplicate"]=t(e.ahooks,e["react-i18next"],e["@emotion/css"],e["@nocobase/client-v2"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,i,o,l,a,s,c,u){return function(){"use strict";var d={477:function(e){e.exports=n},452:function(e){e.exports=i},230:function(e){e.exports=s},342:function(e){e.exports=a},485:function(e){e.exports=r},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=l},773:function(e){e.exports=u},155:function(e){e.exports=o},953:function(e){e.exports=t}},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return d[e](n,n.exports,h),n.exports}h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.g.importScripts&&(f=h.g.location+"");var f,m=h.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var y=m.getElementsByTagName("script");if(y.length)for(var b=y.length-1;b>-1&&(!f||!/^http(s?):/.test(f));)f=y[b--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");h.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-action-duplicate/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",i=r.indexOf("/v2/");e=i>=0?r.slice(0,i+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-duplicate/dist/client/"}h.p=e}(),!function(){h.r(v),h.d(v,{DuplicateActionModel:function(){return eA},PluginActionDuplicateClient:function(){return eT},default:function(){return eI},DuplicateAction:function(){return x},actionDesignerCss:function(){return w}});var e=h(342),t=h(477),n=h(230),r=h(59),i=h(773),o=h.n(i),l=h(155),a=h.n(l),s=h(953);function c(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 u(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(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){d(e,t,n[t])})}return e}function f(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 m(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||g(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(e,t){if(e){if("string"==typeof e)return c(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 c(e,t)}}function S(){var e=b(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n '&.nb-in-template': {\n background: 'var(--colorTemplateBgSettingsHover)';\n }\n ,\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n"]);return S=function(){return e},e}function O(){var e=b(["\n .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n "]);return O=function(){return e},e}var w=(0,t.css)(S()),x=a().forwardRef(function(i,h){var b,v,S,x,k=i.onlyIcon,D=m(i,["onlyIcon"]),A=i.children,j=i.icon,P=i.title,E=m(i,["children","icon","title"]),C=r.App.useApp().message,F=(0,n.useField)(),_=(0,n.useFieldSchema)(),M=(0,e.useAPIClient)(),T=F.disabled||i.disabled,I=(0,e.useDesignable)().designable,R=y((0,l.useState)(!1),2),z=R[0],q=R[1],L=y((0,l.useState)(!1),2),K=L[0],B=L[1],W=y((0,l.useState)(!1),2),$=W[0],G=W[1],U=(0,e.useBlockRequestContext)(),N=U.service,V=U.__parent,H=U.block,J=U.resource,X=_["x-component-props"],Q=X.duplicateFields,Y=X.duplicateMode,Z=void 0===Y?"quickDulicate":Y,ee=X.duplicateCollection,et=(0,e.useRecord)(),en=(0,e.useCollectionParentRecordData)(),er=(0,e.useCollection)(),ei=et.id,eo=et.__collection,el=(0,e.useActionContext)(),ea=(0,e.useCollection_deprecated)().name,es=(0,e.useCollectionManager_deprecated)().getCollectionFields,ec=(0,s.useTranslation)().t,eu=es(eo||ea),ed=(0,e.useFormBlockContext)(),ep=(0,e.useACLActionParamsContext)(),eh=(0,e.useDataSourceKey)(),ef=(0,e.useDataSourceHeaders)(eh),em={key:"duplicate",dataId:Array.isArray(er.filterTargetKey)?(v=Object).assign.apply(v,[{}].concat(function(e){if(Array.isArray(e))return c(e)}(b=er.filterTargetKey.map(function(e){return d({},e,et[e])}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(b)||g(b)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):et[er.filterTargetKey]||ei,default:!0,fields:(null==Q?void 0:Q.filter(function(e){return eu.find(function(t){return e.includes(t.name)})}))||[],collection:eo||ea},ey="Action.Link"===_["x-component"],eb=function(){var t;return(t=function(){var t,n,r,i,o;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:B(!0),l.label=1;case 1:return l.trys.push([1,7,,8]),[4,(0,e.fetchTemplateData)(M,em,ef)];case 2:return t=l.sent(),[4,J.create({values:p({},t)})];case 3:if(l.sent(),C.success(ec("Saved successfully")),"form"!==H)return[3,4];return null==V||null==(r=V.service)||null==(n=r.refresh)||n.call(r),[3,6];case 4:return[4,null==N||null==(i=N.refresh)?void 0:i.call(N)];case 5:l.sent(),l.label=6;case 6:return B(!1),[3,8];case 7:return o=l.sent(),B(!1),console.error(o),[3,8];case 8:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){u(o,r,i,l,a,"next",e)}function a(e){u(o,r,i,l,a,"throw",e)}l(void 0)})})()},ev=function(){T||K||!ep||((null==Q?void 0:Q.length)>0?"quickDulicate"===Z?eb():q(!0):C.error(ec("Please configure the duplicate fields")))};return a().createElement("div",{ref:h,className:(0,t.cx)(w,d({},(0,t.css)(O()),ey))},a().createElement(e.FormBlockContext.Provider,{value:f(p({},ed),{duplicateData:{display:!1,enabled:!0,defaultTemplate:em}})},a().createElement("div",null,ey?a().createElement("a",{className:"nb-action-link",role:i.role,"aria-label":i["aria-label"],disabled:T,style:f(p({},E.style),{opacity:I&&(null==F||null==(S=F.data)?void 0:S.hidden)&&.1,cursor:K?"not-allowed":"pointer",position:"relative"}),onClick:ev},a().createElement(r.Tooltip,{title:P},a().createElement("span",{style:{marginRight:3}},j&&"string"==typeof j?a().createElement(e.Icon,{type:j}):j)),k?A[1]:K?ec("Duplicating"):A||ec("Duplicate")):a().createElement(r.Button,f(p({role:i.role,"aria-label":i["aria-label"],disabled:T,style:{opacity:I&&(null==F||null==(x=F.data)?void 0:x.hidden)&&.1}},D),{onClick:ev}),K?ec("Duplicating"):A||ec("Duplicate")),a().createElement(e.TabsContextProvider,null,a().createElement(e.CollectionProvider_deprecated,{name:ee||ea},a().createElement(e.RecordProvider,{record:f(p({},en),{__collection:ee||eo})},a().createElement(e.ActionContextProvider,{value:f(p({},el),{visible:z,setVisible:q,formValueChanged:$,setFormValueChanged:G})},a().createElement(e.PopupSettingsProvider,{enableURL:!1},a().createElement(e.RefreshComponentProvider,{refresh:o().noop},a().createElement(e.NocoBaseRecursionField,{schema:_,basePath:F.address,onlyRenderProperties:!0}))))))))))}),k=h(452);function D(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 A(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){A(o,r,i,l,a,"next",e)}function a(e){A(o,r,i,l,a,"throw",e)}l(void 0)})}}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(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){P(e,t,n[t])})}return e}function C(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 F(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var _=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var r,i=function(e){if(Array.isArray(e))return e}(r=(0,l.useState)(e.defaultCheckedKeys||[]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw n}}return i}}(r)||function(e){if(e){if("string"==typeof e)return D(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=i[0],a=i[1],s=function(e){a(e),t.value=e};t.onCheck=s;var c=(0,n.useForm)();return C(E({},e),{checkedKeys:o,onCheck:s,treeData:null==e?void 0:e.treeData.map(function(e){if("quickDulicate"===c.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return C(E({},e),{disabled:!1})});return C(E({},e),{disabled:!1,children:n})}return e})})})),M=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&M(i,t)}return t},T=function(e){return e.reduceProperties(function(e,t){return"FormBlockProvider"===t["x-decorator"]?t:T(t)},null)},I=[{name:"Customize",Component:function(e){return e.children},children:[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t=(0,e.useCollection_deprecated)().name;return C(E({},(0,e.useSchemaToolbar)().linkageRulesProps),{collectionName:t})}},{name:"duplicationMode",Component:function(){var t,r,o,c,u=(0,e.useDesignable)().dn,d=(0,s.useTranslation)().t,p=(0,n.useField)(),h=(0,n.useFieldSchema)(),f=(0,e.useCollection_deprecated)().name,m=(0,e.useCollectionState)(f),y=m.collectionList,b=m.getEnableFieldTree,v=m.getOnLoadData,g=m.getOnCheck,S=(0,i.cloneDeep)((null==(t=h["x-component-props"])?void 0:t.duplicateFields)||[]),O=(0,e.useRecord)(),w=(0,l.useCallback)(function(e,t,n){n.query("duplicateFields").take(function(r){r.componentProps.treeData=e,r.componentProps.defaultCheckedKeys=t,r.setInitialValue(t),null==r||r.onCheck(t),n.setValues(C(E({},n.values),{treeData:e}))})},[]);return a().createElement(e.SchemaSettingsModalItem,{title:d("Duplicate mode"),components:{Tree:_},scope:{getEnableFieldTree:b,collectionName:(null==(r=h["x-component-props"])?void 0:r.duplicateCollection)||(null==O?void 0:O.__collection)||f,currentCollection:(null==O?void 0:O.__collection)||f,getOnLoadData:v,getOnCheck:g,treeData:null==(o=h["x-component-props"])?void 0:o.treeData,duplicateValues:S,onFieldInputValueChange:k.onFieldInputValueChange},schema:{type:"object",title:d("Duplicate mode"),properties:{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",title:d("Duplicate mode"),default:(null==(c=h["x-component-props"])?void 0:c.duplicateMode)||"quickDulicate",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:d("If collection inherits, choose inherited collections as templates"),default:"{{ collectionName }}","x-display":y.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:y},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":"Action.Link","x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var t,n=(0,l.useMemo)(function(){return T(h)},[h]);return(0,e.useSyncFromForm)(n,(null==(t=h["x-component-props"])?void 0:t.duplicateCollection)||(null==O?void 0:O.__collection)||f,w)}},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){var t,n=M(e.componentProps.treeData,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)}),[2]})})()}}}}},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":"Action.Link","x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}],"x-component-props":{type:"primary",style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},useAction:function(){var e;return e=(0,n.useForm)(),{run:function(){return j(function(){return F(this,function(t){return e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])}),[2]})})()}}}}},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:d("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":_,"x-component-props":{defaultCheckedKeys:S,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:"{{ getOnLoadData($self) }}",onCheck:"{{ getOnCheck($self) }}",rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection",".duplicateMode"],fulfill:{state:{disabled:"{{ !$deps[0] }}",componentProps:{treeData:"{{ getEnableFieldTree($deps[0], $self,treeData) }}"}}}}]}}},onSubmit:function(e){var t,n,r=e.duplicateMode,i=e.collection,o=e.duplicateFields,l=e.treeData,a=Array.isArray(o)?o:o.checked||[];p.componentProps.duplicateMode=r,p.componentProps.duplicateFields=a,h["x-component-props"]=h["x-component-props"]||{},h["x-component-props"].duplicateMode=r,h["x-component-props"].duplicateFields=a,h["x-component-props"].duplicateCollection=i,h["x-component-props"].treeData=l||(null==(t=p.componentProps)?void 0:t.treeData),u.emit("patch",{schema:(P(n={},"x-uid",h["x-uid"]),P(n,"x-component-props",E({},h["x-component-props"])),n)}),u.refresh()}})},useVisible:function(){return"duplicate"===(0,n.useFieldSchema)()["x-action"]}},{name:"openMode",Component:e.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var t=(0,e.useOpenModeContext)().hideOpenMode,n=(0,s.useTranslation)().t;return{openMode:!t,openSize:!t,modeOptions:(0,l.useMemo)(function(){return[{label:n("Drawer"),value:"drawer"},{label:n("Dialog"),value:"modal"}]},[n])}}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}],R=new e.SchemaSettings({name:"ActionSettings:duplicate",items:I}),z=new e.SchemaSettings({name:"actionSettings:duplicate",items:I}),q=function(t){return a().createElement(e.ACLActionProvider,null,t.children)},L=function(t){var n,r,i={type:"void","x-action":"duplicate","x-acl-action":"create",title:'{{ t("Duplicate") }}',"x-component":"Action.Link","x-decorator":"DuplicateActionDecorator","x-component-props":{openMode:(0,e.useOpenModeContext)().defaultOpenMode,component:"DuplicateAction"},properties:{drawer:{type:"void",title:'{{ t("Duplicate") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Duplicate")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:addNew:addBlock",properties:{}}}}}}}}}};return a().createElement(e.ActionInitializerItem,(n=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}({},t),r=r={schema:i},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n))},K=function(t){return a().createElement(e.SchemaComponentOptions,{components:{DuplicateActionInitializer:L,DuplicateAction:x}},t.children)},B=h(694),W=h(485),$=h(625),G="action-duplicate",U={hasSubscribers:!1},N="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,V=new Set,H="object"==typeof process&&process?process:{},J=(Symbol("type"),e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e)),X=e=>J(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Q:null:null,Q=class extends Array{constructor(e){super(e),this.fill(0)}},Y=class e{heap;length;static #e=!1;static create(t){let n=X(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Z=class e{#e;#t;#n;#r;#i;#o;#l;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#c;#u;#d;#p;#h;#f;#m;#y;#b;#v;#g;#S;#O;#w;#x;#k;#D;#A;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#O,autopurgeTimers:e.#w,sizes:e.#g,keyMap:e.#u,keyList:e.#d,valList:e.#p,next:e.#h,prev:e.#f,get head(){return e.#m},get tail(){return e.#y},free:e.#b,isBackgroundFetch:t=>e.#j(t),backgroundFetch:(t,n,r,i)=>e.#P(t,n,r,i),moveToTail:t=>e.#E(t),indexes:t=>e.#C(t),rindexes:t=>e.#F(t),isStale:t=>e.#_(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#c}get size(){return this.#s}get fetchMethod(){return this.#o}get memoMethod(){return this.#l}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:l,updateAgeOnHas:a,allowStale:s,dispose:c,onInsert:u,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:h,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:y,fetchMethod:b,memoMethod:v,noDeleteOnFetchRejection:g,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:w,ignoreFetchAbort:x,perf:k}=t;if(void 0!==k&&"function"!=typeof k?.now)throw TypeError("perf option must have a now() method if specified");if(this.#a=k??N,0!==n&&!J(n))throw TypeError("max option must be a nonnegative integer");let D=n?X(n):Array;if(!D)throw Error("invalid max value: "+n);if(this.#e=n,this.#t=f,this.maxEntrySize=m||this.#t,this.sizeCalculation=y,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==v&&"function"!=typeof v)throw TypeError("memoMethod must be a function if defined");if(this.#l=v,void 0!==b&&"function"!=typeof b)throw TypeError("fetchMethod must be a function if specified");if(this.#o=b,this.#k=!!b,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#p=Array.from({length:n}).fill(void 0),this.#h=new D(n),this.#f=new D(n),this.#m=0,this.#y=0,this.#b=Y.create(n),this.#s=0,this.#c=0,"function"==typeof c&&(this.#n=c),"function"==typeof u&&(this.#r=u),"function"==typeof d?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#x=!!this.#n,this.#A=!!this.#r,this.#D=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!g,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.#t&&!J(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!J(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#M()}if(this.allowStale=!!s,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!a,this.ttlResolution=J(i)||0===i?i:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!J(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!V.has(e))(t)&&(V.add(t),((e,t,n,r)=>{"function"==typeof H.emitWarning?H.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#T(){let e=new Q(this.#e),t=new Q(this.#e);this.#O=e,this.#S=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#w=n,this.#I=(n,i,o=this.#a.now())=>{t[n]=0!==i?o:0,e[n]=i,r(n,i)},this.#R=n=>{t[n]=0!==e[n]?this.#a.now():0,r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&0!==t&&n){let r=setTimeout(()=>{this.#_(e)&&this.#z(this.#d[e],"expire")},t+1);r.unref&&r.unref(),n[e]=r}}:()=>{};this.#q=(n,r)=>{if(e[r]){let l=e[r],a=t[r];if(!l||!a)return;n.ttl=l,n.start=a,n.now=i||o();let s=n.now-a;n.remainingTTL=l-s}};let i=0,o=()=>{let e=this.#a.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let r=this.#u.get(n);if(void 0===r)return 0;let l=e[r],a=t[r];return l&&a?l-((i||o())-a):1/0},this.#_=n=>{let r=t[n],l=e[n];return!!l&&!!r&&(i||o())-r>l}}#R=()=>{};#q=()=>{};#I=()=>{};#_=()=>!1;#M(){let e=new Q(this.#e);this.#c=0,this.#g=e,this.#L=t=>{this.#c-=e[t],e[t]=0},this.#K=(e,t,n,r)=>{if(this.#j(t))return 0;if(!J(n))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!J(n=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#B=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#c>n;)this.#W(!0)}this.#c+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#c)}}#L=e=>{};#B=(e,t,n)=>{};#K=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#C({allowStale:e=this.allowStale}={}){if(this.#s)for(let t=this.#y;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#m);)t=this.#f[t]}*#F({allowStale:e=this.allowStale}={}){if(this.#s)for(let t=this.#m;this.#$(t)&&((e||!this.#_(t))&&(yield t),t!==this.#y);)t=this.#h[t]}#$(e){return void 0!==e&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#C())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*rentries(){for(let e of this.#F())void 0===this.#p[e]||void 0===this.#d[e]||this.#j(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*keys(){for(let e of this.#C()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*rkeys(){for(let e of this.#F()){let t=this.#d[e];void 0===t||this.#j(this.#p[e])||(yield t)}}*values(){for(let e of this.#C())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}*rvalues(){for(let e of this.#F())void 0===this.#p[e]||this.#j(this.#p[e])||(yield this.#p[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#d[n],this))return this.#G(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#C()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#F()){let r=this.#p[n],i=this.#j(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#F({allowStale:!0}))this.#_(t)&&(this.#z(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let n=this.#p[t],r=this.#j(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#O&&this.#S){let e=this.#O[t],n=this.#S[t];e&&n&&(i.ttl=e-(this.#a.now()-n),i.start=Date.now())}return this.#g&&(i.size=this.#g[t]),i}dump(){let e=[];for(let t of this.#C({allowStale:!0})){let n=this.#d[t],r=this.#p[t],i=this.#j(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#O&&this.#S){o.ttl=this.#O[t];let e=this.#a.now()-this.#S[t];o.start=Math.floor(Date.now()-e)}this.#g&&(o.size=this.#g[t]),e.unshift([n,o])}return e}load(e){for(let[t,n]of(this.clear(),e)){if(n.start){let e=Date.now()-n.start;n.start=this.#a.now()-e}this.#U(t,n.value,n)}}set(e,t,n={}){let{status:r=U.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op="set",r.key=e,void 0!==t&&(r.value=t));let i=this.#U(e,t,n);return r&&U.hasSubscribers&&U.publish(r),i}#U(e,t,n={}){let{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:a}=n;if(void 0===t)return a&&(a.set="deleted"),this.delete(e),this;let{noUpdateTTL:s=this.noUpdateTTL}=n;a&&!this.#j(t)&&(a.value=t);let c=this.#K(e,t,n.size||0,l,a);if(this.maxEntrySize&&c>this.maxEntrySize)return this.#z(e,"set"),a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this;let u=0===this.#s?void 0:this.#u.get(e);if(void 0===u)u=0===this.#s?this.#y:0!==this.#b.length?this.#b.pop():this.#s===this.#e?this.#W(!1):this.#s,this.#d[u]=e,this.#p[u]=t,this.#u.set(e,u),this.#h[this.#y]=u,this.#f[u]=this.#y,this.#y=u,this.#s++,this.#B(u,c,a),a&&(a.set="add"),s=!1,this.#A&&this.#r?.(t,e,"add");else{this.#E(u);let n=this.#p[u];if(t!==n){if(this.#k&&this.#j(n)){n.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=n;void 0!==t&&!o&&(this.#x&&this.#n?.(t,e,"set"),this.#D&&this.#v?.push([t,e,"set"]))}else o||(this.#x&&this.#n?.(n,e,"set"),this.#D&&this.#v?.push([n,e,"set"]));if(this.#L(u),this.#B(u,c,a),this.#p[u]=t,a){a.set="replace";let e=n&&this.#j(n)?n.__staleWhileFetching:n;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#A&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#O||this.#T(),this.#O&&(s||this.#I(u,r,i),a&&this.#q(a,u)),!o&&this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#s;){let e=this.#p[this.#m];if(this.#W(!0),this.#j(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#W(e){let t=this.#m,n=this.#d[t],r=this.#p[t];return this.#k&&this.#j(r)?r.__abortController.abort(Error("evicted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(r,n,"evict"),this.#D&&this.#v?.push([r,n,"evict"])),this.#L(t),this.#w?.[t]&&(clearTimeout(this.#w[t]),this.#w[t]=void 0),e&&(this.#d[t]=void 0,this.#p[t]=void 0,this.#b.push(t)),1===this.#s?(this.#m=this.#y=0,this.#b.length=0):this.#m=this.#h[t],this.#u.delete(n),this.#s--,t}has(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="has",n.key=e);let r=this.#N(e,t);return U.hasSubscribers&&U.publish(n),r}#N(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(void 0!==i){let e=this.#p[i];if(this.#j(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#_(i))return n&&this.#R(i),r&&(r.has="hit",this.#q(r,i)),!0;r&&(r.has="stale",this.#q(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:n=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;n&&(n.op="peek",n.key=e),t.status=n;let r=this.#V(e,t);return U.hasSubscribers&&U.publish(n),r}#V(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(void 0===i||!r&&this.#_(i)){n&&(n.peek=void 0===i?"miss":"stale");return}let o=this.#p[i],l=this.#j(o)?o.__staleWhileFetching:o;return n&&(void 0!==l?(n.peek="hit",n.value=l):n.peek="miss"),l}#P(e,t,n,r){let i=void 0===t?void 0:this.#p[t];if(this.#j(i))return i;let o=new AbortController,{signal:l}=n;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let a={signal:o.signal,options:n,context:r},s=(r,i=!1)=>{let{aborted:l}=o.signal,s=n.ignoreFetchAbort&&void 0!==r,u=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&void 0!==r);if(n.status&&(l&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,s&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),l&&!s&&!i)return c(o.signal.reason,u);let p=this.#p[t];return(p===d||void 0===p&&s&&i)&&(void 0===r?void 0!==d.__staleWhileFetching?this.#p[t]=d.__staleWhileFetching:this.#z(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#U(e,r,a.options))),r},c=(r,i)=>{let{aborted:l}=o.signal,a=l&&n.allowStaleOnFetchAbort,s=a||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection;if(this.#p[t]===d&&(c&&(i||void 0!==d.__staleWhileFetching)?a||(this.#p[t]=d.__staleWhileFetching):this.#z(e,"fetch")),s)return n.status&&void 0!==d.__staleWhileFetching&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r},u=(t,r)=>{let l=this.#o?.(e,i,a);l&&l instanceof Promise&&l.then(e=>t(void 0===e?void 0:e),r),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>s(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(u).then(s,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),c(e,!1))),p=Object.assign(d,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.#U(e,p,{...a.options,status:void 0}),t=this.#u.get(e)):this.#p[t]=p,p}#j(e){return!!this.#k&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(e,t={}){let n=U.hasSubscribers,{status:r=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#H(e,t);return r&&(U.hasSubscribers||U.hasSubscribers)&&n&&(r.trace=!0,U.tracePromise(()=>i,r).catch(()=>{})),i}async #H(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:a=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:y,signal:b}=t;if(y&&(y.op="fetch",y.key=e,m&&(y.forceRefresh=!0)),!this.#k)return y&&(y.fetch="get"),this.#G(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:y});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:l,size:a,sizeCalculation:s,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:y,signal:b},g=this.#u.get(e);if(void 0===g){y&&(y.fetch="miss");let t=this.#P(e,g,v,f);return t.__returned=t}{let t=this.#p[g];if(this.#j(t)){let e=n&&void 0!==t.__staleWhileFetching;return y&&(y.fetch="inflight",e&&(y.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#_(g);if(!m&&!i)return y&&(y.fetch="hit"),this.#E(g),r&&this.#R(g),y&&this.#q(y,g),t;let o=this.#P(e,g,v,f),l=void 0!==o.__staleWhileFetching&&n;return y&&(y.fetch=i?"stale":"refresh",l&&i&&(y.returnedStale=!0)),l?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let n=U.hasSubscribers,{status:r=U.hasSubscribers||U.hasSubscribers?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#J(e,t);return r&&(U.hasSubscribers||U.hasSubscribers)&&n&&(r.trace=!0,U.tracePromise(()=>i,r).catch(()=>{})),i}async #J(e,t={}){let n=await this.#H(e,t);if(void 0===n)throw Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context));let r=this.#X(e,t);return n&&(n.value=r),U.hasSubscribers&&U.publish(n),r}#X(e,t={}){let n=this.#l;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,status:i,forceRefresh:o,...l}=t;i&&o&&(i.forceRefresh=!0);let a=this.#G(e,l),s=o||void 0===a;if(i&&(i.memo=s?"miss":"hit",s||(i.value=a)),!s)return a;let c=n(e,a,{options:l,context:r});return i&&(i.value=c),this.#U(e,c,l),c}get(e,t={}){let{status:n=U.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op="get",n.key=e);let r=this.#G(e,t);return n&&(void 0!==r&&(n.value=r),U.hasSubscribers&&U.publish(n)),r}#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,l=this.#u.get(e);if(void 0===l){o&&(o.get="miss");return}let a=this.#p[l],s=this.#j(a);return o&&this.#q(o,l),this.#_(l)?s?(o&&(o.get="stale-fetching"),n&&void 0!==a.__staleWhileFetching?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(i||this.#z(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=s?"fetching":"hit"),this.#E(l),r&&this.#R(l),s?a.__staleWhileFetching:a)}#Q(e,t){this.#f[t]=e,this.#h[e]=t}#E(e){e!==this.#y&&(e===this.#m?this.#m=this.#h[e]:this.#Q(this.#f[e],this.#h[e]),this.#Q(this.#y,e),this.#y=e)}delete(e){return this.#z(e,"delete")}#z(e,t){U.hasSubscribers&&U.publish({op:"delete",delete:t,key:e});let n=!1;if(0!==this.#s){let r=this.#u.get(e);if(void 0!==r)if(this.#w?.[r]&&(clearTimeout(this.#w?.[r]),this.#w[r]=void 0),n=!0,1===this.#s)this.#Y(t);else{this.#L(r);let n=this.#p[r];if(this.#j(n)?n.__abortController.abort(Error("deleted")):(this.#x||this.#D)&&(this.#x&&this.#n?.(n,e,t),this.#D&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#p[r]=void 0,r===this.#y)this.#y=this.#f[r];else if(r===this.#m)this.#m=this.#h[r];else{let e=this.#f[r];this.#h[e]=this.#h[r];let t=this.#h[r];this.#f[t]=this.#f[r]}this.#s--,this.#b.push(r)}}if(this.#D&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Y("delete")}#Y(e){for(let t of this.#F({allowStale:!0})){let n=this.#p[t];if(this.#j(n))n.__abortController.abort(Error("deleted"));else{let r=this.#d[t];this.#x&&this.#n?.(n,r,e),this.#D&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#p.fill(void 0),this.#d.fill(void 0),this.#O&&this.#S){for(let e of(this.#O.fill(0),this.#S.fill(0),this.#w??[]))void 0!==e&&clearTimeout(e);this.#w?.fill(void 0)}if(this.#g&&this.#g.fill(0),this.#m=0,this.#y=0,this.#b.length=0,this.#c=0,this.#s=0,this.#D&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}};function ee(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 et(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function en(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}function er(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 ei(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return ee(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ee(e,void 0)}}(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.")}()}var eo=function(e){var t=e.tag,n=e.type,i=e.displayType;return a().createElement("div",null,a().createElement(r.Tag,{color:{reference:"blue",duplicate:"green",preloading:"cyan"}[n]},a().createElement("span",null,t)," ",void 0===i||i?"(".concat({reference:"Reference",duplicate:"Duplicate",preloading:"Preloading"}[n],")"):""))},el=["sort","createdById","createdBy","createdAt","updatedById","updatedBy","updatedAt","password","sequence"];function ea(e){var t=e.node,n=e.traverseAssociations,r=e.traverseFields,i=e.systemKeys,o=e.dataSource,l=e.setDataSource,a=function(e,t){for(var n=ei(e);n.length;){var r=n.shift();if(r.key===t.key)return r;r.children&&n.push.apply(n,ei(r.children))}}(o,t),s=[];return["belongsTo","belongsToMany"].includes(t.field.type)&&(null==t?void 0:t.type)==="reference"?s=n(t.field.target,{exclude:i,prefix:t.key,maxDepth:1}):(["hasOne","hasMany"].includes(t.field.type)||(null==t?void 0:t.type)==="duplicate")&&(s=r(t.field.target,{exclude:["id"].concat(ei(i.filter(function(e){return"sort"!==e}))),prefix:t.key,maxDepth:1})),s.length?a.children=s:a.isLeaf=!0,l(ei(o)),s}var es=function(e,t,n){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=function(o,l){var s=l.exclude,c=void 0===s?[]:s,u=l.depth,d=void 0===u?0:u,p=l.maxDepth,h=l.prefix,f=void 0===h?"":h;return d>p?[]:ei(e.getCollection(n,o).fields.values()).map(function(e){if(!c.includes(e.name)&&e.interface&&!(0===d&&["sort","password","sequence"].includes(e.type))){var n,o={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},l=er(en({},o),{role:"button",title:a().createElement(eo,er(en({},o),{displayType:!0})),key:f?"".concat(f,".").concat(e.name):e.name,isLeaf:!0,field:e});return["belongsTo","belongsToMany"].includes(e.type)?(o.type="reference",l.type="reference",l.title=a().createElement(eo,er(en({},o),{type:"reference",displayType:!0})),l.isLeaf=!1,l.children=i(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:el})):["hasOne","hasMany"].includes(e.type)&&(l.isLeaf=!1,l.children=r(e.target,{depth:d+1,maxDepth:p,prefix:l.key,exclude:["id"].concat(ei(el.filter(function(e){return"sort"!==e})))})),l}}).filter(Boolean)},i=function(r,o){var l,s=o.prefix,c=o.maxDepth,u=o.depth,d=void 0===u?0:u,p=o.exclude,h=void 0===p?[]:p;return d>c||!e.getCollection(n,r)?[]:ei((null==(l=e.getCollection(n,r))?void 0:l.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},o=s?"".concat(s,".").concat(e.name):e.name;return{role:"button",title:a().createElement(eo,er(en({},r),{displayType:!0})),key:o,isLeaf:!1,field:e,children:i(e.target,{prefix:o,depth:d+1,maxDepth:c,exclude:h})}}}).filter(Boolean)};return{getEnableFieldTree:function(e){try{return r(e,{exclude:["id"].concat(ei(el)),maxDepth:1})}catch(e){return console.error(e),[]}},getOnLoadData:function(e,t){return function(n){return new Promise(function(o){if(n.children.length)return n.children.forEach(function(n){ea({node:n,traverseAssociations:i,traverseFields:r,systemKeys:el,dataSource:e,setDataSource:t})}),o(void 0);ea({node:n,traverseAssociations:i,traverseFields:r,systemKeys:el,dataSource:e,setDataSource:t}),o(void 0)})}},getOnCheck:function(e){return function(t){e.value=t}}}},ec=function(e,t,n,r,i){var o,l=(o=new Z({max:50}),function(r,i,c){var u=i.exclude,d=void 0===u?[]:u,p=i.depth,h=void 0===p?0:p,f=i.maxDepth,m=i.prefix,y=void 0===m?"":m,b=i.disabled,v=void 0!==b&&b;if(h>f)return[];var g=Array.isArray(c)?c:[],S=(e.getCollection(n,r)?ei(e.getCollection(n,r).fields.values()):[]).map(function(e){if(!d.includes(e.name)&&e.interface&&!["sort","password","sequence"].includes(e.type)){var n,r={type:"duplicate",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=er(en({},r),{title:a().createElement(eo,r),key:y?"".concat(y,".").concat(e.name):e.name,isLeaf:!0,field:e,disabled:v}),o=g.find(function(e){return(null==e?void 0:e.name)===i.key});if(!["belongsTo","belongsToMany"].includes(e.type)||o&&(null==o?void 0:o.updateAssociation)){if(["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)){var c=!1;!["hasOne","hasMany"].includes(e.type)||(null==o?void 0:o.updateAssociation)||(c=!0),i.disabled=!0,i.isLeaf=!1,i.children=l(e.target,{depth:h+1,maxDepth:f,prefix:i.key,exclude:["id"].concat(ei(el.filter(function(e){return"sort"!==e}))),disabled:c},g)}}else r.type="reference",i.type="reference",i.title=a().createElement(eo,er(en({},r),{type:"reference"})),i.isLeaf=!1,i.children=s(e.target,{depth:h+1,maxDepth:f,prefix:i.key,exclude:el});return i}}).filter(Boolean);return o.set(r+JSON.stringify(g),S),S}),s=function(r,i){var o,l=i.prefix,c=i.maxDepth,u=i.depth,d=void 0===u?0:u,p=i.exclude,h=void 0===p?[]:p;return d>c||!e.getCollection(n,r)?[]:ei((null==(o=e.getCollection(n,r))?void 0:o.fields.values())||[]).map(function(e){if(e.target&&e.interface&&!h.includes(e.name)){var n,r={type:"preloading",tag:t(null==(n=e.uiSchema)?void 0:n.title)||e.name},i=l?"".concat(l,".").concat(e.name):e.name;return{title:a().createElement(eo,r),key:i,disabled:!0,isLeaf:!1,field:e,children:s(e.target,{prefix:i,depth:d+1,maxDepth:c,exclude:h})}}}).filter(Boolean)};return{run:function(e){var t;return(t=function(){var t,n,o,a;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){return(null==e?void 0:e.mapSubModels)?(t=new Set,n=new Set,(o=function(e,r){var i;null==e||null==(i=e.mapSubModels)||i.call(e,r,function(e){var r,i,l;e.collectionField&&!(["hasOne","hasMany"].includes(e.collectionField.type)||(null==(r=e.subModels.field)?void 0:r.updateAssociation))&&n.add(e.fieldPath),e.collectionField&&e.collectionField.isAssociationField()&&(t.add({name:e.fieldPath,updateAssociation:null==(i=e.subModels.field)?void 0:i.updateAssociation}),(null==(l=e.subModels.field)?void 0:l.updateAssociation)&&(e.subModels.field.subModels.grid?o(e.subModels.field.subModels.grid,"items"):e.subModels.field.subModels.subTableColumns?o(e.subModels.field,"subTableColumns"):e.subModels.field.subModels.columns&&o(e.subModels.field,"columns")))})})(e,"items"),a=l(r,{exclude:["id"].concat(ei(el)),maxDepth:1},ei(t)),null==i||i(a,ei(n))):null==i||i([],[]),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){et(o,r,i,l,a,"next",e)}function a(e){et(o,r,i,l,a,"throw",e)}l(void 0)})})()}}};function eu(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 ed(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function ep(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){ed(o,r,i,l,a,"next",e)}function a(e){ed(o,r,i,l,a,"throw",e)}l(void 0)})}}function eh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e){return(ef=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function em(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){eh(e,t,n[t])})}return e}function ey(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 eb(e,t){return(eb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ev(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||eS(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eg(e){return function(e){if(Array.isArray(e))return eu(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eS(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 eS(e,t){if(e){if("string"==typeof e)return eu(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 eu(e,t)}}function eO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eO=function(){return!!e})()}function ew(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var ex=(0,n.connect)(r.Tree,(0,n.mapProps)(function(e,t){var r=e.loadData;(0,l.useEffect)(function(){t.value=e.defaultCheckedKeys||[]},[]);var i=ev((0,l.useState)((null==e?void 0:e.treeData)||[]),2),o=i[0],a=i[1],s=ev((0,l.useState)(e.defaultCheckedKeys||[]),2),c=s[0],u=s[1],d=function(e){u(e),t.value=e};t.onCheck=d;var p=(0,n.useForm)();return(0,l.useEffect)(function(){var n=e.getEnableFieldTree(p.values.collection);a(n),t.dataSource=n},[p.values.collection]),(0,l.useEffect)(function(){a(t.dataSource)},[t.dataSource]),ey(em({},e),{checkedKeys:c,onCheck:d,loadData:r(o,a),treeData:o.map(function(e){if("quickDulicate"===p.values.duplicateMode){var t,n=null==e||null==(t=e.children)?void 0:t.map(function(e){return ey(em({},e),{disabled:!1})});return ey(em({},e),{disabled:!1,children:n})}return e})})}));function ek(e){var t=e.options,n=(0,B.useFlowViewContext)(),r=(0,$.useRequest)(function(){return ep(function(){var e;return ew(this,function(r){switch(r.label){case 0:return[4,n.engine.loadOrCreateModel(t,{delegateToParent:!1,delegate:n,skipSave:!n.flowSettingsEnabled})];case 1:return e=r.sent(),(null==t?void 0:t.scene)&&(e.actionName=t.scene),[2,e]}})})()},{refreshDeps:[n,t]}),i=r.data;return!r.loading&&(null==i?void 0:i.uid)?a().createElement(B.FlowModelRenderer,{model:i,fallback:a().createElement(W.SkeletonFallback,{style:{margin:16}})}):a().createElement(W.SkeletonFallback,{style:{margin:16}})}function eD(e){var t=e.model,n=e.scene,r=(0,B.useFlowContext)(),i=r.view,o=i.Header,l=i.type;t._closeView=r.view.close;var s=r.t("Duplicate record");return a().createElement("div",null,a().createElement(o,{title:"dialog"===l?a().createElement("div",{style:{padding:"".concat(r.themeToken.paddingLG,"px ").concat(r.themeToken.paddingLG,"px 0"),marginBottom:-r.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"}},s):s}),a().createElement(ek,{options:{parentId:r.view.inputArgs.parentId,subKey:"deplicate.edit-form-grid-block",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel",scene:void 0===n?"create":n}}))}var eA=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=ef(t),eh(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,eO()?Reflect.construct(t,r||[],ef(this).constructor):t.apply(this,r)),"duplicateLoading",!1),eh(e,"defaultProps",{type:"link",title:(0,B.tExpr)("Duplicate"),duplicateFields:[]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eb(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onClick",value:function(e){"quickDulicate"===this.props.duplicateMode?this.dispatchEvent("quickCreateClick",em({event:e},this.getInputArgs()),{debounce:!0}):this.dispatchEvent("openDuplicatePopup",em({event:e},this.getInputArgs()),{debounce:!0})}},{key:"getTitle",value:function(){return this.duplicateLoading?this.context.t("Duplicating"):this.props.title||this.context.t("Duplicate")}}],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}(W.ActionModel);function ej(e,t){return ep(function(){var n,r;return ew(this,function(i){switch(i.label){case 0:if(!(null==t?void 0:t.dataId)||(null==(n=t.fields)?void 0:n.length)===0)return[2];return[4,e.runAction("get",{params:{filterByTk:t.dataId,fields:t.fields,isTemplate:!0}})];case 1:return[2,null==(r=i.sent())?void 0:r.data]}})})()}function eP(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function eE(e,t,n){return(eE=eM()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&eF(i,n.prototype),i}).apply(null,arguments)}eh(eA,"scene",W.ActionSceneEnum.record),eA.define({label:(0,B.tExpr)("Duplicate"),sort:60}),eA.registerFlow({key:"duplicateModeSettings",steps:{duplicateMode:{title:(0,B.tExpr)("Duplicate mode",{ns:G}),uiSchema:function(e){var t,r,o,l=e.t,s=(e.dataSourceManager.getDataSource("main").collectionManager.getAllCollectionsInheritChain(e.blockModel.collection.name)||[]).map(function(t){var n;return{label:null==(n=e.dataSourceManager.getDataSource("main").collectionManager.getCollection(t))?void 0:n.title,value:t}}),c=(0,i.cloneDeep)((null==(t=e.model.props)?void 0:t.duplicateFields)||[]),u=function(e,t){for(var n=0;n<(null==e?void 0:e.length);n++){var r=e[n],i=r.children,o=function(e,t){if(null==e)return{};var n,r,i,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(i=0,n=Reflect.ownKeys(Object(e));i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,i={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,t),Object.getOwnPropertySymbols)for(i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r=n[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(r,["children"]);t.push(o.key),i&&u(i,t)}return t},d=es(e.dataSourceManager,l,e.blockModel.collection.dataSourceKey),p=d.getEnableFieldTree,h=d.getOnLoadData,f=d.getOnCheck;return e.model.flowEngine.flowSettings.registerScopes({collectionName:(null==(r=e.record)?void 0:r.__collection)||e.blockModel.collection.name,currentCollection:(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,getOnLoadData:h,getOnCheck:f,treeData:[],duplicateValues:c,onFieldInputValueChange:k.onFieldInputValueChange}),{duplicateMode:{"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{value:"quickDulicate",label:'{{t("Direct duplicate")}}'},{value:"continueduplicate",label:'{{t("Copy into the form and continue to fill in")}}'}]},collection:{type:"string",title:'{{ t("Target collection") }}',required:!0,description:l("If collection inherits, choose inherited collections as templates"),"x-display":s.length>1?"visible":"hidden","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:s},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{disabled:'{{ $deps[0]==="quickDulicate" }}',value:'{{ $deps[0]==="quickDulicate"? currentCollection:collectionName }}'}}},function(t){if("quickDulicate"===t.form.values.duplicateMode){var n;t.form.setValuesIn("collection",(null==(n=e.record)?void 0:n.__collection)||e.blockModel.collection.name)}}]},syncFromForm:{type:"void",title:'{{ t("Sync from form fields") }}',"x-component":function(){var t,r,i,o,s=null==(r=(i=e.model).getStepParams)||null==(t=r.call(i,"popupSettings","openView"))?void 0:t.uid,c=(0,n.useForm)(),u=ec(e.dataSourceManager,e.t,e.blockModel.collection.dataSourceKey,(null==(o=e.record)?void 0:o.__collection)||e.blockModel.collection.name,function(t,n){c.query("duplicateFields").take(function(r){r.dataSource=t,r.componentProps.defaultCheckedKeys=n,r.setInitialValue(n),null==r||r.onCheck(n),e.message.success(l("Sync successfully"))})}).run;return a().createElement("a",{onClick:function(){return ep(function(){var t,n,r;return ew(this,function(i){switch(i.label){case 0:if(!s)return[3,3];return[4,e.engine.loadModel({parentId:s,refresh:!0})];case 1:return t=i.sent(),[4,e.engine.loadModel({parentId:t.subModels.tabs[0].uid})];case 2:if(!(n=i.sent()))return[2];return u(n.subModels.items[0].subModels.grid),[3,5];case 3:return[4,e.engine.loadModel({parentId:e.model.uid,refresh:!0})];case 4:if(!(r=i.sent()))return[2];u(r.subModels.items[0].subModels.grid),i.label=5;case 5:return[2]}})})()},style:{float:"right",position:"relative",zIndex:1200}},l("Sync from form fields"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]!=="quickDulicate" }}'}}}]},selectAll:{type:"void",title:'{{ t("Select all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{onClick:function(){e.query("duplicateFields").take(function(e){var t,n=u(e.dataSource,[]);e.componentProps.defaultCheckedKeys=n,e.setInitialValue(n),null==e||null==(t=e.onCheck)||t.call(e,n)})},style:{float:"right",position:"relative",zIndex:1200}},l("Select all"))},"x-reactions":[{dependencies:[".duplicateMode"],fulfill:{state:{visible:'{{ $deps[0]==="quickDulicate"}}'}}}]},unselectAll:{type:"void",title:'{{ t("UnSelect all") }}',"x-component":function(){var e=(0,n.useForm)();return a().createElement("a",{style:{float:"right",position:"relative",zIndex:1200,marginRight:"10px"},onClick:function(){e.query("duplicateFields").take(function(e){e.componentProps.defaultCheckedKeys=[],e.setInitialValue([]),null==e||e.onCheck([])})}},l("UnSelect all"))},"x-reactions":[{dependencies:[".duplicateMode",".duplicateFields"],fulfill:{state:{visible:"{{ $deps[0]===\"quickDulicate\"&&$form.getValuesIn('duplicateFields').length>0 }}"}}}]},duplicateFields:{type:"array",title:'{{ t("Data fields") }}',required:!0,description:l("Only the selected fields will be used as the initialization data for the form"),"x-decorator":"FormItem","x-component":ex,"x-component-props":{defaultCheckedKeys:c,treeData:[],checkable:!0,checkStrictly:!0,selectable:!1,loadData:h,onCheck:"{{ getOnCheck($self) }}",getEnableFieldTree:p,rootStyle:{padding:"8px 0",border:"1px solid #d9d9d9",borderRadius:"2px",maxHeight:"30vh",overflow:"auto",margin:"2px 0"}},"x-reactions":[{dependencies:[".collection"],fulfill:{state:{disabled:"{{ !$deps[0] }}"}}}]}}},defaultParams:function(e){var t;return{duplicateMode:"quickDulicate",collection:(null==(t=e.record)?void 0:t.__collection)||e.blockModel.collection.name}},handler:function(e,t){return ep(function(){var n,r,i,o,l;return ew(this,function(a){return n=t.duplicateMode,r=t.duplicateFields,i=t.collection,o=t.treeData,l=Array.isArray(r)?r:(null==r?void 0:r.checked)||[],e.model.setProps({duplicateMode:n,duplicateFields:l,duplicateCollection:i,treeData:o}),[2]})})()}}}}),eA.registerFlow({key:"duplicateSettings",title:(0,B.tExpr)("Duplicate mode settings"),on:"quickCreateClick",steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"!==(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},duplicate:{handler:function(e,t){return ep(function(){var n,r,i,o,l,a,s,c;return ew(this,function(u){switch(u.label){case 0:if(!(null==(i=void 0===(r=e.model.props.duplicateFields)?[]:r)?void 0:i.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:G})),[2];if(e.model.duplicateLoading)return[2];return e.model.duplicateLoading=!0,e.model.rerender(),o=e.blockModel.collection.filterTargetKey,l={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eg(o.map(function(t){return eh({},t,e.record[t])})))):e.record[o]||e.record.id,default:!0,fields:(null==i?void 0:i.filter(function(t){return"string"==typeof t&&eg(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},a=e.createResource(B.MultiRecordResource),s=e.blockModel.collection.dataSourceKey,a.setDataSourceKey(s),a.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,ej(a,l)];case 1:return c=u.sent(),[4,e.blockModel.resource.create(em({},c),t.requestConfig)];case 2:return u.sent(),e.message.success(e.t("Saved successfully")),e.model.duplicateLoading=!1,e.model.rerender(),[2]}})})()}}}}),eA.registerFlow({key:"popupSettings",on:{eventName:"openDuplicatePopup"},sort:300,steps:{confirm:{use:"confirm",hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},defaultParams:{enable:!1,title:(0,B.tExpr)("Duplicate record"),content:(0,B.tExpr)("Are you sure you want to duplicate it?")}},openView:{title:(0,B.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return"quickDulicate"===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"duplicateModeSettings","duplicateMode"))?void 0:t.duplicateMode)},use:"openView",defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){return ep(function(){var n,r,i,o,l,s,c,u,d,p,h,f,m,y,b,v,g,S,O,w;return ew(this,function(x){switch(x.label){case 0:return[4,e.model.dispatchEvent("beforeRender")];case 1:if(x.sent(),!(null==(l=void 0===(o=e.model.props.duplicateFields)?[]:o)?void 0:l.length))return e.message.error(e.t("Please configure the duplicate fields in duplicate mode configuration",{ns:G})),[2];return s={drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}},c=(null==(r=e.inputArgs)?void 0:r.mode)||(null==t?void 0:t.mode)||"drawer",u=(null==(i=e.inputArgs)?void 0:i.size)||(null==t?void 0:t.size)||"medium",d=e.blockModel.collection.filterTargetKey,p={dataId:Array.isArray(e.blockModel.collection.filterTargetKey)?(n=Object).assign.apply(n,[{}].concat(eg(d.map(function(t){return eh({},t,e.record[t])})))):e.record[d]||e.record.id,default:!0,fields:(null==l?void 0:l.filter(function(t){return"string"==typeof t&&eg(e.collection.fields.values()).find(function(e){return t.includes(e.name)})}))||[]},h=e.createResource(B.MultiRecordResource),f=e.blockModel.collection.dataSourceKey,h.setDataSourceKey(f),h.setResourceName(e.record.__collection||e.blockModel.collection.name),[4,ej(h,p)];case 2:if(m=x.sent(),y="string"==typeof(null==t?void 0:t.popupTemplateUid)?t.popupTemplateUid.trim():"",b="string"==typeof(null==t?void 0:t.uid)?t.uid.trim():"",v=!!y||!!b&&b!==e.model.uid,g=(null==t?void 0:t.viewUid)||e.blockModel.uid,S=(null==t?void 0:t.dataSourceKey)||e.blockModel.collection.dataSourceKey,O=(null==t?void 0:t.collectionName)||e.record.__collection||e.blockModel.collection.name,!v)return[3,4];return w=ey(em({},t||{}),{navigation:!1,scene:"new",formData:m,viewUid:g,dataSourceKey:S,collectionName:O}),b&&(w.uid=b),[4,e.runAction("openView",w)];case 3:return x.sent(),[2];case 4:return e.viewer.open({type:c,width:s[c][u],inheritContext:!1,target:e.layoutContentElement,inputArgs:{parentId:e.model.uid,scene:"new",dataSourceKey:S,collectionName:O,formData:m,viewUid:g},content:function(){return a().createElement(eD,{model:e.model,scene:"create"})},styles:{content:em({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===c?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}}),[2]}})})()}}}}),W.RecordActionGroupModel.registerActionModels({DuplicateActionModel:eA});function eC(e){return(eC=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eF(e,t){return(eF=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function e_(e){var t="function"==typeof Map?new Map:void 0;return(e_=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eE(e,arguments,eC(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eF(n,e)})(e)}function eM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eM=function(){return!!e})()}var eT=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eC(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,eM()?Reflect.construct(e,t||[],eC(this).constructor):e.apply(this,t))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&eF(r,t),n=[{key:"load",value:function(){var t;return(t=function(){var t;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){return this.app.use(K),this.app.addComponents({DuplicateActionInitializer:L,DuplicateAction:x,DuplicateActionDecorator:q}),this.app.schemaSettingsManager.add(R),this.app.schemaSettingsManager.add(z),t={title:'{{t("Duplicate")}}',Component:"DuplicateActionInitializer",schema:{"x-component":"Action.Link","x-action":"duplicate","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:duplicate","x-decorator":"DuplicateActionDecorator","x-component-props":{type:"primary"}},useVisible:function(){return(0,e.useActionAvailable)("create")}},this.app.schemaInitializerManager.addItem("table:configureItemActions","actions.duplicate",t),this.app.flowEngine.registerModels({DuplicateActionModel:eA}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function l(e){eP(o,r,i,l,a,"next",e)}function a(e){eP(o,r,i,l,a,"throw",e)}l(void 0)})}).call(this)}}],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)}}(r.prototype,n),r}(e_(e.Plugin)),eI=eT}(),v}()});
|
|
@@ -6,7 +6,8 @@
|
|
|
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
|
-
|
|
9
|
+
import { NAMESPACE } from '../../client-v2/locale';
|
|
10
|
+
export { NAMESPACE };
|
|
10
11
|
export declare function lang(key: string): string;
|
|
11
12
|
export declare function generateNTemplate(key: string): string;
|
|
12
13
|
export declare function useBulkEditTranslation(): import("react-i18next").UseTranslationResponse<"action-duplicate", undefined>;
|
|
@@ -6,10 +6,10 @@
|
|
|
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
|
-
import { ActionModel } from '@nocobase/client';
|
|
9
|
+
import { ActionModel } from '@nocobase/client-v2';
|
|
10
10
|
export declare class DuplicateActionModel extends ActionModel {
|
|
11
11
|
props: any;
|
|
12
|
-
static scene: import("@nocobase/client").ActionSceneType;
|
|
12
|
+
static scene: import("@nocobase/client-v2").ActionSceneType;
|
|
13
13
|
duplicateLoading: boolean;
|
|
14
14
|
defaultProps: any;
|
|
15
15
|
getAclActionName(): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PluginActionDuplicateClient extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export { DuplicateActionModel } from './DuplicateActionModel';
|
|
14
|
+
export default PluginActionDuplicateClient;
|