@nocobase/plugin-workflow-cc 2.3.0-alpha.1 → 3.0.0-alpha.2

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.
@@ -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("@nocobase/plugin-notification-manager/client-v2"),require("react-router-dom"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-cc",["react-i18next","@nocobase/plugin-notification-manager/client-v2","react-router-dom","@ant-design/icons","@nocobase/plugin-workflow/client","@nocobase/flow-engine","ahooks","@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-cc"]=t(require("react-i18next"),require("@nocobase/plugin-notification-manager/client-v2"),require("react-router-dom"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("antd-style")):e["@nocobase/plugin-workflow-cc"]=t(e["react-i18next"],e["@nocobase/plugin-notification-manager/client-v2"],e["react-router-dom"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["antd-style"])}(self,function(e,t,n,r,o,i,c,a,u,l,s,f,p){return function(){"use strict";var d,b,y,m={488:function(e,t,n){n.d(t,{CU:function(){return i},MZ:function(){return c},kj:function(){return a}});var r=n(694);function o(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}n(953);var i="@nocobase/plugin-workflow-cc";function c(e,t){return(0,r.tExpr)(e,o({ns:i},t))}function a(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"],nsMode:"fallback"},n))}}},813:function(e,t,n){function r(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var c=e.apply(t,n);function a(e){r(c,o,i,a,u,"next",e)}function u(e){r(c,o,i,a,u,"throw",e)}a(void 0)})}}function i(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}n.d(t,{W:function(){return l}});var c=new WeakSet,a="__workflowCcModelLoadersRegistered__";function u(e){return o(function(){return i(this,function(t){return[2,e()]})})()}function l(e){c.has(e)||e[a]||"function"!=typeof e.registerModelLoaders||(e.registerModelLoaders({CCChildPageModel:{extends:"ChildPageModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("458").then(n.bind(n,401))];case 1:return[2,e.sent().CCChildPageModel]}})})()})}},CCChildPageTabModel:{extends:"ChildPageTabModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("458").then(n.bind(n,401))];case 1:return[2,e.sent().CCChildPageTabModel]}})})()})}},CCBlockGridModel:{extends:"BlockGridModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("746").then(n.bind(n,561))];case 1:return[2,e.sent().CCBlockGridModel]}})})()})}},CCTriggerBlockGridModel:{extends:"BlockGridModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("86").then(n.bind(n,29))];case 1:return[2,e.sent().CCTriggerBlockGridModel]}})})()})}},CCTaskCardDetailsModel:{extends:"DetailsBlockModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("164").then(n.bind(n,303))];case 1:return[2,e.sent().CCTaskCardDetailsModel]}})})()})}},CCTaskCardGridModel:{extends:"DetailsGridModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("352").then(n.bind(n,923))];case 1:return[2,e.sent().CCTaskCardGridModel]}})})()})}},CCTaskCardDetailsItemModel:{extends:"DetailsItemModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("437").then(n.bind(n,628))];case 1:return[2,e.sent().CCTaskCardDetailsItemModel]}})})()})}},CCTaskCardDetailsAssociationFieldGroupModel:{extends:"DetailsAssociationFieldGroupModel",loader:function(){return u(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("486").then(n.bind(n,429))];case 1:return[2,e.sent().CCTaskCardDetailsAssociationFieldGroupModel]}})})()})}}}),c.add(e),e[a]=!0)}},42:function(e,t,n){var r=n(358);t.A={name:"workflowCcTasks",dataCategory:"business",filterTargetKey:"id",simplePaginate:!0,dumpRules:{group:"log"},migrationRules:["schema-only"],shared:!0,createdAt:!0,updatedAt:!0,fields:[{type:"snowflakeId",name:"id",primaryKey:!0,allowNull:!1},{type:"belongsTo",name:"job",target:"jobs",foreignKey:"jobId",primaryKey:!1},{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",primaryKey:!1},{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(r.CU,'" })}}'),"x-component":"Input"}},{type:"belongsTo",name:"execution",onDelete:"CASCADE"},{type:"belongsTo",name:"node",target:"flow_nodes",uiSchema:{type:"object",title:'{{t("CC node", { ns: "'.concat(r.CU,'" })}}')}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",onDelete:"CASCADE",interface:"m2o",uiSchema:{type:"object",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"id"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "'.concat(r.CU,'" })}}'),"x-component":"Select",enum:[{label:'{{t("Unread", { ns: "'.concat(r.CU,'" })}}'),value:0,color:"gold"},{label:'{{t("Read", { ns: "'.concat(r.CU,'" })}}'),value:1,color:"green"}]},defaultValue:0},{type:"date",name:"readAt",interface:"datetime",uiSchema:{type:"string",title:'{{t("Read at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"date",name:"createdAt",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"date",name:"updatedAt",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Updated at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}}]}},358:function(e,t,n){n.d(t,{CU:function(){return r},Rr:function(){return i},wl:function(){return o}});var r="@nocobase/plugin-workflow-cc",o="cc",i={UNREAD:0,READ:1}},375:function(e){e.exports=r},342:function(e){e.exports=f},485:function(e){e.exports=a},694:function(e){e.exports=i},341:function(e){e.exports=t},990:function(e){e.exports=o},197:function(e){e.exports=s},625:function(e){e.exports=c},59:function(e){e.exports=l},235:function(e){e.exports=p},155:function(e){e.exports=u},953:function(t){t.exports=e},442:function(e){e.exports=n}},v={};function h(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return m[e](n,n.exports,h),n.exports}h.m=m,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+e+"."+({164:"feee9c6f7d571d46",208:"d91a659a2b3502bd",352:"4012efde85e3acaf",437:"78f2b52a4a3fac84",458:"da07eac3bc1412d1",486:"5966b38a176b8313",746:"9362358210d85302",86:"e6c4759f3e699b2d"})[e]+".js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},w={},h.l=function(e,t,n,r){if(w[e])return void w[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-workflow-cc:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-cc:"+n),o.src=e),w[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=w[e];if(delete w[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.g.importScripts&&(g=h.g.location+"");var w,g,k=h.g.document;if(!g&&k&&(k.currentScript&&"SCRIPT"===k.currentScript.tagName.toUpperCase()&&(g=k.currentScript.src),!g)){var C=k.getElementsByTagName("script");if(C.length)for(var x=C.length-1;x>-1&&(!g||!/^http(s?):/.test(g));)g=C[x--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");h.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),d={889:0},h.f.j=function(e,t){var n=h.o(d,e)?d[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=d[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(d,e)&&(0!==(n=d[e])&&(d[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},b=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==d[e]})){for(n in i)h.o(i,n)&&(h.m[n]=i[n]);c&&c(h)}for(e&&e(t);a<o.length;a++)r=o[a],h.o(d,r)&&d[r]&&d[r][0](),d[r]=0},(y=self.webpackChunk_nocobase_plugin_workflow_cc=self.webpackChunk_nocobase_plugin_workflow_cc||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y));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-cc/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-cc/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 c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-cc/dist/client/"}h.p=e}(),!function(){h.r(O),h.d(O,{PluginWorkflowCCClient:function(){return el},default:function(){return es}});var e=h(155),t=h.n(e),n=h(342),r=h(990),o=h.n(r),i=h(375),c=h(197),a=h(488);function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=function(e){return'{{t("'.concat(e,'", { ns: "').concat(a.CU,'" })}}')};function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}var m=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,n=arguments,e=d(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,y()?Reflect.construct(e,n||[],d(this).constructor):e.apply(this,n))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e),t}(function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,n,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return n=r,o=arguments,n=l(n),u(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,f()?Reflect.construct(n,o||[],l(this).constructor):n.apply(this,o)),"title",p("CC")),u(e,"type","cc"),u(e,"group","manual"),u(e,"description",p("Provide a CC (carbon copy) feature in workflows to send approvals, or any other type of information to specified users.")),u(e,"icon",t().createElement(i.EyeOutlined,null)),u(e,"FieldsetLoader",function(){return h.e("208").then(h.bind(h,427)).then(function(e){return{default:e.CCFieldset}})}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),n=[{key:"createDefaultConfig",value:function(){return{}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(c.Instruction)),v=h(42),w=h(358),g=h(235),k=h(59),C=h(442);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=(0,n.usePlugin)(o());return(0,e.useMemo)(function(){if(!t)return[];var e,n,o,c,a=i.triggers.get(t.type),u=null==a||null==(c=a.useTempAssociationSource)?void 0:c.call(a,t.config,t),l=u||"string"!=typeof(o=null==(e=t)||null==(n=e.config)?void 0:n.collection)||!o||(null==e?void 0:e.id)==null?null:{collection:o,nodeId:e.id,nodeKey:"workflow",nodeType:"workflow"},s=(r||[]).map(function(e){var t,n;return null==(n=i.instructions.get(e.type))||null==(t=n.useTempAssociationSource)?void 0:t.call(n,e)}).filter(Boolean);return u||l?[u||l].concat(function(e){if(Array.isArray(e))return x(e)}(s)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||function(e){if(e){if("string"==typeof e)return x(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 x(e,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s},[t,r,i])}var j=h(953);function S(e){var t,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.i18n.t(e,(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}({},o),r=r={ns:w.CU},Object.getOwnPropertyDescriptors?Object.defineProperties(t,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(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}var A=h(485),E=h(694);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 _(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function R(n){var r,o=n.enableUIConfiguration,i=void 0!==o&&o,c=n.mapModel,a=void 0===c?function(e){return e}:c,u=n.onModelLoaded,l=n.reloadKey,s=n.uid,f=n.useCache,p=function(e){if(Array.isArray(e))return e}(r=(0,e.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(r)||function(e){if(e){if("string"==typeof e)return T(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d=p[0],b=p[1],y=(0,E.useFlowEngine)(),m=(0,E.useFlowViewContext)(),v=(0,e.useRef)(u),h=(0,e.useRef)(a),w=(0,e.useRef)(null),g=(0,e.useRef)(i);return(0,e.useEffect)(function(){v.current=u},[u]),(0,e.useEffect)(function(){h.current=a},[a]),(0,e.useEffect)(function(){var e,t=!1;return(e=function(){var e,n;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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:if(!s)return t||b(null),[2];return[4,y.loadModel({uid:s})];case 1:if(!(e=r.sent()))return t||b(null),[2];return e=h.current?h.current(e):e,m&&e.context.addDelegate(m),e.context.defineProperty("flowSettingsEnabled",{value:g.current}),w.current=e,t||(b(e),null==(n=v.current)||n.call(v,e)),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){_(i,r,o,c,a,"next",e)}function a(e){_(i,r,o,c,a,"throw",e)}c(void 0)})})(),function(){t=!0}},[y,l,s,m]),(0,e.useEffect)(function(){g.current=i,w.current&&w.current.context.defineProperty("flowSettingsEnabled",{value:i})},[i]),t().createElement(E.FlowModelRenderer,{fallback:t().createElement(A.SkeletonFallback,null),hideRemoveInSettings:!0,model:d,showFlowSettings:!1,useCache:void 0!==f&&f})}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 D(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function I(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function B(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 F(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function 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=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||G(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function G(e,t){if(e){if("string"==typeof e)return 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)}}function N(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function $(){var e=q(["\n .ant-modal-content {\n background: var(--nb-box-bg);\n }\n .ant-modal-header {\n background: none;\n }\n "]);return $=function(){return e},e}function K(){var e=q(["\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 K=function(){return e},e}function L(){var e=q(["\n .ant-card-extra {\n color: ",";\n }\n "]);return L=function(){return e},e}function W(){return{form:(0,n.useFormBlockContext)().form}}function z(){var e=(0,n.useCollectionRecordData)(),t=(0,n.useActionContext)(),r=(0,n.useAPIClient)(),o=(0,n.useCollectionRecordData)().id,i=((0,n.useListBlockContext)()||{}).service,c=e.status?"unread":"read";return{run:function(){return I(function(){var e;return N(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r.resource("workflowCcTasks")[c]({filterByTk:o})];case 1:return n.sent(),t.setVisible(!1),t.setSubmitted(!0),null==i||null==(e=i.refresh)||e.call(i),[3,3];case 2:return console.error("Failed to mark task as read:",n.sent()),[3,3];case 3:return[2]}})})()}}}function V(){return(0,n.useCollectionRecordData)().status?{title:S("Mark as unread")}:{type:"primary",title:S("Mark as read")}}function Z(){var e=(0,n.useAPIClient)(),t=(0,n.useListBlockContext)();return{run:function(){return I(function(){var n,r;return N(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.resource("workflowCcTasks").read()];case 1:return o.sent(),null==t||null==(r=t.service)||null==(n=r.refresh)||n.call(r),[3,3];case 2:return console.error("Failed to mark task as read:",o.sent()),[3,3];case 3:return[2]}})})()}}}function H(e){var t,n=null==(t=(0,r.useTasksCountsContext)().counts[w.wl])?void 0:t.pending;return F(B({},e),{disabled:0===n})}function J(){var i,c,a,u,l=(0,n.usePlugin)(o()),s=(0,n.useAPIClient)(),f=((0,n.useCollectionRecordData)()||{}).id,p=U((0,e.useState)(null),2),d=p[0],b=p[1],y=U((0,e.useState)((0,n.useCollectionRecordData)()),2),m=y[0],v=y[1],h=U((0,e.useState)(null),2),w=h[0],g=h[1],C=null!=(i=null==d||null==(c=d.nodes)?void 0:c.find(function(e){return e.id===(null==w?void 0:w.id)}))?i:w,x=(0,r.useAvailableUpstreams)(C),O=P(null==d?void 0:d.workflow,x);(0,e.useEffect)(function(){var e,t;f&&(null==(e=(t=s.resource("workflowCcTasks")).get)||e.call(t,{filterByTk:f,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs"]}).then(function(e){var t,n=e.data,o=null!=(t=null==n?void 0:n.data)?t:{},i=o.node,c=o.workflow,a=void 0===c?{}:c,u=a.nodes,l=void 0===u?[]:u,s=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}(a,["nodes"]),f=o.execution;(0,r.linkNodes)(l),g(i),b({workflow:s,nodes:l,execution:f}),v(null==n?void 0:n.data)}))},[s,f]);var j=null==w||null==(a=w.config)?void 0:a.ccUid;if(j&&w&&d){var S=l.triggers.get(d.workflow.type);return t().createElement(n.CollectionRecordProvider,{record:m},t().createElement(r.FlowContext.Provider,{value:d},t().createElement(r.NodeContext.Provider,{value:w},t().createElement(R,{uid:j,onModelLoaded:function(e){e.context.defineProperty("flowSettingsEnabled",{value:!1}),e.context.defineProperty("disableBlockGridPadding",{value:!0}),e.context.defineProperty("view",{value:{inputArgs:{flowContext:d,availableUpstreams:x,trigger:S,node:w}}}),e.context.defineProperty("workflow",{value:d.workflow}),e.context.defineProperty("nodes",{value:d.nodes}),e.context.defineProperty("tempAssociationSources",{value:O,cache:!1})}}))))}var A=x.reduce(function(e,t){var n=t.type;return Object.assign(e,l.instructions.get(n).components)},{});return w&&d?t().createElement(n.CollectionRecordProvider,{record:m},t().createElement(r.FlowContext.Provider,{value:d},t().createElement(r.NodeContext.Provider,{value:w},t().createElement(n.RemoteSchemaComponent,{components:B({DetailsBlockProvider:r.DetailsBlockProvider},A),scope:{useDetailsBlockProps:W},uid:null==(u=w.config)?void 0:u.ccDetail,noForm:!0})))):t().createElement(k.Spin,null)}function Q(e){var r=(0,j.useTranslation)().t,o=(0,g.useAntdToken)();return t().createElement(k.ConfigProvider,{theme:{token:{fontSizeLG:14}}},t().createElement(k.Descriptions,F(B({},e),{column:1,items:[{key:"createdAt",label:r("Created at"),children:t().createElement(n.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:r("Status",{ns:"workflow"}),children:t().createElement(n.SchemaComponent,{components:{},schema:{name:"status",type:"number","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,n.css)(K(),o.colorTextDescription)})))}var X=function(e,t){if(!e||!t)return[];var n,r=[],o=t.find(function(t){return t.id===e.upstreamId});return o&&r.push.apply(r,[o].concat(function(e){if(Array.isArray(e))return M(e)}(n=X(o,t))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||G(n)||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},Y={pending:{status:w.Rr.UNREAD},completed:{status:w.Rr.READ}},ee={key:w.wl,title:'{{t("CC to me", { ns: "'.concat(w.CU,'" })}}'),collection:"workflowCcTasks",action:"listMine",useActionParams:function(e){var t;return{filter:null!=(t=Y[e])?t:{},appends:["node.id","node.title","node.updatedAt","node.config","workflow.id","workflow.title","workflow.enabled","workflow.config","workflow.nodes","workflow.nodes.title","workflow.nodes.key","workflow.nodes.config","execution.id","execution.status"],except:["workflow.options","execution.context","execution.output"]}},Actions:function(e){return t().createElement(n.SchemaComponent,{scope:{useReadAllAction:Z,useReadAllActionProps:H},schema:{name:"actions",type:"void","x-component":"ActionBar",properties:{refresh:{type:"void",title:'{{t("Refresh", { ns: "'.concat(w.CU,'" })}}'),"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":B({icon:"ReloadOutlined"},e)},filter:{type:"void",title:'{{t("Filter", { ns: "'.concat(w.CU,'" })}}'),"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":B({icon:"FilterOutlined"},e),default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]}},readAll:{type:"void",title:'{{t("Mark all as read", { ns: "'.concat(w.CU,'" })}}'),"x-component":"Action","x-use-component-props":"useReadAllActionProps","x-component-props":B({useAction:"{{useReadAllAction}}",icon:"CheckOutlined"},e)}}}})},Item:function(){var o,i,c,a,u,l,s,f,p=(0,g.useAntdToken)(),d=(0,n.useCollectionRecordData)(),b=(0,C.useNavigate)(),y=(0,r.usePopupRecordContext)().setRecord,m=(0,e.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&(y(d),b("./".concat(d.id))),e.stopPropagation()},[b,d,y]),v=null==(c=d.node)||null==(i=c.config)?void 0:i.taskCardUid,h=X(d.node,null==(a=d.workflow)?void 0:a.nodes),w=P(d.workflow,h),x=(0,e.useCallback)(function(e){e.setDecoratorProps({onClick:m,hoverable:!0}),e.getCurrentRecord=function(){return d},e.context.defineProperty("workflow",{get:function(){return d.workflow},cache:!1}),e.context.defineProperty("nodes",{get:function(){var e,t;return null!=(e=null==(t=d.workflow)?void 0:t.nodes)?e:[]},cache:!1}),e.context.defineProperty("tempAssociationSources",{get:function(){return w},cache:!1})},[d,m,w]),O=(0,e.useCallback)(function(e){return e.clone()},[]),j=null!=(o=null==(s=d.node)||null==(l=s.updatedAt)||null==(u=l.valueOf)?void 0:u.call(l))?o:null==(f=d.node)?void 0:f.updatedAt;return v?t().createElement(R,{uid:v,onModelLoaded:x,mapModel:O,reloadKey:j}):t().createElement(k.Card,{onClick:m,hoverable:!0,size:"small",title:d.title,extra:t().createElement(r.WorkflowTitle,d.workflow),className:(0,n.css)(L(),p.colorTextDescription)},t().createElement(Q,null))},Detail:function(){var r,o=(0,e.useContext)(n.SchemaComponentContext),i=(0,n.useCollectionRecordData)(),c=i||{},a=c.id,u=c.node,l=c.workflow,s=c.status;return i?t().createElement(n.SchemaComponentContext.Provider,{value:F(B({},o),{reset:function(){},designable:!1})},t().createElement(n.SchemaComponent,{components:{FlowContextProvider:J},scope:{useReadAction:z,useReadActionProps:V},schema:{type:"void",name:"manual-detail-drawer-".concat(a,"-").concat(s),"x-component":"Action.Container","x-component-props":{className:(0,n.css)($())},title:null!=(r=null==u?void 0:u.title)?r:"".concat(null==l?void 0:l.title," - ").concat("#".concat(null==u?void 0:u.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:0}},properties:{read:{type:"void","x-component":"Action","x-use-component-props":"useReadActionProps","x-component-props":{useAction:"{{useReadAction}}"}}}}}}}}})):null},getPopupRecord:function(e,t){var n=t.params;return e.resource("workflowCcTasks").get(F(B({},n),{appends:["node","workflow","workflow.nodes","execution","execution.jobs"]}))}},et=h(813);function en(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function er(e,t,n){return(er=ea()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ei(o,n.prototype),o}).apply(null,arguments)}function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(e){var t="function"==typeof Map?new Map:void 0;return(ec=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 er(e,arguments,eo(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ei(n,e)})(e)}function ea(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ea=function(){return!!e})()}function eu(e){return t().createElement(n.ExtendCollectionsProvider,{collections:[v.A]},e.children)}var el=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eo(e),function(e,t){var n;if(t&&("object"==((n=t)&&"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,ea()?Reflect.construct(e,t||[],eo(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ei(r,e),t=[{key:"load",value: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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return this.app.addProvider(eu),(e=this.app.pm.get(o())).registerInstruction("cc",m),e.registerTaskType(w.wl,ee),(0,et.W)(this.flowEngine),this.app.schemaSettingsManager.add(new n.SchemaSettings({name:"actionSettings:workflow:cc:read",items:[{name:"editButton",Component:n.ButtonEditor,useComponentProps:function(){return(0,n.useSchemaToolbar)().buttonEditorProps}},{name:"delete",sort:100,Component:n.RemoveButton,useComponentProps:function(){return(0,n.useSchemaToolbar)().removeButtonProps}}]})),e.registerCollectionsToDataSource([v.A]),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){en(i,r,o,c,a,"next",e)}function a(e){en(i,r,o,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(ec(n.Plugin)),es=el}(),O}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-notification-manager/client-v2"),require("react-router-dom"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-cc",["react-i18next","@nocobase/plugin-notification-manager/client-v2","react-router-dom","@ant-design/icons","@nocobase/plugin-workflow/client","@nocobase/flow-engine","ahooks","@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-cc"]=t(require("react-i18next"),require("@nocobase/plugin-notification-manager/client-v2"),require("react-router-dom"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("antd-style")):e["@nocobase/plugin-workflow-cc"]=t(e["react-i18next"],e["@nocobase/plugin-notification-manager/client-v2"],e["react-router-dom"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["antd-style"])}(self,function(e,t,n,r,o,i,c,a,l,u,s,f,p){return function(){"use strict";var d,b,y,m={488:function(e,t,n){n.d(t,{CU:function(){return i},MZ:function(){return c},kj:function(){return a}});var r=n(694);function o(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}n(953);var i="@nocobase/plugin-workflow-cc";function c(e,t){return(0,r.tExpr)(e,o({ns:i},t))}function a(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"],nsMode:"fallback"},n))}}},813:function(e,t,n){function r(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var c=e.apply(t,n);function a(e){r(c,o,i,a,l,"next",e)}function l(e){r(c,o,i,a,l,"throw",e)}a(void 0)})}}function i(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=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}}}}n.d(t,{W:function(){return u}});var c=new WeakSet,a="__workflowCcModelLoadersRegistered__";function l(e){return o(function(){return i(this,function(t){return[2,e()]})})()}function u(e){c.has(e)||e[a]||"function"!=typeof e.registerModelLoaders||(e.registerModelLoaders({CCChildPageModel:{extends:"ChildPageModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("458").then(n.bind(n,401))];case 1:return[2,e.sent().CCChildPageModel]}})})()})}},CCChildPageTabModel:{extends:"ChildPageTabModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("458").then(n.bind(n,401))];case 1:return[2,e.sent().CCChildPageTabModel]}})})()})}},CCBlockGridModel:{extends:"BlockGridModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("746").then(n.bind(n,561))];case 1:return[2,e.sent().CCBlockGridModel]}})})()})}},CCTriggerBlockGridModel:{extends:"BlockGridModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("86").then(n.bind(n,29))];case 1:return[2,e.sent().CCTriggerBlockGridModel]}})})()})}},CCTaskCardDetailsModel:{extends:"DetailsBlockModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("164").then(n.bind(n,303))];case 1:return[2,e.sent().CCTaskCardDetailsModel]}})})()})}},CCTaskCardGridModel:{extends:"DetailsGridModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("352").then(n.bind(n,923))];case 1:return[2,e.sent().CCTaskCardGridModel]}})})()})}},CCTaskCardDetailsItemModel:{extends:"DetailsItemModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("437").then(n.bind(n,628))];case 1:return[2,e.sent().CCTaskCardDetailsItemModel]}})})()})}},CCTaskCardDetailsAssociationFieldGroupModel:{extends:"DetailsAssociationFieldGroupModel",loader:function(){return l(function(){return o(function(){return i(this,function(e){switch(e.label){case 0:return[4,n.e("486").then(n.bind(n,429))];case 1:return[2,e.sent().CCTaskCardDetailsAssociationFieldGroupModel]}})})()})}}}),c.add(e),e[a]=!0)}},42:function(e,t,n){var r=n(358);t.A={name:"workflowCcTasks",dataCategory:"business",filterTargetKey:"id",simplePaginate:!0,dumpRules:{group:"log"},migrationRules:["schema-only"],shared:!0,createdAt:!0,updatedAt:!0,fields:[{type:"snowflakeId",name:"id",primaryKey:!0,allowNull:!1},{type:"belongsTo",name:"job",target:"jobs",foreignKey:"jobId",primaryKey:!1},{type:"belongsTo",name:"user",target:"users",foreignKey:"userId",primaryKey:!1},{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(r.CU,'" })}}'),"x-component":"Input"}},{type:"belongsTo",name:"execution",onDelete:"CASCADE"},{type:"belongsTo",name:"node",target:"flow_nodes",uiSchema:{type:"object",title:'{{t("CC node", { ns: "'.concat(r.CU,'" })}}')}},{type:"belongsTo",name:"workflow",target:"workflows",foreignKey:"workflowId",onDelete:"CASCADE",interface:"m2o",uiSchema:{type:"object",title:'{{t("Workflow", { ns: "workflow" })}}',"x-component":"AssociationField","x-component-props":{fieldNames:{label:"title",value:"id"}}}},{type:"integer",name:"status",interface:"select",uiSchema:{type:"number",title:'{{t("Status", { ns: "'.concat(r.CU,'" })}}'),"x-component":"Select",enum:[{label:'{{t("Unread", { ns: "'.concat(r.CU,'" })}}'),value:0,color:"gold"},{label:'{{t("Read", { ns: "'.concat(r.CU,'" })}}'),value:1,color:"green"}]},defaultValue:0},{type:"date",name:"readAt",interface:"datetime",uiSchema:{type:"string",title:'{{t("Read at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"date",name:"createdAt",interface:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"date",name:"updatedAt",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Updated at", { ns: "'.concat(r.CU,'" })}}'),"x-component":"DatePicker","x-component-props":{showTime:!0}}}]}},358:function(e,t,n){n.d(t,{CU:function(){return r},Rr:function(){return i},wl:function(){return o}});var r="@nocobase/plugin-workflow-cc",o="cc",i={UNREAD:0,READ:1}},375:function(e){e.exports=r},342:function(e){e.exports=f},485:function(e){e.exports=a},694:function(e){e.exports=i},341:function(e){e.exports=t},990:function(e){e.exports=o},197:function(e){e.exports=s},625:function(e){e.exports=c},59:function(e){e.exports=u},235:function(e){e.exports=p},155:function(e){e.exports=l},953:function(t){t.exports=e},442:function(e){e.exports=n}},v={};function w(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return m[e](n,n.exports,w),n.exports}w.m=m,w.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return w.d(t,{a:t}),t},w.d=function(e,t){for(var n in t)w.o(t,n)&&!w.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},w.f={},w.e=function(e){return Promise.all(Object.keys(w.f).reduce(function(t,n){return w.f[n](e,t),t},[]))},w.u=function(e){return""+e+"."+({164:"feee9c6f7d571d46",208:"d91a659a2b3502bd",352:"4012efde85e3acaf",437:"78f2b52a4a3fac84",458:"da07eac3bc1412d1",486:"5966b38a176b8313",746:"9362358210d85302",86:"e6c4759f3e699b2d"})[e]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),w.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},w.l=function(e,t,n,r){if(h[e])return void h[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var l=c[a];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-workflow-cc:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-cc:"+n),o.src=e),h[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},w.g.importScripts&&(g=w.g.location+"");var h,g,k=w.g.document;if(!g&&k&&(k.currentScript&&"SCRIPT"===k.currentScript.tagName.toUpperCase()&&(g=k.currentScript.src),!g)){var C=k.getElementsByTagName("script");if(C.length)for(var x=C.length-1;x>-1&&(!g||!/^http(s?):/.test(g));)g=C[x--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");w.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),d={889:0},w.f.j=function(e,t){var n=w.o(d,e)?d[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=d[e]=[t,r]});t.push(n[2]=r);var o=w.p+w.u(e),i=Error();w.l(o,function(t){if(w.o(d,e)&&(0!==(n=d[e])&&(d[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},b=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==d[e]})){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);c&&c(w)}for(e&&e(t);a<o.length;a++)r=o[a],w.o(d,r)&&d[r]&&d[r][0](),d[r]=0},(y=self.webpackChunk_nocobase_plugin_workflow_cc=self.webpackChunk_nocobase_plugin_workflow_cc||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y));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-cc/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-cc/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 c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-cc/dist/client/"}w.p=e}(),!function(){w.r(O),w.d(O,{PluginWorkflowCCClient:function(){return eu},default:function(){return es}});var e=w(155),t=w.n(e),n=w(342),r=w(990),o=w.n(r),i=w(375),c=w(197),a=w(488);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=function(e){return'{{t("'.concat(e,'", { ns: "').concat(a.CU,'" })}}')};function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}var m=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,n=arguments,e=d(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,y()?Reflect.construct(e,n||[],d(this).constructor):e.apply(this,n))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e),t}(function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,n,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return n=r,o=arguments,n=u(n),l(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,f()?Reflect.construct(n,o||[],u(this).constructor):n.apply(this,o)),"title",p("CC")),l(e,"type","cc"),l(e,"group","manual"),l(e,"description",p("Provide a CC (carbon copy) feature in workflows to send approvals, or any other type of information to specified users.")),l(e,"icon",t().createElement(i.EyeOutlined,null)),l(e,"FieldsetLoader",function(){return w.e("208").then(w.bind(w,427)).then(function(e){return{default:e.CCFieldset}})}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),n=[{key:"createDefaultConfig",value:function(){return{}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(c.Instruction)),v=w(42),h=w(358),g=w(235),k=w(59),C=w(442);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=(0,n.usePlugin)(o());return(0,e.useMemo)(function(){if(!t)return[];var e,n,o,c,a=i.triggers.get(t.type),l=null==a||null==(c=a.useTempAssociationSource)?void 0:c.call(a,t.config,t),u=l||"string"!=typeof(o=null==(e=t)||null==(n=e.config)?void 0:n.collection)||!o||(null==e?void 0:e.id)==null?null:{collection:o,nodeId:e.id,nodeKey:"workflow",nodeType:"workflow"},s=(r||[]).map(function(e){var t,n;return null==(n=i.instructions.get(e.type))||null==(t=n.useTempAssociationSource)?void 0:t.call(n,e)}).filter(Boolean);return l||u?[l||u].concat(function(e){if(Array.isArray(e))return x(e)}(s)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||function(e){if(e){if("string"==typeof e)return x(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 x(e,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s},[t,r,i])}var j=w(953);function S(e){var t,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.i18n.t(e,(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}({},o),r=r={ns:h.CU},Object.getOwnPropertyDescriptors?Object.defineProperties(t,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(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}var A=w(485),E=w(694);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 _(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function R(n){var r,o=n.enableUIConfiguration,i=void 0!==o&&o,c=n.mapModel,a=void 0===c?function(e){return e}:c,l=n.onModelLoaded,u=n.reloadKey,s=n.uid,f=n.useCache,p=function(e){if(Array.isArray(e))return e}(r=(0,e.useState)(null))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(r)||function(e){if(e){if("string"==typeof e)return T(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d=p[0],b=p[1],y=(0,E.useFlowEngine)(),m=(0,E.useFlowViewContext)(),v=(0,e.useRef)(l),w=(0,e.useRef)(a),h=(0,e.useRef)(null),g=(0,e.useRef)(i);return(0,e.useEffect)(function(){v.current=l},[l]),(0,e.useEffect)(function(){w.current=a},[a]),(0,e.useEffect)(function(){var e,t=!1;return(e=function(){var e,n;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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=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(r){switch(r.label){case 0:if(!s)return t||b(null),[2];return[4,y.loadModel({uid:s})];case 1:if(!(e=r.sent()))return t||b(null),[2];return e=w.current?w.current(e):e,m&&e.context.addDelegate(m),e.context.defineProperty("flowSettingsEnabled",{value:g.current}),h.current=e,t||(b(e),null==(n=v.current)||n.call(v,e)),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){_(i,r,o,c,a,"next",e)}function a(e){_(i,r,o,c,a,"throw",e)}c(void 0)})})(),function(){t=!0}},[y,u,s,m]),(0,e.useEffect)(function(){g.current=i,h.current&&h.current.context.defineProperty("flowSettingsEnabled",{value:i})},[i]),t().createElement(E.FlowModelRenderer,{fallback:t().createElement(A.SkeletonFallback,null),hideRemoveInSettings:!0,model:d,showFlowSettings:!1,useCache:void 0!==f&&f})}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 D(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function I(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function B(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 F(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function 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=[],c=!0,a=!1;try{for(o=o.call(e);!(c=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||G(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function G(e,t){if(e){if("string"==typeof e)return 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)}}function N(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=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 $(){var e=q(["\n .ant-modal-content {\n background: var(--nb-box-bg);\n }\n .ant-modal-header {\n background: none;\n }\n "]);return $=function(){return e},e}function K(){var e=q(["\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 K=function(){return e},e}function L(){var e=q(["\n .ant-card-extra {\n color: ",";\n }\n "]);return L=function(){return e},e}function W(){return{form:(0,n.useFormBlockContext)().form}}function z(){var e=(0,n.useCollectionRecordData)(),t=(0,n.useActionContext)(),r=(0,n.useAPIClient)(),o=(0,n.useCollectionRecordData)().id,i=((0,n.useListBlockContext)()||{}).service,c=e.status?"unread":"read";return{run:function(){return I(function(){var e;return N(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r.resource("workflowCcTasks")[c]({filterByTk:o})];case 1:return n.sent(),t.setVisible(!1),t.setSubmitted(!0),null==i||null==(e=i.refresh)||e.call(i),[3,3];case 2:return console.error("Failed to mark task as read:",n.sent()),[3,3];case 3:return[2]}})})()}}}function V(){return(0,n.useCollectionRecordData)().status?{title:S("Mark as unread")}:{type:"primary",title:S("Mark as read")}}function Z(){var e=(0,n.useAPIClient)(),t=(0,n.useListBlockContext)(),o=(0,r.useWorkflowTaskFilterContext)().selectedWorkflow;return{run:function(){return I(function(){var n,r;return N(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e.resource("workflowCcTasks").read(B({},o?{filter:{"workflow.key":o.workflowKey}}:{}))];case 1:return i.sent(),null==t||null==(r=t.service)||null==(n=r.refresh)||n.call(r),[3,3];case 2:return console.error("Failed to mark task as read:",i.sent()),[3,3];case 3:return[2]}})})()}}}function H(e){var t,n,o=(0,r.useTasksCountsContext)().counts,i=(0,r.useWorkflowTaskFilterContext)().selectedWorkflow,c=null!=(t=null==i?void 0:i.stats.pending)?t:null==(n=o[h.wl])?void 0:n.pending;return F(B({},e),{disabled:0===c})}function J(){var i,c,a,l,u=(0,n.usePlugin)(o()),s=(0,n.useAPIClient)(),f=((0,n.useCollectionRecordData)()||{}).id,p=U((0,e.useState)(null),2),d=p[0],b=p[1],y=U((0,e.useState)((0,n.useCollectionRecordData)()),2),m=y[0],v=y[1],w=U((0,e.useState)(null),2),h=w[0],g=w[1],C=null!=(i=null==d||null==(c=d.nodes)?void 0:c.find(function(e){return e.id===(null==h?void 0:h.id)}))?i:h,x=(0,r.useAvailableUpstreams)(C),O=P(null==d?void 0:d.workflow,x);(0,e.useEffect)(function(){var e,t;f&&(null==(e=(t=s.resource("workflowCcTasks")).get)||e.call(t,{filterByTk:f,appends:["node","job","workflow","workflow.nodes","execution","execution.jobs"]}).then(function(e){var t,n=e.data,o=null!=(t=null==n?void 0:n.data)?t:{},i=o.node,c=o.workflow,a=void 0===c?{}:c,l=a.nodes,u=void 0===l?[]:l,s=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}(a,["nodes"]),f=o.execution;(0,r.linkNodes)(u),g(i),b({workflow:s,nodes:u,execution:f}),v(null==n?void 0:n.data)}))},[s,f]);var j=null==h||null==(a=h.config)?void 0:a.ccUid;if(j&&h&&d){var S=u.triggers.get(d.workflow.type);return t().createElement(n.CollectionRecordProvider,{record:m},t().createElement(r.FlowContext.Provider,{value:d},t().createElement(r.NodeContext.Provider,{value:h},t().createElement(R,{uid:j,onModelLoaded:function(e){e.context.defineProperty("flowSettingsEnabled",{value:!1}),e.context.defineProperty("disableBlockGridPadding",{value:!0}),e.context.defineProperty("view",{value:{inputArgs:{flowContext:d,availableUpstreams:x,trigger:S,node:h}}}),e.context.defineProperty("workflow",{value:d.workflow}),e.context.defineProperty("nodes",{value:d.nodes}),e.context.defineProperty("tempAssociationSources",{value:O,cache:!1})}}))))}var A=x.reduce(function(e,t){var n=t.type;return Object.assign(e,u.instructions.get(n).components)},{});return h&&d?t().createElement(n.CollectionRecordProvider,{record:m},t().createElement(r.FlowContext.Provider,{value:d},t().createElement(r.NodeContext.Provider,{value:h},t().createElement(n.RemoteSchemaComponent,{components:B({DetailsBlockProvider:r.DetailsBlockProvider},A),scope:{useDetailsBlockProps:W},uid:null==(l=h.config)?void 0:l.ccDetail,noForm:!0})))):t().createElement(k.Spin,null)}function Q(e){var r=(0,j.useTranslation)().t,o=(0,g.useAntdToken)();return t().createElement(k.ConfigProvider,{theme:{token:{fontSizeLG:14}}},t().createElement(k.Descriptions,F(B({},e),{column:1,items:[{key:"createdAt",label:r("Created at"),children:t().createElement(n.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:r("Status",{ns:"workflow"}),children:t().createElement(n.SchemaComponent,{components:{},schema:{name:"status",type:"number","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,n.css)(K(),o.colorTextDescription)})))}var X=function(e,t){if(!e||!t)return[];var n,r=[],o=t.find(function(t){return t.id===e.upstreamId});return o&&r.push.apply(r,[o].concat(function(e){if(Array.isArray(e))return M(e)}(n=X(o,t))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||G(n)||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},Y={pending:{status:h.Rr.UNREAD},completed:{status:h.Rr.READ}},ee={key:h.wl,title:'{{t("CC to me", { ns: "'.concat(h.CU,'" })}}'),collection:"workflowCcTasks",action:"listMine",useActionParams:function(e,t){var n,r=null!=(n=Y[e])?n:{};return{filter:t?{$and:[r,{"workflow.key":t}]}:r,appends:["node.id","node.title","node.updatedAt","node.config","workflow.id","workflow.title","workflow.enabled","workflow.config","workflow.nodes","workflow.nodes.title","workflow.nodes.key","workflow.nodes.config","execution.id","execution.status"],except:["workflow.options","execution.context","execution.output"]}},Actions:function(e){return t().createElement(n.SchemaComponent,{scope:{useReadAllAction:Z,useReadAllActionProps:H},schema:{name:"actions",type:"void","x-component":"ActionBar",properties:{refresh:{type:"void",title:'{{t("Refresh", { ns: "'.concat(h.CU,'" })}}'),"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":B({icon:"ReloadOutlined"},e)},filter:{type:"void",title:'{{t("Filter", { ns: "'.concat(h.CU,'" })}}'),"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":F(B({icon:"FilterOutlined"},e),{nonfilterable:["workflow.title"]}),default:{$and:[{title:{$includes:""}}]}},readAll:{type:"void",title:'{{t("Mark all as read", { ns: "'.concat(h.CU,'" })}}'),"x-component":"Action","x-use-component-props":"useReadAllActionProps","x-component-props":B({useAction:"{{useReadAllAction}}",icon:"CheckOutlined"},e)}}}})},Item:function(){var o,i,c,a,l,u,s,f,p=(0,g.useAntdToken)(),d=(0,n.useCollectionRecordData)(),b=(0,C.useNavigate)(),y=(0,r.usePopupRecordContext)().setRecord,m=(0,e.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&(y(d),b("./".concat(d.id))),e.stopPropagation()},[b,d,y]),v=null==(c=d.node)||null==(i=c.config)?void 0:i.taskCardUid,w=X(d.node,null==(a=d.workflow)?void 0:a.nodes),h=P(d.workflow,w),x=(0,e.useCallback)(function(e){e.setDecoratorProps({onClick:m,hoverable:!0}),e.getCurrentRecord=function(){return d},e.context.defineProperty("workflow",{get:function(){return d.workflow},cache:!1}),e.context.defineProperty("nodes",{get:function(){var e,t;return null!=(e=null==(t=d.workflow)?void 0:t.nodes)?e:[]},cache:!1}),e.context.defineProperty("tempAssociationSources",{get:function(){return h},cache:!1})},[d,m,h]),O=(0,e.useCallback)(function(e){return e.clone()},[]),j=null!=(o=null==(s=d.node)||null==(u=s.updatedAt)||null==(l=u.valueOf)?void 0:l.call(u))?o:null==(f=d.node)?void 0:f.updatedAt;return v?t().createElement(R,{uid:v,onModelLoaded:x,mapModel:O,reloadKey:j}):t().createElement(k.Card,{onClick:m,hoverable:!0,size:"small",title:d.title,extra:t().createElement(r.WorkflowTitle,d.workflow),className:(0,n.css)(L(),p.colorTextDescription)},t().createElement(Q,null))},Detail:function(){var r,o=(0,e.useContext)(n.SchemaComponentContext),i=(0,n.useCollectionRecordData)(),c=i||{},a=c.id,l=c.node,u=c.workflow,s=c.status;return i?t().createElement(n.SchemaComponentContext.Provider,{value:F(B({},o),{reset:function(){},designable:!1})},t().createElement(n.SchemaComponent,{components:{FlowContextProvider:J},scope:{useReadAction:z,useReadActionProps:V},schema:{type:"void",name:"manual-detail-drawer-".concat(a,"-").concat(s),"x-component":"Action.Container","x-component-props":{className:(0,n.css)($())},title:null!=(r=null==l?void 0:l.title)?r:"".concat(null==u?void 0:u.title," - ").concat("#".concat(null==l?void 0:l.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:0}},properties:{read:{type:"void","x-component":"Action","x-use-component-props":"useReadActionProps","x-component-props":{useAction:"{{useReadAction}}"}}}}}}}}})):null},getPopupRecord:function(e,t){var n=t.params;return e.resource("workflowCcTasks").get(F(B({},n),{appends:["node","workflow","workflow.nodes","execution","execution.jobs"]}))}},et=w(813);function en(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function er(e,t,n){return(er=ea()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ei(o,n.prototype),o}).apply(null,arguments)}function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(e){var t="function"==typeof Map?new Map:void 0;return(ec=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 er(e,arguments,eo(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ei(n,e)})(e)}function ea(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ea=function(){return!!e})()}function el(e){return t().createElement(n.ExtendCollectionsProvider,{collections:[v.A]},e.children)}var eu=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eo(e),function(e,t){var n;if(t&&("object"==((n=t)&&"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,ea()?Reflect.construct(e,t||[],eo(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ei(r,e),t=[{key:"load",value: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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=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){return this.app.addProvider(el),(e=this.app.pm.get(o())).registerInstruction("cc",m),e.registerTaskType(h.wl,ee),(0,et.W)(this.flowEngine),this.app.schemaSettingsManager.add(new n.SchemaSettings({name:"actionSettings:workflow:cc:read",items:[{name:"editButton",Component:n.ButtonEditor,useComponentProps:function(){return(0,n.useSchemaToolbar)().buttonEditorProps}},{name:"delete",sort:100,Component:n.RemoveButton,useComponentProps:function(){return(0,n.useSchemaToolbar)().removeButtonProps}}]})),e.registerCollectionsToDataSource([v.A]),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){en(i,r,o,c,a,"next",e)}function a(e){en(i,r,o,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(ec(n.Plugin)),es=eu}(),O}()});
@@ -9,7 +9,7 @@
9
9
  import React from 'react';
10
10
  declare function Drawer(): React.JSX.Element;
11
11
  declare function TaskItem(): React.JSX.Element;
12
- declare function useTodoActionParams(status: any): {
12
+ declare function useTodoActionParams(status: any, workflowKey?: string): {
13
13
  filter: any;
14
14
  appends: string[];
15
15
  except: string[];
@@ -9,22 +9,22 @@
9
9
 
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
- "@nocobase/client": "2.3.0-alpha.1",
13
- "@nocobase/plugin-workflow": "2.3.0-alpha.1",
12
+ "@nocobase/client": "3.0.0-alpha.2",
13
+ "@nocobase/plugin-workflow": "3.0.0-alpha.2",
14
14
  "react-i18next": "11.18.6",
15
15
  "antd-style": "3.7.1",
16
16
  "antd": "5.24.2",
17
17
  "react-router-dom": "6.30.1",
18
18
  "lodash": "4.18.1",
19
- "@nocobase/flow-engine": "2.3.0-alpha.1",
20
- "@nocobase/client-v2": "2.3.0-alpha.1",
19
+ "@nocobase/flow-engine": "3.0.0-alpha.2",
20
+ "@nocobase/client-v2": "3.0.0-alpha.2",
21
21
  "@ant-design/icons": "5.6.1",
22
22
  "ahooks": "3.7.8",
23
- "@nocobase/utils": "2.3.0-alpha.1",
24
- "@nocobase/plugin-ui-schema-storage": "2.3.0-alpha.1",
25
- "@nocobase/actions": "2.3.0-alpha.1",
26
- "@nocobase/server": "2.3.0-alpha.1",
27
- "@nocobase/database": "2.3.0-alpha.1",
28
- "@nocobase/data-source-manager": "2.3.0-alpha.1",
29
- "@nocobase/plugin-notification-manager": "2.3.0-alpha.1"
23
+ "@nocobase/utils": "3.0.0-alpha.2",
24
+ "@nocobase/plugin-ui-schema-storage": "3.0.0-alpha.2",
25
+ "@nocobase/actions": "3.0.0-alpha.2",
26
+ "@nocobase/server": "3.0.0-alpha.2",
27
+ "@nocobase/database": "3.0.0-alpha.2",
28
+ "@nocobase/data-source-manager": "3.0.0-alpha.2",
29
+ "@nocobase/plugin-notification-manager": "3.0.0-alpha.2"
30
30
  };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ on: string;
12
+ up(): Promise<void>;
13
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var rebuild_workflow_task_stats_exports = {};
38
+ __export(rebuild_workflow_task_stats_exports, {
39
+ default: () => rebuild_workflow_task_stats_default
40
+ });
41
+ module.exports = __toCommonJS(rebuild_workflow_task_stats_exports);
42
+ var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
43
+ var import_server = require("@nocobase/server");
44
+ var import_constants = require("../../common/constants");
45
+ class rebuild_workflow_task_stats_default extends import_server.Migration {
46
+ on = "afterLoad";
47
+ async up() {
48
+ const workflowPlugin = this.pm.get(import_plugin_workflow.default);
49
+ await workflowPlugin.repairTaskStats({ types: [import_constants.TASK_TYPE_CC], silent: true });
50
+ }
51
+ }
@@ -9,6 +9,8 @@
9
9
  import { Plugin } from '@nocobase/server';
10
10
  import { Model } from '@nocobase/database';
11
11
  export declare class PluginWorkflowCCServer extends Plugin {
12
+ private getWorkflowKeyById;
13
+ private collectCcTaskStats;
12
14
  onRecordSave: (record: Model, { transaction }: {
13
15
  transaction: any;
14
16
  }) => Promise<void>;
@@ -46,28 +46,132 @@ var import_CCInstruction = __toESM(require("./CCInstruction"));
46
46
  var import_constants = require("../common/constants");
47
47
  var import_actions = require("./actions");
48
48
  class PluginWorkflowCCServer extends import_server.Plugin {
49
- onRecordSave = async (record, { transaction }) => {
50
- if (!record.userId) {
51
- return;
49
+ async getWorkflowKeyById(workflowId, transaction) {
50
+ const WorkflowRepo = this.db.getRepository("workflows");
51
+ const workflow = await WorkflowRepo.findOne({
52
+ filterByTk: workflowId,
53
+ fields: ["key"],
54
+ transaction
55
+ });
56
+ return workflow == null ? void 0 : workflow.key;
57
+ }
58
+ async collectCcTaskStats(options) {
59
+ var _a, _b;
60
+ const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
61
+ const CCModel = this.db.getModel("workflowCcTasks");
62
+ const qualifiedColumn = (name) => {
63
+ const fieldName = CCModel.getAttributes()[name].field ?? name;
64
+ return this.db.sequelize.col(`${CCModel.name}.${fieldName}`);
65
+ };
66
+ const group = ["userId", "workflowId"].map((name) => qualifiedColumn(name));
67
+ const countColumn = qualifiedColumn("id");
68
+ const where = {};
69
+ if ((_a = options.userIds) == null ? void 0 : _a.length) {
70
+ where.userId = options.userIds;
52
71
  }
53
- const CCModel = record.constructor;
54
- const pending = await CCModel.count({
72
+ if ((_b = options.workflowKeys) == null ? void 0 : _b.length) {
73
+ const workflowIds2 = (await Promise.all(
74
+ options.workflowKeys.map(
75
+ (workflowKey) => workflowPlugin.getWorkflowIdsByKey(workflowKey, options.transaction)
76
+ )
77
+ )).flat();
78
+ if (!workflowIds2.length) {
79
+ return [];
80
+ }
81
+ where.workflowId = workflowIds2;
82
+ }
83
+ const allCounts = await CCModel.findAll({
84
+ attributes: ["userId", "workflowId", [this.db.sequelize.fn("COUNT", countColumn), "count"]],
85
+ where,
86
+ group,
87
+ raw: true,
88
+ transaction: options.transaction
89
+ });
90
+ const pendingCounts = await CCModel.findAll({
91
+ attributes: ["userId", "workflowId", [this.db.sequelize.fn("COUNT", countColumn), "count"]],
55
92
  where: {
56
- userId: record.userId,
93
+ ...where,
57
94
  status: import_constants.TASK_STATUS.UNREAD
58
95
  },
59
- transaction
96
+ group,
97
+ raw: true,
98
+ transaction: options.transaction
60
99
  });
61
- const all = await CCModel.count({
62
- where: {
63
- userId: record.userId
64
- },
100
+ const workflowIds = Array.from(new Set([...allCounts, ...pendingCounts].map((row) => row.workflowId)));
101
+ const workflows = workflowIds.length ? await this.db.getRepository("workflows").find({
102
+ filter: { id: workflowIds },
103
+ fields: ["id", "key"],
104
+ transaction: options.transaction
105
+ }) : [];
106
+ const workflowKeyMap = new Map(
107
+ workflows.map((workflow) => [workflow.id, workflow.key])
108
+ );
109
+ const statsMap = /* @__PURE__ */ new Map();
110
+ for (const row of allCounts) {
111
+ const userId = row.userId;
112
+ const workflowKey = workflowKeyMap.get(row.workflowId);
113
+ if (!userId || !workflowKey) {
114
+ continue;
115
+ }
116
+ const key = `${userId}\0${workflowKey}`;
117
+ const stats = statsMap.get(key) ?? {
118
+ userId,
119
+ workflowKey,
120
+ type: import_constants.TASK_TYPE_CC,
121
+ pending: 0,
122
+ all: 0
123
+ };
124
+ stats.all += Number(row.count) || 0;
125
+ statsMap.set(key, stats);
126
+ }
127
+ for (const row of pendingCounts) {
128
+ const userId = row.userId;
129
+ const workflowKey = workflowKeyMap.get(row.workflowId);
130
+ if (!userId || !workflowKey) {
131
+ continue;
132
+ }
133
+ const key = `${userId}\0${workflowKey}`;
134
+ const stats = statsMap.get(key) ?? {
135
+ userId,
136
+ workflowKey,
137
+ type: import_constants.TASK_TYPE_CC,
138
+ pending: 0,
139
+ all: 0
140
+ };
141
+ stats.pending += Number(row.count) || 0;
142
+ statsMap.set(key, stats);
143
+ }
144
+ return Array.from(statsMap.values());
145
+ }
146
+ onRecordSave = async (record, { transaction }) => {
147
+ const userId = record.get("userId");
148
+ const workflowId = record.get("workflowId");
149
+ if (!userId || !workflowId) {
150
+ return;
151
+ }
152
+ const workflowKey = await this.getWorkflowKeyById(workflowId, transaction);
153
+ if (!workflowKey) {
154
+ return;
155
+ }
156
+ const [row] = await this.collectCcTaskStats({
157
+ userIds: [userId],
158
+ workflowKeys: [workflowKey],
65
159
  transaction
66
160
  });
67
- await this.app.pm.get(import_plugin_workflow.default).updateTasksStats(
68
- record.userId,
69
- import_constants.TASK_TYPE_CC,
70
- { pending, all },
161
+ const stats = row ?? {
162
+ userId,
163
+ workflowKey,
164
+ type: import_constants.TASK_TYPE_CC,
165
+ pending: 0,
166
+ all: 0
167
+ };
168
+ await this.app.pm.get(import_plugin_workflow.default).updateTaskStatsByWorkflow(
169
+ {
170
+ userId,
171
+ workflowKey,
172
+ type: import_constants.TASK_TYPE_CC,
173
+ stats
174
+ },
71
175
  { transaction }
72
176
  );
73
177
  };
@@ -76,7 +180,12 @@ class PluginWorkflowCCServer extends import_server.Plugin {
76
180
  this.app.acl.allow("workflowCcTasks", ["list", "listMine", "get", "read", "unread", "readAll"], "loggedIn");
77
181
  const workflowPlugin = this.app.pm.get(import_plugin_workflow.default);
78
182
  workflowPlugin.registerInstruction("cc", import_CCInstruction.default);
79
- this.app.db.on("workflowCcTasks.afterSave", this.onRecordSave);
183
+ workflowPlugin.registerTaskStatsProvider(import_constants.TASK_TYPE_CC, {
184
+ collectTaskStats: (options) => this.collectCcTaskStats(options)
185
+ });
186
+ this.app.db.on("workflowCcTasks.afterCreateWithAssociations", this.onRecordSave);
187
+ this.app.db.on("workflowCcTasks.afterUpdate", this.onRecordSave);
188
+ this.app.db.on("workflowCcTasks.afterDestroy", this.onRecordSave);
80
189
  }
81
190
  }
82
191
  var plugin_default = PluginWorkflowCCServer;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/workflow-cc",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow-cc",
12
12
  "license": "Apache-2.0",
13
- "version": "2.3.0-alpha.1",
13
+ "version": "3.0.0-alpha.2",
14
14
  "main": "dist/server/index.js",
15
15
  "peerDependencies": {
16
16
  "@nocobase/actions": "2.x",
@@ -30,5 +30,5 @@
30
30
  "keywords": [
31
31
  "Workflow"
32
32
  ],
33
- "gitHead": "2377df8ceb12549149017f7f14a61207bf6e49a2"
33
+ "gitHead": "a3faea21082b30989301de04591ee1b91fd4e6a5"
34
34
  }