@nocobase/plugin-workflow-manual 2.2.0-alpha.1 → 2.2.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/client-v2/index.js');
@@ -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&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-workflow-manual/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",a=i.indexOf(o);e=a>=0?i.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),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(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}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { CollectionOptions } from '@nocobase/flow-engine';
10
+ export declare const workflowManualTaskCollections: CollectionOptions[];
@@ -0,0 +1,9 @@
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
+ export { default } from './plugin';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-manual/client-v2",["@nocobase/client-v2","react-router-dom","react","antd","@nocobase/plugin-workflow/client-v2","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-manual/client-v2"]=t(require("@nocobase/client-v2"),require("react-router-dom"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-manual/client-v2"]=t(e["@nocobase/client-v2"],e["react-router-dom"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,a,l){return function(){"use strict";var i={375:function(e){e.exports=a},485:function(t){t.exports=e},694:function(e){e.exports=l},197:function(e){e.exports=o},59:function(e){e.exports=r},155:function(e){e.exports=n},442:function(e){e.exports=t}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return i[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(s=u.g.location+"");var s,f=u.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var p=f.getElementsByTagName("script");if(p.length)for(var b=p.length-1;b>-1&&(!s||!/^http(s?):/.test(s));)s=p[b--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");u.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};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-v2/")>=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-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",i=l.indexOf(a);e=i>=0?l.slice(0,i+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-manual/dist/client-v2/"}u.p=e}(),!function(){u.r(d),u.d(d,{default:function(){return W}});var e,t=u(485),n=u(197),r="manual",o=[{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"}];o.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))},{});var a=u(375),l=u(694),i=u(59),c=u(155),s=u.n(c),f=u(442),p=[{name:"workflows",dataCategory:"system",hidden:!0,shared:!0,fields:[{name:"id",type:"snowflakeId",primaryKey:!0,allowNull:!1},{name:"title",type:"string",interface:"input",uiSchema:{type:"string",title:'{{t("Name")}}',"x-component":"Input"}}]},{name:"workflowManualTasks",dataCategory:"business",filterTargetKey:"id",hidden:!0,shared:!0,fields:[{name:"id",type:"snowflakeId",primaryKey:!0,allowNull:!1},{name:"title",type:"string",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "workflow-manual" })}}',"x-component":"Input"}},{name:"workflow",type:"belongsTo",target:"workflows",interface:"m2o",uiSchema:{type:"object",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"id"}}}}]}],b="@nocobase/plugin-workflow-manual";function w(){var e=(0,l.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[b,"client"],nsMode:"fallback"},n))}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=["node.id","node.title","job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"],h=["node.config","workflow.config","workflow.options"],k="workflowManualTasksFilter",O={$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]},S=(g(e={},n.TASK_STATUS.PENDING,{filter:{status:0,"execution.status":0}}),g(e,n.TASK_STATUS.COMPLETED,{filter:{status:[1,-3,-5]}}),e);function j(e){return!!e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&!Array.isArray(e)}function x(e,t){return t.split(".").reduce(function(e,t){return j(e)?e[t]:void 0},e)}function P(e,t){var n=x(e,t);if(null!=n)return String(n)}function T(e){return!j(e)||function e(t){return null==t||""===t||(Array.isArray(t)?t.every(e):!!j(t)&&Object.values(t).every(e))}(e)}function _(){if(!("u"<typeof window)){var e=new URLSearchParams(window.location.search).get(k);if(e)try{var t=JSON.parse(e);return j(t)&&!T(t)?t:void 0}catch(e){return}}}function E(e){return String(e).padStart(2,"0")}function A(e){var t=e.record,n=w(),r=t.status,a=x(t,"execution.status");if(null==r&&null!=a&&0!==a)return s().createElement(i.Tag,null,n("Unprocessed"));var l=o.find(function(e){return e.value===r});return l?s().createElement(i.Tag,{color:l.color},n(l.label)):s().createElement(i.Tag,null,null==r?"-":String(r))}function R(e){var n,r,o,a,u,p=e.onlyIcon,b=w(),d=(0,f.useNavigate)(),y=(0,f.useLocation)(),v=null==(a=(0,l.useFlowEngine)().context.dataSourceManager)||null==(o=a.getDataSource)||null==(r=o.call(a,"main"))||null==(n=r.getCollection)?void 0:n.call(r,"workflowManualTasks"),g=b("Filter"),m=(0,c.useCallback)(function(e){var t,n,r;d((n=new URLSearchParams(y.search),T(e)?n.delete(k):n.set(k,JSON.stringify(e)),r=n.toString(),"".concat(y.pathname).concat(r?"?".concat(r):"").concat(null!=(t=y.hash)?t:"")),{replace:!0})},[y,d]),h=s().createElement(t.CollectionFilter,{key:y.search||"empty-filter",collection:v,initialValue:null!=(u=_())?u:O,onChange:m,t:b,filterableFieldNames:["title","workflow"],buttonText:p?"":void 0,showCount:!1,buttonProps:{"aria-label":p?g:void 0}});return p?s().createElement(i.Tooltip,{title:g},h):h}function C(e){if(!e||"/"===e)return"";var t=e.replace(/\/+$/,"");return t.startsWith("/")?t:"/".concat(t)}var M={key:r,title:'{{t("My manual tasks", { ns: "'.concat(b,'" })}}'),collection:"workflowManualTasks",action:"listMine",useActionParams:function(e){var t,n,r,o,a,l=null!=(a=S[e])?a:{},i=(t=l.filter,n=_(),T(t)?null!=n?n:{}:T(n)?null!=t?t:{}:{$and:[t,n]});return r=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){g(e,t,n[t])})}return e}({},l),o=o={filter:i,appends:m,except:h},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r},Actions:function(e){var n=e.onlyIcon,r=e.reload,o=i.App.useApp().message,l=w(),u=(0,c.useCallback)(function(){var e;return(e=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)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 a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}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(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,null==r?void 0:r()];case 1:return e.sent(),[3,3];case 2:return console.error("Failed to refresh workflow manual tasks",e.sent()),o.error(l("Load failed")),[3,3];case 3:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){v(a,r,o,l,i,"next",e)}function i(e){v(a,r,o,l,i,"throw",e)}l(void 0)})})()},[o,r,l]),f=s().createElement(i.Button,{icon:s().createElement(a.ReloadOutlined,null),onClick:u,"aria-label":l("Refresh")},n?null:l("Refresh"));return s().createElement(t.ExtendCollectionsProvider,{collections:p},s().createElement(i.Space,{size:"small",wrap:!0},n?s().createElement(i.Tooltip,{title:l("Refresh")},f):f,s().createElement(R,{onlyIcon:n})))},Item:function(){var e,t,r=(0,n.useWorkflowTaskRecord)().record,o=w(),a=null!=(e=null!=(t=P(r,"title"))?t:P(r,"node.title"))?e:o("Task"),l=P(r,"workflow.title");return s().createElement(i.Card,{size:"small",hoverable:!0,title:a,extra:l},s().createElement(i.Descriptions,{column:1,size:"small",items:[{key:"createdAt",label:o("Created at"),children:function(e){var t="string"==typeof e||"number"==typeof e?String(e):void 0;if(!t)return"-";var n=new Date(t);return Number.isNaN(n.getTime())?t:"".concat(n.getFullYear(),"-").concat(E(n.getMonth()+1),"-").concat(E(n.getDate())," ").concat(E(n.getHours()),":").concat(E(n.getMinutes()),":").concat(E(n.getSeconds()))}(r.createdAt)},{key:"status",label:o("Status"),children:s().createElement(A,{record:r})}]}))},Detail:function(){var e,o,c,u,f=(0,n.useWorkflowTaskRecord)().record,p=(0,l.useFlowContext)(),b=function(e,n){var o=(u=C(e),s=C("u"<typeof window?e:window.__nocobase_public_path__||e),f=C((0,t.stripModernClientPrefix)(s)),p=u===s?"":s&&u.startsWith("".concat(s,"/"))?u.slice(s.length):"","".concat(f).concat(p)),a=null==n?"":encodeURIComponent(String(n)),l="".concat(o,"/admin/workflow/tasks/").concat(r,"/pending").concat(a?"/".concat(a):"");if("u"<typeof window||null==n)return l;var i=(b=window.location.pathname,(d=C(e))?b===d?"/":b.startsWith("".concat(d,"/"))?b.slice(d.length):b:b),c="/admin/workflow/tasks/";if(i.startsWith(c)){var u,s,f,p,b,d,w,v=function(e){if(Array.isArray(e))return e}(w=i.slice(c.length).split("/"))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(w)||function(e){if(e){if("string"==typeof e)return y(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 y(e,void 0)}}(w)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=v[0],m=v[1],h=v[2];if(0===v.slice(3).length&&m&&g===r&&(h===String(n)||h===a)){var k="".concat(o,"/admin/workflow/tasks/").concat(r,"/").concat(m,"/").concat(a);return"".concat(k).concat(window.location.search).concat(window.location.hash)}}return l}(null!=(e=null==p||null==(c=p.router)||null==(o=c.getBasename)?void 0:o.call(c))?e:null==p||null==(u=p.router)?void 0:u.basename,(0,n.getWorkflowTaskRecordKey)(f)),d=w();return s().createElement(i.Result,{status:"info",title:d("Manual task cannot be processed on the new page"),subTitle:d("Manual tasks are not yet supported on the new page. Return to the legacy page to process this task."),extra:s().createElement(i.Button,{type:"primary",href:b,icon:s().createElement(a.ArrowRightOutlined,{"aria-hidden":!0})},d("Return to legacy page"))})}};function I(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function N(e,t,n){return(N=D()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&$(o,n.prototype),o}).apply(null,arguments)}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e){var t="function"==typeof Map?new Map:void 0;return(F=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 N(e,arguments,q(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(n,e)})(e)}function D(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(D=function(){return!!e})()}var W=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var e,t;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,t=arguments,e=q(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,D()?Reflect.construct(e,t||[],q(this).constructor):e.apply(this,t))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&$(o,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t,o;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)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 a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}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(a){return null==(o=null!=(e=this.app.pm.get(n.PluginWorkflowClientV2))?e:this.app.pm.get("workflow"))||null==(t=o.registerTaskType)||t.call(o,r,M),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){I(a,r,o,l,i,"next",e)}function i(e){I(a,r,o,l,i,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(o.prototype,t),o}(F(t.Plugin))}(),d}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE = "@nocobase/plugin-workflow-manual";
10
+ export declare function useT(): (key: string, options?: Record<string, unknown>) => string;
@@ -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 { Plugin, type Application } from '@nocobase/client-v2';
10
+ export declare class PluginWorkflowManualClientV2 extends Plugin<Record<string, never>, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginWorkflowManualClientV2;
@@ -0,0 +1,17 @@
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 { type TaskTypeOptions, type WorkflowTaskStatus } from '@nocobase/plugin-workflow/client-v2';
10
+ type RecordObject = Record<string, unknown>;
11
+ export declare function useManualTaskActionParams(status: WorkflowTaskStatus): {
12
+ filter: RecordObject;
13
+ appends: string[];
14
+ except: string[];
15
+ };
16
+ export declare const manualTaskType: TaskTypeOptions;
17
+ export {};
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-alpha.1",
11
+ "@nocobase/client": "2.2.0-alpha.11",
12
12
  "react": "18.2.0",
13
13
  "react-router-dom": "6.30.1",
14
14
  "@formily/react": "2.3.7",
@@ -19,14 +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.1",
23
- "@nocobase/plugin-mobile": "2.2.0-alpha.1",
24
- "@nocobase/utils": "2.2.0-alpha.1",
25
- "@nocobase/server": "2.2.0-alpha.1",
26
- "@nocobase/database": "2.2.0-alpha.1",
27
- "@nocobase/actions": "2.2.0-alpha.1",
28
- "@nocobase/test": "2.2.0-alpha.1",
29
- "@nocobase/plugin-workflow-test": "2.2.0-alpha.1",
22
+ "@nocobase/plugin-workflow": "2.2.0-alpha.11",
23
+ "@nocobase/plugin-mobile": "2.2.0-alpha.11",
24
+ "@nocobase/flow-engine": "2.2.0-alpha.11",
25
+ "@nocobase/client-v2": "2.2.0-alpha.11",
26
+ "@nocobase/utils": "2.2.0-alpha.11",
27
+ "@nocobase/server": "2.2.0-alpha.11",
28
+ "@nocobase/database": "2.2.0-alpha.11",
29
+ "@nocobase/actions": "2.2.0-alpha.11",
30
+ "@nocobase/test": "2.2.0-alpha.11",
31
+ "@nocobase/plugin-workflow-test": "2.2.0-alpha.11",
30
32
  "@formily/core": "2.3.7",
31
33
  "sequelize": "6.35.2"
32
34
  };
@@ -17,9 +17,12 @@
17
17
  "Field name existed in form": "Field name existed in form",
18
18
  "Filter settings": "Filter settings",
19
19
  "Manual": "Manual",
20
+ "Manual task cannot be processed on the new page": "Manual task cannot be processed on the new page",
21
+ "Manual tasks are not yet supported on the new page. Return to the legacy page to process this task.": "Manual tasks are not yet supported on the new page. Return to the legacy page to process this task.",
20
22
  "My manual tasks": "My manual tasks",
21
23
  "Negotiation": "Negotiation",
22
24
  "Please check one of your update record form, and add at least one filter condition in form settings.": "Please check one of your update record form, and add at least one filter condition in form settings.",
25
+ "Return to legacy page": "Return to legacy page",
23
26
  "Save temporarily": "Save temporarily",
24
27
  "Separately": "Separately",
25
28
  "Task": "Task",
@@ -33,4 +36,4 @@
33
36
  "Values preset in this form will override user submitted ones when continue or reject.": "Values preset in this form will override user submitted ones when continue or reject.",
34
37
  "View user interface": "View user interface",
35
38
  "Workflow todos": "Workflow todos"
36
- }
39
+ }
@@ -17,9 +17,12 @@
17
17
  "Field name existed in form": "表单中已有对应标识的字段",
18
18
  "Filter settings": "筛选设置",
19
19
  "Manual": "人工处理",
20
+ "Manual task cannot be processed on the new page": "人工任务无法在新版页面中处理",
21
+ "Manual tasks are not yet supported on the new page. Return to the legacy page to process this task.": "新版页面暂不支持处理人工任务,请返回旧版页面处理该任务。",
20
22
  "My manual tasks": "我的人工任务",
21
23
  "Negotiation": "协商机制",
22
24
  "Please check one of your update record form, and add at least one filter condition in form settings.": "请检查您的其中的更新数据表单,并在表单设置中至少添加一个筛选条件。",
25
+ "Return to legacy page": "返回旧版页面",
23
26
  "Save temporarily": "暂存",
24
27
  "Separately": "分别处理",
25
28
  "Task": "Task",
@@ -33,4 +36,4 @@
33
36
  "Values preset in this form will override user submitted ones when continue or reject.": "表单中预设的字段值会在用户提交继续或拒绝时覆盖相应字段的值。",
34
37
  "View user interface": "查看界面",
35
38
  "Workflow todos": "工作流待办"
36
- }
39
+ }
@@ -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-06-10T18:13:29.981Z"}
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-28T07:42:02.517Z"}
@@ -7,7 +7,8 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Registry } from '@nocobase/utils';
10
- import WorkflowPlugin, { Processor, Instruction } from '@nocobase/plugin-workflow';
10
+ import WorkflowPlugin, { Instruction, Processor } from '@nocobase/plugin-workflow';
11
+ import type { FlowNodeModel, JobModel } from '@nocobase/plugin-workflow';
11
12
  import { FormHandler } from './forms';
12
13
  type FormType = {
13
14
  type: 'custom' | 'create' | 'update';
@@ -31,7 +32,7 @@ export default class extends Instruction {
31
32
  workflow: WorkflowPlugin;
32
33
  formTypes: Registry<FormHandler>;
33
34
  constructor(workflow: WorkflowPlugin);
34
- run(node: any, prevJob: any, processor: Processor): Promise<import("@nocobase/plugin-workflow").JobModel>;
35
- resume(node: any, job: any, processor: Processor): Promise<any>;
35
+ run(node: any, prevJob: any, processor: Processor): Promise<JobModel>;
36
+ resume(node: FlowNodeModel, job: JobModel, processor: Processor): Promise<JobModel>;
36
37
  }
37
38
  export {};
@@ -42,64 +42,6 @@ module.exports = __toCommonJS(ManualInstruction_exports);
42
42
  var import_utils = require("@nocobase/utils");
43
43
  var import_plugin_workflow = require("@nocobase/plugin-workflow");
44
44
  var import_forms = __toESM(require("./forms"));
45
- const MULTIPLE_ASSIGNED_MODE = {
46
- SINGLE: Symbol("single"),
47
- ALL: Symbol("all"),
48
- ANY: Symbol("any"),
49
- ALL_PERCENTAGE: Symbol("all percentage"),
50
- ANY_PERCENTAGE: Symbol("any percentage")
51
- };
52
- const Modes = {
53
- [MULTIPLE_ASSIGNED_MODE.SINGLE]: {
54
- getStatus(distribution, assignees) {
55
- const done = distribution.find((item) => item.status !== import_plugin_workflow.JOB_STATUS.PENDING && item.count > 0);
56
- return done ? done.status : null;
57
- }
58
- },
59
- [MULTIPLE_ASSIGNED_MODE.ALL]: {
60
- getStatus(distribution, assignees) {
61
- const resolved = distribution.find((item) => item.status === import_plugin_workflow.JOB_STATUS.RESOLVED);
62
- if (resolved && resolved.count === assignees.length) {
63
- return import_plugin_workflow.JOB_STATUS.RESOLVED;
64
- }
65
- const rejected = distribution.find((item) => item.status < import_plugin_workflow.JOB_STATUS.PENDING);
66
- if (rejected && rejected.count) {
67
- return rejected.status;
68
- }
69
- return null;
70
- }
71
- },
72
- [MULTIPLE_ASSIGNED_MODE.ANY]: {
73
- getStatus(distribution, assignees) {
74
- const resolved = distribution.find((item) => item.status === import_plugin_workflow.JOB_STATUS.RESOLVED);
75
- if (resolved && resolved.count) {
76
- return import_plugin_workflow.JOB_STATUS.RESOLVED;
77
- }
78
- const rejectedCount = distribution.reduce(
79
- (count, item) => item.status < import_plugin_workflow.JOB_STATUS.PENDING ? count + item.count : count,
80
- 0
81
- );
82
- if (rejectedCount === assignees.length) {
83
- return import_plugin_workflow.JOB_STATUS.REJECTED;
84
- }
85
- return null;
86
- }
87
- }
88
- };
89
- function getMode(mode) {
90
- switch (true) {
91
- case mode === 1:
92
- return Modes[MULTIPLE_ASSIGNED_MODE.ALL];
93
- case mode === -1:
94
- return Modes[MULTIPLE_ASSIGNED_MODE.ANY];
95
- case mode > 0:
96
- return Modes[MULTIPLE_ASSIGNED_MODE.ALL_PERCENTAGE];
97
- case mode < 0:
98
- return Modes[MULTIPLE_ASSIGNED_MODE.ANY_PERCENTAGE];
99
- default:
100
- return Modes[MULTIPLE_ASSIGNED_MODE.SINGLE];
101
- }
102
- }
103
45
  class ManualInstruction_default extends import_plugin_workflow.Instruction {
104
46
  constructor(workflow) {
105
47
  super(workflow);
@@ -136,35 +78,7 @@ class ManualInstruction_default extends import_plugin_workflow.Instruction {
136
78
  return job;
137
79
  }
138
80
  async resume(node, job, processor) {
139
- var _a;
140
- const { mode } = node.config;
141
- const TaskRepo = this.workflow.app.db.getRepository("workflowManualTasks");
142
- const tasks = await TaskRepo.find({
143
- where: {
144
- jobId: job.id
145
- }
146
- });
147
- const assignees = [];
148
- const distributionMap = tasks.reduce((result2, item) => {
149
- if (result2[item.status] == null) {
150
- result2[item.status] = 0;
151
- }
152
- result2[item.status] += 1;
153
- assignees.push(item.userId);
154
- return result2;
155
- }, {});
156
- const distribution = Object.keys(distributionMap).map((status2) => ({
157
- status: Number.parseInt(status2, 10),
158
- count: distributionMap[status2]
159
- }));
160
- const submitted = tasks.reduce((count, item) => item.status !== import_plugin_workflow.JOB_STATUS.PENDING ? count + 1 : count, 0);
161
- const status = job.status || (getMode(mode).getStatus(distribution, assignees) ?? import_plugin_workflow.JOB_STATUS.PENDING);
162
- const result = mode ? (submitted || 0) / assignees.length : ((_a = job.latestTask) == null ? void 0 : _a.result) ?? job.result;
163
- processor.logger.debug(`manual resume job and next status: ${status}`);
164
- job.set({
165
- status,
166
- result
167
- });
81
+ processor.logger.debug(`manual resume job and next status: ${job.status}`);
168
82
  return job;
169
83
  }
170
84
  }
@@ -41,7 +41,62 @@ __export(actions_exports, {
41
41
  });
42
42
  module.exports = __toCommonJS(actions_exports);
43
43
  var import_actions = __toESM(require("@nocobase/actions"));
44
+ var import_database = require("@nocobase/database");
44
45
  var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
46
+ function getSubmittedRatio(tasks) {
47
+ if (!tasks.length) {
48
+ return 0;
49
+ }
50
+ const submitted = tasks.reduce((count, item) => item.status !== import_plugin_workflow.JOB_STATUS.PENDING ? count + 1 : count, 0);
51
+ return submitted / tasks.length;
52
+ }
53
+ function getSingleModeStatus(distribution) {
54
+ var _a;
55
+ return ((_a = distribution.find((item) => item.status !== import_plugin_workflow.JOB_STATUS.PENDING && item.count > 0)) == null ? void 0 : _a.status) ?? null;
56
+ }
57
+ function getAllModeStatus(distribution, assignees) {
58
+ const resolved = distribution.find((item) => item.status === import_plugin_workflow.JOB_STATUS.RESOLVED);
59
+ if ((resolved == null ? void 0 : resolved.count) === assignees.length) {
60
+ return import_plugin_workflow.JOB_STATUS.RESOLVED;
61
+ }
62
+ const rejected = distribution.find((item) => item.status < import_plugin_workflow.JOB_STATUS.PENDING);
63
+ return (rejected == null ? void 0 : rejected.count) ? rejected.status : null;
64
+ }
65
+ function getAnyModeStatus(distribution, assignees) {
66
+ const resolved = distribution.find((item) => item.status === import_plugin_workflow.JOB_STATUS.RESOLVED);
67
+ if (resolved == null ? void 0 : resolved.count) {
68
+ return import_plugin_workflow.JOB_STATUS.RESOLVED;
69
+ }
70
+ const rejectedCount = distribution.reduce(
71
+ (count, item) => item.status < import_plugin_workflow.JOB_STATUS.PENDING ? count + item.count : count,
72
+ 0
73
+ );
74
+ return rejectedCount === assignees.length ? import_plugin_workflow.JOB_STATUS.REJECTED : null;
75
+ }
76
+ async function updateJobByManualTasks(job, node, database, latestTask, transaction) {
77
+ const mode = node.config.mode ?? 0;
78
+ const tasks = await database.getModel("workflowManualTasks").findAll({
79
+ where: {
80
+ jobId: job.id
81
+ },
82
+ transaction
83
+ });
84
+ const assignees = [];
85
+ const distributionMap = /* @__PURE__ */ new Map();
86
+ for (const task of tasks) {
87
+ distributionMap.set(task.status, (distributionMap.get(task.status) ?? 0) + 1);
88
+ assignees.push(task.userId);
89
+ }
90
+ const distribution = Array.from(distributionMap.entries()).map(([status2, count]) => ({ status: status2, count }));
91
+ const status = mode === 1 ? getAllModeStatus(distribution, assignees) : mode === -1 ? getAnyModeStatus(distribution, assignees) : getSingleModeStatus(distribution);
92
+ await job.update(
93
+ {
94
+ status: status ?? import_plugin_workflow.JOB_STATUS.PENDING,
95
+ result: mode ? getSubmittedRatio(tasks) : latestTask.result ?? job.result
96
+ },
97
+ { transaction }
98
+ );
99
+ }
45
100
  async function submit(context, next) {
46
101
  var _a, _b, _c;
47
102
  const repository = import_actions.utils.getRepositoryFromParams(context);
@@ -78,48 +133,99 @@ async function submit(context, next) {
78
133
  return context.throw(400);
79
134
  }
80
135
  task.execution.workflow = task.workflow;
81
- const processor = plugin.createProcessor(task.execution);
82
- await processor.prepare();
83
- const assignees = processor.getParsedValue(task.node.config.assignees ?? [], task.nodeId).flat().filter(Boolean);
84
- if (!assignees.includes(currentUser.id) || task.userId !== currentUser.id) {
85
- return context.throw(403);
86
- }
87
- const presetValues = processor.getParsedValue(actionItem.values ?? {}, task.nodeId, {
88
- additionalScope: {
89
- // @deprecated
90
- currentUser,
91
- // @deprecated
92
- currentRecord: values.result[formKey],
93
- // @deprecated
94
- currentTime: /* @__PURE__ */ new Date(),
95
- $user: currentUser,
96
- $nForm: values.result[formKey],
97
- $nDate: {
98
- now: /* @__PURE__ */ new Date()
136
+ const formConfig = forms[formKey];
137
+ const handler = instruction.formTypes.get(formConfig.type);
138
+ const usesMainDataSource = (formConfig.dataSource ?? "main") === "main";
139
+ const transactionOptions = context.db.sequelize.getDialect() === "sqlite" ? { type: import_database.Transaction.TYPES.IMMEDIATE } : {};
140
+ const validateTask = () => {
141
+ if (task.status !== import_plugin_workflow.JOB_STATUS.PENDING || task.job.status !== import_plugin_workflow.JOB_STATUS.PENDING || task.execution.status !== import_plugin_workflow.EXECUTION_STATUS.STARTED) {
142
+ return context.throw(400);
143
+ }
144
+ };
145
+ const getPresetValues = (processor) => {
146
+ const assignees = processor.getParsedValue(task.node.config.assignees ?? [], task.nodeId).flat().filter(Boolean);
147
+ if (!assignees.includes(currentUser.id) || task.userId !== currentUser.id) {
148
+ return context.throw(403);
149
+ }
150
+ return processor.getParsedValue(actionItem.values ?? {}, task.nodeId, {
151
+ additionalScope: {
152
+ // @deprecated
153
+ currentUser,
154
+ // @deprecated
155
+ currentRecord: values.result[formKey],
156
+ // @deprecated
157
+ currentTime: /* @__PURE__ */ new Date(),
158
+ $user: currentUser,
159
+ $nForm: values.result[formKey],
160
+ $nDate: {
161
+ now: /* @__PURE__ */ new Date()
162
+ }
99
163
  }
164
+ });
165
+ };
166
+ const setTaskResult = (presetValues) => {
167
+ task.set({
168
+ status: actionItem.status,
169
+ result: actionItem.status ? { [formKey]: { ...values.result[formKey], ...presetValues }, _: actionKey } : { ...task.result ?? {}, ...values.result }
170
+ });
171
+ task.changed("result", true);
172
+ };
173
+ const handleFormSubmission = async (transaction) => {
174
+ const processor = plugin.createProcessor(task.execution, { transaction });
175
+ await processor.prepare();
176
+ const presetValues = getPresetValues(processor);
177
+ setTaskResult(presetValues);
178
+ if (handler && task.status) {
179
+ const { actions: actions2, ...formOptions } = formConfig;
180
+ const parsedFormConfig = {
181
+ ...processor.getParsedValue(formOptions, task.nodeId),
182
+ actions: actions2
183
+ };
184
+ await handler.call(instruction, task, parsedFormConfig, transaction);
100
185
  }
101
- });
102
- task.set({
103
- status: actionItem.status,
104
- result: actionItem.status ? { [formKey]: { ...values.result[formKey], ...presetValues }, _: actionKey } : { ...task.result ?? {}, ...values.result }
105
- });
106
- task.changed("result", true);
107
- const handler = instruction.formTypes.get(forms[formKey].type);
108
- if (handler && task.status) {
109
- await handler.call(instruction, task, forms[formKey], processor);
186
+ return presetValues;
187
+ };
188
+ let shouldResume = false;
189
+ try {
190
+ const lock = await context.app.lockManager.tryAcquire((0, import_plugin_workflow.getJobLockKey)(task.job.id));
191
+ await lock.runExclusive(async () => {
192
+ let presetValues = {};
193
+ if (!usesMainDataSource) {
194
+ await Promise.all([task.reload(), task.job.reload(), task.execution.reload()]);
195
+ validateTask();
196
+ presetValues = await handleFormSubmission();
197
+ }
198
+ await context.db.sequelize.transaction(transactionOptions, async (transaction) => {
199
+ await Promise.all([
200
+ task.reload({ transaction }),
201
+ task.job.reload({ transaction }),
202
+ task.execution.reload({ transaction })
203
+ ]);
204
+ validateTask();
205
+ if (usesMainDataSource) {
206
+ await handleFormSubmission(transaction);
207
+ } else {
208
+ setTaskResult(presetValues);
209
+ }
210
+ await task.save({ transaction });
211
+ await updateJobByManualTasks(task.job, task.node, context.db, task, transaction);
212
+ shouldResume = task.job.status !== import_plugin_workflow.JOB_STATUS.PENDING;
213
+ });
214
+ }, 6e4);
215
+ } catch (error) {
216
+ if ((0, import_plugin_workflow.isLockAcquireError)(error)) {
217
+ return context.throw(409);
218
+ }
219
+ throw error;
110
220
  }
111
- await task.save();
112
- await processor.exit();
113
221
  context.body = task;
114
222
  context.status = 202;
115
223
  await next();
116
- if (task.execution.status !== import_plugin_workflow.EXECUTION_STATUS.STARTED) {
224
+ if (!shouldResume) {
117
225
  return;
118
226
  }
119
- task.job.execution = task.execution;
120
- task.job.latestTask = task;
121
- processor.logger.info(`manual node (${task.nodeId}) action trigger execution (${task.execution.id}) to resume`);
122
- plugin.resume(task.job);
227
+ plugin.getLogger(task.execution.workflowId).info(`manual node (${task.nodeId}) action trigger execution (${task.execution.id}) to resume`);
228
+ plugin.resume(task.job).catch(() => void 0);
123
229
  }
124
230
  async function listMine(context, next) {
125
231
  context.action.mergeParams({
@@ -6,9 +6,9 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Processor } from '@nocobase/plugin-workflow';
9
+ import type { Transaction } from '@nocobase/database';
10
10
  import ManualInstruction from '../ManualInstruction';
11
11
  export default function (this: ManualInstruction, instance: any, { dataSource, collection }: {
12
12
  dataSource?: string;
13
13
  collection: any;
14
- }, processor: Processor): Promise<void>;
14
+ }, transaction?: Transaction): Promise<void>;
@@ -29,7 +29,7 @@ __export(create_exports, {
29
29
  default: () => create_default
30
30
  });
31
31
  module.exports = __toCommonJS(create_exports);
32
- async function create_default(instance, { dataSource = "main", collection }, processor) {
32
+ async function create_default(instance, { dataSource = "main", collection }, transaction) {
33
33
  const repo = this.workflow.app.dataSourceManager.dataSources.get(dataSource).collectionManager.getRepository(collection);
34
34
  if (!repo) {
35
35
  throw new Error(`collection ${collection} for create data on manual node not found`);
@@ -43,8 +43,8 @@ async function create_default(instance, { dataSource = "main", collection }, pro
43
43
  updatedBy: instance.userId
44
44
  },
45
45
  context: {
46
- executionId: processor.execution.id
46
+ executionId: instance.executionId
47
47
  },
48
- transaction: processor.transaction
48
+ transaction
49
49
  });
50
50
  }
@@ -6,9 +6,9 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Processor } from '@nocobase/plugin-workflow';
9
+ import type { Transaction } from '@nocobase/database';
10
10
  import ManualInstruction from '../ManualInstruction';
11
- export type FormHandler = (this: ManualInstruction, instance: any, formConfig: any, processor: Processor) => Promise<void>;
11
+ export type FormHandler = (this: ManualInstruction, instance: any, formConfig: any, transaction?: Transaction) => Promise<void>;
12
12
  export default function ({ formTypes }: {
13
13
  formTypes: any;
14
14
  }): void;
@@ -6,10 +6,10 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Processor } from '@nocobase/plugin-workflow';
9
+ import type { Transaction } from '@nocobase/database';
10
10
  import ManualInstruction from '../ManualInstruction';
11
11
  export default function (this: ManualInstruction, instance: any, { dataSource, collection, filter }: {
12
12
  dataSource?: string;
13
13
  collection: any;
14
14
  filter?: {};
15
- }, processor: Processor): Promise<void>;
15
+ }, transaction?: Transaction): Promise<void>;
@@ -29,7 +29,7 @@ __export(update_exports, {
29
29
  default: () => update_default
30
30
  });
31
31
  module.exports = __toCommonJS(update_exports);
32
- async function update_default(instance, { dataSource = "main", collection, filter = {} }, processor) {
32
+ async function update_default(instance, { dataSource = "main", collection, filter = {} }, transaction) {
33
33
  const repo = this.workflow.app.dataSourceManager.dataSources.get(dataSource).collectionManager.getRepository(collection);
34
34
  if (!repo) {
35
35
  throw new Error(`collection ${collection} for update data on manual node not found`);
@@ -37,14 +37,14 @@ async function update_default(instance, { dataSource = "main", collection, filte
37
37
  const { _, ...form } = instance.result;
38
38
  const [values] = Object.values(form);
39
39
  await repo.update({
40
- filter: processor.getParsedValue(filter, instance.nodeId),
40
+ filter,
41
41
  values: {
42
42
  ...values ?? {},
43
43
  updatedBy: instance.userId
44
44
  },
45
45
  context: {
46
- executionId: processor.execution.id
46
+ executionId: instance.executionId
47
47
  },
48
- transaction: processor.transaction
48
+ transaction
49
49
  });
50
50
  }
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.1",
9
+ "version": "2.2.0-alpha.11",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/workflow-manual",
@@ -26,7 +26,9 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@nocobase/client": "2.x",
29
+ "@nocobase/client-v2": "2.x",
29
30
  "@nocobase/database": "2.x",
31
+ "@nocobase/flow-engine": "2.x",
30
32
  "@nocobase/plugin-data-source-main": "2.x",
31
33
  "@nocobase/plugin-mobile": "2.x",
32
34
  "@nocobase/plugin-users": "2.x",
@@ -35,7 +37,7 @@
35
37
  "@nocobase/test": "2.x",
36
38
  "@nocobase/utils": "2.x"
37
39
  },
38
- "gitHead": "303663aba6c6eefa27e6a6435b4c0352074ec40f",
40
+ "gitHead": "c9ff1f51e5c33bc6437b64eb779212be71b78f58",
39
41
  "keywords": [
40
42
  "Workflow"
41
43
  ]