@steedos-widgets/amis-lib 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.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +9 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +4 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1622,10 +1622,7 @@ var getAttachments=/*#__PURE__*/function(){var _ref35=_asyncToGenerator(/*#__PUR
|
|
|
1622
1622
|
* @LastEditTime: 2025-08-31 09:46:58
|
|
1623
1623
|
* @Description:
|
|
1624
1624
|
*/var getRelatedRecords=/*#__PURE__*/function(){var _ref37=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(instance){return _regenerator().w(function(_context34){while(1)switch(_context34.n){case 0:if(!(!instance.record_ids||_$1.isEmpty(instance.record_ids))){_context34.n=1;break;}return _context34.a(2);case 1:return _context34.a(2,_$1.map(instance.record_ids,function(item){return{type:'tpl',tpl:"<a href='/app/-/".concat(item.o,"/view/").concat(item.ids[0],"' target='_blank'>").concat(amisLib.i18next.t('frontend_workflow_related_records_link_title'),"</a>")};}));}},_callee34);}));return function getRelatedRecords(_x271){return _ref37.apply(this,arguments);};}();// TODO delete button
|
|
1625
|
-
var getRelatedInstances=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(instance){
|
|
1626
|
-
// return ;
|
|
1627
|
-
// }
|
|
1628
|
-
spaceId=amisLib.getSteedosAuth().tenantId;return _context35.a(2,{"type":"list","name":"relatedInstances","source":"${related_instances}",title:amisLib.i18next.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(_x272){return _ref38.apply(this,arguments);};}();/*
|
|
1625
|
+
var getRelatedInstances=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(instance){return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:return _context35.a(2,{"type":"list","name":"relatedInstances","source":"${related_instances}",title:amisLib.i18next.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(_x272){return _ref38.apply(this,arguments);};}();/*
|
|
1629
1626
|
* @Author: baozhoutao@steedos.com
|
|
1630
1627
|
* @Date: 2022-09-24 16:48:28
|
|
1631
1628
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
@@ -1640,7 +1637,7 @@ spaceId=amisLib.getSteedosAuth().tenantId;return _context35.a(2,{"type":"list","
|
|
|
1640
1637
|
* @LastEditTime: 2025-11-20 20:13:03
|
|
1641
1638
|
* @Description:
|
|
1642
1639
|
*/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,_t65,_t66;return _regenerator().w(function(_context37){while(1)switch(_context37.p=_context37.n){case 0:// console.log('field',field)
|
|
1643
|
-
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(
|
|
1640
|
+
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":amisLib.i18next.t('frontend_workflow_instance_button_sign'),//"签批",
|
|
1644
1641
|
"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":amisLib.i18next.t('frontend_workflow_suggestion_placeholder')//"请填写意见"
|
|
1645
1642
|
},{"type":"grid","columns":[{"body":[{"type":"button","label":amisLib.i18next.t('frontend_workflow_approval_judge_readed'),//"已阅",
|
|
1646
1643
|
"onEvent":{"click":{"actions":[{"componentId":"u:1d5a60623000","args":{"valueInput":amisLib.i18next.t('frontend_workflow_approval_judge_readed'),//"已阅",
|
|
@@ -1652,7 +1649,7 @@ tpl={label:label===true?field.name:false,name:field.code,mode:"horizontal",class
|
|
|
1652
1649
|
"onEvent":{"click":{"actions":[{"componentId":"u:1d5a60623000","args":{"valueInput":amisLib.i18next.t('frontend_workflow_approval_suggestion_agree'),//"同意"
|
|
1653
1650
|
"value":amisLib.i18next.t('frontend_workflow_approval_suggestion_agree')//"同意"
|
|
1654
1651
|
},"actionType":"setValue"}]}},"id":"u:06e0037dcd23","level":"link","className":"m-r"},{"type":"button","label":amisLib.i18next.t('frontend_workflow_approval_suggestion_other'),//"同意"
|
|
1655
|
-
"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:_t65=field.type;_context37.n=_t65==="input"?2:_t65==="number"?3:_t65==="date"?4:_t65==="dateTime"?5:_t65==="checkbox"?6:_t65==="email"?7:_t65==="url"?8:_t65==="password"?9:_t65==="select"?10:_t65==="user"?11:_t65==="group"?13:_t65==="radio"?15:_t65==="multiSelect"?16:_t65==="odata"?17:_t65==="html"?18:_t65==="table"?19:_t65==="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=
|
|
1652
|
+
"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:_t65=field.type;_context37.n=_t65==="input"?2:_t65==="number"?3:_t65==="date"?4:_t65==="dateTime"?5:_t65==="checkbox"?6:_t65==="email"?7:_t65==="url"?8:_t65==="password"?9:_t65==="select"?10:_t65==="user"?11:_t65==="group"?13:_t65==="radio"?15:_t65==="multiSelect"?16:_t65==="odata"?17:_t65==="html"?18:_t65==="table"?19:_t65==="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 amisLib.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 amisLib.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;
|
|
1656
1653
|
// tpl.valueField = "_value";
|
|
1657
1654
|
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)
|
|
1658
1655
|
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 + "_";
|
|
@@ -1674,7 +1671,7 @@ trsSchema=[];trs=[];tdFields=[];fields=[];_$1.each(instance.fields,function(fiel
|
|
|
1674
1671
|
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){// 只读的审批箱中最后一步的保存按钮要隐藏
|
|
1675
1672
|
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(_x284){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.formVersion.wizard_mode||"vertical";//vertical,horizontal
|
|
1676
1673
|
_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":{//点最后一步完成按钮触发暂存按钮事件保存数据
|
|
1677
|
-
"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(_x285){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"__applicant",value:instance.applicant||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=_t84.assign.call(_t84,_t85,_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'>"+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(_x286){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance,events){var _t86,_t87,_t88,_t89,_t90,_t91,_t92,_t93;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:_t86=amisLib.i18next.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance,events);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};_t93={"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.box==='draft'};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:_t93});}},_callee47);}));return function getApproveButton(_x287,_x288){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,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113;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:
|
|
1674
|
+
"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(_x285){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"__applicant",value:instance.applicant||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=_t84.assign.call(_t84,_t85,_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'>"+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(_x286){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance,events){var _t86,_t87,_t88,_t89,_t90,_t91,_t92,_t93;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:_t86=amisLib.i18next.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance,events);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};_t93={"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.box==='draft'};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:_t93});}},_callee47);}));return function getApproveButton(_x287,_x288){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,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113;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') {
|
|
1678
1675
|
// TODO: 临时去掉 AutoOpenApproveDrawer 功能因为测试到性能问题
|
|
1679
1676
|
if((box=='inbox'||box=='draft')&&window.enableAutoOpenApproveDrawer){// 滚动条滚动到底部弹出底部签批drawer窗口
|
|
1680
1677
|
initedEvents.push({"actionType":"custom","script":getScrollToBottomAutoOpenApproveDrawerScript(),"args":{}});}// console.log('formContentSchema....', formContentSchema)
|