@nocobase/plugin-workflow-aggregate 2.0.0-alpha.63 → 2.0.0-alpha.64

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.
@@ -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 {};
@@ -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"),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 q}});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 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,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 x(){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 x=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,O=(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}})),x=v((0,r.useState)(O),2),S=x[0],C=x[1],P=null!=f?f:{},k=P.associatedKey,F=P.name,I=[],M=(void 0===k?"":k).match(/^{{(.*)}}$/);M&&(I=g(M[1].trim().split(".").slice(0,-1)).concat([F]));var D=(c=d(function(e){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(),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 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=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 T=(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:T,loadData:D},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,O()?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)(x())}},"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}},{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:c},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))}("Query result")}},cardSettings:{titleDescription:{title:'{{t("Aggregate", { ns: "'.concat(c,'" })}}')}}}}}}}],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 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 k(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 F(e,t,n){return(F=T()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&M(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 M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t="function"==typeof Map?new Map:void 0;return(D=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}}),M(n,e)})(e)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function _(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 q=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,T()?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&&M(n,e),t=[{key:"afterAdd",value:function(){return k(function(){return _(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return k(function(){return _(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return k(function(){return _(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}(D(e.Plugin))}(),s}()});
@@ -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.0.0-alpha.63",
16
- "@nocobase/plugin-workflow": "2.0.0-alpha.63",
15
+ "@nocobase/client": "2.0.0-alpha.64",
16
+ "@nocobase/plugin-workflow": "2.0.0-alpha.64",
17
+ "@nocobase/flow-engine": "2.0.0-alpha.64",
17
18
  "react-i18next": "11.18.6",
18
19
  "mathjs": "10.6.4",
19
- "@nocobase/data-source-manager": "2.0.0-alpha.63",
20
- "@nocobase/database": "2.0.0-alpha.63",
21
- "@nocobase/server": "2.0.0-alpha.63",
22
- "@nocobase/plugin-workflow-test": "2.0.0-alpha.63",
23
- "@nocobase/test": "2.0.0-alpha.63",
24
- "@nocobase/utils": "2.0.0-alpha.63"
20
+ "@nocobase/data-source-manager": "2.0.0-alpha.64",
21
+ "@nocobase/database": "2.0.0-alpha.64",
22
+ "@nocobase/server": "2.0.0-alpha.64",
23
+ "@nocobase/plugin-workflow-test": "2.0.0-alpha.64",
24
+ "@nocobase/test": "2.0.0-alpha.64",
25
+ "@nocobase/utils": "2.0.0-alpha.64"
25
26
  };
@@ -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;
@@ -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
  });
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.",
7
7
  "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。",
8
8
  "description.ru-RU": "Используется для агрегирования данных из базы данных в рабочем процессе, например: статистика, сумма, среднее и т.д.",
9
- "version": "2.0.0-alpha.63",
9
+ "version": "2.0.0-alpha.64",
10
10
  "license": "AGPL-3.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow-aggregate",
@@ -25,7 +25,7 @@
25
25
  "@nocobase/server": "2.x",
26
26
  "@nocobase/test": "2.x"
27
27
  },
28
- "gitHead": "0d5e9eb45e4d0f3ba70d7561a0d296d12a4d8bf8",
28
+ "gitHead": "f6c2831b27608b53de6dc8b7aa6a48d12ec48a14",
29
29
  "keywords": [
30
30
  "Workflow"
31
31
  ]