@steedos-widgets/amis-object 6.10.2-beta.3 → 6.10.3

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.
@@ -628,9 +628,15 @@ export declare const AmisInstanceDetail: (props: any) => Promise<{
628
628
  regions: string[];
629
629
  onEvent: {
630
630
  "@data.@instanceDetail.changed": {
631
- actions: {
631
+ actions: ({
632
632
  actionType: string;
633
- }[];
633
+ script: string;
634
+ componentId?: undefined;
635
+ } | {
636
+ componentId: string;
637
+ actionType: string;
638
+ script?: undefined;
639
+ })[];
634
640
  };
635
641
  inited: {
636
642
  actions: any[];
@@ -1723,27 +1723,10 @@ style:{borderLeftColor:"#000000",borderTopColor:"#000000",borderRightColor:"#000
1723
1723
  stepsSchema=[];stepFields=[];fields=[];unGroupFields=[];_$1.each(instance.fields,function(field){if(field.type==="section"){fields.push(field);}else{unGroupFields.push(field);}});if(unGroupFields.length>0){fields=[{type:"section",name:"General",code:"General",fields:unGroupFields}].concat(fields);}_iterator5=_createForOfIteratorHelper(fields);_context44.p=1;_iterator5.s();case 2:if((_step5=_iterator5.n()).done){_context44.n=12;break;}field=_step5.value;if(!(field.type==="section"&&field.fields)){_context44.n=11;break;}stepFields=[];fieldSchema=void 0;_iterator6=_createForOfIteratorHelper(field.fields);_context44.p=3;_iterator6.s();case 4:if((_step6=_iterator6.n()).done){_context44.n=7;break;}childField=_step6.value;_context44.n=5;return getTdInputTpl(childField,true);case 5:fieldSchema=_context44.v;if(fieldSchema.type==="steedos-field"&&fieldSchema.config){if(fieldSchema.config.amis){fieldSchema.config.amis.mode=formMode;}else{fieldSchema.config.amis={mode:formMode};}}else{fieldSchema.mode=formMode;}stepFields.push(fieldSchema);case 6:_context44.n=4;break;case 7:_context44.n=9;break;case 8:_context44.p=8;_t78=_context44.v;_iterator6.e(_t78);case 9:_context44.p=9;_iterator6.f();return _context44.f(9);case 10:stepsSchema.push({"title":field.name,"body":stepFields});case 11:_context44.n=2;break;case 12:_context44.n=14;break;case 13:_context44.p=13;_t79=_context44.v;_iterator5.e(_t79);case 14:_context44.p=14;_iterator5.f();return _context44.f(14);case 15:isReadonlyBox=instance.box!=='inbox'&&instance.box!=='draft';if(isReadonlyBox){// 只读的审批箱中最后一步的保存按钮要隐藏
1724
1724
  if(stepsSchema.length==1){stepsSchema[stepsSchema.length-1].actions=[];}else if(stepsSchema.length>1){stepsSchema[stepsSchema.length-1].actions=[{"label":"Prev","type":"button","actionType":"prev"}];}}return _context44.a(2,stepsSchema);}},_callee44,null,[[3,8,9,10],[1,13,14,15]]);}));return function getFormSteps(_x283){return _ref47.apply(this,arguments);};}();var getFormWizardView=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(instance){var wizardMode,formSchema,_t80,_t81,_t82,_t83;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:wizardMode=instance.form.current.wizard_mode||"vertical";//vertical,horizontal
1725
1725
  _t80="instance-form-view-wizard ".concat(wizardMode==="horizontal"?"pt-4":"pt-1"," mt-3");_t81=wizardMode;_context45.n=1;return getFormSteps(instance);case 1:_t82=_context45.v;_t83={"change":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data}"}}]},"finished":{//点最后一步完成按钮触发暂存按钮事件保存数据
1726
- "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t80,mode:_t81,steps:_t82,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t83};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x284){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"applicant",value:getSteedosAuth().userId,disabled:instance$1.box!=='draft'};_context46.n=1;return lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t84.assign.call(_t84,_t85,_context46.v);_context46.n=3;break;case 2:applicantInput={label:false,mode:"horizontal",className:"m-none p-none",disabled:true,type:"tpl",tpl:'<div>${applicant_name}</div>',id:"u:2016b04355f4"};case 3:if(applicantInput){if(applicantInput.className){applicantInput.className="".concat(applicantInput.className," inline-left");}else{applicantInput.className="inline-left";}}return _context46.a(2,{type:"table-view",className:"instance-applicant-view",trs:[{background:"#FFFFFF",tds:[{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instances_applicant_name_prefix')+"</div>",id:"u:ee62634201bf"},applicantInput],id:"u:6c24c1bb99c9",style:{padding:"none"}},{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instance_submit_date_prefix')+"</div>",id:"u:6d0a7763d527"},{label:false,mode:"horizontal",className:"m-none p-none inline-left",disabled:true,type:"tpl",inputFormat:"YYYY-MM-DD",valueFormat:"YYYY-MM-DDT00:00:00.000[Z]",tpl:'<div>${submit_date}</div>',id:"u:2016b04355f4"}],id:"u:c8b8214ac931",style:{padding:"none"}}]}],id:"u:047f3669468b",style:{borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none"}});}},_callee46);}));return function getApplicantTableView(_x285){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,submitEvents){var _t86,_t87,_t88,_t89,_t90,_t91,_t92;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance$1.approve||instance$1.box!='inbox'&&instance$1.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t86=instance.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance$1,submitEvents);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0"});}},_callee47);}));return function getApproveButton(_x286,_x287){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance$1,box){var _instance$1$formVersi;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance$1.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance$1);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance$1);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$1$formVersi=instance$1.formVersion)===null||_instance$1$formVersi===void 0?void 0:_instance$1$formVersi.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance$1.formVersion.amis_schema).onEvent;initedEvents=onEvent.inited.actions||[];changeEvents=onEvent.change.actions||[];submitEvents=onEvent.submit.actions||[];}console.log('getFlowFormSchema formContentSchema',formContentSchema);_t93="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t94={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance$1._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t95={".steedos-amis-instance-view-body":{"height":"calc(100% - 65px)"},".instance-approve-history .antd-Table-table thead":{"display":"none"},".instance-approve-history .antd-Table-heading":{"font-size":"14px","font-weight":"500","padding-left":"0px"},".antd-List-heading":{"font-size":"14px","font-weight":"500"},".steedos-object-record-detail-header .antd-Grid-col--mdAuto":{"padding":"0px !important"},".antd-List-placeholder":{"display":"none"},".steedos-amis-instance-view .antd-Table-fixedTop":{"top":"-13px"},".steedos-amis-instance-view .antd-Table-fixedTop:after":{"box-shadow":"none"},".antd-List-items":{"border":'0px'},".antd-ListItem":{"border-top":"0px !important","background":"transparent !important"}};_context48.n=5;return getAttachments(instance$1);case 5:_t96=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t97=_context48.v;_context48.n=7;return getRelatedRecords(instance$1);case 7:_t98=_context48.v;_t99={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance$1.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t100=formContentSchema;_context48.n=8;return getApplicantTableView(instance$1);case 8:_t101=_context48.v;_t102=[_t99,_t100,_t101];_t103={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":instance.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
1726
+ "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t80,mode:_t81,steps:_t82,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t83};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x284){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"applicant",value:getSteedosAuth().userId,disabled:instance$1.box!=='draft'};_context46.n=1;return lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t84.assign.call(_t84,_t85,_context46.v);_context46.n=3;break;case 2:applicantInput={label:false,mode:"horizontal",className:"m-none p-none",disabled:true,type:"tpl",tpl:'<div>${applicant_name}</div>',id:"u:2016b04355f4"};case 3:if(applicantInput){if(applicantInput.className){applicantInput.className="".concat(applicantInput.className," inline-left");}else{applicantInput.className="inline-left";}}return _context46.a(2,{type:"table-view",className:"instance-applicant-view",trs:[{background:"#FFFFFF",tds:[{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instances_applicant_name_prefix')+"</div>",id:"u:ee62634201bf"},applicantInput],id:"u:6c24c1bb99c9",style:{padding:"none"}},{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instance_submit_date_prefix')+"</div>",id:"u:6d0a7763d527"},{label:false,mode:"horizontal",className:"m-none p-none inline-left",disabled:true,type:"tpl",inputFormat:"YYYY-MM-DD",valueFormat:"YYYY-MM-DDT00:00:00.000[Z]",tpl:'<div>${submit_date}</div>',id:"u:2016b04355f4"}],id:"u:c8b8214ac931",style:{padding:"none"}}]}],id:"u:047f3669468b",style:{borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none"}});}},_callee46);}));return function getApplicantTableView(_x285){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,submitEvents){var _t86,_t87,_t88,_t89,_t90,_t91,_t92;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance$1.approve||instance$1.box!='inbox'&&instance$1.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t86=instance.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance$1,submitEvents);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0"});}},_callee47);}));return function getApproveButton(_x286,_x287){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance$1,box){var _instance$1$formVersi;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance$1.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance$1);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance$1);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$1$formVersi=instance$1.formVersion)===null||_instance$1$formVersi===void 0?void 0:_instance$1$formVersi.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance$1.formVersion.amis_schema).onEvent;initedEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.inited.actions)||[];changeEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.change.actions)||[];submitEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.submit.actions)||[];}console.log('getFlowFormSchema formContentSchema',formContentSchema);_t93="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t94={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance$1._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t95={".steedos-amis-instance-view-body":{"height":"calc(100% - 65px)"},".instance-approve-history .antd-Table-table thead":{"display":"none"},".instance-approve-history .antd-Table-heading":{"font-size":"14px","font-weight":"500","padding-left":"0px"},".antd-List-heading":{"font-size":"14px","font-weight":"500"},".steedos-object-record-detail-header .antd-Grid-col--mdAuto":{"padding":"0px !important"},".antd-List-placeholder":{"display":"none"},".steedos-amis-instance-view .antd-Table-fixedTop":{"top":"-13px"},".steedos-amis-instance-view .antd-Table-fixedTop:after":{"box-shadow":"none"},".antd-List-items":{"border":'0px'},".antd-ListItem":{"border-top":"0px !important","background":"transparent !important"}};_context48.n=5;return getAttachments(instance$1);case 5:_t96=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t97=_context48.v;_context48.n=7;return getRelatedRecords(instance$1);case 7:_t98=_context48.v;_t99={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance$1.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t100=formContentSchema;_context48.n=8;return getApplicantTableView(instance$1);case 8:_t101=_context48.v;_t102=[_t99,_t100,_t101];_t103={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":instance.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
1727
1727
  "msg":instance.t('frontend_workflow_submit_validate_error_msg')//"请填写必填字段"
1728
- },"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t104={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t102,id:"instance_form",onEvent:_t103};_context48.n=9;return getInstanceApprovalHistory();case 9:_t105=_context48.v;_context48.n=10;return getApproveButton(instance$1,submitEvents);case 10:_t106=_context48.v;_t107=[_t96,_t97,_t98,_t104,_t105,_t106];_t108={};_t109={};_t110=["body","header"];_t111={"@data.@instanceDetail.changed":{actions:[{actionType:"reload"}]},"inited":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data.context.approveValues}"},"expression":"${event.data.context.form.current.style === 'wizard'}"// 表单为 wizard 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
1729
- }].concat(_toConsumableArray(initedEvents))}// inited: {
1730
- // weight: 0,
1731
- // actions: [
1732
- // // {
1733
- // // componentId: "steedos-approve-button",
1734
- // // actionType: "click",
1735
- // // },
1736
- // // {
1737
- // // "componentId": "",
1738
- // // "args": {},
1739
- // // "actionType": "drawer",
1740
- // // "drawer": await getApprovalDrawerSchema()
1741
- // // }
1742
- // ],
1743
- // }
1744
- };_t112={"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"messages":{},"requestAdaptor":"\n api.data = {\n query: `\n {\n instance: instances__findOne(id:\"".concat(instance$1._id,"\"){\n related_instances: related_instances__expand{\n _id,\n name\n }\n }\n }\n `\n }\n return api;\n "),"adaptor":"\n payload.data = {\n related_instances: payload.data.instance.related_instances\n };\n return payload;\n ","data":{// "&": "$$",
1745
- // "context": "${context}",
1746
- "judge":"${new_judge}"}};return _context48.a(2,{type:"page",name:"instancePage",className:_t93,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t94,"css":_t95,body:_t107,id:"u:63849ea39e12",messages:_t108,pullRefresh:_t109,regions:_t110,onEvent:_t111,initApi:_t112,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x288,_x289){return _ref51.apply(this,arguments);};}();/*
1728
+ },"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t104={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t102,id:"instance_form",onEvent:_t103};_context48.n=9;return getInstanceApprovalHistory();case 9:_t105=_context48.v;_context48.n=10;return getApproveButton(instance$1,submitEvents);case 10:_t106=_context48.v;_t107=[_t96,_t97,_t98,_t104,_t105,_t106];_t108={};_t109={};_t110=["body","header"];_t111={"@data.@instanceDetail.changed":{actions:[{actionType:"custom",script:"debugger;"},{componentId:"u:instancePage",actionType:"reload"}]},"inited":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data.context.approveValues}"},"expression":"${event.data.context.form.current.style === 'wizard'}"// 表单为 wizard 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
1729
+ }].concat(_toConsumableArray(initedEvents))}};_t112={"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"messages":{},"requestAdaptor":"\n api.data = {\n query: `\n {\n instance: instances__findOne(id:\"".concat(instance$1._id,"\"){\n related_instances: related_instances__expand{\n _id,\n name\n }\n }\n }\n `\n }\n return api;\n "),"adaptor":"\n payload.data = {\n related_instances: payload.data.instance.related_instances\n };\n return payload;\n ","data":{"judge":"${new_judge}"}};return _context48.a(2,{type:"page",name:"instancePage",className:_t93,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t94,"css":_t95,body:_t107,id:"u:instancePage",messages:_t108,pullRefresh:_t109,regions:_t110,onEvent:_t111,initApi:_t112,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x288,_x289){return _ref51.apply(this,arguments);};}();/*
1747
1730
  * @Author: baozhoutao@steedos.com
1748
1731
  * @Date: 2022-10-08 16:26:26
1749
1732
  * @LastEditors: baozhoutao@steedos.com