@nocobase/plugin-workflow-manual 1.7.0-beta.3 → 1.7.0-beta.5
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/dist/client/index.js +1 -1
- package/dist/externalVersion.js +9 -9
- package/dist/server/migrations/{20250312100512-change-table-name.js → 20250316100513-change-table-name.js} +71 -5
- package/dist/server/migrations/{20250313133421-remove-m2m-fields.js → 20250317121621-remove-m2m-fields.js} +36 -7
- package/package.json +2 -2
- /package/dist/server/migrations/{20250312100512-change-table-name.d.ts → 20250316100513-change-table-name.d.ts} +0 -0
- /package/dist/server/migrations/{20250313133421-remove-m2m-fields.d.ts → 20250317121621-remove-m2m-fields.d.ts} +0 -0
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/plugin-workflow/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@formily/antd-v5"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("dayjs"),require("antd"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-manual",["@nocobase/plugin-workflow/client","@nocobase/client","@ant-design/icons","@formily/react","react","@formily/antd-v5","react-i18next","@nocobase/utils/client","@formily/core","lodash","dayjs","antd","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-manual"]=t(require("@nocobase/plugin-workflow/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@formily/antd-v5"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("dayjs"),require("antd"),require("antd-style")):e["@nocobase/plugin-workflow-manual"]=t(e["@nocobase/plugin-workflow/client"],e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["@formily/antd-v5"],e["react-i18next"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e.dayjs,e.antd,e["antd-style"])}(self,function(e,t,n,r,o,i,a,l,c,u,s,p,f){return function(){"use strict";var m={482:function(e){e.exports=n},632:function(e){e.exports=i},563:function(e){e.exports=c},505:function(e){e.exports=r},772:function(e){e.exports=t},433:function(t){t.exports=e},584:function(e){e.exports=l},721:function(e){e.exports=p},202:function(e){e.exports=f},760:function(e){e.exports=s},467:function(e){e.exports=u},156:function(e){e.exports=o},238:function(e){e.exports=a}},d={};function y(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var v={};y.r(v),y.d(v,{default:function(){return tF}});var b=y("772"),h=y("156"),g=y.n(h),x=y("482"),w=y("433"),S=y.n(w),O=y("632"),k=y("563"),C=y("505"),j=y("721"),P=y("238"),A=y("584"),E="workflow-manual",I=0,F=1,T=-1,D=[{value:I,label:'{{t("Pending", { ns: "workflow" })}}',color:"gold"},{value:F,label:'{{t("Resolved", { ns: "workflow" })}}',color:"green"},{value:T,label:'{{t("Rejected", { ns: "workflow" })}}',color:"red"}],M=D.reduce(function(e,t){var n,r,o;return Object.assign(e,(n={},r=t.value,o=t,r in n?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o,n))},{});function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,R(t).t)(e)}function R(e){return(0,P.useTranslation)(E,e)}function z(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 N(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function V(e){var t,n,r,o,i,a,l=(0,b.useCollectionRecordData)(),c=(0,C.useFieldSchema)(),u=(0,C.useField)(),s=(0,h.useRef)(null),p=e.dataSource||b.DEFAULT_DATA_SOURCE_KEY,f=j.theme.useToken().token,m=(0,(0,b.useAssociationNames)(p).getAssociationAppends)(),d=m.appends,y=m.updateAssociationValues;var v=(t=Object.keys(null!==(a=c.toJSON().properties)&&void 0!==a?a:{}),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,1)||function(e,t){if(e){if("string"==typeof e)return z(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 z(e,t)}}(t,n)||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],x=null==l?void 0:null===(i=l.result)||void 0===i?void 0:i[v],w=(0,h.useMemo)(function(){return(0,k.createForm)({initialValues:x})},[x]),S=(0,h.useMemo)(function(){return N({appends:d},e.params)},[d,e.params]),O=(0,h.useMemo)(function(){return{loading:!1,data:{data:x}}},[x]),P=(0,b.useAPIClient)(),A=(0,b.useDataSourceHeaders)(p),E=P.resource(e.collection,void 0,A),I=(0,b.useBlockRequestContext)(),F=(0,h.useMemo)(function(){return{params:S,form:w,field:u,service:O,updateAssociationValues:y,formBlockRef:s}},[u,w,S,O,y]);return(null==l?void 0:l.status)&&!x?null:g().createElement(b.CollectionManagerProvider,{dataSource:p},g().createElement(b.CollectionProvider_deprecated,{collection:e.collection},g().createElement(b.BlockProvider,(r=N({name:e.name||"form"},e),o=(o={block:"form",parentRecord:null},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r),g().createElement(b.FormActiveFieldsProvider,{name:"form"},g().createElement(b.BlockRequestContext_deprecated.Provider,{value:{block:"form",props:e,field:u,service:O,resource:E,__parent:I}},g().createElement(b.FormBlockContext.Provider,{value:F},g().createElement(b.RecordProvider,{record:x,parent:null},g().createElement(b.FormV2.Templates,{style:{marginBottom:f.margin},form:w}),g().createElement("div",{ref:s},e.children))))))))}var _=y("467"),U=y.n(_);function q(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,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 G(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function L(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return q(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 q(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 $(e){var t=e.schema,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["schema"]),r=(0,b.useSchemaTemplateManager)().getTemplateSchemaByMode,o=(0,b.useSchemaInitializer)().insert,i=(0,b.useRecordCollectionDataSourceItems)("FormItem");function a(){var e;return e=function(e){var n,i,a,l,c,u,s;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(p){switch(p.label){case 0:if(!(n=e.item).template)return[3,2];return[4,r(n)];case 1:return l=p.sent(),[3,3];case 2:l=null,p.label=3;case 3:var f;return a=l,f=L(G({actionInitializers:"workflowManual:form:configureActions",actions:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(E,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:w.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-designer-props":{}}}},t),{template:a}),c=(0,b.createFormBlockSchema)(f),delete c["x-acl-action-props"],delete c["x-acl-action"],u=J(Object.keys(c.properties),1)[0],s=(null===(i=Object.entries(c.properties[u].properties).find(function(e){var t=J(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===i?void 0:i[0])||"actions",c.properties[u].properties[s]["x-decorator"]="ActionBarProvider",c.properties[u].properties[s]["x-component-props"].style={marginTop:"1.5em",flexWrap:"wrap"},(0,w.traverseSchema)(c,function(e){e["x-uid"]&&delete e["x-uid"]}),o(c),[2]}})},(a=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){W(i,r,o,a,l,"next",e)}function l(e){W(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return g().createElement(b.SchemaInitializerItem,L(G({},n),{onClick:function(e){return a.apply(this,arguments)},items:i}))}function K(){var e,t,n=(0,b.useSchemaInitializerItem)();return g().createElement(b.CollectionProvider_deprecated,{dataSource:null===(e=n.schema)||void 0===e?void 0:e.dataSource,collection:null===(t=n.schema)||void 0===t?void 0:t.collection},g().createElement($,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 Q(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 Y(e)}(o=Q(e.properties[n],t))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return Y(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 Y(e,t)}}(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):(r.push(e),r):r}function H(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 X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return H(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 H(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 Z(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 ee(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 et(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ee(i,r,o,a,l,"next",e)}function l(e){ee(i,r,o,a,l,"throw",e)}a(void 0)})}}function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function er(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){en(e,t,n[t])})}return e}function eo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||ea(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 ea(e,t){if(e){if("string"==typeof e)return Z(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 Z(e,t)}}function el(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function ec(e){var t,n,r,o,i=ei((0,h.useState)(null!==(r=null===(t=e.collection)||void 0===t?void 0:t.fields)&&void 0!==r?r:[]),2),a=i[0],l=i[1],c=(0,b.useCollectionRecordData)(),u=(0,C.useField)(),s=ei(Object.keys(null!==(o=(0,C.useFieldSchema)().toJSON().properties)&&void 0!==o?o:{}),1)[0],p=null==c?void 0:null===(n=c.result)||void 0===n?void 0:n[s],f=(0,h.useMemo)(function(){return(0,k.createForm)({initialValues:p})},[p]);return(null==c?void 0:c.status)&&!p?null:g().createElement(b.CollectionProvider_deprecated,{collection:eo(er({},e.collection),{fields:a})},g().createElement(b.RecordProvider,{record:p,parent:null},g().createElement(b.FormBlockContext.Provider,{value:{form:f,field:u,setCollectionFields:l}},e.children)))}function eu(){var e=(0,b.useSchemaInitializer)().insert,t=(0,b.useSchemaInitializerItem)();return g().createElement(b.SchemaInitializerItem,eo(er({},t),{onClick:function(){e({type:"void","x-decorator":"CustomFormBlockProvider","x-decorator-props":{collection:{name:(0,A.uid)(),fields:[]}},"x-component":"CardItem","x-component-props":{title:'{{t("Form")}}'},"x-designer":"SimpleDesigner","x-designer-props":{type:"customForm"},properties:en({},(0,A.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(E,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:w.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner"}}}}})})}}))}var es={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")}}'},ep=g().createContext({});function ef(){var e=(0,C.useForm)(),t=e.values,n=e.query,r=e.reset,o=[B("Field name existed in form")],i=(0,h.useContext)(ep),a=i.collection,l=i.interfaceOptions,c=i.setCollectionFields,u=i.insert,s=i.setCallback,p=i.setInterface;return{run:function(){return et(function(){var e,i,f,m,d,y,v;return el(this,function(b){var h;if(f=l.default,m=(0,A.uid)(),f.name=null!==(d=t.name)&&void 0!==d?d:m,f.uiSchema.title=null!==(y=null===(e=t.uiSchema)||void 0===e?void 0:e.title)&&void 0!==y?y:m,f.interface=l.name,null===(i=a.fields)||void 0===i?void 0:i.find(function(e){return e.name===f.name}))return n("name").take().setFeedback({type:"error",messages:o}),[2];return v=(0,A.merge)(f,t),c(((function(e){if(Array.isArray(e))return Z(e)})(h=a.fields)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(h)||ea(h)||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])),u({name:f.name,type:f.uiSchema.type,"x-decorator":"FormItem","x-component":"CollectionField","x-component-props":{field:v},"x-collection-field":"".concat(a.name,".").concat(f.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem"}),r(),s(null),p(null),[2]})})()}}}var em={wrap:b.gridRowColWrap,insertPosition:"beforeEnd",title:"{{t('Configure fields')}}",ItemsComponent:function(e){var t,n,r=ei((0,h.useState)(null),2),o=r[0],i=r[1],a=ei((0,h.useState)(),2),l=a[0],c=a[1];var u=(n={},Object.keys(t=(0,b.useCollectionManager_deprecated)().interfaces).forEach(function(e){var r=t[e],o=r.group,i=void 0===o?"others":o;n[i]=n[i]||{},(0,_.set)(n,[i,e],r)}),Object.keys(es).filter(function(e){return["basic","choices","datetime","media"].includes(e)}).map(function(e){return{title:es[e],children:Object.keys(n[e]||{}).map(function(t){var r=n[e][t];return er({value:t,title:r.title,name:t},n[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:ev,fieldInterface:e.name}})}}),s=(0,b.useCollection_deprecated)(),p=(0,h.useContext)(b.FormBlockContext).setCollectionFields,f=(0,h.useMemo)(function(){return(0,k.createForm)()},[]);return g().createElement(ep.Provider,{value:{collection:s,insert:l,interfaceOptions:o,onAddField:function(e){var t=(0,_.pick)(e,["name","group","title","default","validateSchema"]),n=e.properties,r=(n.unique,n.type,n.layout,n.autoIncrement,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e.properties,["unique","type","layout","autoIncrement"]));t.properties=r;var o=(0,_.cloneDeep)(t);delete o.properties.name["x-disabled"],i(o)},setCallback:c,setInterface:i,setCollectionFields:p}},g().createElement(b.SchemaInitializerItems,eo(er({},e),{items:u})),g().createElement(b.ActionContextProvider,{value:{visible:!!o,setVisible:function(e){!e&&i(null)}}},o?g().createElement(b.SchemaComponent,{schema:{type:"void",name:"drawer",title:'{{t("Configure field")}}',"x-decorator":"FormV2","x-decorator-props":{form:f},"x-component":"Action.Drawer",properties:eo(er({},o.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 et(function(){return el(this,function(t){return c(null),i(null),e.reset(),[2]})})()}}}}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:ef}}}}})},components:{ArrayTable:O.ArrayTable}}):null))}},ed=new b.CompatibleSchemaInitializer(er({name:"AddCustomFormField"},em)),ey=new b.CompatibleSchemaInitializer(er({name:"workflowManual:customForm:configureFields"},em),ed);function ev(){var e=(0,b.useSchemaInitializerItem)(),t=(0,b.useSchemaInitializer)().insert,n=(0,h.useContext)(ep),r=n.onAddField,o=n.setCallback,i=(0,(0,b.useCollectionManager_deprecated)().getInterface)(e.fieldInterface);return g().createElement(b.SchemaInitializerItem,er({key:e.fieldInterface,onClick:function(){o(function(){return t}),r(i)}},e))}function eb(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 eh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eb(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 eb(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 eg={title:'{{t("Update record form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(e){var t=e.allCollections,n=(0,h.useMemo)(function(){return t.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:U().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(E,'" })}}'),formType:"update","x-designer":"UpdateFormDesigner"},Component:K}})}})},[t]),r=eh((0,h.useState)([]),2),o=r[0],i=r[1],a=(0,b.useMenuSearch)({data:n,openKeys:o});return{name:"updateRecordForm",key:"updateRecordForm",type:"subMenu",title:'{{t("Update record form", { ns: "'.concat(E,'" })}}'),componentProps:{onOpenChange:function(e){i(e)}},children:a}},initializers:{},components:{FilterDynamicComponent:w.FilterDynamicComponent,UpdateFormDesigner:function(){var e=(0,b.useCollection_deprecated)(),t=e.name,n=e.title,r=(0,C.useFieldSchema)(),o=(0,P.useTranslation)().t,i=(0,b.useDesignable)().dn;return g().createElement(b.GeneralSchemaDesigner,{title:n||t},g().createElement(b.SchemaSettingsBlockTitleItem,null),g().createElement(b.SchemaSettingsActionModalItem,{title:o("Filter settings",{ns:E}),schema:{name:"filter",type:"object",title:'{{t("Filter")}}',"x-component":"Filter","x-use-component-props":function(){var e;return{options:(0,b.useCollectionFilterOptions)(null==r?void 0:null===(e=r["x-decorator-props"])||void 0===e?void 0:e.collection)}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},initialValues:null==r?void 0:r["x-decorator-props"],onSubmit:function(e){var t=e.filter;r["x-decorator-props"].filter=t,i.emit("patch",{schema:{"x-decorator-props":r["x-decorator-props"]}}),i.refresh()},width:"60%"}),g().createElement(b.SchemaSettingsLinkageRules,{collectionName:t}),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return Q(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"update"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o,i,a=eh(Object.keys(e.properties),1)[0],l=e.properties[a],c=(null===(o=Object.entries(l.properties).find(function(e){var t=eh(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===o?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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},e["x-decorator-props"]),r=(r={type:"update",title:(null===(i=e["x-component-props"])||void 0===i?void 0:i.title)||a,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}})},r),Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n)}),t}},block:{scope:{},components:{}},validate:function(e){var t=e.filter;return t&&(0,A.isValidFilter)(t)?null:"Please check one of your update record form, and add at least one filter condition in form settings."}};function ex(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 ew(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function eS(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eO(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function ek(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||ej(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 ex(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ej(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 ej(e,t){if(e){if("string"==typeof e)return ex(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 ex(e,t)}}var eP=new A.Registry;eP.register("custom",{title:'{{t("Custom form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(){return{name:"customForm",type:"item",title:'{{t("Custom form", { ns: "'.concat(E,'" })}}'),Component:eu}},initializers:{},components:{CustomFormBlockProvider:ec},parseFormOptions:function(e){var t={};return Q(e,function(e){return"CustomFormBlockProvider"===e["x-decorator"]}).forEach(function(e){var n,r,o=ei(Object.keys(e.properties),1)[0],i=e.properties[o],a=Q(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!==(n=null===(t=e["x-component-props"])||void 0===t?void 0:t.field)&&void 0!==n?n:e["x-interface-options"]});var l=(null===(n=Object.entries(i.properties).find(function(e){var t=ei(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===n?void 0:n[0])||"actions";t[o]={type:"custom",title:(null===(r=e["x-component-props"])||void 0===r?void 0:r.title)||o,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{CustomFormBlockProvider:ec}}}),eP.register("create",{title:'{{t("Create record form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(e){var t=e.allCollections,n=(0,h.useMemo)(function(){return t.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:U().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(E,'" })}}'),formType:"create","x-designer":"CreateFormDesigner"},Component:K}})}})},[t]),r=X((0,h.useState)([]),2),o=r[0],i=r[1],a=(0,b.useMenuSearch)({data:n,openKeys:o});return{name:"createRecordForm",key:"createRecordForm",type:"subMenu",title:'{{t("Create record form", { ns: "'.concat(E,'" })}}'),componentProps:{onOpenChange:function(e){i(e)}},children:a}},initializers:{},components:{CreateFormDesigner:function(){var e=(0,b.useCollection_deprecated)(),t=e.name,n=e.title;return g().createElement(b.GeneralSchemaDesigner,{title:n||t},g().createElement(b.SchemaSettingsBlockTitleItem,null),g().createElement(b.SchemaSettingsLinkageRules,{collectionName:t}),g().createElement(b.SchemaSettingsDataTemplates,{collectionName:t}),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return Q(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"create"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o=X(Object.keys(e.properties),1)[0],i=e.properties[o],a=(null===(n=Object.entries(i.properties).find(function(e){var t=X(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===n?void 0:n[0])||"actions";t[o]={type:"create",title:(null===(r=e["x-component-props"])||void 0===r?void 0:r.title)||o,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{}}}),eP.register("update",eg);var eA={wrap:b.gridRowColWrap,title:'{{t("Add block")}}',items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',hideIfNoChildren:!0,useChildren:function(){var e,t,n=(0,b.usePlugin)(S()),r=(0,w.useNodeContext)(),o=(0,w.useAvailableUpstreams)(r);var i=[(e=(0,w.useFlowContext)().workflow,(t=(0,w.useTrigger)()).useInitializers?t.useInitializers(e.config):null)].filter(Boolean),a=o.map(function(e){var t,r=n.instructions.get(e.type);return null==r?void 0:null===(t=r.useInitializers)||void 0===t?void 0:t.call(r,e)}).filter(Boolean);return eC(i).concat(eC(a.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "'.concat(E,'" })}}'),children:a}]:[])).filter(Boolean)}},{type:"itemGroup",name:"form",title:'{{t("Form")}}',useChildren:function(){var e=(0,b.useDataSourceManager)().getAllCollections();return Array.from(eP.getValues()).map(function(t){return(0,t.config.useInitializer)({allCollections:e})})}},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Markdown")}}',Component:"MarkdownBlockInitializer"}]}]},eE=new b.CompatibleSchemaInitializer(ew({name:"AddBlockButton"},eA)),eI=new b.CompatibleSchemaInitializer(ew({name:"workflowManual:popup:configureUserInterface:addBlock"},eA),eE);function eF(){var e,t,n,r=(0,h.useContext)(b.SchemaComponentContext),o=(0,P.useTranslation)().t,i=R().t,a=(0,C.useFieldSchema)(),l=(0,w.useWorkflowVariableOptions)(),c=ek((0,h.useState)(!1),2),u=c[0],s=c[1],p=ek((0,h.useState)(null!==(n=null==a?void 0:null===(t=a["x-action-settings"])||void 0===t?void 0:null===(e=t.assignedValues)||void 0===e?void 0:e.schema)&&void 0!==n?n:{type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields",properties:{}}),2),f=p[0],m=p[1],d=ek((0,h.useState)(null),2),y=d[0],v=d[1],x=(0,b.useSchemaOptionsContext)().components;(0,h.useEffect)(function(){v(new C.Schema({properties:{grid:f}}))},[f]);var S=(0,h.useMemo)(function(){var e,t,n=null==a?void 0:null===(t=a["x-action-settings"])||void 0===t?void 0:null===(e=t.assignedValues)||void 0===e?void 0:e.values;return(0,k.createForm)({initialValues:A.lodash.cloneDeep(n),values:A.lodash.cloneDeep(n)})},[a]),E=(0,b.useFormActiveFields)(),I=o("Assign field values");function F(){s(!1)}return g().createElement(g().Fragment,null,g().createElement(b.SchemaSettingsItem,{title:I,onClick:function(){return s(!0)}},I),g().createElement(j.Modal,{width:"50%",title:I,open:u,onCancel:F,footer:g().createElement(j.Space,null,g().createElement(j.Button,{onClick:F},i("Cancel")),g().createElement(j.Button,{type:"primary",onClick:function(){!a["x-action-settings"]&&(a["x-action-settings"]={}),!a["x-action-settings"].assignedValues&&(a["x-action-settings"].assignedValues={}),a["x-action-settings"].assignedValues.schema=f,a["x-action-settings"].assignedValues.values=S.values,s(!1),setTimeout(function(){var e;null===(e=r.refresh)||void 0===e||e.call(r)},300)}},i("Submit")))},g().createElement(b.DefaultValueProvider,{isAllowToSetDefaultValue:function(){return!1}},g().createElement(b.VariableScopeProvider,{scope:l},g().createElement(b.FormActiveFieldsProvider,{name:"form",getActiveFieldsName:null==E?void 0:E.getActiveFieldsName},g().createElement(C.FormProvider,{form:S},g().createElement(O.FormLayout,{layout:"vertical"},g().createElement(j.Alert,{message:i("Values preset in this form will override user submitted ones when continue or reject.")}),g().createElement("br",null),u&&y&&g().createElement(b.SchemaComponentContext.Provider,{value:eS(ew({},r),{refresh:function(){m(A.lodash.get(y.toJSON(),"properties.grid"))}})},g().createElement(b.SchemaComponent,{schema:y,components:x})))))))))}function eT(e){return g().createElement(b.GeneralSchemaDesigner,eS(ew({},e),{disableInitializer:!0}),g().createElement(b.Action.Designer.ButtonEditor,null),g().createElement(eF,null),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"ActionBar"}}))}function eD(){var e=(0,b.useSchemaInitializerItem)(),t=e.action,n=e.actionProps,r=eO(e,["action","actionProps"]);return g().createElement(b.InitializerWithSwitch,eS(ew({},r),{item:e,schema:{type:"void",title:r.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:t},"x-component":"Action","x-component-props":eS(ew({},n),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action":"".concat(t)},type:"x-action"}))}var eM={title:'{{t("Configure actions")}}',items:[{name:"jobStatusResolved",title:'{{t("Continue the process", { ns: "'.concat(E,'" })}}'),Component:function(){var e=(0,b.useSchemaInitializerItem)(),t=e.action,n=e.actionProps,r=eO(e,["action","actionProps"]),o=(0,b.useSchemaInitializer)().insert;return g().createElement(b.SchemaInitializerItem,eS(ew({},r),{onClick:function(){o({type:"void",title:r.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:t},"x-component":"Action","x-component-props":eS(ew({},n),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action-settings":{}})}}))},action:w.JOB_STATUS.RESOLVED,actionProps:{type:"primary"}},{name:"jobStatusRejected",title:'{{t("Terminate the process", { ns: "'.concat(E,'" })}}'),Component:eD,action:w.JOB_STATUS.REJECTED,actionProps:{danger:!0}},{name:"jobStatusPending",title:'{{t("Save temporarily", { ns: "'.concat(E,'" })}}'),Component:eD,action:w.JOB_STATUS.PENDING}]},eB=new b.CompatibleSchemaInitializer(ew({name:"AddActionButton"},eM)),eR=new b.CompatibleSchemaInitializer(ew({name:"workflowManual:form:configureActions"},eM),eB);function ez(){return{run:function(){}}}function eN(e){var t=e.value,n=e.onChange,r=(0,b.usePlugin)(S()),o=(0,h.useContext)(b.SchemaComponentContext),i=(0,w.useNodeContext)(),a=(0,w.useAvailableUpstreams)(i),l=(0,C.useForm)(),c=(0,w.useFlowContext)().workflow,u=(0,h.useRef)(function(){}),s={};a.forEach(function(e){Object.assign(s,r.instructions.get(e.type).components)});var p=(0,h.useMemo)(function(){return new C.Schema({properties:{drawer:{type:"void",title:'{{t("User interface", { ns: "'.concat(E,'" })}}'),"x-decorator":"Form","x-component":"Action.Container","x-component-props":{onClose:function(){return u.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!=t?t:{tab1:{type:"void",title:'{{t("Manual", { ns: "'.concat(E,'" })}}'),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:popup:configureUserInterface:addBlock",properties:{}}}}}}}}}})},[]),f=(0,h.useCallback)(function(){var e=A.lodash.get(p.toJSON(),"properties.drawer.properties").tabs,t=Array.from(eP.getValues()).reduce(function(t,n){return Object.assign(t,n.config.parseFormOptions(e))},{});l.setValuesIn("forms",t),n(e.properties)},[l,n,p]);return u.current=f,g().createElement(b.SchemaComponentContext.Provider,{value:eS(ew({},o),{designable:!c.executed,refresh:f})},g().createElement(b.SchemaComponent,{schema:p,components:eS(ew({},s,Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.config.components)},{})),{FormBlockProvider:V,DetailsBlockProvider:w.DetailsBlockProvider,ManualActionStatusProvider:function(e){return e.children},ActionBarProvider:function(e){return e.children},SimpleDesigner:w.SimpleDesigner,ManualActionDesigner:eT}),scope:{useSubmit:ez,useDetailsBlockProps:b.useFormBlockContext}}))}function eV(e){var t=(0,w.useFlowContext)().workflow,n=ek((0,h.useState)(!1),2),r=n[0],o=n[1],i=(0,C.useForm)().values,a=R().t,l=(0,h.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=eP.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}}}(i.forms);if(t){j.message.error({content:a(t)});return}}o(e)},[i.forms]);return g().createElement(g().Fragment,null,g().createElement(j.Button,{type:"primary",onClick:function(){return o(!0)},disabled:!1},a(t.executed?"View user interface":"Configure user interface")),g().createElement(b.ActionContextProvider,{value:{visible:r,setVisible:l,formValueChanged:!1}},e.children))}function e_(){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 e_=function(){return n},n}function eU(e){var t,n=e.value,r=e.onChange;!(t=n)||t>=1;var o=g().createElement("fieldset",null,g().createElement(O.FormLayout,{layout:"vertical"},g().createElement(b.FormItem,{label:B("Negotiation")},g().createElement(j.Radio.Group,{value:n,onChange:r},g().createElement(j.Radio,{value:1},g().createElement(j.Tooltip,{title:B("Everyone should pass"),placement:"bottom"},g().createElement("span",null,B("All pass")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))),g().createElement(j.Radio,{value:-1},g().createElement(j.Tooltip,{title:B("Anyone pass"),placement:"bottom"},g().createElement("span",null,B("Any pass")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}})))))));return g().createElement("fieldset",{className:(0,b.css)(e_())},g().createElement(j.Form.Item,null,g().createElement(j.Radio.Group,{value:!!n,onChange:function(e){var t=e.target.value;console.log(t),r(Number(t))}},g().createElement(j.Radio,{value:!0},g().createElement(j.Tooltip,{title:B("Each user has own task"),placement:"bottom"},g().createElement("span",null,B("Separately")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))),g().createElement(j.Radio,{value:!1},g().createElement(j.Tooltip,{title:B("Everyone shares one task"),placement:"bottom"},g().createElement("span",null,B("Collaboratively")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))))),n?o:null)}function eq(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}function eW(e){e.multiple;var t=e.value,n=void 0===t?[]:t,r=e.onChange,o=(0,w.useWorkflowVariableOptions)({types:[eq]});return g().createElement(b.Variable.Input,{scope:o,value:n[0],onChange:function(e){r([e])}},g().createElement(b.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:n[0],onChange:function(e){r(null!=e?[e]:[])}}))}function eG(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)}}function eL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eJ(e){return(eJ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e$(e,t){return(e$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eK=function(){return!!e})()}function eY(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=t.types,c=t.fieldNames,u=void 0===c?w.defaultFieldNames:c,s=(0,b.useCompile)(),p=(0,b.useCollectionManager_deprecated)().getCollectionFields,f=Object.keys(null!==(n=a.forms)&&void 0!==n?n:{});if(!f.length)return null;var m=f.map(function(e){var t,n=a.forms[e],r=(0,w.getCollectionFieldOptions)({fields:null===(t=n.collection)||void 0===t?void 0:t.fields,collection:n.collection,types:l,compile:s,getCollectionFields:p}),o=s(n.title)||e;return r.length?{key:e,value:e,label:o,title:o,children:r}:null}).filter(Boolean);return m.length?(eL(r={},u.value,o),eL(r,u.label,i),eL(r,u.children,m),r):null}function eQ(e){var t,n=(0,b.useCollectionManager_deprecated)().getCollection,r=Object.keys(null!==(t=e.config.forms)&&void 0!==t?t:{});if(!r.length||e.config.mode)return null;var o=r.map(function(t){var r,o,i=e.config.forms[t],a=n(i.collection).fields;return(void 0===a?[]:a).length?{name:null!==(r=i.title)&&void 0!==r?r:t,type:"item",title:null!==(o=i.title)&&void 0!==o?o:t,Component:w.CollectionBlockInitializer,collection:i.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key,".").concat(t)}:null}).filter(Boolean);return o.length?{name:"#".concat(e.id),key:"forms",type:"subMenu",title:e.title,children:o}:null}Symbol("single"),Symbol("all"),Symbol("any"),Symbol("all percentage"),Symbol("any percentage");var eH=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=eJ(n),eL(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,eK()?Reflect.construct(n,r||[],eJ(t).constructor):n.apply(t,r)),"title",'{{t("Manual", { ns: "'.concat(E,'" })}}')),eL(e,"type","manual"),eL(e,"group","manual"),eL(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(E,'" })}}')),eL(e,"icon",g().createElement(x.SolutionOutlined,null)),eL(e,"fieldset",{assignees:{type:"array",title:'{{t("Assignees", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"AssigneesSelect","x-component-props":{},required:!0,default:[]},mode:{type:"number",title:'{{t("Mode", { ns: "'.concat(E,'" })}}'),"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(E,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea",description:'{{t("Title of each task item. Default to node title.", { ns: "'.concat(E,'" })}}'),default:"{{useNodeContext().title}}"},schema:{type:"void",title:'{{t("User interface", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"SchemaConfigButton",properties:{schema:{type:"object","x-component":"SchemaConfig",default:null}}},forms:{type:"object",default:{}}}),eL(e,"scope",{useNodeContext:w.useNodeContext}),eL(e,"components",{SchemaConfigButton:eV,SchemaConfig:eN,ModeConfig:eU,AssigneesSelect:eW,WorkflowVariableTextArea:w.WorkflowVariableTextArea}),eL(e,"useVariables",eY),eL(e,"useInitializers",eQ),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&e$(e,t)}(o,e),t=o,n=[{key:"isAvailable",value:function(e){var t=e.engine,n=e.workflow;return e.upstream,e.branchIndex,!t.isWorkflowSync(n)}}],eG(t.prototype,n),o}(w.Instruction),eX=y("202"),eZ=y("760"),e0=y.n(eZ);function e1(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 e2(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 e3(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e6(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){e3(e,t,n[t])})}return e}function e5(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function e8(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function e4(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return e1(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 e1(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 e7(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function e9(){var e=e7(["\n margin-bottom: 1em;\n time {\n margin-right: 0.5em;\n }\n "]);return e9=function(){return e},e}function te(){var e=e7(["\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 te=function(){return e},e}function tt(){var e=e7(["\n .ant-card-extra {\n color: ",";\n }\n "]);return tt=function(){return e},e}function tn(e){var t,n=(0,b.useCollectionRecordData)(),r=B("Unprocessed");return(null==n?void 0:null===(t=n.execution)||void 0===t?void 0:t.status)&&!(null==n?void 0:n.status)?g().createElement(j.Tag,null,r):e.children}function tr(e){var t=(0,b.useCollectionRecordData)();if(Array.isArray(e.dataIndex)){var n=!0,r=!1,o=void 0;try{for(var i,a=e.dataIndex[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value,c=(0,_.get)(t,l);if(c)return c}}catch(e){r=!0,o=e}finally{try{!n&&null!=a.return&&a.return()}finally{if(r)throw o}}}return(0,_.get)(t,e.dataIndex)}var to=function(e){var t=ti({defaultOpenMode:(0,b.useOpenModeContext)().defaultOpenMode,collectionName:"workflowManualTasks"});return g().createElement(b.SchemaComponentContext.Provider,{value:{designable:!1}},g().createElement(b.SchemaComponent,{scope:{useCollectionRecordData:b.useCollectionRecordData},components:{FormLayout:O.FormLayout,ContentDetailWithTitle:tv},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"},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:t}}}}}}}}}))};function ti(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":to.Drawer}}}}function ta(e){var t,n=(0,b.useCurrentUserContext)().data,r=(0,w.useFlowContext)().userJob,o=r.status,i=r.result,a=r.userId,l=(0,C.useFieldSchema)().parent.toJSON().name,c=e.children;return o?!i[l]&&(c=null):(null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.id)!==a&&(c=null),c}var tl=(0,h.createContext)(null);function tc(e){var t=e.value,n=e.children,r=(0,w.useFlowContext)(),o=r.userJob,i=r.execution,a=(0,C.useField)(),l=(0,C.useFieldSchema)(),c=(0,b.useCompile)();return(0,h.useEffect)(function(){(i.status||o.status)&&(a.disabled=!0,a.visible=o.status===t&&o.result._===l.name)},[i,o,t,a,l.name]),g().createElement(tl.Provider,{value:t},i.status||o.status?g().createElement(j.Button,{type:"primary",disabled:!0},c(l.title)):n)}function tu(){var e,t=(0,b.useAPIClient)(),n=(0,b.useActionContext)(),r=n.setVisible,o=n.setSubmitted,i=(0,C.useForm)(),a=i.values,l=i.submit,c=(0,C.useField)(),u=(0,C.useFieldSchema)(),s=(0,b.useTableBlockContext)().service,p=(0,w.useFlowContext)(),f=p.userJob,m=p.execution,d=u.name,y=u.parent.parent.name,v=(null!==(e=null==u?void 0:u["x-action-settings"])&&void 0!==e?e:{}).assignedValues,h=void 0===v?{}:v;return{run:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(n){switch(n.label){case 0:if(m.status||f.status)return[2];return[4,l()];case 1:return n.sent(),c.data=c.data||{},c.data.loading=!0,[4,t.resource("workflowManualTasks").submit({filterByTk:f.id,values:{result:(e3(e={},y,e6({},a,h.values)),e3(e,"_",d),e)}})];case 2:return n.sent(),c.data.loading=!1,o(!0),r(!1),null==s||s.refresh(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){e2(i,r,o,a,l,"next",e)}function l(e){e2(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function ts(e){var t,n=(0,b.usePlugin)(S()),r=(0,b.useAPIClient)(),o=((0,b.useCollectionRecordData)()||{}).id,i=e4((0,h.useState)(null),2),a=i[0],l=i[1],c=e4((0,h.useState)(null),2),u=c[0],s=c[1];(0,h.useEffect)(function(){var e,t;if(!!o)null===(e=(t=r.resource("workflowManualTasks")).get)||void 0===e||e.call(t,{filterByTk:o,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)&&void 0!==t?t:{},o=r.node,i=r.workflow,a=(void 0===i?{}:i).nodes,c=void 0===a?[]:a,u=r.execution,p=e8(r.workflow,["nodes"]),f=e8(r,["node","workflow","execution"]);(0,w.linkNodes)(c),s(o),l({userJob:f,workflow:p,nodes:c,execution:u})})},[r,o]);var p=(0,w.useAvailableUpstreams)(null==a?void 0:a.nodes.find(function(e){return e.id===u.id})).reduce(function(e,t){var r=t.type;return Object.assign(e,n.instructions.get(r).components)},{});return u&&a?g().createElement(w.FlowContext.Provider,{value:a},g().createElement(b.SchemaComponent,{components:e6({FormBlockProvider:V,DetailsBlockProvider:w.DetailsBlockProvider,ActionBarProvider:ta,ManualActionStatusProvider:tc},Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.block.components)},{}),p),scope:e6({useSubmit:tu,useFormBlockProps:tp,useDetailsBlockProps:tf},Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.block.scope)},{})),schema:{type:"void",name:"tabs","x-component":"Tabs",properties:null===(t=u.config)||void 0===t?void 0:t.schema}})):g().createElement(j.Spin,null)}function tp(){var e,t=(0,w.useFlowContext)(),n=t.userJob,r=t.execution,o=(0,b.useCollectionRecordData)(),i=(0,b.useCurrentUserContext)().data,a=(0,b.useFormBlockContext)().form,l=r.status||n.status?o?"readPretty":"disabled":(null==i?void 0:null===(e=i.data)||void 0===e?void 0:e.id)!==n.userId?"disabled":"editable";return(0,h.useEffect)(function(){null==a||a.setPattern(l)},[l,a]),{form:a}}function tf(){return{form:(0,b.useFormBlockContext)().form}}function tm(){var e=(0,b.useCompile)(),t=(0,b.useCollectionRecordData)()||{},n=t.status,r=t.updatedAt,o=M[n];return n?g().createElement(j.Space,{className:(0,b.css)(e9())},g().createElement("time",null,e0()(r).format("YYYY-MM-DD HH:mm:ss")),g().createElement(j.Tag,{color:o.color},e(o.label))):null}function td(){var e,t=(0,h.useContext)(b.SchemaComponentContext),n=(0,b.useCollectionRecordData)()||{},r=n.id,o=n.node,i=n.workflow,a=n.status;return g().createElement(b.SchemaComponentContext.Provider,{value:e5(e6({},t),{reset:function(){},designable:!1})},g().createElement(b.SchemaComponent,{components:{FooterStatus:tm,FlowContextProvider:ts},schema:{type:"void",name:"drawer-".concat(r,"-").concat(a),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:"".concat(null==i?void 0:i.title," - ").concat(null!==(e=null==o?void 0:o.title)&&void 0!==e?e:"#".concat(null==o?void 0:o.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"FooterStatus"}}}}}}))}tl.displayName="ManualActionStatusContext";function ty(e){var t=(0,P.useTranslation)().t,n=(0,eX.useAntdToken)();return g().createElement(j.ConfigProvider,{theme:{token:{fontSizeLG:14}}},g().createElement(j.Descriptions,e5(e6({},e),{column:1,items:[{key:"createdAt",label:t("Created at"),children:g().createElement(b.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:t("Status",{ns:"workflow"}),children:g().createElement(b.SchemaComponent,{components:{TaskStatusColumn:tn},schema:{name:"status",type:"number","x-decorator":"TaskStatusColumn","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,b.css)(te(),n.colorTextDescription)})))}function tv(e){return g().createElement(ty,{title:g().createElement(tr,{dataIndex:["title","node.title"]}),extra:g().createElement(tr,{dataIndex:"workflow.title"})})}to.Initializer=function(){var e=(0,b.useSchemaInitializerItem)(),t=(0,b.useSchemaInitializer)().insert;return g().createElement(b.SchemaInitializerItem,e5(e6({icon:g().createElement(x.TableOutlined,null)},e),{onClick:function(){t({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"}}})}}))},to.Drawer=td,to.Decorator=function(e){var t=e.params,n=void 0===t?{}:t,r=e.children,o={collection:"workflowManualTasks",resource:"workflowManualTasks",action:"list",params:e5(e6({pageSize:20,sort:["-createdAt"]},n),{filter:e6({},n.filter),appends:["user","node","workflow","execution.status"],except:["node.config","workflow.config","workflow.options"]})};return g().createElement(b.OpenModeProvider,{defaultOpenMode:"modal"},g().createElement(b.List.Decorator,o,r))};var tb={pending:{status:w.JOB_STATUS.PENDING,"execution.status":w.EXECUTION_STATUS.STARTED},completed:{status:w.JOB_STATUS.RESOLVED}},th={title:'{{t("My manual tasks", { ns: "'.concat(E,'" })}}'),collection:"workflowManualTasks",useActionParams:function(e){var t,n,r=(0,b.useCurrentUserContext)().data;return{filter:e5(e6({},null!==(n=tb[e])&&void 0!==n?n:{}),{userId:null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.id}),appends:["job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"]}},component:function(){var e=(0,eX.useAntdToken)(),t=e4((0,h.useState)(!1),2),n=t[0],r=t[1],o=(0,b.useCollectionRecordData)();(0,P.useTranslation)().t;var i=(0,h.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&r(!0),e.stopPropagation()},[]);return g().createElement(g().Fragment,null,g().createElement(j.Card,{onClick:i,hoverable:!0,size:"small",title:o.title,extra:g().createElement(w.WorkflowTitle,o.workflow),className:(0,b.css)(tt(),e.colorTextDescription)},g().createElement(ty,null)),g().createElement(b.PopupContextProvider,{visible:n,setVisible:r,openMode:"modal"},g().createElement(td,null)))},extraActions:function(){return g().createElement(b.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":{icon:"ReloadOutlined"}},filter:{type:"void",title:'{{t("Filter")}}',"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]}}}}})}},tg={title:'{{t("Workflow", { ns: "workflow" })}}',name:"workflows",fields:[{type:"string",name:"title"}]},tx={title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),name:"workflowManualTasks",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(E,'" })}}'),"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(E,'" })}}'),"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}}}]},tw=function(e){return g().createElement(b.ExtendCollectionsProvider,{collections:[tg,tx]},e.children)};!function(e){e.forEach(function(e){var t=ti({defaultOpenMode:function(){return window.location.pathname.startsWith("/m/")}()?"page":"modal",collectionName:e});(0,b.storePopupContext)(t["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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({schema:t},t["x-action-context"]))})}([tx.name]);function tS(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 tO(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){tS(i,r,o,a,l,"next",e)}function l(e){tS(i,r,o,a,l,"throw",e)}a(void 0)})}}function tk(e,t,n){return(tk=tE()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tP(o,n.prototype),o}).apply(null,arguments)}function tC(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)}}function tj(e){return(tj=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tP(e,t){return(tP=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tA(e){var t="function"==typeof Map?new Map:void 0;return(tA=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return tk(e,arguments,tj(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),tP(r,e)})(e)}function tE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tE=function(){return!!e})()}function tI(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var tF=function(e){var t,n,r;function o(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),e=this,t=o,n=arguments,t=tj(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,tE()?Reflect.construct(t,n||[],tj(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tP(e,t)}(o,e),t=o,n=[{key:"afterAdd",value:function(){return tO(function(){return tI(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return tO(function(){var t;return tI(this,function(n){return e.addComponents(),e.app.addProvider(tw),(t=e.app.pm.get("workflow")).registerInstruction("manual",eH),t.registerTaskType("manual",th),e.app.schemaInitializerManager.add(eE),e.app.schemaInitializerManager.add(eI),e.app.schemaInitializerManager.add(eB),e.app.schemaInitializerManager.add(eR),e.app.schemaInitializerManager.add(ed),e.app.schemaInitializerManager.add(ey),e.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),e.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),[2]})})()}},{key:"addComponents",value:function(){this.app.addComponents({WorkflowTodo:to})}}],tC(t.prototype,n),o}(tA(b.Plugin));return v}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/plugin-workflow/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@formily/antd-v5"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("dayjs"),require("antd"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-manual",["@nocobase/plugin-workflow/client","@nocobase/client","@ant-design/icons","@formily/react","react","@formily/antd-v5","react-i18next","@nocobase/utils/client","@formily/core","lodash","dayjs","antd","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-manual"]=t(require("@nocobase/plugin-workflow/client"),require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@formily/antd-v5"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("dayjs"),require("antd"),require("antd-style")):e["@nocobase/plugin-workflow-manual"]=t(e["@nocobase/plugin-workflow/client"],e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["@formily/antd-v5"],e["react-i18next"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e.dayjs,e.antd,e["antd-style"])}(self,function(e,t,n,r,o,i,a,l,c,u,s,p,f){return function(){"use strict";var m={482:function(e){e.exports=n},632:function(e){e.exports=i},563:function(e){e.exports=c},505:function(e){e.exports=r},772:function(e){e.exports=t},433:function(t){t.exports=e},584:function(e){e.exports=l},721:function(e){e.exports=p},202:function(e){e.exports=f},760:function(e){e.exports=s},467:function(e){e.exports=u},156:function(e){e.exports=o},238:function(e){e.exports=a}},d={};function y(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var v={};y.r(v),y.d(v,{default:function(){return tF}});var b=y("772"),h=y("156"),g=y.n(h),x=y("482"),w=y("433"),S=y.n(w),O=y("632"),k=y("563"),C=y("505"),j=y("721"),P=y("238"),A=y("584"),E="workflow-manual",I=0,F=1,T=-1,D=[{value:I,label:'{{t("Pending", { ns: "workflow" })}}',color:"gold"},{value:F,label:'{{t("Resolved", { ns: "workflow" })}}',color:"green"},{value:T,label:'{{t("Rejected", { ns: "workflow" })}}',color:"red"}],M=D.reduce(function(e,t){var n,r,o;return Object.assign(e,(n={},r=t.value,o=t,r in n?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o,n))},{});function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,R(t).t)(e)}function R(e){return(0,P.useTranslation)(E,e)}function z(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 N(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function V(e){var t,n,r,o,i,a,l=(0,b.useCollectionRecordData)(),c=(0,C.useFieldSchema)(),u=(0,C.useField)(),s=(0,h.useRef)(null),p=e.dataSource||b.DEFAULT_DATA_SOURCE_KEY,f=j.theme.useToken().token,m=(0,(0,b.useAssociationNames)(p).getAssociationAppends)(),d=m.appends,y=m.updateAssociationValues;var v=(t=Object.keys(null!==(a=c.toJSON().properties)&&void 0!==a?a:{}),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,1)||function(e,t){if(e){if("string"==typeof e)return z(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 z(e,t)}}(t,n)||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],x=null==l?void 0:null===(i=l.result)||void 0===i?void 0:i[v],w=(0,h.useMemo)(function(){return(0,k.createForm)({initialValues:x})},[x]),S=(0,h.useMemo)(function(){return N({appends:d},e.params)},[d,e.params]),O=(0,h.useMemo)(function(){return{loading:!1,data:{data:x}}},[x]),P=(0,b.useAPIClient)(),A=(0,b.useDataSourceHeaders)(p),E=P.resource(e.collection,void 0,A),I=(0,b.useBlockRequestContext)(),F=(0,h.useMemo)(function(){return{params:S,form:w,field:u,service:O,updateAssociationValues:y,formBlockRef:s}},[u,w,S,O,y]);return(null==l?void 0:l.status)&&!x?null:g().createElement(b.CollectionManagerProvider,{dataSource:p},g().createElement(b.CollectionProvider_deprecated,{collection:e.collection},g().createElement(b.BlockProvider,(r=N({name:e.name||"form"},e),o=(o={block:"form",parentRecord:null},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r),g().createElement(b.FormActiveFieldsProvider,{name:"form"},g().createElement(b.BlockRequestContext_deprecated.Provider,{value:{block:"form",props:e,field:u,service:O,resource:E,__parent:I}},g().createElement(b.FormBlockContext.Provider,{value:F},g().createElement(b.RecordProvider,{record:x,parent:null},g().createElement(b.FormV2.Templates,{style:{marginBottom:f.margin},form:w}),g().createElement("div",{ref:s},e.children))))))))}var _=y("467"),U=y.n(_);function q(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,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 G(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function L(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return q(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 q(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 $(e){var t=e.schema,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["schema"]),r=(0,b.useSchemaTemplateManager)().getTemplateSchemaByMode,o=(0,b.useSchemaInitializer)().insert,i=(0,b.useRecordCollectionDataSourceItems)("FormItem");function a(){var e;return e=function(e){var n,i,a,l,c,u,s;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(p){switch(p.label){case 0:if(!(n=e.item).template)return[3,2];return[4,r(n)];case 1:return l=p.sent(),[3,3];case 2:l=null,p.label=3;case 3:var f;return a=l,f=L(G({actionInitializers:"workflowManual:form:configureActions",actions:{resolve:{type:"void",title:'{{t("Continue the process", { ns: "'.concat(E,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:w.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner","x-designer-props":{}}}},t),{template:a}),c=(0,b.createFormBlockSchema)(f),delete c["x-acl-action-props"],delete c["x-acl-action"],u=J(Object.keys(c.properties),1)[0],s=(null===(i=Object.entries(c.properties[u].properties).find(function(e){var t=J(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===i?void 0:i[0])||"actions",c.properties[u].properties[s]["x-decorator"]="ActionBarProvider",c.properties[u].properties[s]["x-component-props"].style={marginTop:"1.5em",flexWrap:"wrap"},(0,w.traverseSchema)(c,function(e){e["x-uid"]&&delete e["x-uid"]}),o(c),[2]}})},(a=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){W(i,r,o,a,l,"next",e)}function l(e){W(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return g().createElement(b.SchemaInitializerItem,L(G({},n),{onClick:function(e){return a.apply(this,arguments)},items:i}))}function K(){var e,t,n=(0,b.useSchemaInitializerItem)();return g().createElement(b.CollectionProvider_deprecated,{dataSource:null===(e=n.schema)||void 0===e?void 0:e.dataSource,collection:null===(t=n.schema)||void 0===t?void 0:t.collection},g().createElement($,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 Q(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 Y(e)}(o=Q(e.properties[n],t))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return Y(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 Y(e,t)}}(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):(r.push(e),r):r}function H(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 X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return H(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 H(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 Z(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 ee(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 et(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ee(i,r,o,a,l,"next",e)}function l(e){ee(i,r,o,a,l,"throw",e)}a(void 0)})}}function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function er(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){en(e,t,n[t])})}return e}function eo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||ea(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 ea(e,t){if(e){if("string"==typeof e)return Z(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 Z(e,t)}}function el(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function ec(e){var t,n,r,o,i=ei((0,h.useState)(null!==(r=null===(t=e.collection)||void 0===t?void 0:t.fields)&&void 0!==r?r:[]),2),a=i[0],l=i[1],c=(0,b.useCollectionRecordData)(),u=(0,C.useField)(),s=ei(Object.keys(null!==(o=(0,C.useFieldSchema)().toJSON().properties)&&void 0!==o?o:{}),1)[0],p=null==c?void 0:null===(n=c.result)||void 0===n?void 0:n[s],f=(0,h.useMemo)(function(){return(0,k.createForm)({initialValues:p})},[p]);return(null==c?void 0:c.status)&&!p?null:g().createElement(b.CollectionProvider_deprecated,{collection:eo(er({},e.collection),{fields:a})},g().createElement(b.RecordProvider,{record:p,parent:null},g().createElement(b.FormBlockContext.Provider,{value:{form:f,field:u,setCollectionFields:l}},e.children)))}function eu(){var e=(0,b.useSchemaInitializer)().insert,t=(0,b.useSchemaInitializerItem)();return g().createElement(b.SchemaInitializerItem,eo(er({},t),{onClick:function(){e({type:"void","x-decorator":"CustomFormBlockProvider","x-decorator-props":{collection:{name:(0,A.uid)(),fields:[]}},"x-component":"CardItem","x-component-props":{title:'{{t("Form")}}'},"x-designer":"SimpleDesigner","x-designer-props":{type:"customForm"},properties:en({},(0,A.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(E,'" })}}'),"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:w.JOB_STATUS.RESOLVED},"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSubmit }}"},"x-designer":"ManualActionDesigner"}}}}})})}}))}var es={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")}}'},ep=g().createContext({});function ef(){var e=(0,C.useForm)(),t=e.values,n=e.query,r=e.reset,o=[B("Field name existed in form")],i=(0,h.useContext)(ep),a=i.collection,l=i.interfaceOptions,c=i.setCollectionFields,u=i.insert,s=i.setCallback,p=i.setInterface;return{run:function(){return et(function(){var e,i,f,m,d,y,v;return el(this,function(b){var h;if(f=l.default,m=(0,A.uid)(),f.name=null!==(d=t.name)&&void 0!==d?d:m,f.uiSchema.title=null!==(y=null===(e=t.uiSchema)||void 0===e?void 0:e.title)&&void 0!==y?y:m,f.interface=l.name,null===(i=a.fields)||void 0===i?void 0:i.find(function(e){return e.name===f.name}))return n("name").take().setFeedback({type:"error",messages:o}),[2];return v=(0,A.merge)(f,t),c(((function(e){if(Array.isArray(e))return Z(e)})(h=a.fields)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(h)||ea(h)||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])),u({name:f.name,type:f.uiSchema.type,"x-decorator":"FormItem","x-component":"CollectionField","x-component-props":{field:v},"x-collection-field":"".concat(a.name,".").concat(f.name),"x-toolbar":"FormItemSchemaToolbar","x-settings":"fieldSettings:FormItem"}),r(),s(null),p(null),[2]})})()}}}var em={wrap:b.gridRowColWrap,insertPosition:"beforeEnd",title:"{{t('Configure fields')}}",ItemsComponent:function(e){var t,n,r=ei((0,h.useState)(null),2),o=r[0],i=r[1],a=ei((0,h.useState)(),2),l=a[0],c=a[1];var u=(n={},Object.keys(t=(0,b.useCollectionManager_deprecated)().interfaces).forEach(function(e){var r=t[e],o=r.group,i=void 0===o?"others":o;n[i]=n[i]||{},(0,_.set)(n,[i,e],r)}),Object.keys(es).filter(function(e){return["basic","choices","datetime","media"].includes(e)}).map(function(e){return{title:es[e],children:Object.keys(n[e]||{}).map(function(t){var r=n[e][t];return er({value:t,title:r.title,name:t},n[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:ev,fieldInterface:e.name}})}}),s=(0,b.useCollection_deprecated)(),p=(0,h.useContext)(b.FormBlockContext).setCollectionFields,f=(0,h.useMemo)(function(){return(0,k.createForm)()},[]);return g().createElement(ep.Provider,{value:{collection:s,insert:l,interfaceOptions:o,onAddField:function(e){var t=(0,_.pick)(e,["name","group","title","default","validateSchema"]),n=e.properties,r=(n.unique,n.type,n.layout,n.autoIncrement,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e.properties,["unique","type","layout","autoIncrement"]));t.properties=r;var o=(0,_.cloneDeep)(t);delete o.properties.name["x-disabled"],i(o)},setCallback:c,setInterface:i,setCollectionFields:p}},g().createElement(b.SchemaInitializerItems,eo(er({},e),{items:u})),g().createElement(b.ActionContextProvider,{value:{visible:!!o,setVisible:function(e){!e&&i(null)}}},o?g().createElement(b.SchemaComponent,{schema:{type:"void",name:"drawer",title:'{{t("Configure field")}}',"x-decorator":"FormV2","x-decorator-props":{form:f},"x-component":"Action.Drawer",properties:eo(er({},o.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 et(function(){return el(this,function(t){return c(null),i(null),e.reset(),[2]})})()}}}}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:ef}}}}})},components:{ArrayTable:O.ArrayTable}}):null))}},ed=new b.CompatibleSchemaInitializer(er({name:"AddCustomFormField"},em)),ey=new b.CompatibleSchemaInitializer(er({name:"workflowManual:customForm:configureFields"},em),ed);function ev(){var e=(0,b.useSchemaInitializerItem)(),t=(0,b.useSchemaInitializer)().insert,n=(0,h.useContext)(ep),r=n.onAddField,o=n.setCallback,i=(0,(0,b.useCollectionManager_deprecated)().getInterface)(e.fieldInterface);return g().createElement(b.SchemaInitializerItem,er({key:e.fieldInterface,onClick:function(){o(function(){return t}),r(i)}},e))}function eb(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 eh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eb(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 eb(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 eg={title:'{{t("Update record form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(e){var t=e.allCollections,n=(0,h.useMemo)(function(){return t.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:U().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(E,'" })}}'),formType:"update","x-designer":"UpdateFormDesigner"},Component:K}})}})},[t]),r=eh((0,h.useState)([]),2),o=r[0],i=r[1],a=(0,b.useMenuSearch)({data:n,openKeys:o});return{name:"updateRecordForm",key:"updateRecordForm",type:"subMenu",title:'{{t("Update record form", { ns: "'.concat(E,'" })}}'),componentProps:{onOpenChange:function(e){i(e)}},children:a}},initializers:{},components:{FilterDynamicComponent:w.FilterDynamicComponent,UpdateFormDesigner:function(){var e=(0,b.useCollection_deprecated)(),t=e.name,n=e.title,r=(0,C.useFieldSchema)(),o=(0,P.useTranslation)().t,i=(0,b.useDesignable)().dn;return g().createElement(b.GeneralSchemaDesigner,{title:n||t},g().createElement(b.SchemaSettingsBlockTitleItem,null),g().createElement(b.SchemaSettingsActionModalItem,{title:o("Filter settings",{ns:E}),schema:{name:"filter",type:"object",title:'{{t("Filter")}}',"x-component":"Filter","x-use-component-props":function(){var e;return{options:(0,b.useCollectionFilterOptions)(null==r?void 0:null===(e=r["x-decorator-props"])||void 0===e?void 0:e.collection)}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},initialValues:null==r?void 0:r["x-decorator-props"],onSubmit:function(e){var t=e.filter;r["x-decorator-props"].filter=t,i.emit("patch",{schema:{"x-decorator-props":r["x-decorator-props"]}}),i.refresh()},width:"60%"}),g().createElement(b.SchemaSettingsLinkageRules,{collectionName:t}),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return Q(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"update"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o,i,a=eh(Object.keys(e.properties),1)[0],l=e.properties[a],c=(null===(o=Object.entries(l.properties).find(function(e){var t=eh(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===o?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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},e["x-decorator-props"]),r=(r={type:"update",title:(null===(i=e["x-component-props"])||void 0===i?void 0:i.title)||a,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}})},r),Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n)}),t}},block:{scope:{},components:{}},validate:function(e){var t=e.filter;return t&&(0,A.isValidFilter)(t)?null:"Please check one of your update record form, and add at least one filter condition in form settings."}};function ex(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 ew(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function eS(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eO(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function ek(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||ej(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 ex(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ej(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 ej(e,t){if(e){if("string"==typeof e)return ex(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 ex(e,t)}}var eP=new A.Registry;eP.register("custom",{title:'{{t("Custom form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(){return{name:"customForm",type:"item",title:'{{t("Custom form", { ns: "'.concat(E,'" })}}'),Component:eu}},initializers:{},components:{CustomFormBlockProvider:ec},parseFormOptions:function(e){var t={};return Q(e,function(e){return"CustomFormBlockProvider"===e["x-decorator"]}).forEach(function(e){var n,r,o=ei(Object.keys(e.properties),1)[0],i=e.properties[o],a=Q(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!==(n=null===(t=e["x-component-props"])||void 0===t?void 0:t.field)&&void 0!==n?n:e["x-interface-options"]});var l=(null===(n=Object.entries(i.properties).find(function(e){var t=ei(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===n?void 0:n[0])||"actions";t[o]={type:"custom",title:(null===(r=e["x-component-props"])||void 0===r?void 0:r.title)||o,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{CustomFormBlockProvider:ec}}}),eP.register("create",{title:'{{t("Create record form", { ns: "'.concat(E,'" })}}'),config:{useInitializer:function(e){var t=e.allCollections,n=(0,h.useMemo)(function(){return t.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:U().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(E,'" })}}'),formType:"create","x-designer":"CreateFormDesigner"},Component:K}})}})},[t]),r=X((0,h.useState)([]),2),o=r[0],i=r[1],a=(0,b.useMenuSearch)({data:n,openKeys:o});return{name:"createRecordForm",key:"createRecordForm",type:"subMenu",title:'{{t("Create record form", { ns: "'.concat(E,'" })}}'),componentProps:{onOpenChange:function(e){i(e)}},children:a}},initializers:{},components:{CreateFormDesigner:function(){var e=(0,b.useCollection_deprecated)(),t=e.name,n=e.title;return g().createElement(b.GeneralSchemaDesigner,{title:n||t},g().createElement(b.SchemaSettingsBlockTitleItem,null),g().createElement(b.SchemaSettingsLinkageRules,{collectionName:t}),g().createElement(b.SchemaSettingsDataTemplates,{collectionName:t}),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},parseFormOptions:function(e){var t={};return Q(e,function(e){return"FormBlockProvider"===e["x-decorator"]&&"create"===e["x-decorator-props"].formType}).forEach(function(e){var n,r,o=X(Object.keys(e.properties),1)[0],i=e.properties[o],a=(null===(n=Object.entries(i.properties).find(function(e){var t=X(e,2);return"ActionBar"===(t[0],t[1])["x-component"]}))||void 0===n?void 0:n[0])||"actions";t[o]={type:"create",title:(null===(r=e["x-component-props"])||void 0===r?void 0:r.title)||o,actions:Q(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"])||void 0===n?void 0:null===(t=n.assignedValues)||void 0===t?void 0:t.values,key:e.name}}),collection:e["x-decorator-props"].collection}}),t}},block:{scope:{},components:{}}}),eP.register("update",eg);var eA={wrap:b.gridRowColWrap,title:'{{t("Add block")}}',items:[{type:"itemGroup",name:"dataBlocks",title:'{{t("Data blocks")}}',hideIfNoChildren:!0,useChildren:function(){var e,t,n=(0,b.usePlugin)(S()),r=(0,w.useNodeContext)(),o=(0,w.useAvailableUpstreams)(r);var i=[(e=(0,w.useFlowContext)().workflow,(t=(0,w.useTrigger)()).useInitializers?t.useInitializers(e.config):null)].filter(Boolean),a=o.map(function(e){var t,r=n.instructions.get(e.type);return null==r?void 0:null===(t=r.useInitializers)||void 0===t?void 0:t.call(r,e)}).filter(Boolean);return eC(i).concat(eC(a.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "'.concat(E,'" })}}'),children:a}]:[])).filter(Boolean)}},{type:"itemGroup",name:"form",title:'{{t("Form")}}',useChildren:function(){var e=(0,b.useDataSourceManager)().getAllCollections();return Array.from(eP.getValues()).map(function(t){return(0,t.config.useInitializer)({allCollections:e})})}},{type:"itemGroup",name:"otherBlocks",title:'{{t("Other blocks")}}',children:[{name:"markdown",title:'{{t("Markdown")}}',Component:"MarkdownBlockInitializer"}]}]},eE=new b.CompatibleSchemaInitializer(ew({name:"AddBlockButton"},eA)),eI=new b.CompatibleSchemaInitializer(ew({name:"workflowManual:popup:configureUserInterface:addBlock"},eA),eE);function eF(){var e,t,n,r=(0,h.useContext)(b.SchemaComponentContext),o=(0,P.useTranslation)().t,i=R().t,a=(0,C.useFieldSchema)(),l=(0,w.useWorkflowVariableOptions)(),c=ek((0,h.useState)(!1),2),u=c[0],s=c[1],p=ek((0,h.useState)(null!==(n=null==a?void 0:null===(t=a["x-action-settings"])||void 0===t?void 0:null===(e=t.assignedValues)||void 0===e?void 0:e.schema)&&void 0!==n?n:{type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields",properties:{}}),2),f=p[0],m=p[1],d=ek((0,h.useState)(null),2),y=d[0],v=d[1],x=(0,b.useSchemaOptionsContext)().components;(0,h.useEffect)(function(){v(new C.Schema({properties:{grid:f}}))},[f]);var S=(0,h.useMemo)(function(){var e,t,n=null==a?void 0:null===(t=a["x-action-settings"])||void 0===t?void 0:null===(e=t.assignedValues)||void 0===e?void 0:e.values;return(0,k.createForm)({initialValues:A.lodash.cloneDeep(n),values:A.lodash.cloneDeep(n)})},[a]),E=(0,b.useFormActiveFields)(),I=o("Assign field values");function F(){s(!1)}return g().createElement(g().Fragment,null,g().createElement(b.SchemaSettingsItem,{title:I,onClick:function(){return s(!0)}},I),g().createElement(j.Modal,{width:"50%",title:I,open:u,onCancel:F,footer:g().createElement(j.Space,null,g().createElement(j.Button,{onClick:F},i("Cancel")),g().createElement(j.Button,{type:"primary",onClick:function(){!a["x-action-settings"]&&(a["x-action-settings"]={}),!a["x-action-settings"].assignedValues&&(a["x-action-settings"].assignedValues={}),a["x-action-settings"].assignedValues.schema=f,a["x-action-settings"].assignedValues.values=S.values,s(!1),setTimeout(function(){var e;null===(e=r.refresh)||void 0===e||e.call(r)},300)}},i("Submit")))},g().createElement(b.DefaultValueProvider,{isAllowToSetDefaultValue:function(){return!1}},g().createElement(b.VariableScopeProvider,{scope:l},g().createElement(b.FormActiveFieldsProvider,{name:"form",getActiveFieldsName:null==E?void 0:E.getActiveFieldsName},g().createElement(C.FormProvider,{form:S},g().createElement(O.FormLayout,{layout:"vertical"},g().createElement(j.Alert,{message:i("Values preset in this form will override user submitted ones when continue or reject.")}),g().createElement("br",null),u&&y&&g().createElement(b.SchemaComponentContext.Provider,{value:eS(ew({},r),{refresh:function(){m(A.lodash.get(y.toJSON(),"properties.grid"))}})},g().createElement(b.SchemaComponent,{schema:y,components:x})))))))))}function eT(e){return g().createElement(b.GeneralSchemaDesigner,eS(ew({},e),{disableInitializer:!0}),g().createElement(b.Action.Designer.ButtonEditor,null),g().createElement(eF,null),g().createElement(b.SchemaSettingsDivider,null),g().createElement(b.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"ActionBar"}}))}function eD(){var e=(0,b.useSchemaInitializerItem)(),t=e.action,n=e.actionProps,r=eO(e,["action","actionProps"]);return g().createElement(b.InitializerWithSwitch,eS(ew({},r),{item:e,schema:{type:"void",title:r.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:t},"x-component":"Action","x-component-props":eS(ew({},n),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action":"".concat(t)},type:"x-action"}))}var eM={title:'{{t("Configure actions")}}',items:[{name:"jobStatusResolved",title:'{{t("Continue the process", { ns: "'.concat(E,'" })}}'),Component:function(){var e=(0,b.useSchemaInitializerItem)(),t=e.action,n=e.actionProps,r=eO(e,["action","actionProps"]),o=(0,b.useSchemaInitializer)().insert;return g().createElement(b.SchemaInitializerItem,eS(ew({},r),{onClick:function(){o({type:"void",title:r.title,"x-decorator":"ManualActionStatusProvider","x-decorator-props":{value:t},"x-component":"Action","x-component-props":eS(ew({},n),{useAction:"{{ useSubmit }}"}),"x-designer":"ManualActionDesigner","x-action-settings":{}})}}))},action:w.JOB_STATUS.RESOLVED,actionProps:{type:"primary"}},{name:"jobStatusRejected",title:'{{t("Terminate the process", { ns: "'.concat(E,'" })}}'),Component:eD,action:w.JOB_STATUS.REJECTED,actionProps:{danger:!0}},{name:"jobStatusPending",title:'{{t("Save temporarily", { ns: "'.concat(E,'" })}}'),Component:eD,action:w.JOB_STATUS.PENDING}]},eB=new b.CompatibleSchemaInitializer(ew({name:"AddActionButton"},eM)),eR=new b.CompatibleSchemaInitializer(ew({name:"workflowManual:form:configureActions"},eM),eB);function ez(){return{run:function(){}}}function eN(e){var t=e.value,n=e.onChange,r=(0,b.usePlugin)(S()),o=(0,h.useContext)(b.SchemaComponentContext),i=(0,w.useNodeContext)(),a=(0,w.useAvailableUpstreams)(i),l=(0,C.useForm)(),c=(0,w.useFlowContext)().workflow,u=(0,h.useRef)(function(){}),s={};a.forEach(function(e){Object.assign(s,r.instructions.get(e.type).components)});var p=(0,h.useMemo)(function(){return new C.Schema({properties:{drawer:{type:"void",title:'{{t("User interface", { ns: "'.concat(E,'" })}}'),"x-decorator":"Form","x-component":"Action.Container","x-component-props":{onClose:function(){return u.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!=t?t:{tab1:{type:"void",title:'{{t("Manual", { ns: "'.concat(E,'" })}}'),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"workflowManual:popup:configureUserInterface:addBlock",properties:{}}}}}}}}}})},[]),f=(0,h.useCallback)(function(){var e=A.lodash.get(p.toJSON(),"properties.drawer.properties").tabs,t=Array.from(eP.getValues()).reduce(function(t,n){return Object.assign(t,n.config.parseFormOptions(e))},{});l.setValuesIn("forms",t),n(e.properties)},[l,n,p]);return u.current=f,g().createElement(b.SchemaComponentContext.Provider,{value:eS(ew({},o),{designable:!c.executed,refresh:f})},g().createElement(b.SchemaComponent,{schema:p,components:eS(ew({},s,Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.config.components)},{})),{FormBlockProvider:V,DetailsBlockProvider:w.DetailsBlockProvider,ManualActionStatusProvider:function(e){return e.children},ActionBarProvider:function(e){return e.children},SimpleDesigner:w.SimpleDesigner,ManualActionDesigner:eT}),scope:{useSubmit:ez,useDetailsBlockProps:b.useFormBlockContext}}))}function eV(e){var t=(0,w.useFlowContext)().workflow,n=ek((0,h.useState)(!1),2),r=n[0],o=n[1],i=(0,C.useForm)().values,a=R().t,l=(0,h.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=eP.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}}}(i.forms);if(t){j.message.error({content:a(t)});return}}o(e)},[i.forms]);return g().createElement(g().Fragment,null,g().createElement(j.Button,{type:"primary",onClick:function(){return o(!0)},disabled:!1},a(t.executed?"View user interface":"Configure user interface")),g().createElement(b.ActionContextProvider,{value:{visible:r,setVisible:l,formValueChanged:!1}},e.children))}function e_(){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 e_=function(){return n},n}function eU(e){var t,n=e.value,r=e.onChange;!(t=n)||t>=1;var o=g().createElement("fieldset",null,g().createElement(O.FormLayout,{layout:"vertical"},g().createElement(b.FormItem,{label:B("Negotiation")},g().createElement(j.Radio.Group,{value:n,onChange:r},g().createElement(j.Radio,{value:1},g().createElement(j.Tooltip,{title:B("Everyone should pass"),placement:"bottom"},g().createElement("span",null,B("All pass")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))),g().createElement(j.Radio,{value:-1},g().createElement(j.Tooltip,{title:B("Anyone pass"),placement:"bottom"},g().createElement("span",null,B("Any pass")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}})))))));return g().createElement("fieldset",{className:(0,b.css)(e_())},g().createElement(j.Form.Item,null,g().createElement(j.Radio.Group,{value:!!n,onChange:function(e){var t=e.target.value;console.log(t),r(Number(t))}},g().createElement(j.Radio,{value:!0},g().createElement(j.Tooltip,{title:B("Each user has own task"),placement:"bottom"},g().createElement("span",null,B("Separately")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))),g().createElement(j.Radio,{value:!1},g().createElement(j.Tooltip,{title:B("Everyone shares one task"),placement:"bottom"},g().createElement("span",null,B("Collaboratively")),g().createElement(x.QuestionCircleOutlined,{style:{color:"#999"}}))))),n?o:null)}function eq(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}function eW(e){e.multiple;var t=e.value,n=void 0===t?[]:t,r=e.onChange,o=(0,w.useWorkflowVariableOptions)({types:[eq]});return g().createElement(b.Variable.Input,{scope:o,value:n[0],onChange:function(e){r([e])}},g().createElement(b.RemoteSelect,{fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1,value:n[0],onChange:function(e){r(null!=e?[e]:[])}}))}function eG(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)}}function eL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eJ(e){return(eJ=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e$(e,t){return(e$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eK=function(){return!!e})()}function eY(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=t.types,c=t.fieldNames,u=void 0===c?w.defaultFieldNames:c,s=(0,b.useCompile)(),p=(0,b.useCollectionManager_deprecated)().getCollectionFields,f=Object.keys(null!==(n=a.forms)&&void 0!==n?n:{});if(!f.length)return null;var m=f.map(function(e){var t,n=a.forms[e],r=(0,w.getCollectionFieldOptions)({fields:null===(t=n.collection)||void 0===t?void 0:t.fields,collection:n.collection,types:l,compile:s,getCollectionFields:p}),o=s(n.title)||e;return r.length?{key:e,value:e,label:o,title:o,children:r}:null}).filter(Boolean);return m.length?(eL(r={},u.value,o),eL(r,u.label,i),eL(r,u.children,m),r):null}function eQ(e){var t,n=(0,b.useCollectionManager_deprecated)().getCollection,r=Object.keys(null!==(t=e.config.forms)&&void 0!==t?t:{});if(!r.length||e.config.mode)return null;var o=r.map(function(t){var r,o,i=e.config.forms[t],a=n(i.collection).fields;return(void 0===a?[]:a).length?{name:null!==(r=i.title)&&void 0!==r?r:t,type:"item",title:null!==(o=i.title)&&void 0!==o?o:t,Component:w.CollectionBlockInitializer,collection:i.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key,".").concat(t)}:null}).filter(Boolean);return o.length?{name:"#".concat(e.id),key:"forms",type:"subMenu",title:e.title,children:o}:null}Symbol("single"),Symbol("all"),Symbol("any"),Symbol("all percentage"),Symbol("any percentage");var eH=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=eJ(n),eL(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,eK()?Reflect.construct(n,r||[],eJ(t).constructor):n.apply(t,r)),"title",'{{t("Manual", { ns: "'.concat(E,'" })}}')),eL(e,"type","manual"),eL(e,"group","manual"),eL(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(E,'" })}}')),eL(e,"icon",g().createElement(x.SolutionOutlined,null)),eL(e,"fieldset",{assignees:{type:"array",title:'{{t("Assignees", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"AssigneesSelect","x-component-props":{},required:!0,default:[]},mode:{type:"number",title:'{{t("Mode", { ns: "'.concat(E,'" })}}'),"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(E,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea",description:'{{t("Title of each task item. Default to node title.", { ns: "'.concat(E,'" })}}'),default:"{{useNodeContext().title}}"},schema:{type:"void",title:'{{t("User interface", { ns: "'.concat(E,'" })}}'),"x-decorator":"FormItem","x-component":"SchemaConfigButton",properties:{schema:{type:"object","x-component":"SchemaConfig",default:null}}},forms:{type:"object",default:{}}}),eL(e,"scope",{useNodeContext:w.useNodeContext}),eL(e,"components",{SchemaConfigButton:eV,SchemaConfig:eN,ModeConfig:eU,AssigneesSelect:eW,WorkflowVariableTextArea:w.WorkflowVariableTextArea}),eL(e,"useVariables",eY),eL(e,"useInitializers",eQ),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&e$(e,t)}(o,e),t=o,n=[{key:"isAvailable",value:function(e){var t=e.engine,n=e.workflow;return e.upstream,e.branchIndex,!t.isWorkflowSync(n)}}],eG(t.prototype,n),o}(w.Instruction),eX=y("202"),eZ=y("760"),e0=y.n(eZ);function e1(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 e2(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 e3(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e6(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){e3(e,t,n[t])})}return e}function e5(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function e8(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function e4(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return e1(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 e1(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 e7(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function e9(){var e=e7(["\n margin-bottom: 1em;\n time {\n margin-right: 0.5em;\n }\n "]);return e9=function(){return e},e}function te(){var e=e7(["\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 te=function(){return e},e}function tt(){var e=e7(["\n .ant-card-extra {\n color: ",";\n }\n "]);return tt=function(){return e},e}function tn(e){var t,n=(0,b.useCollectionRecordData)(),r=B("Unprocessed");return(null==n?void 0:null===(t=n.execution)||void 0===t?void 0:t.status)&&!(null==n?void 0:n.status)?g().createElement(j.Tag,null,r):e.children}function tr(e){var t=(0,b.useCollectionRecordData)();if(Array.isArray(e.dataIndex)){var n=!0,r=!1,o=void 0;try{for(var i,a=e.dataIndex[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value,c=(0,_.get)(t,l);if(c)return c}}catch(e){r=!0,o=e}finally{try{!n&&null!=a.return&&a.return()}finally{if(r)throw o}}}return(0,_.get)(t,e.dataIndex)}var to=function(e){var t=ti({defaultOpenMode:(0,b.useOpenModeContext)().defaultOpenMode,collectionName:"workflowManualTasks"});return g().createElement(b.SchemaComponentContext.Provider,{value:{designable:!1}},g().createElement(b.SchemaComponent,{scope:{useCollectionRecordData:b.useCollectionRecordData},components:{FormLayout:O.FormLayout,ContentDetailWithTitle:tv},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"},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:t}}}}}}}}}))};function ti(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":to.Drawer}}}}function ta(e){var t,n=(0,b.useCurrentUserContext)().data,r=(0,w.useFlowContext)().userJob,o=r.status,i=r.result,a=r.userId,l=(0,C.useFieldSchema)().parent.toJSON().name,c=e.children;return o?!i[l]&&(c=null):(null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.id)!==a&&(c=null),c}var tl=(0,h.createContext)(null);function tc(e){var t=e.value,n=e.children,r=(0,w.useFlowContext)(),o=r.userJob,i=r.execution,a=(0,C.useField)(),l=(0,C.useFieldSchema)(),c=(0,b.useCompile)();return(0,h.useEffect)(function(){(i.status||o.status)&&(a.disabled=!0,a.visible=o.status===t&&o.result._===l.name)},[i,o,t,a,l.name]),g().createElement(tl.Provider,{value:t},i.status||o.status?g().createElement(j.Button,{type:"primary",disabled:!0},c(l.title)):n)}function tu(){var e,t=(0,b.useAPIClient)(),n=(0,b.useActionContext)(),r=n.setVisible,o=n.setSubmitted,i=(0,C.useForm)(),a=i.values,l=i.submit,c=(0,C.useField)(),u=(0,C.useFieldSchema)(),s=(0,b.useTableBlockContext)().service,p=(0,w.useFlowContext)(),f=p.userJob,m=p.execution,d=u.name,y=u.parent.parent.name,v=(null!==(e=null==u?void 0:u["x-action-settings"])&&void 0!==e?e:{}).assignedValues,h=void 0===v?{}:v;return{run:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(n){switch(n.label){case 0:if(m.status||f.status)return[2];return[4,l()];case 1:return n.sent(),c.data=c.data||{},c.data.loading=!0,[4,t.resource("workflowManualTasks").submit({filterByTk:f.id,values:{result:(e3(e={},y,e6({},a,h.values)),e3(e,"_",d),e)}})];case 2:return n.sent(),c.data.loading=!1,o(!0),r(!1),null==s||s.refresh(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){e2(i,r,o,a,l,"next",e)}function l(e){e2(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}function ts(e){var t,n=(0,b.usePlugin)(S()),r=(0,b.useAPIClient)(),o=((0,b.useCollectionRecordData)()||{}).id,i=e4((0,h.useState)(null),2),a=i[0],l=i[1],c=e4((0,h.useState)(null),2),u=c[0],s=c[1];(0,h.useEffect)(function(){var e,t;if(!!o)null===(e=(t=r.resource("workflowManualTasks")).get)||void 0===e||e.call(t,{filterByTk:o,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)&&void 0!==t?t:{},o=r.node,i=r.workflow,a=(void 0===i?{}:i).nodes,c=void 0===a?[]:a,u=r.execution,p=e8(r.workflow,["nodes"]),f=e8(r,["node","workflow","execution"]);(0,w.linkNodes)(c),s(o),l({userJob:f,workflow:p,nodes:c,execution:u})})},[r,o]);var p=(0,w.useAvailableUpstreams)(null==a?void 0:a.nodes.find(function(e){return e.id===u.id})).reduce(function(e,t){var r=t.type;return Object.assign(e,n.instructions.get(r).components)},{});return u&&a?g().createElement(w.FlowContext.Provider,{value:a},g().createElement(b.SchemaComponent,{components:e6({FormBlockProvider:V,DetailsBlockProvider:w.DetailsBlockProvider,ActionBarProvider:ta,ManualActionStatusProvider:tc},Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.block.components)},{}),p),scope:e6({useSubmit:tu,useFormBlockProps:tp,useDetailsBlockProps:tf},Array.from(eP.getValues()).reduce(function(e,t){return Object.assign(e,t.block.scope)},{})),schema:{type:"void",name:"tabs","x-component":"Tabs",properties:null===(t=u.config)||void 0===t?void 0:t.schema}})):g().createElement(j.Spin,null)}function tp(){var e,t=(0,w.useFlowContext)(),n=t.userJob,r=t.execution,o=(0,b.useCollectionRecordData)(),i=(0,b.useCurrentUserContext)().data,a=(0,b.useFormBlockContext)().form,l=r.status||n.status?o?"readPretty":"disabled":(null==i?void 0:null===(e=i.data)||void 0===e?void 0:e.id)!==n.userId?"disabled":"editable";return(0,h.useEffect)(function(){null==a||a.setPattern(l)},[l,a]),{form:a}}function tf(){return{form:(0,b.useFormBlockContext)().form}}function tm(){var e=(0,b.useCompile)(),t=(0,b.useCollectionRecordData)()||{},n=t.status,r=t.updatedAt,o=M[n];return n?g().createElement(j.Space,{className:(0,b.css)(e9())},g().createElement("time",null,e0()(r).format("YYYY-MM-DD HH:mm:ss")),g().createElement(j.Tag,{color:o.color},e(o.label))):null}function td(){var e,t=(0,h.useContext)(b.SchemaComponentContext),n=(0,b.useCollectionRecordData)()||{},r=n.id,o=n.node,i=n.workflow,a=n.status;return g().createElement(b.SchemaComponentContext.Provider,{value:e5(e6({},t),{reset:function(){},designable:!1})},g().createElement(b.SchemaComponent,{components:{FooterStatus:tm,FlowContextProvider:ts},schema:{type:"void",name:"drawer-".concat(r,"-").concat(a),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:"".concat(null==i?void 0:i.title," - ").concat(null!==(e=null==o?void 0:o.title)&&void 0!==e?e:"#".concat(null==o?void 0:o.id)),properties:{tabs:{type:"void","x-component":"FlowContextProvider"},footer:{type:"void","x-component":"Action.Container.Footer",properties:{content:{type:"void","x-component":"FooterStatus"}}}}}}))}tl.displayName="ManualActionStatusContext";function ty(e){var t=(0,P.useTranslation)().t,n=(0,eX.useAntdToken)();return g().createElement(j.ConfigProvider,{theme:{token:{fontSizeLG:14}}},g().createElement(j.Descriptions,e5(e6({},e),{column:1,items:[{key:"createdAt",label:t("Created at"),children:g().createElement(b.SchemaComponent,{schema:{name:"createdAt",type:"string","x-component":"CollectionField","x-read-pretty":!0}})},{key:"status",label:t("Status",{ns:"workflow"}),children:g().createElement(b.SchemaComponent,{components:{TaskStatusColumn:tn},schema:{name:"status",type:"number","x-decorator":"TaskStatusColumn","x-component":"CollectionField","x-read-pretty":!0}})}],className:(0,b.css)(te(),n.colorTextDescription)})))}function tv(e){return g().createElement(ty,{title:g().createElement(tr,{dataIndex:["title","node.title"]}),extra:g().createElement(tr,{dataIndex:"workflow.title"})})}to.Initializer=function(){var e=(0,b.useSchemaInitializerItem)(),t=(0,b.useSchemaInitializer)().insert;return g().createElement(b.SchemaInitializerItem,e5(e6({icon:g().createElement(x.TableOutlined,null)},e),{onClick:function(){t({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"}}})}}))},to.Drawer=td,to.Decorator=function(e){var t=e.params,n=void 0===t?{}:t,r=e.children,o={collection:"workflowManualTasks",resource:"workflowManualTasks",action:"list",params:e5(e6({pageSize:20,sort:["-createdAt"]},n),{filter:e6({},n.filter),appends:["user","node","workflow","execution.status"],except:["node.config","workflow.config","workflow.options"]})};return g().createElement(b.OpenModeProvider,{defaultOpenMode:"modal"},g().createElement(b.List.Decorator,o,r))};var tb={pending:{status:w.JOB_STATUS.PENDING,"execution.status":w.EXECUTION_STATUS.STARTED},completed:{status:w.JOB_STATUS.RESOLVED}},th={title:'{{t("My manual tasks", { ns: "'.concat(E,'" })}}'),collection:"workflowManualTasks",useActionParams:function(e){var t,n,r=(0,b.useCurrentUserContext)().data;return{filter:e5(e6({},null!==(n=tb[e])&&void 0!==n?n:{}),{userId:null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.id}),appends:["job.id","job.status","job.result","workflow.id","workflow.title","workflow.enabled","execution.id","execution.status"]}},component:function(){var e=(0,eX.useAntdToken)(),t=e4((0,h.useState)(!1),2),n=t[0],r=t[1],o=(0,b.useCollectionRecordData)();(0,P.useTranslation)().t;var i=(0,h.useCallback)(function(e){var t=e.target;e.currentTarget.contains(t)&&r(!0),e.stopPropagation()},[]);return g().createElement(g().Fragment,null,g().createElement(j.Card,{onClick:i,hoverable:!0,size:"small",title:o.title,extra:g().createElement(w.WorkflowTitle,o.workflow),className:(0,b.css)(tt(),e.colorTextDescription)},g().createElement(ty,null)),g().createElement(b.PopupContextProvider,{visible:n,setVisible:r,openMode:"modal"},g().createElement(td,null)))},extraActions:function(){return g().createElement(b.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":{icon:"ReloadOutlined"}},filter:{type:"void",title:'{{t("Filter")}}',"x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},default:{$and:[{title:{$includes:""}},{"workflow.title":{$includes:""}}]}}}}})}},tg={title:'{{t("Workflow", { ns: "workflow" })}}',name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input"}}]},tx={title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),name:"workflowManualTasks",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:'{{t("Task title", { ns: "'.concat(E,'" })}}'),"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(E,'" })}}'),"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}}}]},tw=function(e){return g().createElement(b.ExtendCollectionsProvider,{collections:[tg,tx]},e.children)};!function(e){e.forEach(function(e){var t=ti({defaultOpenMode:function(){return window.location.pathname.startsWith("/m/")}()?"page":"modal",collectionName:e});(0,b.storePopupContext)(t["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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({schema:t},t["x-action-context"]))})}([tx.name]);function tS(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 tO(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){tS(i,r,o,a,l,"next",e)}function l(e){tS(i,r,o,a,l,"throw",e)}a(void 0)})}}function tk(e,t,n){return(tk=tE()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tP(o,n.prototype),o}).apply(null,arguments)}function tC(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)}}function tj(e){return(tj=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tP(e,t){return(tP=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tA(e){var t="function"==typeof Map?new Map:void 0;return(tA=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return tk(e,arguments,tj(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),tP(r,e)})(e)}function tE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tE=function(){return!!e})()}function tI(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var tF=function(e){var t,n,r;function o(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),e=this,t=o,n=arguments,t=tj(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,tE()?Reflect.construct(t,n||[],tj(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tP(e,t)}(o,e),t=o,n=[{key:"afterAdd",value:function(){return tO(function(){return tI(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return tO(function(){var t;return tI(this,function(n){return e.addComponents(),e.app.addProvider(tw),(t=e.app.pm.get("workflow")).registerInstruction("manual",eH),t.registerTaskType("manual",th),e.app.schemaInitializerManager.add(eE),e.app.schemaInitializerManager.add(eI),e.app.schemaInitializerManager.add(eB),e.app.schemaInitializerManager.add(eR),e.app.schemaInitializerManager.add(ed),e.app.schemaInitializerManager.add(ey),e.app.schemaInitializerManager.get("page:addBlock").add("otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),e.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.workflowTodos",{title:'{{t("Workflow todos", { ns: "'.concat(E,'" })}}'),Component:"WorkflowTodo.Initializer",icon:"CheckSquareOutlined"}),[2]})})()}},{key:"addComponents",value:function(){this.app.addComponents({WorkflowTodo:to})}}],tC(t.prototype,n),o}(tA(b.Plugin));return v}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.7.0-beta.
|
|
11
|
+
"@nocobase/client": "1.7.0-beta.5",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"@formily/react": "2.3.0",
|
|
14
14
|
"@formily/antd-v5": "1.1.9",
|
|
@@ -18,14 +18,14 @@ module.exports = {
|
|
|
18
18
|
"dayjs": "1.11.10",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
|
-
"@nocobase/plugin-workflow": "1.7.0-beta.
|
|
22
|
-
"@nocobase/utils": "1.7.0-beta.
|
|
23
|
-
"@nocobase/server": "1.7.0-beta.
|
|
24
|
-
"@nocobase/actions": "1.7.0-beta.
|
|
25
|
-
"@nocobase/resourcer": "1.7.0-beta.
|
|
26
|
-
"@nocobase/test": "1.7.0-beta.
|
|
27
|
-
"@nocobase/plugin-workflow-test": "1.7.0-beta.
|
|
21
|
+
"@nocobase/plugin-workflow": "1.7.0-beta.5",
|
|
22
|
+
"@nocobase/utils": "1.7.0-beta.5",
|
|
23
|
+
"@nocobase/server": "1.7.0-beta.5",
|
|
24
|
+
"@nocobase/actions": "1.7.0-beta.5",
|
|
25
|
+
"@nocobase/resourcer": "1.7.0-beta.5",
|
|
26
|
+
"@nocobase/test": "1.7.0-beta.5",
|
|
27
|
+
"@nocobase/plugin-workflow-test": "1.7.0-beta.5",
|
|
28
28
|
"@formily/core": "2.3.0",
|
|
29
|
-
"@nocobase/database": "1.7.0-beta.
|
|
29
|
+
"@nocobase/database": "1.7.0-beta.5",
|
|
30
30
|
"sequelize": "6.35.2"
|
|
31
31
|
};
|
|
@@ -39,8 +39,8 @@ __export(change_table_name_exports, {
|
|
|
39
39
|
default: () => change_table_name_default
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(change_table_name_exports);
|
|
42
|
-
var import_sequelize = require("sequelize");
|
|
43
42
|
var import_server = require("@nocobase/server");
|
|
43
|
+
var import_sequelize = require("sequelize");
|
|
44
44
|
var import_workflowManualTasks = __toESM(require("../collections/workflowManualTasks"));
|
|
45
45
|
class change_table_name_default extends import_server.Migration {
|
|
46
46
|
appVersion = "<1.7.0";
|
|
@@ -61,8 +61,55 @@ class change_table_name_default extends import_server.Migration {
|
|
|
61
61
|
const newTableNameWithQuotes = workflowManualTasksCollection.getRealTableName(true);
|
|
62
62
|
const exists = await queryInterface.tableExists(oldTableName);
|
|
63
63
|
if (!exists) {
|
|
64
|
+
const newColumns = await queryInterface.describeTable(newTableName);
|
|
65
|
+
const newPrimaryKeys = Object.values(newColumns).filter((c) => c.primaryKey);
|
|
66
|
+
if (newPrimaryKeys.length > 1) {
|
|
67
|
+
const constraints2 = await queryInterface.showConstraint(newTableName);
|
|
68
|
+
await db.sequelize.transaction(
|
|
69
|
+
{
|
|
70
|
+
isolationLevel: import_sequelize.Transaction.ISOLATION_LEVELS.SERIALIZABLE
|
|
71
|
+
},
|
|
72
|
+
async (transaction) => {
|
|
73
|
+
if (this.db.isPostgresCompatibleDialect()) {
|
|
74
|
+
const primaryKeys = constraints2.filter((item) => item.constraintType === "PRIMARY KEY");
|
|
75
|
+
if (primaryKeys.length) {
|
|
76
|
+
for (const primaryKey of primaryKeys) {
|
|
77
|
+
await queryInterface.removeConstraint(newTableName, primaryKey.constraintName, { transaction });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} else if (this.db.isMySQLCompatibleDialect()) {
|
|
81
|
+
const idExists = await workflowManualTasksCollection.getField("id").existsInDb();
|
|
82
|
+
if (!idExists) {
|
|
83
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} ADD COLUMN id BIGINT;`, {
|
|
84
|
+
transaction
|
|
85
|
+
});
|
|
86
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} DROP PRIMARY KEY`, {
|
|
87
|
+
transaction
|
|
88
|
+
});
|
|
89
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} ADD PRIMARY KEY (id)`, {
|
|
90
|
+
transaction
|
|
91
|
+
});
|
|
92
|
+
await db.sequelize.query(
|
|
93
|
+
`ALTER TABLE ${newTableNameWithQuotes} MODIFY COLUMN id BIGINT AUTO_INCREMENT`,
|
|
94
|
+
{
|
|
95
|
+
transaction
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
} else {
|
|
99
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} DROP PRIMARY KEY`, {
|
|
100
|
+
transaction
|
|
101
|
+
});
|
|
102
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} ADD PRIMARY KEY (id)`, {
|
|
103
|
+
transaction
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
64
110
|
return;
|
|
65
111
|
}
|
|
112
|
+
const oldColumns = await queryInterface.describeTable(oldTableName);
|
|
66
113
|
const constraints = await queryInterface.showConstraint(oldTableName);
|
|
67
114
|
await db.sequelize.transaction(
|
|
68
115
|
{
|
|
@@ -71,7 +118,12 @@ class change_table_name_default extends import_server.Migration {
|
|
|
71
118
|
async (transaction) => {
|
|
72
119
|
const newExists = await queryInterface.tableExists(newTableName, { transaction });
|
|
73
120
|
if (newExists) {
|
|
74
|
-
|
|
121
|
+
if (oldColumns.status) {
|
|
122
|
+
await queryInterface.dropTable(newTableName, { transaction });
|
|
123
|
+
} else {
|
|
124
|
+
await queryInterface.dropTable(oldTableName, { transaction });
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
75
127
|
}
|
|
76
128
|
if (this.db.isPostgresCompatibleDialect()) {
|
|
77
129
|
await db.sequelize.query(
|
|
@@ -91,9 +143,23 @@ class change_table_name_default extends import_server.Migration {
|
|
|
91
143
|
}
|
|
92
144
|
}
|
|
93
145
|
} else if (this.db.isMySQLCompatibleDialect()) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
146
|
+
const idExists = await workflowManualTasksCollection.getField("id").existsInDb();
|
|
147
|
+
if (!idExists) {
|
|
148
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} ADD COLUMN id BIGINT;`, {
|
|
149
|
+
transaction
|
|
150
|
+
});
|
|
151
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} DROP PRIMARY KEY`, {
|
|
152
|
+
transaction
|
|
153
|
+
});
|
|
154
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} ADD PRIMARY KEY (id)`, {
|
|
155
|
+
transaction
|
|
156
|
+
});
|
|
157
|
+
await db.sequelize.query(`ALTER TABLE ${newTableNameWithQuotes} MODIFY COLUMN id BIGINT AUTO_INCREMENT`, {
|
|
158
|
+
transaction
|
|
159
|
+
});
|
|
160
|
+
} else {
|
|
161
|
+
console.log("------------------ id exists", idExists);
|
|
162
|
+
}
|
|
97
163
|
}
|
|
98
164
|
const indexes = await queryInterface.showIndex(newTableName, { transaction });
|
|
99
165
|
const oldIndexPrefix = `${db.options.tablePrefix || ""}users_jobs`;
|
|
@@ -32,26 +32,55 @@ module.exports = __toCommonJS(remove_m2m_fields_exports);
|
|
|
32
32
|
var import_server = require("@nocobase/server");
|
|
33
33
|
class remove_m2m_fields_default extends import_server.Migration {
|
|
34
34
|
appVersion = "<1.7.0";
|
|
35
|
-
on = "
|
|
35
|
+
on = "beforeLoad";
|
|
36
36
|
async up() {
|
|
37
37
|
const { db } = this.context;
|
|
38
|
+
const usersJobsCollection = db.collection({
|
|
39
|
+
name: "users_jobs"
|
|
40
|
+
});
|
|
41
|
+
const fieldCollection = db.collection({
|
|
42
|
+
name: "fields",
|
|
43
|
+
autoGenId: false,
|
|
44
|
+
createdAt: false,
|
|
45
|
+
updatedAt: false,
|
|
46
|
+
filterTargetKey: ["collectionName", "name"],
|
|
47
|
+
fields: [
|
|
48
|
+
{
|
|
49
|
+
name: "collectionName",
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "name",
|
|
54
|
+
type: "string"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
const oldTableExists = await db.sequelize.getQueryInterface().tableExists(usersJobsCollection.getTableNameWithSchema());
|
|
38
59
|
await db.sequelize.transaction(async (transaction) => {
|
|
39
|
-
|
|
40
|
-
await FieldRepo.destroy({
|
|
60
|
+
await fieldCollection.repository.destroy({
|
|
41
61
|
filter: {
|
|
42
62
|
collectionName: "users",
|
|
43
|
-
name: "jobs"
|
|
63
|
+
name: ["jobs", "usersJobs"]
|
|
44
64
|
},
|
|
45
65
|
transaction
|
|
46
66
|
});
|
|
47
|
-
await
|
|
67
|
+
await fieldCollection.repository.destroy({
|
|
48
68
|
filter: {
|
|
49
69
|
collectionName: "jobs",
|
|
50
|
-
name: "users"
|
|
70
|
+
name: ["users", "usersJobs"]
|
|
51
71
|
},
|
|
52
72
|
transaction
|
|
53
73
|
});
|
|
54
|
-
|
|
74
|
+
if (oldTableExists) {
|
|
75
|
+
const oldColumns = await db.sequelize.getQueryInterface().describeTable(usersJobsCollection.getTableNameWithSchema());
|
|
76
|
+
if (!oldColumns.status) {
|
|
77
|
+
await db.sequelize.getQueryInterface().dropTable(usersJobsCollection.getTableNameWithSchema(), { transaction });
|
|
78
|
+
} else {
|
|
79
|
+
throw new Error("users_jobs table is not migrated properly, please contact support.");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
55
82
|
});
|
|
83
|
+
db.removeCollection("fields");
|
|
84
|
+
db.removeCollection("users_jobs");
|
|
56
85
|
}
|
|
57
86
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:人工处理节点",
|
|
5
5
|
"description": "Could be used for workflows which some of decisions are made by users.",
|
|
6
6
|
"description.zh-CN": "用于人工控制部分决策的流程。",
|
|
7
|
-
"version": "1.7.0-beta.
|
|
7
|
+
"version": "1.7.0-beta.5",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow-manual",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@nocobase/test": "1.x",
|
|
31
31
|
"@nocobase/utils": "1.x"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "d95f10c4f23f2f2ee245880b4e900854c40bd114",
|
|
34
34
|
"keywords": [
|
|
35
35
|
"Workflow"
|
|
36
36
|
]
|
|
File without changes
|
|
File without changes
|