@nocobase/plugin-workflow-manual 2.2.0-alpha.10 → 2.2.0-alpha.12

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.
@@ -39,7 +39,7 @@ export declare function getWorkflowTodoViewActionSchema({ defaultOpenMode, colle
39
39
  };
40
40
  declare function Drawer(): React.JSX.Element;
41
41
  declare function TaskItem(): React.JSX.Element;
42
- declare function useTodoActionParams(status: any): {
42
+ declare function useTodoActionParams(status: any, workflowKey?: string): {
43
43
  filter: any;
44
44
  appends: string[];
45
45
  except: string[];
@@ -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-i18next"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("dayjs"),require("@formily/core"),require("@nocobase/plugin-mobile/client"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-manual",["react-i18next","react-router-dom","@formily/antd-v5","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client","dayjs","@formily/core","@nocobase/plugin-mobile/client","react","antd","@nocobase/client","antd-style","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-manual"]=t(require("react-i18next"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("dayjs"),require("@formily/core"),require("@nocobase/plugin-mobile/client"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-workflow-manual"]=t(e["react-i18next"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e.dayjs,e["@formily/core"],e["@nocobase/plugin-mobile/client"],e.react,e.antd,e["@nocobase/client"],e["antd-style"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,a,l,c,u,s,p,f,m,d){return function(){"use strict";var y={375:function(e){e.exports=o},418:function(e){e.exports=n},452:function(e){e.exports=l},230:function(e){e.exports=r},342:function(e){e.exports=p},27:function(e){e.exports=c},990:function(e){e.exports=i},768:function(e){e.exports=m},59:function(e){e.exports=s},235:function(e){e.exports=f},185:function(e){e.exports=a},773:function(e){e.exports=d},155:function(e){e.exports=u},953:function(t){t.exports=e},442:function(e){e.exports=t}},b={};function v(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,v),n.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var n in t)v.o(t,n)&&!v.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.g.importScripts&&(h=v.g.location+"");var h,g=v.g.document;if(!h&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(h=g.currentScript.src),!h)){var w=g.getElementsByTagName("script");if(w.length)for(var x=w.length-1;x>-1&&(!h||!/^http(s?):/.test(h));)h=w[x--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");v.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var O={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-manual/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-manual/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(i);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-manual/dist/client/"}v.p=e}(),!function(){v.r(O),v.d(O,{default:function(){return tm}});var e=v(342),t=v(155),n=v.n(t),r=v(375),o=v(990),i=v.n(o),a=v(418),l=v(452),c=v(230),u=v(59),s=v(953),p=v(768),f="workflow-manual",m="manual",d=[{value:0,label:'{{t("Pending", { ns: "workflow" })}}',color:"gold"},{value:1,label:'{{t("Resolved", { ns: "workflow" })}}',color:"green"},{value:-3,label:'{{t("Aborted", { ns: "workflow" })}}',color:"volcano"},{value:-5,label:'{{t("Rejected", { ns: "workflow" })}}',color:"red"}],y=d.reduce(function(e,t){var n,r;return Object.assign(e,(n={},r=t.value,r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n))},{});function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,h(t).t)(e)}function h(e){return(0,s.useTranslation)(f,e)}function g(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 w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function x(r){var o,i,a,s,p,f=(0,e.useCollectionRecordData)(),m=(0,c.useFieldSchema)(),d=(0,c.useField)(),y=(0,t.useRef)(null),b=r.dataSource||e.DEFAULT_DATA_SOURCE_KEY,v=u.theme.useToken().token,h=(0,(0,e.useAssociationNames)(b).getAssociationAppends)(),x=h.appends,O=h.updateAssociationValues,S=(function(e){if(Array.isArray(e))return e}(o=Object.keys(null!=(s=m.toJSON().properties)?s:{}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(o)||function(e){if(e){if("string"==typeof e)return g(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return g(e,1)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],k=null==f||null==(p=f.result)?void 0:p[S],C=(0,t.useMemo)(function(){return(0,l.createForm)({initialValues:k})},[k]),j=(0,t.useMemo)(function(){return w({appends:x},r.params)},[x,r.params]),P=(0,t.useMemo)(function(){return{loading:!1,data:{data:k}}},[k]),E=(0,e.useAPIClient)(),A=(0,e.useDataSourceHeaders)(b),I=E.resource(r.collection,void 0,A),F=(0,e.useBlockRequestContext)(),T=(0,t.useMemo)(function(){return{params:j,form:C,field:d,service:P,updateAssociationValues:O,formBlockRef:y}},[d,C,j,P,O]);return(null==f?void 0:f.status)&&!k?null:n().createElement(e.TemplateBlockProvider,null,n().createElement(e.CollectionManagerProvider,{dataSource:b},n().createElement(e.CollectionProvider_deprecated,{collection:r.collection},n().createElement(e.BlockProvider,(i=w({name:r.name||"form"},r),a=a={block:"form",parentRecord:null},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i),n().createElement(e.FormActiveFieldsProvider,{name:"form"},n().createElement(e.BlockRequestContext_deprecated.Provider,{value:{block:"form",props:r,field:d,service:P,resource:I,__parent:F}},n().createElement(e.FormBlockContext.Provider,{value:T},n().createElement(e.RecordProvider,{record:k,parent:null},n().createElement(e.FormV2.Templates,{style:{marginBottom:v.margin},form:C}),n().createElement("div",{ref:y},r.children)))))))))}var S=v(773),k=v.n(S);function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(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){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function A(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,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)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}}(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 I(t){var r=t.schema,i=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}(t,["schema"]),a=(0,e.useSchemaTemplateManager)().getTemplateSchemaByMode,l=(0,e.useSchemaInitializer)().insert,c=(0,e.useRecordCollectionDataSourceItems)("FormItem");return n().createElement(e.SchemaInitializerItem,E(P({},i),{onClick:function(t){var n;return(n=function(t){var n,i,c,u,s,p,m;return function(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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}}}}(this,function(d){switch(d.label){case 0:if(!(n=t.item).template)return[3,2];return[4,a(n)];case 1:return u=d.sent(),[3,3];case 2:u=null,d.label=3;case 3:var y;return c=u,y=E(P({actionInitializers:"workflowManual:form:configureActions",actions:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:o.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-designer-props":{}}}},r),{template:c}),s=(0,e.createFormBlockSchema)(y),delete s["x-acl-action-props"],delete s["x-acl-action"],p=A(Object.keys(s.properties),1)[0],m=(null==(i=Object.entries(s.properties[p].properties).find(function(e){var t=A(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:i[0])||"actions",s.properties[p].properties[m]["x-decorator"]="ActionBarProvider",s.properties[p].properties[m]["x-component-props"].style={marginTop:"1.5em",flexWrap:"wrap"},(0,o.traverseSchema)(s,function(e){e["x-uid"]&&delete e["x-uid"]}),l(s),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){j(i,r,o,a,l,"next",e)}function l(e){j(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)},items:c}))}function F(){var t,r,o=(0,e.useSchemaInitializerItem)();return n().createElement(e.CollectionProvider_deprecated,{dataSource:null==(t=o.schema)?void 0:t.dataSource,collection:null==(r=o.schema)?void 0:r.collection},n().createElement(I,o))}function T(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 D(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];return e&&(!t(e)||n&&e.properties?e.properties&&Object.keys(e.properties).forEach(function(n){var o;r.push.apply(r,function(e){if(Array.isArray(e))return T(e)}(o=D(e.properties[n],t))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e){if(e){if("string"==typeof e)return T(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T(e,void 0)}}(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}):r.push(e)),r}function M(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 B(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,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)||function(e,t){if(e){if("string"==typeof e)return M(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 M(e,t)}}(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 R(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 z(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 _(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){z(i,r,o,a,l,"next",e)}function l(e){z(i,r,o,a,l,"throw",e)}a(void 0)})}}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(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){N(e,t,n[t])})}return e}function q(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function U(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,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)||W(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 W(e,t){if(e){if("string"==typeof e)return R(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 R(e,t)}}function $(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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 L(r){var o,i,a,u,s=U((0,t.useState)(null!=(o=null==(a=r.collection)?void 0:a.fields)?o:[]),2),p=s[0],f=s[1],m=(0,e.useCollectionRecordData)(),d=(0,c.useField)(),y=U(Object.keys(null!=(i=(0,c.useFieldSchema)().toJSON().properties)?i:{}),1)[0],b=null==m||null==(u=m.result)?void 0:u[y],v=(0,t.useMemo)(function(){return(0,l.createForm)({initialValues:b})},[b]);return(null==m?void 0:m.status)&&!b?null:n().createElement(e.CollectionProvider_deprecated,{collection:q(V({},r.collection),{fields:p})},n().createElement(e.RecordProvider,{record:b,parent:null},n().createElement(e.FormBlockContext.Provider,{value:{form:v,field:d,setCollectionFields:f}},r.children)))}function G(){var t=(0,e.useSchemaInitializer)().insert,r=(0,e.useSchemaInitializerItem)();return n().createElement(e.SchemaInitializerItem,q(V({},r),{onClick:function(){t({type:"void","x-decorator":"CustomFormBlockProvider","x-decorator-props":{collection:{name:(0,p.uid)(),fields:[]}},"x-component":"CardItem","x-component-props":{title:'{{t("Form")}}'},"x-designer":"SimpleDesigner","x-designer-props":{type:"customForm"},properties:N({},(0,p.uid)(),{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:customForm:configureFields"},actions:{type:"void","x-decorator":"ActionBarProvider","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:"1.5em",flexWrap:"wrap"}},"x-initializer":"workflowManual:form:configureActions",properties:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:o.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner"}}}}})})}}))}var J={basic:'{{t("Basic")}}',choices:'{{t("Choices")}}',media:'{{t("Media")}}',datetime:'{{t("Date & Time")}}',relation:'{{t("Relation")}}',advanced:'{{t("Advanced type")}}',systemInfo:'{{t("System info")}}',others:'{{t("Others")}}'},K=n().createContext({});function Y(){var e=(0,c.useForm)(),n=e.values,r=e.query,o=e.reset,i=[b("Field name existed in form")],a=(0,t.useContext)(K),l=a.collection,u=a.interfaceOptions,s=a.setCollectionFields,f=a.insert,m=a.setCallback,d=a.setInterface;return{run:function(){return _(function(){var e,t,a,c,y,b,v;return $(this,function(h){var g;return(y=u.default,b=(0,p.uid)(),y.name=null!=(e=n.name)?e:b,y.uiSchema.title=null!=(t=null==(a=n.uiSchema)?void 0:a.title)?t:b,y.interface=u.name,null==(c=l.fields)?void 0:c.find(function(e){return e.name===y.name}))?(r("name").take().setFeedback({type:"error",messages:i}),[2]):(v=(0,p.merge)(y,n),s(((function(e){if(Array.isArray(e))return R(e)})(g=l.fields)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(g)||W(g)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([v])),f({name:y.name,type:y.uiSchema.type,"x-decorator":"FormItem","x-component":"CollectionField","x-component-props":{field:v},"x-collection-field":"".concat(l.name,".").concat(y.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem"}),o(),m(null),d(null),[2])})})()}}}var Q={wrap:e.gridRowColWrap,insertPosition:"beforeEnd",title:"{{t('Configure fields')}}",ItemsComponent:function(r){var o,i,u=U((0,t.useState)(null),2),s=u[0],p=u[1],f=U((0,t.useState)(),2),m=f[0],d=f[1],y=(i={},Object.keys(o=(0,e.useCollectionManager_deprecated)().interfaces).forEach(function(e){var t=o[e],n=t.group,r=void 0===n?"others":n;i[r]=i[r]||{},(0,S.set)(i,[r,e],t)}),Object.keys(J).filter(function(e){return["basic","choices","datetime","media"].includes(e)}).map(function(e){return{title:J[e],children:Object.keys(i[e]||{}).map(function(t){var n=i[e][t];return V({value:t,title:n.title,name:t},i[e][t])}).sort(function(e,t){return e.order-t.order})}})).map(function(e){return{name:e.title,type:"itemGroup",title:e.title,children:e.children.map(function(e){return{name:e.name,type:"item",title:e.title,Component:Z,fieldInterface:e.name}})}}),b=(0,e.useCollection_deprecated)(),v=(0,t.useContext)(e.FormBlockContext).setCollectionFields,h=(0,t.useMemo)(function(){return(0,l.createForm)()},[]);return n().createElement(K.Provider,{value:{collection:b,insert:m,interfaceOptions:s,onAddField:function(e){var t=(0,S.pick)(e,["name","group","title","default","validateSchema"]),n=e.properties;n.unique,n.type,n.layout,n.autoIncrement,t.properties=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}(n,["unique","type","layout","autoIncrement"]);var r=(0,S.cloneDeep)(t);delete r.properties.name["x-disabled"],p(r)},setCallback:d,setInterface:p,setCollectionFields:v}},n().createElement(e.SchemaInitializerItems,q(V({},r),{items:y})),n().createElement(e.ActionContextProvider,{value:{visible:!!s,setVisible:function(e){e||p(null)}}},s?n().createElement(e.SchemaComponent,{schema:{type:"void",name:"drawer",title:'{{t("Configure field")}}',"x-decorator":"FormV2","x-decorator-props":{form:h},"x-component":"Action.Drawer",properties:q(V({},s.properties),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:function(){var e=(0,c.useForm)();return{run:function(){return _(function(){return $(this,function(t){return d(null),p(null),e.reset(),[2]})})()}}}}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Y}}}}})},components:{ArrayTable:a.ArrayTable}}):null))}},H=new e.CompatibleSchemaInitializer(V({name:"AddCustomFormField"},Q)),X=new e.CompatibleSchemaInitializer(V({name:"workflowManual:customForm:configureFields"},Q),H);function Z(){var r=(0,e.useSchemaInitializerItem)(),o=(0,e.useSchemaInitializer)().insert,i=(0,t.useContext)(K),a=i.onAddField,l=i.setCallback,c=(0,(0,e.useCollectionManager_deprecated)().getInterface)(r.fieldInterface);return n().createElement(e.SchemaInitializerItem,V({key:r.fieldInterface,onClick:function(){l(function(){return o}),a(c)}},r))}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function et(e,t){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,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)||function(e,t){if(e){if("string"==typeof e)return ee(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 ee(e,t)}}(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.")}()}var en={title:'{{t("Update record form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(n){var r=n.allCollections,o=(0,t.useMemo)(function(){return r.map(function(e){var t=e.key;return{key:t,name:t,label:e.displayName,type:"subMenu",children:e.collections.map(function(e){return{name:k().camelCase("updateRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Update record", { ns: "'.concat(f,'" })}}'),formType:"update","x-designer":"UpdateFormDesigner"},Component:F}})}})},[r]),i=et((0,t.useState)([]),2),a=i[0],l=i[1],c=(0,e.useMenuSearch)({data:o,openKeys:a});return{name:"updateRecordForm",key:"updateRecordForm",type:"subMenu",title:'{{t("Update record form", { ns: "'.concat(f,'" })}}'),componentProps:{onOpenChange:function(e){l(e)}},children:c}},initializers:{},components:{FilterDynamicComponent:o.FilterDynamicComponent,UpdateFormDesigner:function(){var t=(0,e.useCollection_deprecated)(),r=t.name,o=t.title,i=(0,c.useFieldSchema)(),a=(0,s.useTranslation)().t,l=(0,e.useDesignable)().dn;return n().createElement(e.GeneralSchemaDesigner,{title:o||r},n().createElement(e.SchemaSettingsBlockTitleItem,null),n().createElement(e.SchemaSettingsActionModalItem,{title:a("Filter settings",{ns:f}),schema:{name:"filter",type:"object",title:'{{t("Filter")}}',"x-component":"Filter","x-use-component-props":function(){var t;return{options:(0,e.useCollectionFilterOptions)(null==i||null==(t=i["x-decorator-props"])?void 0:t.collection)}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},initialValues:null==i?void 0:i["x-decorator-props"],onSubmit:function(e){var t=e.filter;i["x-decorator-props"].filter=t,l.emit("patch",{schema:{"x-decorator-props":i["x-decorator-props"]}}),l.refresh()},width:"60%"}),n().createElement(e.SchemaSettingsLinkageRules,{collectionName:r}),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return D(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"update"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o,i,a=et(Object.keys(e.properties),1)[0],l=e.properties[a],c=(null==(o=Object.entries(l.properties).find(function(e){var t=et(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:o[0])||"actions";t[a]=(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}({},e["x-decorator-props"]),r=r={type:"update",title:(null==(i=e["x-component-props"])?void 0:i.title)||a,actions:D(l.properties[c],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}})},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)}),t}},block:{scope:{},components:{}},validate:function(e){var t=e.filter;return t&&(0,p.isValidFilter)(t)?null:"Please check one of your update record form, and add at least one filter condition in form settings."}};function er(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 eo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function ei(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ea(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}function el(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,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)||eu(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 ec(e){return function(e){if(Array.isArray(e))return er(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eu(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 eu(e,t){if(e){if("string"==typeof e)return er(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 er(e,t)}}var es=new p.Registry;es.register("custom",{title:'{{t("Custom form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(){return{name:"customForm",type:"item",title:'{{t("Custom form", { ns: "'.concat(f,'" })}}'),Component:G}},initializers:{},components:{CustomFormBlockProvider:L},parseFormOptions:function(e){var t={};return D(e,function(e){return"CustomFormBlockProvider"===e["x-decorator"]}).forEach(function(e){var n,r,o=U(Object.keys(e.properties),1)[0],i=e.properties[o],a=D(i.properties.grid,function(e){return"CollectionField"===e["x-component"]},!0);e["x-decorator-props"].collection.fields=a.map(function(e){var t,n;return null!=(t=null==(n=e["x-component-props"])?void 0:n.field)?t:e["x-interface-options"]});var l=(null==(n=Object.entries(i.properties).find(function(e){var t=U(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:n[0])||"actions";t[o]={type:"custom",title:(null==(r=e["x-component-props"])?void 0:r.title)||o,actions:D(i.properties[l],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{CustomFormBlockProvider:L}}}),es.register("create",{title:'{{t("Create record form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(n){var r=n.allCollections,o=(0,t.useMemo)(function(){return r.map(function(e){var t=e.key;return{key:t,name:t,label:e.displayName,type:"subMenu",children:e.collections.map(function(e){return{name:k().camelCase("createRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Create record", { ns: "'.concat(f,'" })}}'),formType:"create","x-designer":"CreateFormDesigner"},Component:F}})}})},[r]),i=B((0,t.useState)([]),2),a=i[0],l=i[1],c=(0,e.useMenuSearch)({data:o,openKeys:a});return{name:"createRecordForm",key:"createRecordForm",type:"subMenu",title:'{{t("Create record form", { ns: "'.concat(f,'" })}}'),componentProps:{onOpenChange:function(e){l(e)}},children:c}},initializers:{},components:{CreateFormDesigner:function(){var t=(0,e.useCollection_deprecated)(),r=t.name,o=t.title;return n().createElement(e.GeneralSchemaDesigner,{title:o||r},n().createElement(e.SchemaSettingsBlockTitleItem,null),n().createElement(e.SchemaSettingsLinkageRules,{collectionName:r}),n().createElement(e.SchemaSettingsDataTemplates,{collectionName:r}),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return D(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"create"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o=B(Object.keys(e.properties),1)[0],i=e.properties[o],a=(null==(n=Object.entries(i.properties).find(function(e){var t=B(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:n[0])||"actions";t[o]={type:"create",title:(null==(r=e["x-component-props"])?void 0:r.title)||o,actions:D(i.properties[a],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),dataSource:e["x-decorator-props"].dataSource,collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{}}}),es.register("update",en);var ep={wrap:e.gridRowColWrap,title:'{{t("Add block")}}',items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',hideIfNoChildren:!0,useChildren:function(){var t,n,r=(0,e.usePlugin)(i()),a=(0,o.useNodeContext)(),l=(0,o.useAvailableUpstreams)(a),c=[(t=(0,o.useFlowContext)().workflow,(n=(0,o.useTrigger)()).useInitializers?n.useInitializers(t.config):null)].filter(Boolean),u=l.map(function(e){var t,n=r.instructions.get(e.type);return null==n||null==(t=n.useInitializers)?void 0:t.call(n,e)}).filter(Boolean);return ec(c).concat(ec(u.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:u}]:[])).filter(Boolean)}},{type:"itemGroup",name:"form",title:'{{t("Form")}}',useChildren:function(){var t=(0,e.useDataSourceManager)().getAllCollections();return Array.from(es.getValues()).map(function(e){return(0,e.config.useInitializer)({allCollections:t})})}},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Markdown")}}',Component:"MarkdownBlockInitializer"}]}]},ef=new e.CompatibleSchemaInitializer(eo({name:"AddBlockButton"},ep)),em=new e.CompatibleSchemaInitializer(eo({name:"workflowManual:popup:configureUserInterface:addBlock"},ep),ef);function ed(){var r,i,f,m=(0,t.useContext)(e.SchemaComponentContext),d=(0,s.useTranslation)().t,y=h().t,b=(0,c.useFieldSchema)(),v=(0,o.useWorkflowVariableOptions)(),g=el((0,t.useState)(!1),2),w=g[0],x=g[1],O=el((0,t.useState)(null!=(r=null==b||null==(f=b["x-action-settings"])||null==(i=f.assignedValues)?void 0:i.schema)?r:{type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields",properties:{}}),2),S=O[0],k=O[1],C=el((0,t.useState)(null),2),j=C[0],P=C[1],E=(0,e.useSchemaOptionsContext)().components;(0,t.useEffect)(function(){P(new c.Schema({properties:{grid:S}}))},[S]);var A=(0,t.useMemo)(function(){var e,t,n=null==b||null==(t=b["x-action-settings"])||null==(e=t.assignedValues)?void 0:e.values;return(0,l.createForm)({initialValues:p.lodash.cloneDeep(n),values:p.lodash.cloneDeep(n)})},[b]),I=(0,e.useFormActiveFields)(),F=d("Assign field values");function T(){x(!1)}return n().createElement(n().Fragment,null,n().createElement(e.SchemaSettingsItem,{title:F,onClick:function(){return x(!0)}},F),n().createElement(u.Modal,{width:"50%",title:F,open:w,onCancel:T,footer:n().createElement(u.Space,null,n().createElement(u.Button,{onClick:T},y("Cancel")),n().createElement(u.Button,{type:"primary",onClick:function(){b["x-action-settings"]||(b["x-action-settings"]={}),b["x-action-settings"].assignedValues||(b["x-action-settings"].assignedValues={}),b["x-action-settings"].assignedValues.schema=S,b["x-action-settings"].assignedValues.values=A.values,x(!1),setTimeout(function(){var e;null==(e=m.refresh)||e.call(m)},300)}},y("Submit")))},n().createElement(e.DefaultValueProvider,{isAllowToSetDefaultValue:function(){return!1}},n().createElement(e.VariableScopeProvider,{scope:v},n().createElement(e.FormActiveFieldsProvider,{name:"form",getActiveFieldsName:null==I?void 0:I.getActiveFieldsName},n().createElement(c.FormProvider,{form:A},n().createElement(a.FormLayout,{layout:"vertical"},n().createElement(u.Alert,{message:y("Values preset in this form will override user submitted ones when continue or reject.")}),n().createElement("br",null),w&&j&&n().createElement(e.SchemaComponentContext.Provider,{value:ei(eo({},m),{refresh:function(){k(p.lodash.get(j.toJSON(),"properties.grid"))}})},n().createElement(e.SchemaComponent,{schema:j,components:E})))))))))}function ey(t){return n().createElement(e.GeneralSchemaDesigner,ei(eo({},t),{disableInitializer:!0}),n().createElement(e.Action.Designer.ButtonEditor,null),n().createElement(ed,null),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"ActionBar"}}))}function eb(){var t=(0,e.useSchemaInitializerItem)(),r=t.action,o=t.actionProps,i=ea(t,["action","actionProps"]);return n().createElement(e.InitializerWithSwitch,ei(eo({},i),{item:t,schema:{type:"void",title:i.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:r},"x-component":"Action","x-component-props":ei(eo({},o),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action":"".concat(r)},type:"x-action"}))}var ev={title:'{{t("Configure actions")}}',items:[{name:"jobStatusResolved",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),Component:function(){var t=(0,e.useSchemaInitializerItem)(),r=t.action,o=t.actionProps,i=ea(t,["action","actionProps"]),a=(0,e.useSchemaInitializer)().insert;return n().createElement(e.SchemaInitializerItem,ei(eo({},i),{onClick:function(){a({type:"void",title:i.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:r},"x-component":"Action","x-component-props":ei(eo({},o),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action-settings":{}})}}))},action:o.JOB_STATUS.RESOLVED,actionProps:{type:"primary"}},{name:"jobStatusRejected",title:'{{t("Terminate the process", { ns: "'.concat(f,'" })}}'),Component:eb,action:o.JOB_STATUS.REJECTED,actionProps:{danger:!0}},{name:"jobStatusPending",title:'{{t("Save temporarily", { ns: "'.concat(f,'" })}}'),Component:eb,action:o.JOB_STATUS.PENDING}]},eh=new e.CompatibleSchemaInitializer(eo({name:"AddActionButton"},ev)),eg=new e.CompatibleSchemaInitializer(eo({name:"workflowManual:form:configureActions"},ev),eh);function ew(){return{run:function(){}}}function ex(r){var a=r.value,l=r.onChange,u=(0,e.usePlugin)(i()),s=(0,t.useContext)(e.SchemaComponentContext),m=(0,o.useNodeContext)(),d=(0,o.useAvailableUpstreams)(m),y=(0,c.useForm)(),b=(0,o.useWorkflowExecuted)(),v=(0,t.useRef)(function(){}),h={};d.forEach(function(e){Object.assign(h,u.instructions.get(e.type).components)});var g=(0,t.useMemo)(function(){return new c.Schema({properties:{drawer:{type:"void",title:'{{t("User interface", { ns: "'.concat(f,'" })}}'),"x-decorator":"Form","x-component":"Action.Container","x-component-props":{onClose:function(){return v.current()}},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"workflowManual:popup:configureUserInterface:addBlock"},properties:null!=a?a:{tab1:{type:"void",title:'{{t("Manual", { ns: "'.concat(f,'" })}}'),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:popup:configureUserInterface:addBlock",properties:{}}}}}}}}}})},[]),w=(0,t.useCallback)(function(){var e=p.lodash.get(g.toJSON(),"properties.drawer.properties").tabs,t=Array.from(es.getValues()).reduce(function(t,n){return Object.assign(t,n.config.parseFormOptions(e))},{});y.setValuesIn("forms",t),l(e.properties)},[y,l,g]);return v.current=w,n().createElement(e.SchemaComponentContext.Provider,{value:ei(eo({},s),{designable:!b,refresh:w})},n().createElement(e.SchemaComponent,{schema:g,components:ei(eo({},h,Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.config.components)},{})),{FormBlockProvider:x,DetailsBlockProvider:o.DetailsBlockProvider,ManualActionStatusProvider:function(e){return e.children},ActionBarProvider:function(e){return e.children},SimpleDesigner:o.SimpleDesigner,ManualActionDesigner:ey}),scope:{useSubmit:ew,useDetailsBlockProps:e.useFormBlockContext}}))}function eO(r){var i=(0,o.useWorkflowExecuted)(),a=el((0,t.useState)(!1),2),l=a[0],s=a[1],p=(0,c.useForm)().values,f=h().t,m=(0,t.useCallback)(function(e){if(!e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!0,n=!1,r=void 0;try{for(var o,i=Object.values(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value,l=es.get(a.type);if("function"==typeof l.validate){var c=l.validate(a);if(c)return c}}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}}(p.forms);if(t)return void u.message.error({content:f(t)})}s(e)},[p.forms]);return n().createElement(n().Fragment,null,n().createElement(u.Button,{type:"primary",onClick:function(){return s(!0)},disabled:!1},f(i?"View user interface":"Configure user interface")),n().createElement(e.ActionContextProvider,{value:{visible:l,setVisible:m,formValueChanged:!1}},r.children))}function eS(){var e,t,n=(e=["\n .ant-radio-group {\n .anticon {\n margin-left: 0.5em;\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return eS=function(){return n},n}function ek(t){var o=t.value,i=t.onChange,l=n().createElement("fieldset",null,n().createElement(a.FormLayout,{layout:"vertical"},n().createElement(e.FormItem,{label:b("Negotiation")},n().createElement(u.Radio.Group,{value:o,onChange:i},n().createElement(u.Radio,{value:1},n().createElement(u.Tooltip,{title:b("Everyone should pass"),placement:"bottom"},n().createElement("span",null,b("All pass")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))),n().createElement(u.Radio,{value:-1},n().createElement(u.Tooltip,{title:b("Anyone pass"),placement:"bottom"},n().createElement("span",null,b("Any pass")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}})))))));return n().createElement("fieldset",{className:(0,e.css)(eS())},n().createElement(u.Form.Item,null,n().createElement(u.Radio.Group,{value:!!o,onChange:function(e){var t=e.target.value;console.log(t),i(Number(t))}},n().createElement(u.Radio,{value:!0},n().createElement(u.Tooltip,{title:b("Each user has own task"),placement:"bottom"},n().createElement("span",null,b("Separately")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))),n().createElement(u.Radio,{value:!1},n().createElement(u.Tooltip,{title:b("Everyone shares one task"),placement:"bottom"},n().createElement("span",null,b("Collaboratively")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))))),o?l:null)}function eC(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}function ej(t){t.multiple;var r=t.value,i=void 0===r?[]:r,a=t.onChange,l=(0,o.useWorkflowVariableOptions)({types:[eC]});return n().createElement(e.Variable.Input,{scope:l,value:i[0],onChange:function(e){a([e])}},n().createElement(e.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:i[0],onChange:function(e){a(null!=e?[e]:[])}}))}function eP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eE(e){return(eE=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eA(e,t){return(eA=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eI=function(){return!!e})()}function eF(t,n){var r,i,a=t.key,l=t.title,c=t.config,u=n.types,s=n.fieldNames,p=void 0===s?o.defaultFieldNames:s,f=(0,e.useCompile)(),m=(0,e.useApp)(),d=Object.keys(null!=(r=c.forms)?r:{});if(!d.length)return null;var y=d.map(function(e){var t,n,r=c.forms[e];r.dataSource&&(n=m.dataSourceManager.getDataSource(r.dataSource).collectionManager);var i=(0,o.getCollectionFieldOptions)({fields:null==(t=r.collection)?void 0:t.fields,collection:r.collection,types:u,compile:f,collectionManager:n}),a=f(r.title)||e;return i.length?{key:e,value:e,label:a,title:a,children:i}:null}).filter(Boolean);return y.length?(eP(i={},p.value,a),eP(i,p.label,l),eP(i,p.children,y),i):null}function eT(t){var n,r=(0,e.useDataSourceManager)(),i=Object.keys(null!=(n=t.config.forms)?n:{});if(!i.length||t.config.mode)return null;var a=i.map(function(n){var i,a,l=t.config.forms[n],c=r.getDataSource(l.dataSource).collectionManager,u=("string"==typeof l.collection?c.getCollection(l.collection):l.collection||{fields:[]}).fields;return(void 0===u?[]:u).length?{name:null!=(i=l.title)?i:n,type:"item",title:null!=(a=l.title)?a:n,Component:o.CollectionBlockInitializer,collection:(0,e.joinCollectionName)(l.dataSource,l.collection),dataPath:"$jobsMapByNodeKey.".concat(t.key,".").concat(n)}:null}).filter(Boolean);return a.length?{name:"#".concat(t.id),key:"forms",type:"subMenu",title:t.title,children:a}:null}Symbol("single"),Symbol("all"),Symbol("any"),Symbol("all percentage"),Symbol("any percentage");var eD=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,i,a;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return i=t,a=arguments,i=eE(i),eP(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,eI()?Reflect.construct(i,a||[],eE(this).constructor):i.apply(this,a)),"title",'{{t("Manual", { ns: "'.concat(f,'" })}}')),eP(e,"type","manual"),eP(e,"group","manual"),eP(e,"description",'{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "'.concat(f,'" })}}')),eP(e,"icon",n().createElement(r.SolutionOutlined,null)),eP(e,"fieldset",{assignees:{type:"array",title:'{{t("Assignees", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"AssigneesSelect","x-component-props":{},required:!0,default:[]},mode:{type:"number",title:'{{t("Mode", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"ModeConfig",default:1,"x-reactions":{dependencies:["assignees"],fulfill:{state:{visible:"{{$deps[0].length > 1}}"}}}},title:{type:"string",title:'{{t("Task title", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea",description:'{{t("Title of each task item. Default to node title.", { ns: "'.concat(f,'" })}}'),default:"{{useNodeContext().title}}"},schema:{type:"void",title:'{{t("User interface", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"SchemaConfigButton",properties:{schema:{type:"object","x-component":"SchemaConfig",default:null}}},forms:{type:"object",default:{}}}),eP(e,"scope",{useNodeContext:o.useNodeContext}),eP(e,"components",{SchemaConfigButton:eO,SchemaConfig:ex,ModeConfig:ek,AssigneesSelect:ej,WorkflowVariableTextArea:o.WorkflowVariableTextArea}),eP(e,"async",!0),eP(e,"useVariables",eF),eP(e,"useInitializers",eT),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&eA(t,e),t}(o.Instruction),eM=v(442),eB=v(235),eR=v(185),ez=v.n(eR),e_=v(27);function eN(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 eV(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 eq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eU(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){eq(e,t,n[t])})}return e}function eW(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function e$(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}function eL(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,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)||function(e,t){if(e){if("string"==typeof e)return eN(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 eN(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eG(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eJ(){var e=eG(["\n padding: ",";\n margin-bottom: ",";\n time {\n margin-right: 0.5em;\n }\n .ant-tag {\n margin-right: 0;\n }\n "]);return eJ=function(){return e},e}function eK(){var e=eG(["\n .ant-descriptions-header {\n margin-bottom: 0.5em;\n .ant-descriptions-extra {\n color: ",";\n }\n }\n .ant-descriptions-item-label {\n width: 6em;\n }\n "]);return eK=function(){return e},e}function eY(){var e=eG(["\n .ant-card-extra {\n color: ",";\n }\n "]);return eY=function(){return e},e}function eQ(t){var r,o=(0,e.useCollectionRecordData)(),i=b("Unprocessed");return(null==o||null==(r=o.execution)?void 0:r.status)&&(null==o?void 0:o.status)==null?n().createElement(u.Tag,null,i):t.children}function eH(t){var n=(0,e.useCollectionRecordData)();if(Array.isArray(t.dataIndex)){var r=!0,o=!1,i=void 0;try{for(var a,l=t.dataIndex[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value,u=(0,S.get)(n,c);if(u)return u}}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}}return(0,S.get)(n,t.dataIndex)}var eX=function(t){var r=eZ({defaultOpenMode:(0,e.useOpenModeContext)().defaultOpenMode,collectionName:"workflowManualTasks"});return n().createElement(e.SchemaComponentContext.Provider,{value:{designable:!1}},n().createElement(e.SchemaComponent,{scope:{useCollectionRecordData:e.useCollectionRecordData},components:{FormLayout:a.FormLayout,ContentDetailWithTitle:te},schema:{type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined",nonfilterable:["workflow.type","workflow.mode","workflow.description","workflow.categories"]},default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"}}},list:{type:"array","x-component":"List",properties:{item:{type:"object","x-component":"List.Item",properties:{content:{type:"void","x-decorator":"FormLayout","x-decorator-props":{layout:"horizontal"},"x-component":"ContentDetailWithTitle","x-component-props":{}},actions:{type:"void","x-component":"ActionBar","x-use-component-props":"useListActionBarProps","x-component-props":{layout:"one-column"},"x-align":"left",properties:{view:r}}}}}}}}}))};function eZ(e){var t=e.defaultOpenMode,n=e.collectionName;return{name:"view",type:"void","x-component":"Action.Link","x-component-props":{openMode:t},title:'{{t("View")}}',"x-uid":"".concat(n,"-view"),"x-action":"view","x-action-context":{dataSource:"main",collection:n,doNotUpdateContext:!0},properties:{drawer:{type:"void","x-component":eX.Drawer}}}}function e0(t){var n,r=(0,e.useCurrentUserContext)().data,i=(0,o.useFlowContext)().userJob,a=i.status,l=i.result,u=i.userId,s=(0,c.useFieldSchema)().parent.toJSON().name,p=t.children;return a?(null==l?void 0:l[s])||(p=null):(null==r||null==(n=r.data)?void 0:n.id)!==u&&(p=null),p}var e1=(0,t.createContext)(null);function e2(r){var i=r.value,a=r.children,l=(0,o.useFlowContext)(),s=l.userJob,p=l.execution,f=(0,c.useField)(),m=(0,c.useFieldSchema)(),d=(0,e.useCompile)();return(0,t.useEffect)(function(){if(p.status||s.status){var e;f.disabled=!0,f.visible=s.status===i&&(null==(e=s.result)?void 0:e._)===m.name}},[p,s,i,f,m.name]),n().createElement(e1.Provider,{value:i},p.status||s.status?n().createElement(u.Button,{type:"primary",disabled:!0},d(m.title)):a)}function e3(){var t,n=(0,e.useAPIClient)(),r=(0,e.useActionContext)(),i=r.setVisible,a=r.setSubmitted,l=(0,c.useForm)(),u=l.values,s=l.submit,p=(0,c.useField)(),f=(0,c.useFieldSchema)(),m=(0,e.useListBlockContext)().service,d=(0,o.useFlowContext)(),y=d.userJob,b=d.execution,v=f.name,h=f.parent.parent.name,g=(null!=(t=null==f?void 0:f["x-action-settings"])?t:{}).assignedValues,w=void 0===g?{}:g;return{run:function(){var e;return(e=function(){var e;return function(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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}}}}(this,function(t){switch(t.label){case 0:if(b.status||y.status)return[2];return[4,s()];case 1:return t.sent(),p.data=p.data||{},p.data.loading=!0,[4,n.resource("workflowManualTasks").submit({filterByTk:y.id,values:{result:(eq(e={},h,eU({},u,w.values)),eq(e,"_",v),e)}})];case 2:return t.sent(),p.data.loading=!1,a(!0),i(!1),null==m||m.refresh(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){eV(i,r,o,a,l,"next",e)}function l(e){eV(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function e5(r){var a,l=(0,e.usePlugin)(i()),c=(0,e.useAPIClient)(),s=((0,e.useCollectionRecordData)()||{}).id,p=eL((0,t.useState)(null),2),f=p[0],m=p[1],d=eL((0,t.useState)(null),2),y=d[0],b=d[1];(0,t.useEffect)(function(){var e,t;s&&(null==(e=(t=c.resource("workflowManualTasks")).get)||e.call(t,{filterByTk:s,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs"]}).then(function(e){var t,n=e.data,r=null!=(t=null==n?void 0:n.data)?t:{},i=r.node,a=r.workflow,l=void 0===a?{}:a,c=l.nodes,u=void 0===c?[]:c,s=e$(l,["nodes"]),p=r.execution,f=e$(r,["node","workflow","execution"]);(0,o.linkNodes)(u),b(i),m({userJob:f,workflow:s,nodes:u,execution:p})}))},[c,s]);var v=(0,o.useAvailableUpstreams)(null==f?void 0:f.nodes.find(function(e){return e.id===y.id})).reduce(function(e,t){var n,r=t.type;return Object.assign(e,null==(n=l.instructions.get(r))?void 0:n.components)},{});return y&&f?n().createElement(o.FlowContext.Provider,{value:f},n().createElement(e.SchemaComponent,{components:eU({FormBlockProvider:x,DetailsBlockProvider:o.DetailsBlockProvider,ActionBarProvider:e0,ManualActionStatusProvider:e2},Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.block.components)},{}),v),scope:eU({useSubmit:e3,useFormBlockProps:e8,useDetailsBlockProps:e6},Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.block.scope)},{})),schema:{type:"void",name:"manual-".concat(s,"}"),"x-component":"Tabs",properties:null==(a=y.config)?void 0:a.schema}})):n().createElement(u.Spin,null)}function e8(){var n,r=(0,o.useFlowContext)(),i=r.userJob,a=r.execution,l=(0,e.useCollectionRecordData)(),c=(0,e.useCurrentUserContext)().data,u=(0,e.useFormBlockContext)().form,s=a.status||i.status?l?"readPretty":"disabled":(null==c||null==(n=c.data)?void 0:n.id)!==i.userId?"disabled":"editable";return(0,t.useEffect)(function(){null==u||u.setPattern(s)},[s,u]),{form:u}}function e6(){return{form:(0,e.useFormBlockContext)().form}}function e9(){var t=(0,e.useMobileLayout)().isMobileLayout,r=(0,e_.useMobilePage)(),o=(0,e.useCompile)(),i=(0,e.useCollectionRecordData)()||{},a=i.status,l=i.updatedAt,c=y[a];return a?n().createElement(u.Space,{className:(0,e.css)(eJ(),t?"0 1em":"0",r||t?"0":"1em")},n().createElement("time",null,ez()(l).format("YYYY-MM-DD HH:mm:ss")),n().createElement(u.Tag,{color:c.color},o(c.label))):null}function e4(){var r,o=(0,t.useContext)(e.SchemaComponentContext),i=(0,e.useCollectionRecordData)(),a=i||{},l=a.id,c=a.node,u=a.workflow,s=a.status;return i?n().createElement(e.SchemaComponentContext.Provider,{value:eW(eU({},o),{reset:function(){},designable:!1})},n().createElement(e.SchemaComponent,{components:{FooterStatus:e9,FlowContextProvider:e5},schema:{type:"void",name:"manual-detail-drawer-".concat(l,"-").concat(s),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:"".concat(null==u?void 0:u.title," - ").concat(null!=(r=null==c?void 0:c.title)?r:"#".concat(null==c?void 0:c.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"FooterStatus"}}}}}})):null}function e7(t){var r=(0,s.useTranslation)().t,o=(0,eB.useAntdToken)();return n().createElement(u.ConfigProvider,{theme:{token:{fontSizeLG:14}}},n().createElement(u.Descriptions,eW(eU({},t),{column:1,items:[{key:"createdAt",label:r("Created at"),children:n().createElement(e.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:r("Status",{ns:"workflow"}),children:n().createElement(e.SchemaComponent,{components:{TaskStatusColumn:eQ},schema:{name:"status",type:"number","x-decorator":"TaskStatusColumn","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,e.css)(eK(),o.colorTextDescription)})))}function te(e){return n().createElement(e7,{title:n().createElement(eH,{dataIndex:["title","node.title"]}),extra:n().createElement(eH,{dataIndex:"workflow.title"})})}e1.displayName="ManualActionStatusContext",eX.Initializer=function(){var t=(0,e.useSchemaInitializerItem)(),o=(0,e.useSchemaInitializer)().insert;return n().createElement(e.SchemaInitializerItem,eW(eU({icon:n().createElement(r.TableOutlined,null)},t),{onClick:function(){o({type:"void","x-decorator":"WorkflowTodo.Decorator","x-decorator-props":{},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{todos:{type:"void","x-component":"WorkflowTodo"}}})}}))},eX.Drawer=e4,eX.Decorator=function(t){var r=t.params,o=void 0===r?{}:r,i=t.children,a={collection:"workflowManualTasks",resource:"workflowManualTasks",action:"listMine",params:eW(eU({pageSize:20,sort:["-createdAt"]},o),{filter:eU({},o.filter),appends:["user","node","workflow","execution.status"],except:["node.config","workflow.config","workflow.options"]})};return n().createElement(e.OpenModeProvider,{defaultOpenMode:"modal"},n().createElement(e.List.Decorator,a,i))};var tt={pending:{status:0,"execution.status":o.EXECUTION_STATUS.STARTED},completed:{status:[1,-3,-5]}},tn={key:m,title:'{{t("My manual tasks", { ns: "'.concat(f,'" })}}'),collection:"workflowManualTasks",action:"listMine",useActionParams:function(t){var n;return(0,e.useCurrentUserContext)().data,{filter:null!=(n=tt[t])?n:{},appends:["node.id","node.title","job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"],except:["node.config","workflow.config","workflow.options"]}},Actions:function(t){return n().createElement(e.SchemaComponent,{schema:{name:"actions",type:"void","x-component":"ActionBar",properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":eU({icon:"ReloadOutlined"},t)},filter:{type:"void",title:'{{t("Filter")}}',"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":eU({icon:"FilterOutlined"},t),default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]}}}}})},Item:function(){var r=(0,eB.useAntdToken)(),i=(0,e.useCollectionRecordData)(),a=(0,eM.useNavigate)(),l=(0,o.usePopupRecordContext)().setRecord,c=(0,t.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&(l(i),a("./".concat(i.id))),e.stopPropagation()},[a,i.id]);return n().createElement(u.Card,{onClick:c,hoverable:!0,size:"small",title:i.title,extra:n().createElement(o.WorkflowTitle,i.workflow),className:(0,e.css)(eY(),r.colorTextDescription)},n().createElement(e7,null))},Detail:e4},tr={title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),name:"workflowManualTasks",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(f,'" })}}'),"x-component":"Input"}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",interface:"m2o",isAssociation:!0,uiSchema:{type:"number",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"id"}}}},{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",interface:"m2o",isAssociation:!0,uiSchema:{type:"object",title:'{{t("Assignee", { ns: "'.concat(f,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{label:"nickname",value:"id"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "workflow" })}}',"x-component":"Select",enum:d}},{name:"createdAt",type:"date",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"updatedAt",type:"date",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}}]},to=function(t){return n().createElement(e.ExtendCollectionsProvider,{collections:[tr]},t.children)};function ti(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 ta(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ti(i,r,o,a,l,"next",e)}function l(e){ti(i,r,o,a,l,"throw",e)}a(void 0)})}}function tl(e,t,n){return(tl=tp()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tu(o,n.prototype),o}).apply(null,arguments)}[tr.name].forEach(function(t){var n=eZ({defaultOpenMode:window.location.pathname.startsWith("/m/")?"page":"modal",collectionName:t});(0,e.storePopupContext)(n["x-uid"],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}({schema:n},n["x-action-context"]),!0)});function tc(e){return(tc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tu(e,t){return(tu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ts(e){var t="function"==typeof Map?new Map:void 0;return(ts=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 tl(e,arguments,tc(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),tu(n,e)})(e)}function tp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tp=function(){return!!e})()}function tf(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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 tm=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=tc(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,tp()?Reflect.construct(e,t||[],tc(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&tu(n,e),t=[{key:"afterAdd",value:function(){return ta(function(){return tf(this,function(e){return[2]})})()}},{key:"load",value:function(){return ta(function(){var e;return tf(this,function(t){return this.addComponents(),this.app.addProvider(to),(e=this.app.pm.get("workflow")).registerInstruction("manual",eD),e.registerTaskType(m,tn),this.app.schemaInitializerManager.add(ef),this.app.schemaInitializerManager.add(em),this.app.schemaInitializerManager.add(eh),this.app.schemaInitializerManager.add(eg),this.app.schemaInitializerManager.add(H),this.app.schemaInitializerManager.add(X),this.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),e.registerCollectionsToDataSource([tr]),[2]})}).call(this)}},{key:"addComponents",value:function(){this.app.addComponents({WorkflowTodo:eX})}}],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}(ts(e.Plugin))}(),O}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("dayjs"),require("@formily/core"),require("@nocobase/plugin-mobile/client"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-manual",["react-i18next","react-router-dom","@formily/antd-v5","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client","dayjs","@formily/core","@nocobase/plugin-mobile/client","react","antd","@nocobase/client","antd-style","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-manual"]=t(require("react-i18next"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("dayjs"),require("@formily/core"),require("@nocobase/plugin-mobile/client"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-workflow-manual"]=t(e["react-i18next"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e.dayjs,e["@formily/core"],e["@nocobase/plugin-mobile/client"],e.react,e.antd,e["@nocobase/client"],e["antd-style"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,a,l,c,u,s,p,f,m,d){return function(){"use strict";var y={375:function(e){e.exports=o},418:function(e){e.exports=n},452:function(e){e.exports=l},230:function(e){e.exports=r},342:function(e){e.exports=p},27:function(e){e.exports=c},990:function(e){e.exports=i},768:function(e){e.exports=m},59:function(e){e.exports=s},235:function(e){e.exports=f},185:function(e){e.exports=a},773:function(e){e.exports=d},155:function(e){e.exports=u},953:function(t){t.exports=e},442:function(e){e.exports=t}},b={};function v(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,v),n.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var n in t)v.o(t,n)&&!v.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.g.importScripts&&(h=v.g.location+"");var h,g=v.g.document;if(!h&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(h=g.currentScript.src),!h)){var w=g.getElementsByTagName("script");if(w.length)for(var x=w.length-1;x>-1&&(!h||!/^http(s?):/.test(h));)h=w[x--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");v.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var O={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-manual/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-manual/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(i);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-manual/dist/client/"}v.p=e}(),!function(){v.r(O),v.d(O,{default:function(){return tm}});var e=v(342),t=v(155),n=v.n(t),r=v(375),o=v(990),i=v.n(o),a=v(418),l=v(452),c=v(230),u=v(59),s=v(953),p=v(768),f="workflow-manual",m="manual",d=[{value:0,label:'{{t("Pending", { ns: "workflow" })}}',color:"gold"},{value:1,label:'{{t("Resolved", { ns: "workflow" })}}',color:"green"},{value:-3,label:'{{t("Aborted", { ns: "workflow" })}}',color:"volcano"},{value:-5,label:'{{t("Rejected", { ns: "workflow" })}}',color:"red"}],y=d.reduce(function(e,t){var n,r;return Object.assign(e,(n={},r=t.value,r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n))},{});function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,h(t).t)(e)}function h(e){return(0,s.useTranslation)(f,e)}function g(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 w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function x(r){var o,i,a,s,p,f=(0,e.useCollectionRecordData)(),m=(0,c.useFieldSchema)(),d=(0,c.useField)(),y=(0,t.useRef)(null),b=r.dataSource||e.DEFAULT_DATA_SOURCE_KEY,v=u.theme.useToken().token,h=(0,(0,e.useAssociationNames)(b).getAssociationAppends)(),x=h.appends,O=h.updateAssociationValues,S=(function(e){if(Array.isArray(e))return e}(o=Object.keys(null!=(s=m.toJSON().properties)?s:{}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(o)||function(e){if(e){if("string"==typeof e)return g(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return g(e,1)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],k=null==f||null==(p=f.result)?void 0:p[S],C=(0,t.useMemo)(function(){return(0,l.createForm)({initialValues:k})},[k]),j=(0,t.useMemo)(function(){return w({appends:x},r.params)},[x,r.params]),P=(0,t.useMemo)(function(){return{loading:!1,data:{data:k}}},[k]),E=(0,e.useAPIClient)(),A=(0,e.useDataSourceHeaders)(b),I=E.resource(r.collection,void 0,A),F=(0,e.useBlockRequestContext)(),T=(0,t.useMemo)(function(){return{params:j,form:C,field:d,service:P,updateAssociationValues:O,formBlockRef:y}},[d,C,j,P,O]);return(null==f?void 0:f.status)&&!k?null:n().createElement(e.TemplateBlockProvider,null,n().createElement(e.CollectionManagerProvider,{dataSource:b},n().createElement(e.CollectionProvider_deprecated,{collection:r.collection},n().createElement(e.BlockProvider,(i=w({name:r.name||"form"},r),a=a={block:"form",parentRecord:null},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i),n().createElement(e.FormActiveFieldsProvider,{name:"form"},n().createElement(e.BlockRequestContext_deprecated.Provider,{value:{block:"form",props:r,field:d,service:P,resource:I,__parent:F}},n().createElement(e.FormBlockContext.Provider,{value:T},n().createElement(e.RecordProvider,{record:k,parent:null},n().createElement(e.FormV2.Templates,{style:{marginBottom:v.margin},form:C}),n().createElement("div",{ref:y},r.children)))))))))}var S=v(773),k=v.n(S);function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(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){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function A(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,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)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}}(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 I(t){var r=t.schema,i=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}(t,["schema"]),a=(0,e.useSchemaTemplateManager)().getTemplateSchemaByMode,l=(0,e.useSchemaInitializer)().insert,c=(0,e.useRecordCollectionDataSourceItems)("FormItem");return n().createElement(e.SchemaInitializerItem,E(P({},i),{onClick:function(t){var n;return(n=function(t){var n,i,c,u,s,p,m;return function(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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}}}}(this,function(d){switch(d.label){case 0:if(!(n=t.item).template)return[3,2];return[4,a(n)];case 1:return u=d.sent(),[3,3];case 2:u=null,d.label=3;case 3:var y;return c=u,y=E(P({actionInitializers:"workflowManual:form:configureActions",actions:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:o.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-designer-props":{}}}},r),{template:c}),s=(0,e.createFormBlockSchema)(y),delete s["x-acl-action-props"],delete s["x-acl-action"],p=A(Object.keys(s.properties),1)[0],m=(null==(i=Object.entries(s.properties[p].properties).find(function(e){var t=A(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:i[0])||"actions",s.properties[p].properties[m]["x-decorator"]="ActionBarProvider",s.properties[p].properties[m]["x-component-props"].style={marginTop:"1.5em",flexWrap:"wrap"},(0,o.traverseSchema)(s,function(e){e["x-uid"]&&delete e["x-uid"]}),l(s),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){j(i,r,o,a,l,"next",e)}function l(e){j(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)},items:c}))}function F(){var t,r,o=(0,e.useSchemaInitializerItem)();return n().createElement(e.CollectionProvider_deprecated,{dataSource:null==(t=o.schema)?void 0:t.dataSource,collection:null==(r=o.schema)?void 0:r.collection},n().createElement(I,o))}function T(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 D(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];return e&&(!t(e)||n&&e.properties?e.properties&&Object.keys(e.properties).forEach(function(n){var o;r.push.apply(r,function(e){if(Array.isArray(e))return T(e)}(o=D(e.properties[n],t))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e){if(e){if("string"==typeof e)return T(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T(e,void 0)}}(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}):r.push(e)),r}function M(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 B(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,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)||function(e,t){if(e){if("string"==typeof e)return M(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 M(e,t)}}(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 R(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 z(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 _(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){z(i,r,o,a,l,"next",e)}function l(e){z(i,r,o,a,l,"throw",e)}a(void 0)})}}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(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){N(e,t,n[t])})}return e}function q(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function U(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,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)||W(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 W(e,t){if(e){if("string"==typeof e)return R(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 R(e,t)}}function $(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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 L(r){var o,i,a,u,s=U((0,t.useState)(null!=(o=null==(a=r.collection)?void 0:a.fields)?o:[]),2),p=s[0],f=s[1],m=(0,e.useCollectionRecordData)(),d=(0,c.useField)(),y=U(Object.keys(null!=(i=(0,c.useFieldSchema)().toJSON().properties)?i:{}),1)[0],b=null==m||null==(u=m.result)?void 0:u[y],v=(0,t.useMemo)(function(){return(0,l.createForm)({initialValues:b})},[b]);return(null==m?void 0:m.status)&&!b?null:n().createElement(e.CollectionProvider_deprecated,{collection:q(V({},r.collection),{fields:p})},n().createElement(e.RecordProvider,{record:b,parent:null},n().createElement(e.FormBlockContext.Provider,{value:{form:v,field:d,setCollectionFields:f}},r.children)))}function G(){var t=(0,e.useSchemaInitializer)().insert,r=(0,e.useSchemaInitializerItem)();return n().createElement(e.SchemaInitializerItem,q(V({},r),{onClick:function(){t({type:"void","x-decorator":"CustomFormBlockProvider","x-decorator-props":{collection:{name:(0,p.uid)(),fields:[]}},"x-component":"CardItem","x-component-props":{title:'{{t("Form")}}'},"x-designer":"SimpleDesigner","x-designer-props":{type:"customForm"},properties:N({},(0,p.uid)(),{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:customForm:configureFields"},actions:{type:"void","x-decorator":"ActionBarProvider","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:"1.5em",flexWrap:"wrap"}},"x-initializer":"workflowManual:form:configureActions",properties:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:o.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner"}}}}})})}}))}var J={basic:'{{t("Basic")}}',choices:'{{t("Choices")}}',media:'{{t("Media")}}',datetime:'{{t("Date & Time")}}',relation:'{{t("Relation")}}',advanced:'{{t("Advanced type")}}',systemInfo:'{{t("System info")}}',others:'{{t("Others")}}'},K=n().createContext({});function Y(){var e=(0,c.useForm)(),n=e.values,r=e.query,o=e.reset,i=[b("Field name existed in form")],a=(0,t.useContext)(K),l=a.collection,u=a.interfaceOptions,s=a.setCollectionFields,f=a.insert,m=a.setCallback,d=a.setInterface;return{run:function(){return _(function(){var e,t,a,c,y,b,v;return $(this,function(h){var g;return(y=u.default,b=(0,p.uid)(),y.name=null!=(e=n.name)?e:b,y.uiSchema.title=null!=(t=null==(a=n.uiSchema)?void 0:a.title)?t:b,y.interface=u.name,null==(c=l.fields)?void 0:c.find(function(e){return e.name===y.name}))?(r("name").take().setFeedback({type:"error",messages:i}),[2]):(v=(0,p.merge)(y,n),s(((function(e){if(Array.isArray(e))return R(e)})(g=l.fields)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(g)||W(g)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([v])),f({name:y.name,type:y.uiSchema.type,"x-decorator":"FormItem","x-component":"CollectionField","x-component-props":{field:v},"x-collection-field":"".concat(l.name,".").concat(y.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem"}),o(),m(null),d(null),[2])})})()}}}var Q={wrap:e.gridRowColWrap,insertPosition:"beforeEnd",title:"{{t('Configure fields')}}",ItemsComponent:function(r){var o,i,u=U((0,t.useState)(null),2),s=u[0],p=u[1],f=U((0,t.useState)(),2),m=f[0],d=f[1],y=(i={},Object.keys(o=(0,e.useCollectionManager_deprecated)().interfaces).forEach(function(e){var t=o[e],n=t.group,r=void 0===n?"others":n;i[r]=i[r]||{},(0,S.set)(i,[r,e],t)}),Object.keys(J).filter(function(e){return["basic","choices","datetime","media"].includes(e)}).map(function(e){return{title:J[e],children:Object.keys(i[e]||{}).map(function(t){var n=i[e][t];return V({value:t,title:n.title,name:t},i[e][t])}).sort(function(e,t){return e.order-t.order})}})).map(function(e){return{name:e.title,type:"itemGroup",title:e.title,children:e.children.map(function(e){return{name:e.name,type:"item",title:e.title,Component:Z,fieldInterface:e.name}})}}),b=(0,e.useCollection_deprecated)(),v=(0,t.useContext)(e.FormBlockContext).setCollectionFields,h=(0,t.useMemo)(function(){return(0,l.createForm)()},[]);return n().createElement(K.Provider,{value:{collection:b,insert:m,interfaceOptions:s,onAddField:function(e){var t=(0,S.pick)(e,["name","group","title","default","validateSchema"]),n=e.properties;n.unique,n.type,n.layout,n.autoIncrement,t.properties=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}(n,["unique","type","layout","autoIncrement"]);var r=(0,S.cloneDeep)(t);delete r.properties.name["x-disabled"],p(r)},setCallback:d,setInterface:p,setCollectionFields:v}},n().createElement(e.SchemaInitializerItems,q(V({},r),{items:y})),n().createElement(e.ActionContextProvider,{value:{visible:!!s,setVisible:function(e){e||p(null)}}},s?n().createElement(e.SchemaComponent,{schema:{type:"void",name:"drawer",title:'{{t("Configure field")}}',"x-decorator":"FormV2","x-decorator-props":{form:h},"x-component":"Action.Drawer",properties:q(V({},s.properties),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:function(){var e=(0,c.useForm)();return{run:function(){return _(function(){return $(this,function(t){return d(null),p(null),e.reset(),[2]})})()}}}}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Y}}}}})},components:{ArrayTable:a.ArrayTable}}):null))}},H=new e.CompatibleSchemaInitializer(V({name:"AddCustomFormField"},Q)),X=new e.CompatibleSchemaInitializer(V({name:"workflowManual:customForm:configureFields"},Q),H);function Z(){var r=(0,e.useSchemaInitializerItem)(),o=(0,e.useSchemaInitializer)().insert,i=(0,t.useContext)(K),a=i.onAddField,l=i.setCallback,c=(0,(0,e.useCollectionManager_deprecated)().getInterface)(r.fieldInterface);return n().createElement(e.SchemaInitializerItem,V({key:r.fieldInterface,onClick:function(){l(function(){return o}),a(c)}},r))}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function et(e,t){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,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)||function(e,t){if(e){if("string"==typeof e)return ee(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 ee(e,t)}}(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.")}()}var en={title:'{{t("Update record form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(n){var r=n.allCollections,o=(0,t.useMemo)(function(){return r.map(function(e){var t=e.key;return{key:t,name:t,label:e.displayName,type:"subMenu",children:e.collections.map(function(e){return{name:k().camelCase("updateRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Update record", { ns: "'.concat(f,'" })}}'),formType:"update","x-designer":"UpdateFormDesigner"},Component:F}})}})},[r]),i=et((0,t.useState)([]),2),a=i[0],l=i[1],c=(0,e.useMenuSearch)({data:o,openKeys:a});return{name:"updateRecordForm",key:"updateRecordForm",type:"subMenu",title:'{{t("Update record form", { ns: "'.concat(f,'" })}}'),componentProps:{onOpenChange:function(e){l(e)}},children:c}},initializers:{},components:{FilterDynamicComponent:o.FilterDynamicComponent,UpdateFormDesigner:function(){var t=(0,e.useCollection_deprecated)(),r=t.name,o=t.title,i=(0,c.useFieldSchema)(),a=(0,s.useTranslation)().t,l=(0,e.useDesignable)().dn;return n().createElement(e.GeneralSchemaDesigner,{title:o||r},n().createElement(e.SchemaSettingsBlockTitleItem,null),n().createElement(e.SchemaSettingsActionModalItem,{title:a("Filter settings",{ns:f}),schema:{name:"filter",type:"object",title:'{{t("Filter")}}',"x-component":"Filter","x-use-component-props":function(){var t;return{options:(0,e.useCollectionFilterOptions)(null==i||null==(t=i["x-decorator-props"])?void 0:t.collection)}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},initialValues:null==i?void 0:i["x-decorator-props"],onSubmit:function(e){var t=e.filter;i["x-decorator-props"].filter=t,l.emit("patch",{schema:{"x-decorator-props":i["x-decorator-props"]}}),l.refresh()},width:"60%"}),n().createElement(e.SchemaSettingsLinkageRules,{collectionName:r}),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return D(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"update"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o,i,a=et(Object.keys(e.properties),1)[0],l=e.properties[a],c=(null==(o=Object.entries(l.properties).find(function(e){var t=et(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:o[0])||"actions";t[a]=(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}({},e["x-decorator-props"]),r=r={type:"update",title:(null==(i=e["x-component-props"])?void 0:i.title)||a,actions:D(l.properties[c],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}})},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)}),t}},block:{scope:{},components:{}},validate:function(e){var t=e.filter;return t&&(0,p.isValidFilter)(t)?null:"Please check one of your update record form, and add at least one filter condition in form settings."}};function er(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 eo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function ei(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ea(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}function el(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,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)||eu(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 ec(e){return function(e){if(Array.isArray(e))return er(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eu(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 eu(e,t){if(e){if("string"==typeof e)return er(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 er(e,t)}}var es=new p.Registry;es.register("custom",{title:'{{t("Custom form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(){return{name:"customForm",type:"item",title:'{{t("Custom form", { ns: "'.concat(f,'" })}}'),Component:G}},initializers:{},components:{CustomFormBlockProvider:L},parseFormOptions:function(e){var t={};return D(e,function(e){return"CustomFormBlockProvider"===e["x-decorator"]}).forEach(function(e){var n,r,o=U(Object.keys(e.properties),1)[0],i=e.properties[o],a=D(i.properties.grid,function(e){return"CollectionField"===e["x-component"]},!0);e["x-decorator-props"].collection.fields=a.map(function(e){var t,n;return null!=(t=null==(n=e["x-component-props"])?void 0:n.field)?t:e["x-interface-options"]});var l=(null==(n=Object.entries(i.properties).find(function(e){var t=U(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:n[0])||"actions";t[o]={type:"custom",title:(null==(r=e["x-component-props"])?void 0:r.title)||o,actions:D(i.properties[l],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{CustomFormBlockProvider:L}}}),es.register("create",{title:'{{t("Create record form", { ns: "'.concat(f,'" })}}'),config:{useInitializer:function(n){var r=n.allCollections,o=(0,t.useMemo)(function(){return r.map(function(e){var t=e.key;return{key:t,name:t,label:e.displayName,type:"subMenu",children:e.collections.map(function(e){return{name:k().camelCase("createRecordForm-child-".concat(e.name)),type:"item",title:e.title||e.tableName,schema:{collection:e.name,dataSource:t,title:'{{t("Create record", { ns: "'.concat(f,'" })}}'),formType:"create","x-designer":"CreateFormDesigner"},Component:F}})}})},[r]),i=B((0,t.useState)([]),2),a=i[0],l=i[1],c=(0,e.useMenuSearch)({data:o,openKeys:a});return{name:"createRecordForm",key:"createRecordForm",type:"subMenu",title:'{{t("Create record form", { ns: "'.concat(f,'" })}}'),componentProps:{onOpenChange:function(e){l(e)}},children:c}},initializers:{},components:{CreateFormDesigner:function(){var t=(0,e.useCollection_deprecated)(),r=t.name,o=t.title;return n().createElement(e.GeneralSchemaDesigner,{title:o||r},n().createElement(e.SchemaSettingsBlockTitleItem,null),n().createElement(e.SchemaSettingsLinkageRules,{collectionName:r}),n().createElement(e.SchemaSettingsDataTemplates,{collectionName:r}),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return D(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"create"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o=B(Object.keys(e.properties),1)[0],i=e.properties[o],a=(null==(n=Object.entries(i.properties).find(function(e){var t=B(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))?void 0:n[0])||"actions";t[o]={type:"create",title:(null==(r=e["x-component-props"])?void 0:r.title)||o,actions:D(i.properties[a],function(e){return"Action"===e["x-component"]}).map(function(e){var t,n;return{status:e["x-decorator-props"].value,values:null==(n=e["x-action-settings"])||null==(t=n.assignedValues)?void 0:t.values,key:e.name}}),dataSource:e["x-decorator-props"].dataSource,collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{}}}),es.register("update",en);var ep={wrap:e.gridRowColWrap,title:'{{t("Add block")}}',items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',hideIfNoChildren:!0,useChildren:function(){var t,n,r=(0,e.usePlugin)(i()),a=(0,o.useNodeContext)(),l=(0,o.useAvailableUpstreams)(a),c=[(t=(0,o.useFlowContext)().workflow,(n=(0,o.useTrigger)()).useInitializers?n.useInitializers(t.config):null)].filter(Boolean),u=l.map(function(e){var t,n=r.instructions.get(e.type);return null==n||null==(t=n.useInitializers)?void 0:t.call(n,e)}).filter(Boolean);return ec(c).concat(ec(u.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:u}]:[])).filter(Boolean)}},{type:"itemGroup",name:"form",title:'{{t("Form")}}',useChildren:function(){var t=(0,e.useDataSourceManager)().getAllCollections();return Array.from(es.getValues()).map(function(e){return(0,e.config.useInitializer)({allCollections:t})})}},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Markdown")}}',Component:"MarkdownBlockInitializer"}]}]},ef=new e.CompatibleSchemaInitializer(eo({name:"AddBlockButton"},ep)),em=new e.CompatibleSchemaInitializer(eo({name:"workflowManual:popup:configureUserInterface:addBlock"},ep),ef);function ed(){var r,i,f,m=(0,t.useContext)(e.SchemaComponentContext),d=(0,s.useTranslation)().t,y=h().t,b=(0,c.useFieldSchema)(),v=(0,o.useWorkflowVariableOptions)(),g=el((0,t.useState)(!1),2),w=g[0],x=g[1],O=el((0,t.useState)(null!=(r=null==b||null==(f=b["x-action-settings"])||null==(i=f.assignedValues)?void 0:i.schema)?r:{type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields",properties:{}}),2),S=O[0],k=O[1],C=el((0,t.useState)(null),2),j=C[0],P=C[1],E=(0,e.useSchemaOptionsContext)().components;(0,t.useEffect)(function(){P(new c.Schema({properties:{grid:S}}))},[S]);var A=(0,t.useMemo)(function(){var e,t,n=null==b||null==(t=b["x-action-settings"])||null==(e=t.assignedValues)?void 0:e.values;return(0,l.createForm)({initialValues:p.lodash.cloneDeep(n),values:p.lodash.cloneDeep(n)})},[b]),I=(0,e.useFormActiveFields)(),F=d("Assign field values");function T(){x(!1)}return n().createElement(n().Fragment,null,n().createElement(e.SchemaSettingsItem,{title:F,onClick:function(){return x(!0)}},F),n().createElement(u.Modal,{width:"50%",title:F,open:w,onCancel:T,footer:n().createElement(u.Space,null,n().createElement(u.Button,{onClick:T},y("Cancel")),n().createElement(u.Button,{type:"primary",onClick:function(){b["x-action-settings"]||(b["x-action-settings"]={}),b["x-action-settings"].assignedValues||(b["x-action-settings"].assignedValues={}),b["x-action-settings"].assignedValues.schema=S,b["x-action-settings"].assignedValues.values=A.values,x(!1),setTimeout(function(){var e;null==(e=m.refresh)||e.call(m)},300)}},y("Submit")))},n().createElement(e.DefaultValueProvider,{isAllowToSetDefaultValue:function(){return!1}},n().createElement(e.VariableScopeProvider,{scope:v},n().createElement(e.FormActiveFieldsProvider,{name:"form",getActiveFieldsName:null==I?void 0:I.getActiveFieldsName},n().createElement(c.FormProvider,{form:A},n().createElement(a.FormLayout,{layout:"vertical"},n().createElement(u.Alert,{message:y("Values preset in this form will override user submitted ones when continue or reject.")}),n().createElement("br",null),w&&j&&n().createElement(e.SchemaComponentContext.Provider,{value:ei(eo({},m),{refresh:function(){k(p.lodash.get(j.toJSON(),"properties.grid"))}})},n().createElement(e.SchemaComponent,{schema:j,components:E})))))))))}function ey(t){return n().createElement(e.GeneralSchemaDesigner,ei(eo({},t),{disableInitializer:!0}),n().createElement(e.Action.Designer.ButtonEditor,null),n().createElement(ed,null),n().createElement(e.SchemaSettingsDivider,null),n().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"ActionBar"}}))}function eb(){var t=(0,e.useSchemaInitializerItem)(),r=t.action,o=t.actionProps,i=ea(t,["action","actionProps"]);return n().createElement(e.InitializerWithSwitch,ei(eo({},i),{item:t,schema:{type:"void",title:i.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:r},"x-component":"Action","x-component-props":ei(eo({},o),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action":"".concat(r)},type:"x-action"}))}var ev={title:'{{t("Configure actions")}}',items:[{name:"jobStatusResolved",title:'{{t("Continue the process", { ns: "'.concat(f,'" })}}'),Component:function(){var t=(0,e.useSchemaInitializerItem)(),r=t.action,o=t.actionProps,i=ea(t,["action","actionProps"]),a=(0,e.useSchemaInitializer)().insert;return n().createElement(e.SchemaInitializerItem,ei(eo({},i),{onClick:function(){a({type:"void",title:i.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:r},"x-component":"Action","x-component-props":ei(eo({},o),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action-settings":{}})}}))},action:o.JOB_STATUS.RESOLVED,actionProps:{type:"primary"}},{name:"jobStatusRejected",title:'{{t("Terminate the process", { ns: "'.concat(f,'" })}}'),Component:eb,action:o.JOB_STATUS.REJECTED,actionProps:{danger:!0}},{name:"jobStatusPending",title:'{{t("Save temporarily", { ns: "'.concat(f,'" })}}'),Component:eb,action:o.JOB_STATUS.PENDING}]},eh=new e.CompatibleSchemaInitializer(eo({name:"AddActionButton"},ev)),eg=new e.CompatibleSchemaInitializer(eo({name:"workflowManual:form:configureActions"},ev),eh);function ew(){return{run:function(){}}}function ex(r){var a=r.value,l=r.onChange,u=(0,e.usePlugin)(i()),s=(0,t.useContext)(e.SchemaComponentContext),m=(0,o.useNodeContext)(),d=(0,o.useAvailableUpstreams)(m),y=(0,c.useForm)(),b=(0,o.useWorkflowExecuted)(),v=(0,t.useRef)(function(){}),h={};d.forEach(function(e){Object.assign(h,u.instructions.get(e.type).components)});var g=(0,t.useMemo)(function(){return new c.Schema({properties:{drawer:{type:"void",title:'{{t("User interface", { ns: "'.concat(f,'" })}}'),"x-decorator":"Form","x-component":"Action.Container","x-component-props":{onClose:function(){return v.current()}},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"workflowManual:popup:configureUserInterface:addBlock"},properties:null!=a?a:{tab1:{type:"void",title:'{{t("Manual", { ns: "'.concat(f,'" })}}'),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:popup:configureUserInterface:addBlock",properties:{}}}}}}}}}})},[]),w=(0,t.useCallback)(function(){var e=p.lodash.get(g.toJSON(),"properties.drawer.properties").tabs,t=Array.from(es.getValues()).reduce(function(t,n){return Object.assign(t,n.config.parseFormOptions(e))},{});y.setValuesIn("forms",t),l(e.properties)},[y,l,g]);return v.current=w,n().createElement(e.SchemaComponentContext.Provider,{value:ei(eo({},s),{designable:!b,refresh:w})},n().createElement(e.SchemaComponent,{schema:g,components:ei(eo({},h,Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.config.components)},{})),{FormBlockProvider:x,DetailsBlockProvider:o.DetailsBlockProvider,ManualActionStatusProvider:function(e){return e.children},ActionBarProvider:function(e){return e.children},SimpleDesigner:o.SimpleDesigner,ManualActionDesigner:ey}),scope:{useSubmit:ew,useDetailsBlockProps:e.useFormBlockContext}}))}function eO(r){var i=(0,o.useWorkflowExecuted)(),a=el((0,t.useState)(!1),2),l=a[0],s=a[1],p=(0,c.useForm)().values,f=h().t,m=(0,t.useCallback)(function(e){if(!e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!0,n=!1,r=void 0;try{for(var o,i=Object.values(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value,l=es.get(a.type);if("function"==typeof l.validate){var c=l.validate(a);if(c)return c}}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}}(p.forms);if(t)return void u.message.error({content:f(t)})}s(e)},[p.forms]);return n().createElement(n().Fragment,null,n().createElement(u.Button,{type:"primary",onClick:function(){return s(!0)},disabled:!1},f(i?"View user interface":"Configure user interface")),n().createElement(e.ActionContextProvider,{value:{visible:l,setVisible:m,formValueChanged:!1}},r.children))}function eS(){var e,t,n=(e=["\n .ant-radio-group {\n .anticon {\n margin-left: 0.5em;\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return eS=function(){return n},n}function ek(t){var o=t.value,i=t.onChange,l=n().createElement("fieldset",null,n().createElement(a.FormLayout,{layout:"vertical"},n().createElement(e.FormItem,{label:b("Negotiation")},n().createElement(u.Radio.Group,{value:o,onChange:i},n().createElement(u.Radio,{value:1},n().createElement(u.Tooltip,{title:b("Everyone should pass"),placement:"bottom"},n().createElement("span",null,b("All pass")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))),n().createElement(u.Radio,{value:-1},n().createElement(u.Tooltip,{title:b("Anyone pass"),placement:"bottom"},n().createElement("span",null,b("Any pass")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}})))))));return n().createElement("fieldset",{className:(0,e.css)(eS())},n().createElement(u.Form.Item,null,n().createElement(u.Radio.Group,{value:!!o,onChange:function(e){var t=e.target.value;console.log(t),i(Number(t))}},n().createElement(u.Radio,{value:!0},n().createElement(u.Tooltip,{title:b("Each user has own task"),placement:"bottom"},n().createElement("span",null,b("Separately")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))),n().createElement(u.Radio,{value:!1},n().createElement(u.Tooltip,{title:b("Everyone shares one task"),placement:"bottom"},n().createElement("span",null,b("Collaboratively")),n().createElement(r.QuestionCircleOutlined,{style:{color:"#999"}}))))),o?l:null)}function eC(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}function ej(t){t.multiple;var r=t.value,i=void 0===r?[]:r,a=t.onChange,l=(0,o.useWorkflowVariableOptions)({types:[eC]});return n().createElement(e.Variable.Input,{scope:l,value:i[0],onChange:function(e){a([e])}},n().createElement(e.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:i[0],onChange:function(e){a(null!=e?[e]:[])}}))}function eP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eE(e){return(eE=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eA(e,t){return(eA=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eI=function(){return!!e})()}function eF(t,n){var r,i,a=t.key,l=t.title,c=t.config,u=n.types,s=n.fieldNames,p=void 0===s?o.defaultFieldNames:s,f=(0,e.useCompile)(),m=(0,e.useApp)(),d=Object.keys(null!=(r=c.forms)?r:{});if(!d.length)return null;var y=d.map(function(e){var t,n,r=c.forms[e];r.dataSource&&(n=m.dataSourceManager.getDataSource(r.dataSource).collectionManager);var i=(0,o.getCollectionFieldOptions)({fields:null==(t=r.collection)?void 0:t.fields,collection:r.collection,types:u,compile:f,collectionManager:n}),a=f(r.title)||e;return i.length?{key:e,value:e,label:a,title:a,children:i}:null}).filter(Boolean);return y.length?(eP(i={},p.value,a),eP(i,p.label,l),eP(i,p.children,y),i):null}function eT(t){var n,r=(0,e.useDataSourceManager)(),i=Object.keys(null!=(n=t.config.forms)?n:{});if(!i.length||t.config.mode)return null;var a=i.map(function(n){var i,a,l=t.config.forms[n],c=r.getDataSource(l.dataSource).collectionManager,u=("string"==typeof l.collection?c.getCollection(l.collection):l.collection||{fields:[]}).fields;return(void 0===u?[]:u).length?{name:null!=(i=l.title)?i:n,type:"item",title:null!=(a=l.title)?a:n,Component:o.CollectionBlockInitializer,collection:(0,e.joinCollectionName)(l.dataSource,l.collection),dataPath:"$jobsMapByNodeKey.".concat(t.key,".").concat(n)}:null}).filter(Boolean);return a.length?{name:"#".concat(t.id),key:"forms",type:"subMenu",title:t.title,children:a}:null}Symbol("single"),Symbol("all"),Symbol("any"),Symbol("all percentage"),Symbol("any percentage");var eD=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,i,a;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return i=t,a=arguments,i=eE(i),eP(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,eI()?Reflect.construct(i,a||[],eE(this).constructor):i.apply(this,a)),"title",'{{t("Manual", { ns: "'.concat(f,'" })}}')),eP(e,"type","manual"),eP(e,"group","manual"),eP(e,"description",'{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "'.concat(f,'" })}}')),eP(e,"icon",n().createElement(r.SolutionOutlined,null)),eP(e,"fieldset",{assignees:{type:"array",title:'{{t("Assignees", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"AssigneesSelect","x-component-props":{},required:!0,default:[]},mode:{type:"number",title:'{{t("Mode", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"ModeConfig",default:1,"x-reactions":{dependencies:["assignees"],fulfill:{state:{visible:"{{$deps[0].length > 1}}"}}}},title:{type:"string",title:'{{t("Task title", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea",description:'{{t("Title of each task item. Default to node title.", { ns: "'.concat(f,'" })}}'),default:"{{useNodeContext().title}}"},schema:{type:"void",title:'{{t("User interface", { ns: "'.concat(f,'" })}}'),"x-decorator":"FormItem","x-component":"SchemaConfigButton",properties:{schema:{type:"object","x-component":"SchemaConfig",default:null}}},forms:{type:"object",default:{}}}),eP(e,"scope",{useNodeContext:o.useNodeContext}),eP(e,"components",{SchemaConfigButton:eO,SchemaConfig:ex,ModeConfig:ek,AssigneesSelect:ej,WorkflowVariableTextArea:o.WorkflowVariableTextArea}),eP(e,"async",!0),eP(e,"useVariables",eF),eP(e,"useInitializers",eT),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&eA(t,e),t}(o.Instruction),eM=v(442),eB=v(235),eR=v(185),ez=v.n(eR),e_=v(27);function eN(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 eV(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 eq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eU(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){eq(e,t,n[t])})}return e}function eW(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function e$(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}function eL(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,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)||function(e,t){if(e){if("string"==typeof e)return eN(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 eN(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eG(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eJ(){var e=eG(["\n padding: ",";\n margin-bottom: ",";\n time {\n margin-right: 0.5em;\n }\n .ant-tag {\n margin-right: 0;\n }\n "]);return eJ=function(){return e},e}function eK(){var e=eG(["\n .ant-descriptions-header {\n margin-bottom: 0.5em;\n .ant-descriptions-extra {\n color: ",";\n }\n }\n .ant-descriptions-item-label {\n width: 6em;\n }\n "]);return eK=function(){return e},e}function eY(){var e=eG(["\n .ant-card-extra {\n color: ",";\n }\n "]);return eY=function(){return e},e}function eQ(t){var r,o=(0,e.useCollectionRecordData)(),i=b("Unprocessed");return(null==o||null==(r=o.execution)?void 0:r.status)&&(null==o?void 0:o.status)==null?n().createElement(u.Tag,null,i):t.children}function eH(t){var n=(0,e.useCollectionRecordData)();if(Array.isArray(t.dataIndex)){var r=!0,o=!1,i=void 0;try{for(var a,l=t.dataIndex[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value,u=(0,S.get)(n,c);if(u)return u}}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}}return(0,S.get)(n,t.dataIndex)}var eX=function(t){var r=eZ({defaultOpenMode:(0,e.useOpenModeContext)().defaultOpenMode,collectionName:"workflowManualTasks"});return n().createElement(e.SchemaComponentContext.Provider,{value:{designable:!1}},n().createElement(e.SchemaComponent,{scope:{useCollectionRecordData:e.useCollectionRecordData},components:{FormLayout:a.FormLayout,ContentDetailWithTitle:te},schema:{type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined",nonfilterable:["workflow.type","workflow.mode","workflow.description","workflow.categories"]},default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"}}},list:{type:"array","x-component":"List",properties:{item:{type:"object","x-component":"List.Item",properties:{content:{type:"void","x-decorator":"FormLayout","x-decorator-props":{layout:"horizontal"},"x-component":"ContentDetailWithTitle","x-component-props":{}},actions:{type:"void","x-component":"ActionBar","x-use-component-props":"useListActionBarProps","x-component-props":{layout:"one-column"},"x-align":"left",properties:{view:r}}}}}}}}}))};function eZ(e){var t=e.defaultOpenMode,n=e.collectionName;return{name:"view",type:"void","x-component":"Action.Link","x-component-props":{openMode:t},title:'{{t("View")}}',"x-uid":"".concat(n,"-view"),"x-action":"view","x-action-context":{dataSource:"main",collection:n,doNotUpdateContext:!0},properties:{drawer:{type:"void","x-component":eX.Drawer}}}}function e0(t){var n,r=(0,e.useCurrentUserContext)().data,i=(0,o.useFlowContext)().userJob,a=i.status,l=i.result,u=i.userId,s=(0,c.useFieldSchema)().parent.toJSON().name,p=t.children;return a?(null==l?void 0:l[s])||(p=null):(null==r||null==(n=r.data)?void 0:n.id)!==u&&(p=null),p}var e1=(0,t.createContext)(null);function e2(r){var i=r.value,a=r.children,l=(0,o.useFlowContext)(),s=l.userJob,p=l.execution,f=(0,c.useField)(),m=(0,c.useFieldSchema)(),d=(0,e.useCompile)();return(0,t.useEffect)(function(){if(p.status||s.status){var e;f.disabled=!0,f.visible=s.status===i&&(null==(e=s.result)?void 0:e._)===m.name}},[p,s,i,f,m.name]),n().createElement(e1.Provider,{value:i},p.status||s.status?n().createElement(u.Button,{type:"primary",disabled:!0},d(m.title)):a)}function e3(){var t,n=(0,e.useAPIClient)(),r=(0,e.useActionContext)(),i=r.setVisible,a=r.setSubmitted,l=(0,c.useForm)(),u=l.values,s=l.submit,p=(0,c.useField)(),f=(0,c.useFieldSchema)(),m=(0,e.useListBlockContext)().service,d=(0,o.useFlowContext)(),y=d.userJob,b=d.execution,v=f.name,h=f.parent.parent.name,g=(null!=(t=null==f?void 0:f["x-action-settings"])?t:{}).assignedValues,w=void 0===g?{}:g;return{run:function(){var e;return(e=function(){var e;return function(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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}}}}(this,function(t){switch(t.label){case 0:if(b.status||y.status)return[2];return[4,s()];case 1:return t.sent(),p.data=p.data||{},p.data.loading=!0,[4,n.resource("workflowManualTasks").submit({filterByTk:y.id,values:{result:(eq(e={},h,eU({},u,w.values)),eq(e,"_",v),e)}})];case 2:return t.sent(),p.data.loading=!1,a(!0),i(!1),null==m||m.refresh(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){eV(i,r,o,a,l,"next",e)}function l(e){eV(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function e5(r){var a,l=(0,e.usePlugin)(i()),c=(0,e.useAPIClient)(),s=((0,e.useCollectionRecordData)()||{}).id,p=eL((0,t.useState)(null),2),f=p[0],m=p[1],d=eL((0,t.useState)(null),2),y=d[0],b=d[1];(0,t.useEffect)(function(){var e,t;s&&(null==(e=(t=c.resource("workflowManualTasks")).get)||e.call(t,{filterByTk:s,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs"]}).then(function(e){var t,n=e.data,r=null!=(t=null==n?void 0:n.data)?t:{},i=r.node,a=r.workflow,l=void 0===a?{}:a,c=l.nodes,u=void 0===c?[]:c,s=e$(l,["nodes"]),p=r.execution,f=e$(r,["node","workflow","execution"]);(0,o.linkNodes)(u),b(i),m({userJob:f,workflow:s,nodes:u,execution:p})}))},[c,s]);var v=(0,o.useAvailableUpstreams)(null==f?void 0:f.nodes.find(function(e){return e.id===y.id})).reduce(function(e,t){var n,r=t.type;return Object.assign(e,null==(n=l.instructions.get(r))?void 0:n.components)},{});return y&&f?n().createElement(o.FlowContext.Provider,{value:f},n().createElement(e.SchemaComponent,{components:eU({FormBlockProvider:x,DetailsBlockProvider:o.DetailsBlockProvider,ActionBarProvider:e0,ManualActionStatusProvider:e2},Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.block.components)},{}),v),scope:eU({useSubmit:e3,useFormBlockProps:e8,useDetailsBlockProps:e6},Array.from(es.getValues()).reduce(function(e,t){return Object.assign(e,t.block.scope)},{})),schema:{type:"void",name:"manual-".concat(s,"}"),"x-component":"Tabs",properties:null==(a=y.config)?void 0:a.schema}})):n().createElement(u.Spin,null)}function e8(){var n,r=(0,o.useFlowContext)(),i=r.userJob,a=r.execution,l=(0,e.useCollectionRecordData)(),c=(0,e.useCurrentUserContext)().data,u=(0,e.useFormBlockContext)().form,s=a.status||i.status?l?"readPretty":"disabled":(null==c||null==(n=c.data)?void 0:n.id)!==i.userId?"disabled":"editable";return(0,t.useEffect)(function(){null==u||u.setPattern(s)},[s,u]),{form:u}}function e6(){return{form:(0,e.useFormBlockContext)().form}}function e9(){var t=(0,e.useMobileLayout)().isMobileLayout,r=(0,e_.useMobilePage)(),o=(0,e.useCompile)(),i=(0,e.useCollectionRecordData)()||{},a=i.status,l=i.updatedAt,c=y[a];return a?n().createElement(u.Space,{className:(0,e.css)(eJ(),t?"0 1em":"0",r||t?"0":"1em")},n().createElement("time",null,ez()(l).format("YYYY-MM-DD HH:mm:ss")),n().createElement(u.Tag,{color:c.color},o(c.label))):null}function e4(){var r,o=(0,t.useContext)(e.SchemaComponentContext),i=(0,e.useCollectionRecordData)(),a=i||{},l=a.id,c=a.node,u=a.workflow,s=a.status;return i?n().createElement(e.SchemaComponentContext.Provider,{value:eW(eU({},o),{reset:function(){},designable:!1})},n().createElement(e.SchemaComponent,{components:{FooterStatus:e9,FlowContextProvider:e5},schema:{type:"void",name:"manual-detail-drawer-".concat(l,"-").concat(s),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:"".concat(null==u?void 0:u.title," - ").concat(null!=(r=null==c?void 0:c.title)?r:"#".concat(null==c?void 0:c.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"FooterStatus"}}}}}})):null}function e7(t){var r=(0,s.useTranslation)().t,o=(0,eB.useAntdToken)();return n().createElement(u.ConfigProvider,{theme:{token:{fontSizeLG:14}}},n().createElement(u.Descriptions,eW(eU({},t),{column:1,items:[{key:"createdAt",label:r("Created at"),children:n().createElement(e.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:r("Status",{ns:"workflow"}),children:n().createElement(e.SchemaComponent,{components:{TaskStatusColumn:eQ},schema:{name:"status",type:"number","x-decorator":"TaskStatusColumn","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,e.css)(eK(),o.colorTextDescription)})))}function te(e){return n().createElement(e7,{title:n().createElement(eH,{dataIndex:["title","node.title"]}),extra:n().createElement(eH,{dataIndex:"workflow.title"})})}e1.displayName="ManualActionStatusContext",eX.Initializer=function(){var t=(0,e.useSchemaInitializerItem)(),o=(0,e.useSchemaInitializer)().insert;return n().createElement(e.SchemaInitializerItem,eW(eU({icon:n().createElement(r.TableOutlined,null)},t),{onClick:function(){o({type:"void","x-decorator":"WorkflowTodo.Decorator","x-decorator-props":{},"x-component":"CardItem","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{todos:{type:"void","x-component":"WorkflowTodo"}}})}}))},eX.Drawer=e4,eX.Decorator=function(t){var r=t.params,o=void 0===r?{}:r,i=t.children,a={collection:"workflowManualTasks",resource:"workflowManualTasks",action:"listMine",params:eW(eU({pageSize:20,sort:["-createdAt"]},o),{filter:eU({},o.filter),appends:["user","node","workflow","execution.status"],except:["node.config","workflow.config","workflow.options"]})};return n().createElement(e.OpenModeProvider,{defaultOpenMode:"modal"},n().createElement(e.List.Decorator,a,i))};var tt={pending:{status:0,"execution.status":o.EXECUTION_STATUS.STARTED},completed:{status:[1,-3,-5]}},tn={key:m,title:'{{t("My manual tasks", { ns: "'.concat(f,'" })}}'),collection:"workflowManualTasks",action:"listMine",useActionParams:function(e,t){var n,r=null!=(n=tt[e])?n:{};return{filter:t?{$and:[r,{"workflow.key":t}]}:r,appends:["node.id","node.title","job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"],except:["node.config","workflow.config","workflow.options"]}},Actions:function(t){return n().createElement(e.SchemaComponent,{schema:{name:"actions",type:"void","x-component":"ActionBar",properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":eU({icon:"ReloadOutlined"},t)},filter:{type:"void",title:'{{t("Filter")}}',"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":eW(eU({icon:"FilterOutlined"},t),{nonfilterable:["workflow.title"]}),default:{$and:[{title:{$includes:""}}]}}}}})},Item:function(){var r=(0,eB.useAntdToken)(),i=(0,e.useCollectionRecordData)(),a=(0,eM.useNavigate)(),l=(0,o.usePopupRecordContext)().setRecord,c=(0,t.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&(l(i),a("./".concat(i.id))),e.stopPropagation()},[a,i,l]);return n().createElement(u.Card,{onClick:c,hoverable:!0,size:"small",title:i.title,extra:n().createElement(o.WorkflowTitle,i.workflow),className:(0,e.css)(eY(),r.colorTextDescription)},n().createElement(e7,null))},Detail:e4},tr={title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),name:"workflowManualTasks",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(f,'" })}}'),"x-component":"Input"}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",interface:"m2o",isAssociation:!0,uiSchema:{type:"number",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"id"}}}},{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",interface:"m2o",isAssociation:!0,uiSchema:{type:"object",title:'{{t("Assignee", { ns: "'.concat(f,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{label:"nickname",value:"id"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "workflow" })}}',"x-component":"Select",enum:d}},{name:"createdAt",type:"date",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"updatedAt",type:"date",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0}}}]},to=function(t){return n().createElement(e.ExtendCollectionsProvider,{collections:[tr]},t.children)};function ti(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 ta(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ti(i,r,o,a,l,"next",e)}function l(e){ti(i,r,o,a,l,"throw",e)}a(void 0)})}}function tl(e,t,n){return(tl=tp()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tu(o,n.prototype),o}).apply(null,arguments)}[tr.name].forEach(function(t){var n=eZ({defaultOpenMode:window.location.pathname.startsWith("/m/")?"page":"modal",collectionName:t});(0,e.storePopupContext)(n["x-uid"],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}({schema:n},n["x-action-context"]),!0)});function tc(e){return(tc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tu(e,t){return(tu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ts(e){var t="function"==typeof Map?new Map:void 0;return(ts=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 tl(e,arguments,tc(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),tu(n,e)})(e)}function tp(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tp=function(){return!!e})()}function tf(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),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];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 tm=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=tc(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,tp()?Reflect.construct(e,t||[],tc(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&tu(n,e),t=[{key:"afterAdd",value:function(){return ta(function(){return tf(this,function(e){return[2]})})()}},{key:"load",value:function(){return ta(function(){var e;return tf(this,function(t){return this.addComponents(),this.app.addProvider(to),(e=this.app.pm.get("workflow")).registerInstruction("manual",eD),e.registerTaskType(m,tn),this.app.schemaInitializerManager.add(ef),this.app.schemaInitializerManager.add(em),this.app.schemaInitializerManager.add(eh),this.app.schemaInitializerManager.add(eg),this.app.schemaInitializerManager.add(H),this.app.schemaInitializerManager.add(X),this.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(f,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),e.registerCollectionsToDataSource([tr]),[2]})}).call(this)}},{key:"addComponents",value:function(){this.app.addComponents({WorkflowTodo:eX})}}],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}(ts(e.Plugin))}(),O}()});
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-alpha.10",
11
+ "@nocobase/client": "2.2.0-alpha.12",
12
12
  "react": "18.2.0",
13
13
  "react-router-dom": "6.30.1",
14
14
  "@formily/react": "2.3.7",
@@ -19,16 +19,16 @@ module.exports = {
19
19
  "dayjs": "1.11.13",
20
20
  "react-i18next": "11.18.6",
21
21
  "lodash": "4.18.1",
22
- "@nocobase/plugin-workflow": "2.2.0-alpha.10",
23
- "@nocobase/plugin-mobile": "2.2.0-alpha.10",
24
- "@nocobase/flow-engine": "2.2.0-alpha.10",
25
- "@nocobase/client-v2": "2.2.0-alpha.10",
26
- "@nocobase/utils": "2.2.0-alpha.10",
27
- "@nocobase/server": "2.2.0-alpha.10",
28
- "@nocobase/database": "2.2.0-alpha.10",
29
- "@nocobase/actions": "2.2.0-alpha.10",
30
- "@nocobase/test": "2.2.0-alpha.10",
31
- "@nocobase/plugin-workflow-test": "2.2.0-alpha.10",
22
+ "@nocobase/plugin-workflow": "2.2.0-alpha.12",
23
+ "@nocobase/plugin-mobile": "2.2.0-alpha.12",
24
+ "@nocobase/flow-engine": "2.2.0-alpha.12",
25
+ "@nocobase/client-v2": "2.2.0-alpha.12",
26
+ "@nocobase/utils": "2.2.0-alpha.12",
27
+ "@nocobase/server": "2.2.0-alpha.12",
28
+ "@nocobase/database": "2.2.0-alpha.12",
29
+ "@nocobase/actions": "2.2.0-alpha.12",
30
+ "@nocobase/test": "2.2.0-alpha.12",
31
+ "@nocobase/plugin-workflow-test": "2.2.0-alpha.12",
32
32
  "@formily/core": "2.3.7",
33
33
  "sequelize": "6.35.2"
34
34
  };
@@ -1 +1 @@
1
- {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-07-28T04:41:29.372Z"}
1
+ {"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-07-30T03:55:48.974Z"}
@@ -9,6 +9,10 @@
9
9
  import { Plugin } from '@nocobase/server';
10
10
  import { Model } from '@nocobase/database';
11
11
  export default class extends Plugin {
12
+ private mergeTaskCounts;
13
+ private collectManualTaskStats;
14
+ private updateManualWorkflowTaskStats;
15
+ private getWorkflowKeyById;
12
16
  private updateManualTaskStats;
13
17
  onTaskSave: (task: Model, { transaction }: {
14
18
  transaction: any;
@@ -45,18 +45,62 @@ var jobActions = __toESM(require("./actions"));
45
45
  var import_ManualInstruction = __toESM(require("./ManualInstruction"));
46
46
  var import_constants = require("../common/constants");
47
47
  class Plugin_default extends import_server.Plugin {
48
- async updateManualTaskStats(userIds, transaction) {
49
- if (!userIds.length) {
50
- return;
48
+ mergeTaskCounts(statsMap, rows, workflowKeyMap, field) {
49
+ for (const row of rows) {
50
+ const userId = row.userId;
51
+ const workflowKey = workflowKeyMap.get(row.workflowId);
52
+ if (!userId || !workflowKey) {
53
+ continue;
54
+ }
55
+ const key = `${userId}\0${workflowKey}`;
56
+ const stats = statsMap.get(key) ?? {
57
+ userId,
58
+ workflowKey,
59
+ type: import_constants.TASK_TYPE_MANUAL,
60
+ pending: 0,
61
+ all: 0
62
+ };
63
+ stats[field] += Number(row.count) || 0;
64
+ statsMap.set(key, stats);
51
65
  }
66
+ }
67
+ async collectManualTaskStats(options) {
68
+ var _a, _b;
52
69
  const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
53
70
  const WorkflowManualTaskModel = this.db.getModel("workflowManualTasks");
54
- const uniqueUserIds = Array.from(new Set(userIds.filter(Boolean)));
55
- const userStatsMap = new Map(uniqueUserIds.map((userId) => [userId, { pending: 0, all: 0 }]));
56
- const pendingCounts = await WorkflowManualTaskModel.count({
71
+ const qualifiedColumn = (name) => {
72
+ const fieldName = WorkflowManualTaskModel.getAttributes()[name].field ?? name;
73
+ return this.db.sequelize.col(`${WorkflowManualTaskModel.name}.${fieldName}`);
74
+ };
75
+ const group = ["userId", "workflowId"].map((name) => qualifiedColumn(name));
76
+ const countColumn = qualifiedColumn("id");
77
+ const where = {};
78
+ if ((_a = options.userIds) == null ? void 0 : _a.length) {
79
+ where.userId = options.userIds;
80
+ }
81
+ if ((_b = options.workflowKeys) == null ? void 0 : _b.length) {
82
+ const workflowIds2 = (await Promise.all(
83
+ options.workflowKeys.map(
84
+ (workflowKey) => workflowPlugin.getWorkflowIdsByKey(workflowKey, options.transaction)
85
+ )
86
+ )).flat();
87
+ if (!workflowIds2.length) {
88
+ return [];
89
+ }
90
+ where.workflowId = workflowIds2;
91
+ }
92
+ const allCounts = await WorkflowManualTaskModel.findAll({
93
+ attributes: ["userId", "workflowId", [this.db.sequelize.fn("COUNT", countColumn), "count"]],
94
+ where,
95
+ group,
96
+ raw: true,
97
+ transaction: options.transaction
98
+ });
99
+ const pendingCounts = await WorkflowManualTaskModel.findAll({
100
+ attributes: ["userId", "workflowId", [this.db.sequelize.fn("COUNT", countColumn), "count"]],
57
101
  where: {
58
- status: import_constants.TASK_STATUS.PENDING,
59
- userId: uniqueUserIds
102
+ ...where,
103
+ status: import_constants.TASK_STATUS.PENDING
60
104
  },
61
105
  include: [
62
106
  {
@@ -68,58 +112,87 @@ class Plugin_default extends import_server.Plugin {
68
112
  required: true
69
113
  }
70
114
  ],
71
- col: "id",
72
- group: ["userId"],
115
+ group,
116
+ raw: true,
117
+ transaction: options.transaction
118
+ });
119
+ const workflowIds = Array.from(new Set([...allCounts, ...pendingCounts].map((row) => row.workflowId)));
120
+ const workflows = workflowIds.length ? await this.db.getRepository("workflows").find({
121
+ filter: { id: workflowIds },
122
+ fields: ["id", "key"],
123
+ transaction: options.transaction
124
+ }) : [];
125
+ const workflowKeyMap = new Map(
126
+ workflows.map((workflow) => [workflow.id, workflow.key])
127
+ );
128
+ const statsMap = /* @__PURE__ */ new Map();
129
+ this.mergeTaskCounts(statsMap, allCounts, workflowKeyMap, "all");
130
+ this.mergeTaskCounts(statsMap, pendingCounts, workflowKeyMap, "pending");
131
+ return Array.from(statsMap.values());
132
+ }
133
+ async updateManualWorkflowTaskStats(userId, workflowKey, transaction) {
134
+ const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
135
+ const [row] = await this.collectManualTaskStats({
136
+ userIds: [userId],
137
+ workflowKeys: [workflowKey],
73
138
  transaction
74
139
  });
75
- const allCounts = await WorkflowManualTaskModel.count({
76
- where: {
77
- userId: uniqueUserIds
140
+ const stats = row ?? {
141
+ userId,
142
+ workflowKey,
143
+ type: import_constants.TASK_TYPE_MANUAL,
144
+ pending: 0,
145
+ all: 0
146
+ };
147
+ await workflowPlugin.updateTaskStatsByWorkflow(
148
+ {
149
+ userId,
150
+ workflowKey,
151
+ type: import_constants.TASK_TYPE_MANUAL,
152
+ stats
78
153
  },
79
- col: "id",
80
- group: ["userId"],
154
+ { transaction }
155
+ );
156
+ }
157
+ async getWorkflowKeyById(workflowId, transaction) {
158
+ const WorkflowRepo = this.db.getRepository("workflows");
159
+ const workflow = await WorkflowRepo.findOne({
160
+ filterByTk: workflowId,
161
+ fields: ["key"],
81
162
  transaction
82
163
  });
83
- for (const row of pendingCounts) {
84
- userStatsMap.set(row.userId, { ...userStatsMap.get(row.userId), pending: Number(row.count) || 0 });
85
- }
86
- for (const row of allCounts) {
87
- userStatsMap.set(row.userId, { ...userStatsMap.get(row.userId), all: Number(row.count) || 0 });
164
+ return workflow == null ? void 0 : workflow.key;
165
+ }
166
+ async updateManualTaskStats(userIds, transaction) {
167
+ if (!userIds.length) {
168
+ return;
88
169
  }
89
- for (const [userId, stats] of userStatsMap.entries()) {
90
- await workflowPlugin.updateTasksStats(userId, import_constants.TASK_TYPE_MANUAL, stats, { transaction });
170
+ const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
171
+ const uniqueUserIds = Array.from(new Set(userIds.filter(Boolean)));
172
+ const rows = await this.collectManualTaskStats({ userIds: uniqueUserIds, transaction });
173
+ for (const row of rows) {
174
+ await workflowPlugin.updateTaskStatsByWorkflow(
175
+ {
176
+ userId: row.userId,
177
+ workflowKey: row.workflowKey,
178
+ type: import_constants.TASK_TYPE_MANUAL,
179
+ stats: row
180
+ },
181
+ { transaction }
182
+ );
91
183
  }
92
184
  }
93
185
  onTaskSave = async (task, { transaction }) => {
94
- const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
95
- const ModelClass = task.constructor;
96
- const pending = await ModelClass.count({
97
- where: {
98
- userId: task.userId,
99
- status: import_constants.TASK_STATUS.PENDING
100
- },
101
- include: [
102
- {
103
- association: "execution",
104
- attributes: [],
105
- where: {
106
- status: import_plugin_workflow.EXECUTION_STATUS.STARTED
107
- },
108
- required: true
109
- }
110
- ],
111
- col: "id",
112
- distinct: true,
113
- transaction
114
- });
115
- const all = await ModelClass.count({
116
- where: {
117
- userId: task.userId
118
- },
119
- col: "id",
120
- transaction
121
- });
122
- await workflowPlugin.updateTasksStats(task.userId, import_constants.TASK_TYPE_MANUAL, { pending, all }, { transaction });
186
+ const userId = task.get("userId");
187
+ const workflowId = task.get("workflowId");
188
+ if (!userId || !workflowId) {
189
+ return;
190
+ }
191
+ const workflowKey = await this.getWorkflowKeyById(workflowId, transaction);
192
+ if (!workflowKey) {
193
+ return;
194
+ }
195
+ await this.updateManualWorkflowTaskStats(userId, workflowKey, transaction);
123
196
  };
124
197
  onExecutionStatusChange = async (execution, { transaction }) => {
125
198
  if (!execution.status) {
@@ -167,105 +240,15 @@ class Plugin_default extends import_server.Plugin {
167
240
  await this.updateManualTaskStats(userIds, transaction);
168
241
  };
169
242
  onWorkflowStatusChange = async (workflow, { transaction }) => {
170
- const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
171
243
  const WorkflowManualTaskModel = this.db.getModel("workflowManualTasks");
172
- const enalbedSet = new Set(workflowPlugin.enabledCache.keys());
173
- let pendingCounts = [];
174
- let allCounts = [];
175
- const userStatsMap = /* @__PURE__ */ new Map();
176
- if (workflow.enabled) {
177
- enalbedSet.add(workflow.id);
178
- const workflowId = [...enalbedSet];
179
- pendingCounts = await WorkflowManualTaskModel.count({
180
- where: {
181
- status: import_constants.TASK_STATUS.PENDING,
182
- workflowId
183
- },
184
- include: [
185
- {
186
- association: "execution",
187
- attributes: [],
188
- where: {
189
- status: import_plugin_workflow.EXECUTION_STATUS.STARTED
190
- },
191
- required: true
192
- }
193
- ],
194
- col: "id",
195
- group: ["userId"],
196
- transaction
197
- });
198
- allCounts = await WorkflowManualTaskModel.count({
199
- where: {
200
- workflowId
201
- },
202
- col: "id",
203
- group: ["userId"],
204
- transaction
205
- });
206
- } else {
207
- enalbedSet.delete(workflow.id);
208
- const workflowId = [...enalbedSet];
209
- const tasksByUser = await WorkflowManualTaskModel.count({
210
- col: "userId",
211
- where: {
212
- status: import_constants.TASK_STATUS.PENDING,
213
- workflowId: workflow.id
214
- },
215
- distinct: true,
216
- group: ["userId"],
217
- transaction
218
- });
219
- const userId = [];
220
- for (const item of tasksByUser) {
221
- userId.push(item.userId);
222
- userStatsMap.set(item.userId, { pending: 0, all: 0 });
223
- }
224
- pendingCounts = await WorkflowManualTaskModel.count({
225
- where: {
226
- status: import_constants.TASK_STATUS.PENDING,
227
- userId,
228
- workflowId
229
- },
230
- include: [
231
- {
232
- association: "execution",
233
- attributes: [],
234
- where: {
235
- status: import_plugin_workflow.EXECUTION_STATUS.STARTED
236
- },
237
- required: true
238
- }
239
- ],
240
- col: "id",
241
- group: ["userId"],
242
- transaction
243
- });
244
- allCounts = await WorkflowManualTaskModel.count({
245
- where: {
246
- userId,
247
- workflowId
248
- },
249
- col: "id",
250
- group: ["userId"],
251
- transaction
252
- });
253
- }
254
- for (const row of pendingCounts) {
255
- if (!userStatsMap.get(row.userId)) {
256
- userStatsMap.set(row.userId, { pending: 0, all: 0 });
257
- }
258
- userStatsMap.set(row.userId, { ...userStatsMap.get(row.userId), pending: Number(row.count) || 0 });
259
- }
260
- for (const row of allCounts) {
261
- if (!userStatsMap.get(row.userId)) {
262
- userStatsMap.set(row.userId, { pending: 0, all: 0 });
263
- }
264
- userStatsMap.set(row.userId, { ...userStatsMap.get(row.userId), all: Number(row.count) || 0 });
265
- }
266
- for (const [userId, stats] of userStatsMap.entries()) {
267
- await workflowPlugin.updateTasksStats(userId, import_constants.TASK_TYPE_MANUAL, stats, { transaction });
268
- }
244
+ const rows = await WorkflowManualTaskModel.findAll({
245
+ attributes: ["userId"],
246
+ where: {
247
+ workflowId: workflow.id
248
+ },
249
+ transaction
250
+ });
251
+ await this.updateManualTaskStats(rows.map((row) => row.get("userId")).filter(Boolean), transaction);
269
252
  };
270
253
  async load() {
271
254
  this.app.resourceManager.define({
@@ -275,7 +258,11 @@ class Plugin_default extends import_server.Plugin {
275
258
  this.app.acl.allow("workflowManualTasks", ["listMine", "get", "submit"], "loggedIn");
276
259
  const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
277
260
  workflowPlugin.registerInstruction("manual", import_ManualInstruction.default);
278
- this.db.on("workflowManualTasks.afterSave", this.onTaskSave);
261
+ workflowPlugin.registerTaskStatsProvider(import_constants.TASK_TYPE_MANUAL, {
262
+ collectTaskStats: (options) => this.collectManualTaskStats(options)
263
+ });
264
+ this.db.on("workflowManualTasks.afterCreateWithAssociations", this.onTaskSave);
265
+ this.db.on("workflowManualTasks.afterUpdate", this.onTaskSave);
279
266
  this.db.on("workflowManualTasks.afterDestroy", this.onTaskSave);
280
267
  this.db.on("executions.afterUpdate", this.onExecutionStatusChange);
281
268
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ on: string;
12
+ up(): Promise<void>;
13
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var rebuild_workflow_task_stats_exports = {};
38
+ __export(rebuild_workflow_task_stats_exports, {
39
+ default: () => rebuild_workflow_task_stats_default
40
+ });
41
+ module.exports = __toCommonJS(rebuild_workflow_task_stats_exports);
42
+ var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
43
+ var import_server = require("@nocobase/server");
44
+ var import_constants = require("../../common/constants");
45
+ class rebuild_workflow_task_stats_default extends import_server.Migration {
46
+ on = "afterLoad";
47
+ async up() {
48
+ const workflowPlugin = this.pm.get(import_plugin_workflow.default);
49
+ await workflowPlugin.repairTaskStats({ types: [import_constants.TASK_TYPE_MANUAL], silent: true });
50
+ }
51
+ }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Could be used for workflows which some of decisions are made by users.",
7
7
  "description.ru-RU": "Может использоваться в рабочих процессах, где какие-то решения принимаются пользователями.",
8
8
  "description.zh-CN": "用于人工控制部分决策的流程。",
9
- "version": "2.2.0-alpha.10",
9
+ "version": "2.2.0-alpha.12",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow-manual",
@@ -37,7 +37,7 @@
37
37
  "@nocobase/test": "2.x",
38
38
  "@nocobase/utils": "2.x"
39
39
  },
40
- "gitHead": "b5a3f131bb0a4a2fbfd96852896bccadc933d834",
40
+ "gitHead": "96ae69754a6398de63037ead3a4aad5e5d0ab918",
41
41
  "keywords": [
42
42
  "Workflow"
43
43
  ]