@nocobase/plugin-workflow-aggregate 2.1.0-alpha.1 → 2.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/AggregateInstruction.d.ts +7 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +10 -9
- package/dist/locale/index.d.ts +1 -0
- package/dist/locale/index.js +6 -0
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +178 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1067 -0
- package/dist/node_modules/joi/lib/types/link.js +168 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/server/AggregateInstruction.d.ts +2 -0
- package/dist/server/AggregateInstruction.js +19 -0
- package/package.json +7 -6
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>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
|
|
11
11
|
import { FilterDynamicComponent, Instruction } from '@nocobase/plugin-workflow/client';
|
|
12
|
+
import { SubModelItem } from '@nocobase/flow-engine';
|
|
12
13
|
declare function AssociatedConfig({ value, onChange, ...props }: {
|
|
13
14
|
[x: string]: any;
|
|
14
15
|
value: any;
|
|
@@ -236,5 +237,11 @@ export default class extends Instruction {
|
|
|
236
237
|
label: any;
|
|
237
238
|
};
|
|
238
239
|
useInitializers(node: any): SchemaInitializerItemType | null;
|
|
240
|
+
/**
|
|
241
|
+
* 2.0
|
|
242
|
+
*/
|
|
243
|
+
getCreateModelMenuItem({ node }: {
|
|
244
|
+
node: any;
|
|
245
|
+
}): SubModelItem;
|
|
239
246
|
}
|
|
240
247
|
export {};
|
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("react"),require("react-i18next"),require("@formily/react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-aggregate",["react","react-i18next","@formily/react","@nocobase/client","@ant-design/icons","antd","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-aggregate"]=t(require("react"),require("react-i18next"),require("@formily/react"),require("@nocobase/client"),require("@ant-design/icons"),require("antd"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-aggregate"]=t(e.react,e["react-i18next"],e["@formily/react"],e["@nocobase/client"],e["@ant-design/icons"],e.antd,e["@nocobase/plugin-workflow/client"])}(self,function(e,t,n,r,o,i,a){return function(){"use strict";var l={482:function(e){e.exports=o},505:function(e){e.exports=n},772:function(e){e.exports=r},433:function(e){e.exports=a},721:function(e){e.exports=i},156:function(t){t.exports=e},238:function(e){e.exports=t}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return l[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return!function(){u.r(s),u.d(s,{default:function(){return D}});var e=u(772),t=u(505),n=u(721),r=u(156),o=u.n(r),i=u(482),a=u(433),l=u(238),c="workflow-aggregate";function f(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,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,l,"next",e)}function l(e){p(i,r,o,a,l,"throw",e)}a(void 0)})}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}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=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||h(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 g(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(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 h(e,t){if(e){if("string"==typeof e)return f(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 f(e,t)}}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function O(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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}}}}function w(){var e,t,n=(e=["\n position: relative;\n width: 100%;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return w=function(){return n},n}function j(e){return["hasMany","belongsToMany"].includes(e.type)}function S(i){var l,c,u,s,f=i.value,p=i.onChange,b=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}(i,["value","onChange"]),m=(0,t.useForm)().setValuesIn,h=(0,e.useCollectionManager_deprecated)().getCollection,x=(l=(0,e.useCompile)(),[a.nodesOptions,a.triggerOptions].map(function(e){var t,n=null==(t=e.useOptions({types:[j],appends:null,depth:4}))?void 0:t.filter(Boolean);return{label:l(e.label),value:e.value,key:e.value,children:l(n),disabled:n&&!n.length}})),w=v((0,r.useState)(x),2),S=w[0],C=w[1],k=null!=f?f:{},P=k.associatedKey,F=k.name,I=[],T=(void 0===P?"":P).match(/^{{(.*)}}$/);T&&(I=g(T[1].trim().split(".").slice(0,-1)).concat([F]));var _=(c=d(function(e){var t,n;return O(this,function(r){switch(r.label){case 0:if(!(!(null==(t=(n=e[e.length-1]).children)?void 0:t.length)&&!n.isLeaf&&n.loadChildren))return[3,2];return[4,n.loadChildren(n)];case 1:r.sent(),C(function(e){return g(e)}),r.label=2;case 2:return[2]}})}),function(e){return c.apply(this,arguments)});(0,r.useEffect)(function(){var e;(e=d(function(){var e,t,n;return O(this,function(r){switch(r.label){case 0:if(e=function(e){var n,r;return O(this,function(o){switch(o.label){case 0:n=I[e],o.label=1;case 1:if(o.trys.push([1,6,,7]),0!==e)return[3,2];return t=S.find(function(e){return e.value===n}),[3,5];case 2:if(!(t.loadChildren&&!(null==(r=t.children)?void 0:r.length)))return[3,4];return[4,t.loadChildren(t)];case 3:o.sent(),o.label=4;case 4:t=t.children.find(function(e){return e.value===n}),o.label=5;case 5:return[3,7];case 6:return console.error(o.sent()),[3,7];case 7:return[2]}})},!I||S.length<=1)return[2];t=null,n=0,r.label=1;case 1:if(!(n<I.length))return[3,4];return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e(n))];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return C(g(S)),[2]}})}),function(){return e.apply(this,arguments)})()},[f,S.length]);var q=(0,r.useCallback)(function(t,n){if(!(null==t?void 0:t.length)){m("collection",null),p({});return}var r=n.pop().field;if(r&&["hasMany","belongsToMany"].includes(r.type)){var o=r.collectionName,i=r.target,a=r.name,l=r.dataSourceKey,c=h(o,l).fields.find(function(e){return e.primaryKey});m("collection",(0,e.joinCollectionName)(l,i)),p({name:a,associatedKey:"{{".concat(t.slice(0,-1).join("."),".").concat(c.name,"}}"),associatedCollection:(0,e.joinCollectionName)(l,o)})}},[p]);return o().createElement(n.Cascader,(u=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){y(e,t,n[t])})}return e}({},b),s=s={value:I,options:S,changeOnSelect:!0,onChange:q,loadData:_},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(s)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(s)).forEach(function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(s,e))}),u))}var C=function(n){var r;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");function u(){var n,r,l;if(!(this instanceof u))throw TypeError("Cannot call a class as a function");return r=u,l=arguments,r=b(r),y(n=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,x()?Reflect.construct(r,l||[],b(this).constructor):r.apply(this,l)),"title",'{{t("Aggregate", { ns: "'.concat(c,'" })}}')),y(n,"type","aggregate"),y(n,"group","collection"),y(n,"description",'{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "'.concat(c,'" })}}')),y(n,"icon",o().createElement(i.BarChartOutlined,{style:{}})),y(n,"fieldset",{aggregator:{type:"string",title:'{{t("Aggregator function", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"COUNT",value:"count"},{label:"SUM",value:"sum"},{label:"AVG",value:"avg"},{label:"MIN",value:"min"},{label:"MAX",value:"max"}],required:!0,default:"count"},associated:{type:"boolean",title:'{{t("Target type", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Data of collection", { ns: "'.concat(c,'" })}}'),value:!1},{label:'{{t("Data of associated collection", { ns: "'.concat(c,'" })}}'),value:!0}],required:!0,default:!1,"x-reactions":[{target:"collection",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"association",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},collectionField:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{target:{type:"void","x-component":"Grid.Col",properties:{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-component-props":{dataSourceFilter:function(e){return"main"===e.key||e.options.isDBInstance}},title:'{{t("Data of collection", { ns: "'.concat(c,'" })}}'),"x-reactions":[{dependencies:["associated"],fulfill:{state:{display:'{{$deps[0] ? "hidden" : "visible"}}'}}},{target:"params.field",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},association:{type:"object",title:'{{t("Data of associated collection", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"AssociatedConfig","x-component-props":{changeOnSelect:!0},"x-reactions":[{dependencies:["associated"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}],required:!0}}},field:{type:"void","x-component":"Grid.Col",properties:{"params.field":{type:"string",title:'{{t("Field to aggregate", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{filter:function(e){return!e.hidden&&e.interface&&!["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}},required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}}}}},params:{type:"object",properties:{distinct:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Distinct", { ns: "'.concat(c,'" })}}'),"x-reactions":[{dependencies:["collection","aggregator"],fulfill:{state:{visible:'{{!!$deps[0] && ["count"].includes($deps[1])}}'}}}]},filter:{type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var n=(0,t.useForm)().values,r=v((0,e.parseCollectionName)(null==n?void 0:n.collection),2),o=r[0],i=r[1];return{options:(0,e.useCollectionFilterOptions)(i,o),className:(0,e.css)(w())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}},precision:{type:"number",title:'{{t("Result precision", { ns: "'.concat(c,'" })}}'),description:'{{t("Number of decimal places for query result.", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:0,max:14,step:1,precision:0,className:"auto-width"},default:2}}),y(n,"scope",{useCollectionDataSource:e.useCollectionDataSource}),y(n,"components",{SchemaComponentContext:e.SchemaComponentContext,FilterDynamicComponent:a.FilterDynamicComponent,FieldsSelect:a.FieldsSelect,ValueBlock:a.ValueBlock,AssociatedConfig:S}),n}return u.prototype=Object.create(n&&n.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),n&&m(u,n),r=[{key:"useVariables",value:function(e,t){var n,r=e.key,o=e.title,i=t.types,l=t.fieldNames,c=void 0===l?a.defaultFieldNames:l;return i&&!i.some(function(e){return e in a.BaseTypeSets||Object.values(a.BaseTypeSets).some(function(t){return t.has(e)})})?null:(y(n={},c.value,r),y(n,c.label,o),n)}},{key:"useInitializers",value:function(e){var t,n=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=n,(0,l.useTranslation)(c,t)).t)(e)}("Query result");return e.config.collection?{name:"#".concat(e.id),type:"item",title:null!=(t=e.title)?t:"#".concat(e.id),Component:a.ValueBlock.Initializer,node:e,resultTitle:n}:null}}],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)}}(u.prototype,r),u}(a.Instruction);function k(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){k(i,r,o,a,l,"next",e)}function l(e){k(i,r,o,a,l,"throw",e)}a(void 0)})}}function F(e,t,n){return(F=q()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&T(o,n.prototype),o}).apply(null,arguments)}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=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 F(e,arguments,I(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),T(n,e)})(e)}function q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(q=function(){return!!e})()}function E(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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 D=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;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=I(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,q()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&T(n,e),t=[{key:"afterAdd",value:function(){return P(function(){return E(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return P(function(){return E(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return P(function(){return E(this,function(t){return e.app.pm.get("workflow").registerInstruction("aggregate",C),[2]})})()}}],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.Plugin))}(),s}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-aggregate",["react-i18next","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-aggregate"]=t(require("react-i18next"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-aggregate"]=t(e["react-i18next"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,n,r,o,i,a){return function(){"use strict";var c={375:function(e){e.exports=i},230:function(e){e.exports=o},342:function(e){e.exports=r},990:function(e){e.exports=a},59:function(e){e.exports=n},155:function(e){e.exports=t},953:function(t){t.exports=e}},l={};function u(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return c[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(s=u.g.location+"");var s,f=u.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var p=f.getElementsByTagName("script");if(p.length)for(var d=p.length-1;d>-1&&(!s||!/^http(s?):/.test(s));)s=p[d--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");u.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={},b=window.__nocobase_public_path__||"";if(!b&&window.location&&window.location.pathname){var m=window.location.pathname||"/",g=m.indexOf("/v2/");b=g>=0?m.slice(0,g+1):"/"}return b&&(b=b.replace(/\/v2\/?$/,"/")),b||(b="/"),"/"!==b.charAt(b.length-1)&&(b+="/"),u.p=b+"static/plugins/@nocobase/plugin-workflow-aggregate/dist/client/",!function(){u.r(y),u.d(y,{default:function(){return D}});var e=u(342),t=u(230),n=u(59),r=u(155),o=u.n(r),i=u(375),a=u(990),c=u(953),l="workflow-aggregate";function s(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 f(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){f(i,r,o,a,c,"next",e)}function c(e){f(i,r,o,a,c,"throw",e)}a(void 0)})}}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 b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return i}}(e,t)||h(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 v(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(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 h(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function w(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function j(){var e,t,n=(e=["\n position: relative;\n width: 100%;\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return j=function(){return n},n}function x(e){return["hasMany","belongsToMany"].includes(e.type)}function S(i){var c,l,u,s=i.value,f=i.onChange,y=function(e,t){if(null==e)return{};var n,r,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(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}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}(i,["value","onChange"]),b=(0,t.useForm)().setValuesIn,m=(0,e.useCollectionManager_deprecated)().getCollection,h=(c=(0,e.useCompile)(),[a.nodesOptions,a.triggerOptions].map(function(e){var t,n=null==(t=e.useOptions({types:[x],appends:null,depth:4}))?void 0:t.filter(Boolean);return{label:c(e.label),value:e.value,key:e.value,children:c(n),disabled:n&&!n.length}})),O=g((0,r.useState)(h),2),j=O[0],S=O[1],P=null!=s?s:{},C=P.associatedKey,k=P.name,F=[],I=(void 0===C?"":C).match(/^{{(.*)}}$/);I&&(F=v(I[1].trim().split(".").slice(0,-1)).concat([k])),(0,r.useEffect)(function(){p(function(){var e,t,n;return w(this,function(r){switch(r.label){case 0:if(e=function(e){var n,r;return w(this,function(o){switch(o.label){case 0:n=F[e],o.label=1;case 1:if(o.trys.push([1,6,,7]),0!==e)return[3,2];return t=j.find(function(e){return e.value===n}),[3,5];case 2:if(!(t.loadChildren&&!(null==(r=t.children)?void 0:r.length)))return[3,4];return[4,t.loadChildren(t)];case 3:o.sent(),o.label=4;case 4:t=t.children.find(function(e){return e.value===n}),o.label=5;case 5:return[3,7];case 6:return console.error(o.sent()),[3,7];case 7:return[2]}})},!F||j.length<=1)return[2];t=null,n=0,r.label=1;case 1:if(!(n<F.length))return[3,4];return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e(n))];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return S(v(j)),[2]}})})()},[s,j.length]);var _=(0,r.useCallback)(function(t,n){if(!(null==t?void 0:t.length)){b("collection",null),f({});return}var r=n.pop().field;if(r&&["hasMany","belongsToMany"].includes(r.type)){var o=r.collectionName,i=r.target,a=r.name,c=r.dataSourceKey,l=m(o,c).fields.find(function(e){return e.primaryKey});b("collection",(0,e.joinCollectionName)(c,i)),f({name:a,associatedKey:"{{".concat(t.slice(0,-1).join("."),".").concat(l.name,"}}"),associatedCollection:(0,e.joinCollectionName)(c,o)})}},[f]);return o().createElement(n.Cascader,(l=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){d(e,t,n[t])})}return e}({},y),u=u={value:F,options:j,changeOnSelect:!0,onChange:_,loadData:function(e){return p(function(){var t,n;return w(this,function(r){switch(r.label){case 0:if(!(!(null==(t=(n=e[e.length-1]).children)?void 0:t.length)&&!n.isLeaf&&n.loadChildren))return[3,2];return[4,n.loadChildren(n)];case 1:r.sent(),S(function(e){return v(e)}),r.label=2;case 2:return[2]}})})()}},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(u,e))}),l))}var P=function(n){var r;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");function u(){var n,r,c;if(!(this instanceof u))throw TypeError("Cannot call a class as a function");return r=u,c=arguments,r=b(r),d(n=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,O()?Reflect.construct(r,c||[],b(this).constructor):r.apply(this,c)),"title",'{{t("Aggregate", { ns: "'.concat(l,'" })}}')),d(n,"type","aggregate"),d(n,"group","collection"),d(n,"description",'{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "'.concat(l,'" })}}')),d(n,"icon",o().createElement(i.BarChartOutlined,{style:{}})),d(n,"fieldset",{aggregator:{type:"string",title:'{{t("Aggregator function", { ns: "'.concat(l,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"COUNT",value:"count"},{label:"SUM",value:"sum"},{label:"AVG",value:"avg"},{label:"MIN",value:"min"},{label:"MAX",value:"max"}],required:!0,default:"count"},associated:{type:"boolean",title:'{{t("Target type", { ns: "'.concat(l,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Data of collection", { ns: "'.concat(l,'" })}}'),value:!1},{label:'{{t("Data of associated collection", { ns: "'.concat(l,'" })}}'),value:!0}],required:!0,default:!1,"x-reactions":[{target:"collection",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"association",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},collectionField:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{target:{type:"void","x-component":"Grid.Col",properties:{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-component-props":{dataSourceFilter:function(e){return"main"===e.key||e.options.isDBInstance}},title:'{{t("Data of collection", { ns: "'.concat(l,'" })}}'),"x-reactions":[{dependencies:["associated"],fulfill:{state:{display:'{{$deps[0] ? "hidden" : "visible"}}'}}},{target:"params.field",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},association:{type:"object",title:'{{t("Data of associated collection", { ns: "'.concat(l,'" })}}'),"x-decorator":"FormItem","x-component":"AssociatedConfig","x-component-props":{changeOnSelect:!0},"x-reactions":[{dependencies:["associated"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}],required:!0}}},field:{type:"void","x-component":"Grid.Col",properties:{"params.field":{type:"string",title:'{{t("Field to aggregate", { ns: "'.concat(l,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{filter:function(e){return!e.hidden&&e.interface&&!["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}},required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}}}}},params:{type:"object",properties:{distinct:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Distinct", { ns: "'.concat(l,'" })}}'),"x-reactions":[{dependencies:["collection","aggregator"],fulfill:{state:{visible:'{{!!$deps[0] && ["count"].includes($deps[1])}}'}}}]},filter:{type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var n=(0,t.useForm)().values,r=g((0,e.parseCollectionName)(null==n?void 0:n.collection),2),o=r[0],i=r[1];return{options:(0,e.useCollectionFilterOptions)(i,o),className:(0,e.css)(j())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}},precision:{type:"number",title:'{{t("Result precision", { ns: "'.concat(l,'" })}}'),description:'{{t("Number of decimal places for query result.", { ns: "'.concat(l,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:0,max:14,step:1,precision:0,className:"auto-width"},default:2}}),d(n,"scope",{useCollectionDataSource:e.useCollectionDataSource}),d(n,"components",{SchemaComponentContext:e.SchemaComponentContext,FilterDynamicComponent:a.FilterDynamicComponent,FieldsSelect:a.FieldsSelect,ValueBlock:a.ValueBlock,AssociatedConfig:S}),n}return u.prototype=Object.create(n&&n.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),n&&m(u,n),r=[{key:"useVariables",value:function(e,t){var n,r=e.key,o=e.title,i=t.types,c=t.fieldNames,l=void 0===c?a.defaultFieldNames:c;return i&&!i.some(function(e){return e in a.BaseTypeSets||Object.values(a.BaseTypeSets).some(function(t){return t.has(e)})})?null:(d(n={},l.value,r),d(n,l.label,o),n)}},{key:"useInitializers",value:function(e){var t,n=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=n,(0,c.useTranslation)(l,t)).t)(e)}("Query result");return e.config.collection?{name:"#".concat(e.id),type:"item",title:null!=(t=e.title)?t:"#".concat(e.id),Component:a.ValueBlock.Initializer,node:e,resultTitle:n}:null}},{key:"getCreateModelMenuItem",value:function(t){var n,r=t.node;return{key:"#".concat(r.id),label:null!=(n=r.title)?n:"#".concat(r.id),useModel:"NodeValueModel",createModelOptions:{use:"NodeValueModel",stepParams:{valueSettings:{init:{dataSource:"{{$jobsMapByNodeKey.".concat(r.key,"}}"),defaultValue:function(t){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.i18n.t(t,(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}({},o),r=r={ns:l},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))}("Query result")}},cardSettings:{titleDescription:{title:'{{t("Aggregate", { ns: "'.concat(l,'" })}}')}}}}}}}],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)}}(u.prototype,r),u}(a.Instruction);function C(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function k(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){C(i,r,o,a,c,"next",e)}function c(e){C(i,r,o,a,c,"throw",e)}a(void 0)})}}function F(e,t,n){return(F=E()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t="function"==typeof Map?new Map:void 0;return(T=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 F(e,arguments,I(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function M(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var D=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;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=I(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,E()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_(n,e),t=[{key:"afterAdd",value:function(){return k(function(){return M(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return k(function(){return M(this,function(e){return[2]})})()}},{key:"load",value:function(){return k(function(){return M(this,function(e){return this.app.pm.get("workflow").registerInstruction("aggregate",P),[2]})}).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)}}(n.prototype,t),n}(T(e.Plugin))}(),y}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -12,14 +12,15 @@ module.exports = {
|
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
15
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
16
|
-
"@nocobase/plugin-workflow": "2.1.0-alpha.
|
|
15
|
+
"@nocobase/client": "2.1.0-alpha.11",
|
|
16
|
+
"@nocobase/plugin-workflow": "2.1.0-alpha.11",
|
|
17
|
+
"@nocobase/flow-engine": "2.1.0-alpha.11",
|
|
17
18
|
"react-i18next": "11.18.6",
|
|
18
|
-
"mathjs": "
|
|
19
|
-
"@nocobase/data-source-manager": "2.1.0-alpha.
|
|
20
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
21
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/plugin-workflow-test": "2.1.0-alpha.
|
|
23
|
-
"@nocobase/test": "2.1.0-alpha.
|
|
24
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
19
|
+
"mathjs": "15.1.0",
|
|
20
|
+
"@nocobase/data-source-manager": "2.1.0-alpha.11",
|
|
21
|
+
"@nocobase/database": "2.1.0-alpha.11",
|
|
22
|
+
"@nocobase/server": "2.1.0-alpha.11",
|
|
23
|
+
"@nocobase/plugin-workflow-test": "2.1.0-alpha.11",
|
|
24
|
+
"@nocobase/test": "2.1.0-alpha.11",
|
|
25
|
+
"@nocobase/utils": "2.1.0-alpha.11"
|
|
25
26
|
};
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -9,3 +9,4 @@
|
|
|
9
9
|
export declare const NAMESPACE = "workflow-aggregate";
|
|
10
10
|
export declare function useLang(key: string, options?: {}): string;
|
|
11
11
|
export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-aggregate", undefined>;
|
|
12
|
+
export declare function lang(key: string, options?: {}): string;
|
package/dist/locale/index.js
CHANGED
|
@@ -27,10 +27,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
27
27
|
var locale_exports = {};
|
|
28
28
|
__export(locale_exports, {
|
|
29
29
|
NAMESPACE: () => NAMESPACE,
|
|
30
|
+
lang: () => lang,
|
|
30
31
|
useLang: () => useLang,
|
|
31
32
|
usePluginTranslation: () => usePluginTranslation
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(locale_exports);
|
|
35
|
+
var import_client = require("@nocobase/client");
|
|
34
36
|
var import_react_i18next = require("react-i18next");
|
|
35
37
|
const NAMESPACE = "workflow-aggregate";
|
|
36
38
|
function useLang(key, options = {}) {
|
|
@@ -40,9 +42,13 @@ function useLang(key, options = {}) {
|
|
|
40
42
|
function usePluginTranslation(options) {
|
|
41
43
|
return (0, import_react_i18next.useTranslation)(NAMESPACE, options);
|
|
42
44
|
}
|
|
45
|
+
function lang(key, options = {}) {
|
|
46
|
+
return import_client.i18n.t(key, { ...options, ns: NAMESPACE });
|
|
47
|
+
}
|
|
43
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
49
|
0 && (module.exports = {
|
|
45
50
|
NAMESPACE,
|
|
51
|
+
lang,
|
|
46
52
|
useLang,
|
|
47
53
|
usePluginTranslation
|
|
48
54
|
});
|