@steedos-widgets/amis-lib 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.
package/dist/index.umd.js CHANGED
@@ -1640,27 +1640,10 @@ style:{borderLeftColor:"#000000",borderTopColor:"#000000",borderRightColor:"#000
1640
1640
  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;_t77=_context44.v;_iterator6.e(_t77);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;_t78=_context44.v;_iterator5.e(_t78);case 14:_context44.p=14;_iterator5.f();return _context44.f(14);case 15:isReadonlyBox=instance.box!=='inbox'&&instance.box!=='draft';if(isReadonlyBox){// 只读的审批箱中最后一步的保存按钮要隐藏
1641
1641
  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(_x282){return _ref47.apply(this,arguments);};}();var getFormWizardView=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(instance){var wizardMode,formSchema,_t79,_t80,_t81,_t82;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:wizardMode=instance.form.current.wizard_mode||"vertical";//vertical,horizontal
1642
1642
  _t79="instance-form-view-wizard ".concat(wizardMode==="horizontal"?"pt-4":"pt-1"," mt-3");_t80=wizardMode;_context45.n=1;return getFormSteps(instance);case 1:_t81=_context45.v;_t82={"change":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data}"}}]},"finished":{//点最后一步完成按钮触发暂存按钮事件保存数据
1643
- "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t79,mode:_t80,steps:_t81,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t82};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x283){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance){var applicantInput,_t83,_t84;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance.state==='draft')){_context46.n=2;break;}_t83=Object;_t84={name:"applicant",value:amisLib.getSteedosAuth().userId,disabled:instance.box!=='draft'};_context46.n=1;return amisLib.lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t83.assign.call(_t83,_t84,_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'>"+amisLib.i18next.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'>"+amisLib.i18next.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(_x284){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance,submitEvents){var _t85,_t86,_t87,_t88,_t89,_t90,_t91;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance.approve||instance.box!='inbox'&&instance.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t85=amisLib.i18next.t('frontend_workflow_instance_button_sign');_t86={};_context47.n=2;return getApprovalDrawerSchema(instance,submitEvents);case 2:_t87=_context47.v;_t88={componentId:"",args:_t86,actionType:"drawer",drawer:_t87};_t89=[_t88];_t90={actions:_t89};_t91={click:_t90};return _context47.a(2,{type:"button",label:_t85,onEvent:_t91,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(_x285,_x286){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance,box){var _instance$formVersion;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t92,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$formVersion=instance.formVersion)===null||_instance$formVersion===void 0?void 0:_instance$formVersion.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance.formVersion.amis_schema).onEvent;initedEvents=onEvent.inited.actions||[];changeEvents=onEvent.change.actions||[];submitEvents=onEvent.submit.actions||[];}console.log('getFlowFormSchema formContentSchema',formContentSchema);_t92="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t93={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t94={".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);case 5:_t95=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t96=_context48.v;_context48.n=7;return getRelatedRecords(instance);case 7:_t97=_context48.v;_t98={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t99=formContentSchema;_context48.n=8;return getApplicantTableView(instance);case 8:_t100=_context48.v;_t101=[_t98,_t99,_t100];_t102={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":amisLib.i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
1643
+ "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t79,mode:_t80,steps:_t81,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t82};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x283){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance){var applicantInput,_t83,_t84;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance.state==='draft')){_context46.n=2;break;}_t83=Object;_t84={name:"applicant",value:amisLib.getSteedosAuth().userId,disabled:instance.box!=='draft'};_context46.n=1;return amisLib.lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t83.assign.call(_t83,_t84,_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'>"+amisLib.i18next.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'>"+amisLib.i18next.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(_x284){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance,submitEvents){var _t85,_t86,_t87,_t88,_t89,_t90,_t91;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance.approve||instance.box!='inbox'&&instance.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t85=amisLib.i18next.t('frontend_workflow_instance_button_sign');_t86={};_context47.n=2;return getApprovalDrawerSchema(instance,submitEvents);case 2:_t87=_context47.v;_t88={componentId:"",args:_t86,actionType:"drawer",drawer:_t87};_t89=[_t88];_t90={actions:_t89};_t91={click:_t90};return _context47.a(2,{type:"button",label:_t85,onEvent:_t91,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(_x285,_x286){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance,box){var _instance$formVersion;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t92,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$formVersion=instance.formVersion)===null||_instance$formVersion===void 0?void 0:_instance$formVersion.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance.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);_t92="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t93={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t94={".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);case 5:_t95=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t96=_context48.v;_context48.n=7;return getRelatedRecords(instance);case 7:_t97=_context48.v;_t98={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t99=formContentSchema;_context48.n=8;return getApplicantTableView(instance);case 8:_t100=_context48.v;_t101=[_t98,_t99,_t100];_t102={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":amisLib.i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
1644
1644
  "msg":amisLib.i18next.t('frontend_workflow_submit_validate_error_msg')//"请填写必填字段"
1645
- },"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t103={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t101,id:"instance_form",onEvent:_t102};_context48.n=9;return getInstanceApprovalHistory();case 9:_t104=_context48.v;_context48.n=10;return getApproveButton(instance,submitEvents);case 10:_t105=_context48.v;_t106=[_t95,_t96,_t97,_t103,_t104,_t105];_t107={};_t108={};_t109=["body","header"];_t110={"@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 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
1646
- }].concat(_toConsumableArray(initedEvents))}// inited: {
1647
- // weight: 0,
1648
- // actions: [
1649
- // // {
1650
- // // componentId: "steedos-approve-button",
1651
- // // actionType: "click",
1652
- // // },
1653
- // // {
1654
- // // "componentId": "",
1655
- // // "args": {},
1656
- // // "actionType": "drawer",
1657
- // // "drawer": await getApprovalDrawerSchema()
1658
- // // }
1659
- // ],
1660
- // }
1661
- };_t111={"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._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":{// "&": "$$",
1662
- // "context": "${context}",
1663
- "judge":"${new_judge}"}};return _context48.a(2,{type:"page",name:"instancePage",className:_t92,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t93,"css":_t94,body:_t106,id:"u:63849ea39e12",messages:_t107,pullRefresh:_t108,regions:_t109,onEvent:_t110,initApi:_t111,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x287,_x288){return _ref51.apply(this,arguments);};}();/*
1645
+ },"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t103={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t101,id:"instance_form",onEvent:_t102};_context48.n=9;return getInstanceApprovalHistory();case 9:_t104=_context48.v;_context48.n=10;return getApproveButton(instance,submitEvents);case 10:_t105=_context48.v;_t106=[_t95,_t96,_t97,_t103,_t104,_t105];_t107={};_t108={};_t109=["body","header"];_t110={"@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 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
1646
+ }].concat(_toConsumableArray(initedEvents))}};_t111={"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._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:_t92,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t93,"css":_t94,body:_t106,id:"u:instancePage",messages:_t107,pullRefresh:_t108,regions:_t109,onEvent:_t110,initApi:_t111,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x287,_x288){return _ref51.apply(this,arguments);};}();/*
1664
1647
  * @Author: baozhoutao@steedos.com
1665
1648
  * @Date: 2022-10-08 16:26:26
1666
1649
  * @LastEditors: baozhoutao@steedos.com