@steedos-widgets/amis-object 6.10.20 → 6.10.22

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.
@@ -1705,10 +1705,7 @@ var getAttachments=/*#__PURE__*/function(){var _ref35=_asyncToGenerator(/*#__PUR
1705
1705
  * @LastEditTime: 2025-08-31 09:46:58
1706
1706
  * @Description:
1707
1707
  */var getRelatedRecords=/*#__PURE__*/function(){var _ref37=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(instance$1){return _regenerator().w(function(_context34){while(1)switch(_context34.n){case 0:if(!(!instance$1.record_ids||_$1.isEmpty(instance$1.record_ids))){_context34.n=1;break;}return _context34.a(2);case 1:return _context34.a(2,_$1.map(instance$1.record_ids,function(item){return{type:'tpl',tpl:"<a href='/app/-/".concat(item.o,"/view/").concat(item.ids[0],"' target='_blank'>").concat(instance.t('frontend_workflow_related_records_link_title'),"</a>")};}));}},_callee34);}));return function getRelatedRecords(_x272){return _ref37.apply(this,arguments);};}();// TODO delete button
1708
- var getRelatedInstances=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(instance$1){var spaceId;return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:// if(!instance.related_instances || isEmpty(instance.related_instances)){
1709
- // return ;
1710
- // }
1711
- spaceId=getSteedosAuth().tenantId;return _context35.a(2,{"type":"list","name":"relatedInstances","source":"${related_instances}",title:instance.t('frontend_workflow_related_file'),"listItem":{"body":[{type:'tpl',inline:true,tpl:"<a href='${context.rootUrl}/workflow/space/".concat(spaceId,"/view/readonly/${_id}' target='_blank'>${name}</a>")}],"actions":[],"id":"u:550b3fdc8788"},"id":"related_instances"});}},_callee35);}));return function getRelatedInstances(_x273){return _ref38.apply(this,arguments);};}();/*
1708
+ var getRelatedInstances=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(instance$1){return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:return _context35.a(2,{"type":"list","name":"relatedInstances","source":"${related_instances}",title:instance.t('frontend_workflow_related_file'),"listItem":{"body":[{type:'tpl',inline:true,tpl:"<a href='/app/approve_workflow/page/page_instance_view?recordId=${_id}' target='_blank'>${name}</a>"}],"actions":[],"id":"u:550b3fdc8788"},"id":"related_instances"});}},_callee35);}));return function getRelatedInstances(_x273){return _ref38.apply(this,arguments);};}();/*
1712
1709
  * @Author: baozhoutao@steedos.com
1713
1710
  * @Date: 2022-09-24 16:48:28
1714
1711
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
@@ -1723,7 +1720,7 @@ spaceId=getSteedosAuth().tenantId;return _context35.a(2,{"type":"list","name":"r
1723
1720
  * @LastEditTime: 2025-11-20 20:13:03
1724
1721
  * @Description:
1725
1722
  */var getSelectOptions=function getSelectOptions(field){var options=[];_$1.each(field.options.split("\n"),function(item){var foo=item.split(":");if(foo.length==2){options.push({label:foo[0],value:foo[1]});}else{options.push({label:item,value:item});}});return options;};var isOpinionField=function isOpinionField(field){var field_formula=field.formula;return(field_formula===null||field_formula===void 0?void 0:field_formula.indexOf("{traces."))>-1||(field_formula===null||field_formula===void 0?void 0:field_formula.indexOf("{signature.traces."))>-1||(field_formula===null||field_formula===void 0?void 0:field_formula.indexOf("{yijianlan:"))>-1||(field_formula===null||field_formula===void 0?void 0:field_formula.indexOf("{\"yijianlan\":"))>-1||(field_formula===null||field_formula===void 0?void 0:field_formula.indexOf("{'yijianlan':"))>-1;};var getArgumentsList=function getArgumentsList(func){var funcString;if(typeof func==='function'){funcString=func.toString();}else{funcString=func;}var regExp=/function\s*\w*\(([\s\S]*?)\)/;if(regExp.test(funcString)){var argList=RegExp.$1.split(',');return argList.map(function(arg){return arg.replace(/\s/g,'');});}else{return[];}};var getFieldEditTpl=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(field,label){var tpl,useTpl,orgTpl,argsName,labelField,_iterator2,_step2,sField,column,_t66,_t67;return _regenerator().w(function(_context37){while(1)switch(_context37.p=_context37.n){case 0:// console.log('field',field)
1726
- tpl={label:label===true?field.name:false,name:field.code,mode:"horizontal",className:"m-none p-none form-control",disabled:field.permission!=="editable",required:field.is_required,visibleOn:field.visibleOn,requiredOn:field.requiredOn};if(field.formula){tpl.value="$".concat(field.formula);}if(!isOpinionField(field)){_context37.n=1;break;}tpl.type='input-group';tpl.body=[{"type":"textarea","inputClassName":"b-r-none p-r-none","name":"input-group","id":"yijian-".concat(field.code),"minRows":3,"maxRows":20,"mode":"normal","size":"full"},{"type":"button","label":instance.t('frontend_workflow_instance_button_sign'),//"签批",
1723
+ tpl={label:label===true?field.name:false,name:field.code,mode:"horizontal",className:"m-none p-none form-control",disabled:field.permission!=="editable",required:field.is_required,visibleOn:field.visibleOn,requiredOn:field.requiredOn};if(!isOpinionField(field)){_context37.n=1;break;}tpl.type='input-group';tpl.body=[{"type":"textarea","inputClassName":"b-r-none p-r-none","name":"input-group","id":"yijian-".concat(field.code),"minRows":3,"maxRows":20,"mode":"normal","size":"full"},{"type":"button","label":instance.t('frontend_workflow_instance_button_sign'),//"签批",
1727
1724
  "level":"link","id":"u:2592111d236d","block":false,"onEvent":{"click":{"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"".concat(field.name||field.code),"body":[{"type":"form","title":"表单","body":[{"label":"","type":"textarea","name":"yijian","id":"u:1d5a60623000","minRows":6,"maxRows":20,"mode":"normal","placeholder":instance.t('frontend_workflow_suggestion_placeholder')//"请填写意见"
1728
1725
  },{"type":"grid","columns":[{"body":[{"type":"button","label":instance.t('frontend_workflow_approval_judge_readed'),//"已阅",
1729
1726
  "onEvent":{"click":{"actions":[{"componentId":"u:1d5a60623000","args":{"valueInput":instance.t('frontend_workflow_approval_judge_readed'),//"已阅",
@@ -1735,7 +1732,7 @@ tpl={label:label===true?field.name:false,name:field.code,mode:"horizontal",class
1735
1732
  "onEvent":{"click":{"actions":[{"componentId":"u:1d5a60623000","args":{"valueInput":instance.t('frontend_workflow_approval_suggestion_agree'),//"同意"
1736
1733
  "value":instance.t('frontend_workflow_approval_suggestion_agree')//"同意"
1737
1734
  },"actionType":"setValue"}]}},"id":"u:06e0037dcd23","level":"link","className":"m-r"},{"type":"button","label":instance.t('frontend_workflow_approval_suggestion_other'),//"同意"
1738
- "onEvent":{"click":{"actions":[]}},"id":"u:3a781bc550a2","level":"link","className":"m-r"}],"id":"u:3def7a5b7cd5"}],"id":"u:ecbefa51b638"}],"id":"u:dd32ae67b5c7"}],"id":"u:a5d06d3a61b9","closeOnEsc":false,"closeOnOutside":false,"showCloseButton":true,"actions":[{"type":"button","label":"${'OK' | t}","onEvent":{"click":{"actions":[{"componentId":"yijian-".concat(field.code),"args":{"valueInput":"${yijian}","value":"${yijian}"},"actionType":"setValue"},{"componentId":"","args":{},"actionType":"closeDialog"}]}},"id":"u:87e22efe707a","level":"primary"},{"type":"button","label":"${'Cancel' | t}","onEvent":{"click":{"actions":[{"componentId":"","args":{},"actionType":"closeDialog"}]}},"id":"u:d0e6550a848e"}]}}],"weight":0}},"className":"instance-sign-text-btn"}];_context37.n=30;break;case 1:_t66=field.type;_context37.n=_t66==="input"?2:_t66==="number"?3:_t66==="date"?4:_t66==="dateTime"?5:_t66==="checkbox"?6:_t66==="email"?7:_t66==="url"?8:_t66==="password"?9:_t66==="select"?10:_t66==="user"?11:_t66==="group"?13:_t66==="radio"?15:_t66==="multiSelect"?16:_t66==="odata"?17:_t66==="html"?18:_t66==="table"?19:_t66==="section"?28:29;break;case 2:if(field.is_textarea){tpl.type="textarea";}else{tpl.type="input-text";}return _context37.a(3,30);case 3:tpl.type="input-number";tpl.precision=2;return _context37.a(3,30);case 4:tpl.type="input-date";tpl.inputFormat="YYYY-MM-DD";tpl.format='YYYY-MM-DDT00:00:00.000[Z]';return _context37.a(3,30);case 5:tpl.type="input-datetime";tpl.inputFormat="YYYY-MM-DD HH:mm";tpl.format='YYYY-MM-DDTHH:mm:ss.SSSZ';return _context37.a(3,30);case 6:tpl.type="checkbox";return _context37.a(3,30);case 7:tpl.type="input-email";tpl.validations={isEmail:true};return _context37.a(3,30);case 8:tpl.type="input-url";tpl.validations={isUrl:true};return _context37.a(3,30);case 9:tpl.type="input-password";tpl.showCounter=true;return _context37.a(3,30);case 10:tpl.type="select";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 11:_context37.n=12;return lookupToAmis({name:field.code,label:field.name,reference_to:"space_users",reference_to_field:'user',multiple:field.is_multiselect},false,{});case 12:useTpl=_context37.v;Object.assign(tpl,useTpl);return _context37.a(3,30);case 13:_context37.n=14;return lookupToAmis({name:field.code,label:field.name,reference_to:"organizations",multiple:field.is_multiselect},false,{});case 14:orgTpl=_context37.v;Object.assign(tpl,orgTpl);return _context37.a(3,30);case 15:tpl.type="radios";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 16:tpl.type="checkboxes";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 17:argsName=getArgumentsList(field.filters);labelField=field.formula.substr(1,field.formula.length-2);labelField=labelField.substr(labelField.indexOf(".")+1);tpl.type="select";tpl.multiple=field.is_multiselect;// tpl.labelField = labelField;
1735
+ "onEvent":{"click":{"actions":[]}},"id":"u:3a781bc550a2","level":"link","className":"m-r"}],"id":"u:3def7a5b7cd5"}],"id":"u:ecbefa51b638"}],"id":"u:dd32ae67b5c7"}],"id":"u:a5d06d3a61b9","closeOnEsc":false,"closeOnOutside":false,"showCloseButton":true,"actions":[{"type":"button","label":"${'OK' | t}","onEvent":{"click":{"actions":[{"componentId":"yijian-".concat(field.code),"args":{"valueInput":"${yijian}","value":"${yijian}"},"actionType":"setValue"},{"componentId":"","args":{},"actionType":"closeDialog"}]}},"id":"u:87e22efe707a","level":"primary"},{"type":"button","label":"${'Cancel' | t}","onEvent":{"click":{"actions":[{"componentId":"","args":{},"actionType":"closeDialog"}]}},"id":"u:d0e6550a848e"}]}}],"weight":0}},"className":"instance-sign-text-btn"}];_context37.n=30;break;case 1:_t66=field.type;_context37.n=_t66==="input"?2:_t66==="number"?3:_t66==="date"?4:_t66==="dateTime"?5:_t66==="checkbox"?6:_t66==="email"?7:_t66==="url"?8:_t66==="password"?9:_t66==="select"?10:_t66==="user"?11:_t66==="group"?13:_t66==="radio"?15:_t66==="multiSelect"?16:_t66==="odata"?17:_t66==="html"?18:_t66==="table"?19:_t66==="section"?28:29;break;case 2:if(field.is_textarea){tpl.type="textarea";}else{tpl.type="input-text";}if(field.formula){tpl.value="$".concat(field.formula);}return _context37.a(3,30);case 3:tpl.type="input-number";tpl.precision=field.digits;if(field.formula){tpl.value="$".concat(field.formula);}return _context37.a(3,30);case 4:tpl.type="input-date";tpl.inputFormat="YYYY-MM-DD";tpl.format='YYYY-MM-DDT00:00:00.000[Z]';return _context37.a(3,30);case 5:tpl.type="input-datetime";tpl.inputFormat="YYYY-MM-DD HH:mm";tpl.format='YYYY-MM-DDTHH:mm:ss.SSSZ';return _context37.a(3,30);case 6:tpl.type="checkbox";return _context37.a(3,30);case 7:tpl.type="input-email";tpl.validations={isEmail:true};return _context37.a(3,30);case 8:tpl.type="input-url";tpl.validations={isUrl:true};return _context37.a(3,30);case 9:tpl.type="input-password";tpl.showCounter=true;return _context37.a(3,30);case 10:tpl.type="select";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 11:_context37.n=12;return lookupToAmis({name:field.code,label:field.name,reference_to:"space_users",reference_to_field:'user',multiple:field.is_multiselect},false,{});case 12:useTpl=_context37.v;Object.assign(tpl,useTpl);return _context37.a(3,30);case 13:_context37.n=14;return lookupToAmis({name:field.code,label:field.name,reference_to:"organizations",multiple:field.is_multiselect},false,{});case 14:orgTpl=_context37.v;Object.assign(tpl,orgTpl);return _context37.a(3,30);case 15:tpl.type="radios";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 16:tpl.type="checkboxes";tpl.options=getSelectOptions(field);return _context37.a(3,30);case 17:argsName=getArgumentsList(field.filters);labelField=field.formula.substr(1,field.formula.length-2);labelField=labelField.substr(labelField.indexOf(".")+1);tpl.type="select";tpl.multiple=field.is_multiselect;// tpl.labelField = labelField;
1739
1736
  // tpl.valueField = "_value";
1740
1737
  tpl.source={url:field.url,method:"get",dataType:"json",adaptor:"\n payload.data = {\n options: _.map(payload.value, (item)=>{\n const value = item;\n item[\"@label\"] = item[\"".concat(labelField,"\"]\n delete item['@odata.editLink'];\n delete item['@odata.etag'];\n delete item['@odata.id'];\n return {\n label: item[\"@label\"],\n value: value\n }\n })\n }\n return payload;\n "),requestAdaptor:"\n const filters = `".concat(_.replace(field.filters,/_.pluck/g,'_.map'),"`;\n const url = `").concat(field.url,"`;\n if(filters){\n const joinKey = url.indexOf('?') > 0 ? '&' : '?';\n if(filters.startsWith('function(') || filters.startsWith('function (')){\n const argsName = ").concat(JSON.stringify(argsName),";\n const fun = eval('_fun='+filters);\n const funArgs = [];\n for(const item of argsName){\n funArgs.push(context[item])\n }\n api.url = url + joinKey + \"$filter=\" + fun.apply({}, funArgs)\n }else{\n api.url = url + joinKey + \"$filter=\" + filters\n }\n }else{\n api.url = url \n }\n api.query = {};\n return api;\n "),trackExpression:_.join(_.map(argsName,function(item){return"${".concat(item,"|json}");}),'-')};tpl.isAmis=true;// console.log(`odata`, tpl)
1741
1738
  return _context37.a(3,30);case 18:if(tpl.disabled){tpl.type='html';}else{tpl.type="input-rich-text";}return _context37.a(3,30);case 19:tpl.type="steedos-input-table";tpl.addable=field.permission==="editable";tpl.editable=tpl.addable;tpl.copyable=tpl.addable;tpl.removable=tpl.addable;if(tpl.addable){tpl.actionData={"&":"$$"};}// tpl.fieldPrefix = field.name + "_";
@@ -1757,7 +1754,7 @@ trsSchema=[];trs=[];tdFields=[];fields=[];_$1.each(instance.fields,function(fiel
1757
1754
  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;_t79=_context44.v;_iterator6.e(_t79);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;_t80=_context44.v;_iterator5.e(_t80);case 14:_context44.p=14;_iterator5.f();return _context44.f(14);case 15:isReadonlyBox=instance.box!=='inbox'&&instance.box!=='draft';if(isReadonlyBox){// 只读的审批箱中最后一步的保存按钮要隐藏
1758
1755
  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(_x285){return _ref47.apply(this,arguments);};}();var getFormWizardView=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(instance){var wizardMode,formSchema,_t81,_t82,_t83,_t84;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:wizardMode=instance.formVersion.wizard_mode||"vertical";//vertical,horizontal
1759
1756
  _t81="instance-form-view-wizard ".concat(wizardMode==="horizontal"?"pt-4":"pt-1"," mt-3");_t82=wizardMode;_context45.n=1;return getFormSteps(instance);case 1:_t83=_context45.v;_t84={"change":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data}"}}]},"finished":{//点最后一步完成按钮触发暂存按钮事件保存数据
1760
- "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t81,mode:_t82,steps:_t83,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t84};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x286){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t85,_t86;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t85=Object;_t86={name:"__applicant",value:instance$1.applicant||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=_t85.assign.call(_t85,_t86,_context46.v,{"onEvent":{"change":{"actions":[{"actionType":"ajax","api":{"url":"/api/formula/user/${__applicant}","method":"get","messages":{"success":"","failed":""},"silent":true,"adaptor":"return {applicantInfo: payload}"}},{"actionType":"custom","script":"doAction({'componentId': 'u:instancePage', 'actionType': 'setValue', 'args': { 'value': { 'applicant': event.data.applicantInfo } }}) "}]}}});_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(_x287){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,events){var _t87,_t88,_t89,_t90,_t91,_t92,_t93,_t94;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:_t87=instance.t('frontend_workflow_instance_button_sign');_t88={};_context47.n=2;return getApprovalDrawerSchema(instance$1,events);case 2:_t89=_context47.v;_t90={componentId:"",args:_t88,actionType:"drawer",drawer:_t89};_t91=[_t90];_t92={actions:_t91};_t93={click:_t92};_t94={"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":true,"hidden":instance$1.box==='draft'};return _context47.a(2,{type:"button",label:_t87,onEvent:_t93,id:"steedos-approve-button",level:"primary",className:_t94});}},_callee47);}));return function getApproveButton(_x288,_x289){return _ref50.apply(this,arguments);};}();var getScrollToBottomAutoOpenApproveDrawerScript=function getScrollToBottomAutoOpenApproveDrawerScript(){return"\n (function () {\n setTimeout(function () {\n var bodyEl = document.querySelector('.steedos-instance-detail-wrapper .steedos-amis-instance-view .steedos-amis-instance-view-body');\n if (!bodyEl) return;\n var btn = document.querySelector('.steedos-instance-detail-wrapper .steedos-amis-instance-view .approve-button');\n if (!btn) return;\n\n function isDrawerOpen() {\n var dr = document.querySelector('.amis-dialog-widget.approval-drawer');\n return dr && dr.offsetParent !== null;\n }\n\n var lastAtBottom = false; // \u4E0A\u4E00\u4E2Ascroll\u4E8B\u4EF6\u662F\u5426\u5230\u5E95\n\n function isAtBottom() {\n var scrollTop = bodyEl.scrollTop,\n scrollHeight = bodyEl.scrollHeight,\n clientHeight = bodyEl.clientHeight;\n return (scrollHeight <= clientHeight) || (scrollTop + clientHeight >= scrollHeight - 2);\n }\n\n // wheel: \u53EA\u8981\u73B0\u5728\u5230\u5E95\u3001\u4E14\u662F\u5411\u4E0B\u6EDA\uFF0C\u5373\u53EF\u5F39\u51FA\n bodyEl.addEventListener('wheel', function (e) {\n var atBottom = isAtBottom();\n if (atBottom && e.deltaY > 0 && !isDrawerOpen()) {\n // [wheel] \u62D6\u52A8\u6761\u5728\u5E95\u90E8\u4E14\u5411\u4E0B\u6EDA\uFF0C\u5F39drawer\n btn.click();\n }\n });\n\n // scroll: \u62D6\u52A8\u65F6\u4EC5\u201C\u4ECE\u975E\u5E95\u90E8->\u5E95\u90E8\u201D\u77AC\u95F4\u5F39\n bodyEl.addEventListener('scroll', function () {\n var atBottom = isAtBottom();\n if (!lastAtBottom && atBottom && !isDrawerOpen()) {\n // [scroll] \u62D6\u52A8\u6761\u5230\u5E95\uFF0C\u5F39drawer\n btn.click();\n }\n lastAtBottom = atBottom;\n });\n }, 1000);\n })();\n ";};var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance,box){var _instance$formVersion;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,nextStepInitedEvents,nextStepChangeEvents,nextStepUserChangeEvents,_onEvent$inited,_onEvent$change,_onEvent$submit,_onEvent$nextStepInit,_onEvent$nextStepChan,onEvent,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113,_t114;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance.formVersion.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=[];nextStepInitedEvents=[];nextStepChangeEvents=[];nextStepUserChangeEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance.formVersion.amis_schema).onEvent;initedEvents=(onEvent===null||onEvent===void 0||(_onEvent$inited=onEvent.inited)===null||_onEvent$inited===void 0?void 0:_onEvent$inited.actions)||[];changeEvents=(onEvent===null||onEvent===void 0||(_onEvent$change=onEvent.change)===null||_onEvent$change===void 0?void 0:_onEvent$change.actions)||[];submitEvents=(onEvent===null||onEvent===void 0||(_onEvent$submit=onEvent.submit)===null||_onEvent$submit===void 0?void 0:_onEvent$submit.actions)||[];nextStepInitedEvents=(onEvent===null||onEvent===void 0||(_onEvent$nextStepInit=onEvent.nextStepInited)===null||_onEvent$nextStepInit===void 0?void 0:_onEvent$nextStepInit.actions)||[];nextStepChangeEvents=(onEvent===null||onEvent===void 0||(_onEvent$nextStepChan=onEvent.nextStepChange)===null||_onEvent$nextStepChan===void 0?void 0:_onEvent$nextStepChan.actions)||[];nextStepUserChangeEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.nextStepUserChange.actions)||[];}// if (box == 'inbox' || box == 'draft') {
1757
+ "actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t81,mode:_t82,steps:_t83,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t84};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x286){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t85,_t86;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t85=Object;_t86={name:"__applicant",value:instance$1.applicant||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=_t85.assign.call(_t85,_t86,_context46.v,{"onEvent":{"change":{"actions":[{"actionType":"ajax","api":{"url":"/api/formula/user/${__applicant}","method":"get","messages":{"success":"","failed":""},"silent":true,"adaptor":"return {applicantInfo: payload}"}},{"actionType":"custom","script":"doAction({'componentId': 'u:instancePage', 'actionType': 'setValue', 'args': { 'value': { 'applicant': event.data.applicantInfo } }}) "}]}}});_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(_x287){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,events){var _t87,_t88,_t89,_t90,_t91,_t92,_t93,_t94;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:_t87=instance.t('frontend_workflow_instance_button_sign');_t88={};_context47.n=2;return getApprovalDrawerSchema(instance$1,events);case 2:_t89=_context47.v;_t90={componentId:"",args:_t88,actionType:"drawer",drawer:_t89};_t91=[_t90];_t92={actions:_t91};_t93={click:_t92};_t94={"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":true,"hidden":instance$1.box==='draft'};return _context47.a(2,{type:"button",label:_t87,onEvent:_t93,id:"steedos-approve-button",level:"primary",className:_t94});}},_callee47);}));return function getApproveButton(_x288,_x289){return _ref50.apply(this,arguments);};}();var getScrollToBottomAutoOpenApproveDrawerScript=function getScrollToBottomAutoOpenApproveDrawerScript(){return"\n (function () {\n setTimeout(function () {\n var bodyEl = document.querySelector('.steedos-instance-detail-wrapper .steedos-amis-instance-view .steedos-amis-instance-view-body');\n if (!bodyEl) return;\n var btn = document.querySelector('.steedos-instance-detail-wrapper .steedos-amis-instance-view .approve-button');\n if (!btn) return;\n\n function isDrawerOpen() {\n var dr = document.querySelector('.amis-dialog-widget.approval-drawer');\n return dr && dr.offsetParent !== null;\n }\n\n var lastAtBottom = false; // \u4E0A\u4E00\u4E2Ascroll\u4E8B\u4EF6\u662F\u5426\u5230\u5E95\n\n function isAtBottom() {\n var scrollTop = bodyEl.scrollTop,\n scrollHeight = bodyEl.scrollHeight,\n clientHeight = bodyEl.clientHeight;\n return (scrollHeight <= clientHeight) || (scrollTop + clientHeight >= scrollHeight - 2);\n }\n\n // wheel: \u53EA\u8981\u73B0\u5728\u5230\u5E95\u3001\u4E14\u662F\u5411\u4E0B\u6EDA\uFF0C\u5373\u53EF\u5F39\u51FA\n bodyEl.addEventListener('wheel', function (e) {\n var atBottom = isAtBottom();\n if (atBottom && e.deltaY > 0 && !isDrawerOpen()) {\n // [wheel] \u62D6\u52A8\u6761\u5728\u5E95\u90E8\u4E14\u5411\u4E0B\u6EDA\uFF0C\u5F39drawer\n btn.click();\n }\n });\n\n // scroll: \u62D6\u52A8\u65F6\u4EC5\u201C\u4ECE\u975E\u5E95\u90E8->\u5E95\u90E8\u201D\u77AC\u95F4\u5F39\n bodyEl.addEventListener('scroll', function () {\n var atBottom = isAtBottom();\n if (!lastAtBottom && atBottom && !isDrawerOpen()) {\n // [scroll] \u62D6\u52A8\u6761\u5230\u5E95\uFF0C\u5F39drawer\n btn.click();\n }\n lastAtBottom = atBottom;\n });\n }, 1000);\n })();\n ";};var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance,box){var _instance$formVersion;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,nextStepInitedEvents,nextStepChangeEvents,nextStepUserChangeEvents,_onEvent$inited,_onEvent$change,_onEvent$submit,_onEvent$nextStepInit,_onEvent$nextStepChan,_onEvent$nextStepUser,onEvent,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113,_t114;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance.formVersion.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=[];nextStepInitedEvents=[];nextStepChangeEvents=[];nextStepUserChangeEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance.formVersion.amis_schema).onEvent;initedEvents=(onEvent===null||onEvent===void 0||(_onEvent$inited=onEvent.inited)===null||_onEvent$inited===void 0?void 0:_onEvent$inited.actions)||[];changeEvents=(onEvent===null||onEvent===void 0||(_onEvent$change=onEvent.change)===null||_onEvent$change===void 0?void 0:_onEvent$change.actions)||[];submitEvents=(onEvent===null||onEvent===void 0||(_onEvent$submit=onEvent.submit)===null||_onEvent$submit===void 0?void 0:_onEvent$submit.actions)||[];nextStepInitedEvents=(onEvent===null||onEvent===void 0||(_onEvent$nextStepInit=onEvent.nextStepInited)===null||_onEvent$nextStepInit===void 0?void 0:_onEvent$nextStepInit.actions)||[];nextStepChangeEvents=(onEvent===null||onEvent===void 0||(_onEvent$nextStepChan=onEvent.nextStepChange)===null||_onEvent$nextStepChan===void 0?void 0:_onEvent$nextStepChan.actions)||[];nextStepUserChangeEvents=(onEvent===null||onEvent===void 0||(_onEvent$nextStepUser=onEvent.nextStepUserChange)===null||_onEvent$nextStepUser===void 0?void 0:_onEvent$nextStepUser.actions)||[];}// if (box == 'inbox' || box == 'draft') {
1761
1758
  // TODO: 临时去掉 AutoOpenApproveDrawer 功能因为测试到性能问题
1762
1759
  if((box=='inbox'||box=='draft')&&window.enableAutoOpenApproveDrawer){// 滚动条滚动到底部弹出底部签批drawer窗口
1763
1760
  initedEvents.push({"actionType":"custom","script":getScrollToBottomAutoOpenApproveDrawerScript(),"args":{}});}// console.log('formContentSchema....', formContentSchema)