@steedos-widgets/amis-lib 6.10.30 → 6.10.31

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
@@ -1626,7 +1626,7 @@ var getRelatedInstances=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(/*#
1626
1626
  * @Author: baozhoutao@steedos.com
1627
1627
  * @Date: 2022-09-07 16:20:45
1628
1628
  * @LastEditors: yinlianghui yinlianghui@hotoa.com
1629
- * @LastEditTime: 2025-12-09 15:28:25
1629
+ * @LastEditTime: 2025-12-09 16:06:24
1630
1630
  * @Description:
1631
1631
  */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 _ref41=_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)
1632
1632
  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.default_value){tpl.value=field.default_value;}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":i18next__default["default"].t('frontend_workflow_instance_button_sign'),//"签批",
@@ -1666,7 +1666,7 @@ _t81="instance-form-view-wizard ".concat(wizardMode==="horizontal"?"pt-4":"pt-1"
1666
1666
  "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 _ref49.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance){var applicantInput,_t85,_t86;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance.state==='draft')){_context46.n=2;break;}_t85=Object;_t86={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=_t85.assign.call(_t85,_t86,_context46.v,{"onEvent":{"change":{"actions":[{"actionType":"ajax","api":{"url":"/api/workflow/v2/instance/save","method":"post","sendOn":"","requestAdaptor":"var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues(); const _formValues = JSON.parse(JSON.stringify(formValues)); if(_formValues){delete _formValues.__applicant} \nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n instance: {\n _id: instance._id,\n applicant: context.__applicant,\n submitter: formValues.submitter,\n traces: [{\n _id: instance.trace._id,\n step: instance.step._id,\n approves: [{\n _id: instance.approve._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n values: _formValues\n }]\n }]\n }\n};\napi.data = body;\nreturn api;","adaptor":"if (payload.instance == \"upgraded\") { window.setTimeout(function(){ window.location.reload(); }, 2000); return {...payload, status: 1, msg: t('instance_action_instance_save_msg_upgraded')}; } \n return payload.instance === true ? {...payload, status: 0, msg: ''} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"data":{"&":"$$"}}},{"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:// console.log('applicantInput', applicantInput);
1667
1667
  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'>"+i18next__default["default"].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'>"+i18next__default["default"].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 _ref50.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance,events){var _t87,_t88,_t89,_t90,_t91,_t92,_t93,_t94,_t95,_t96;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:_t87=i18next__default["default"].t('frontend_workflow_instance_button_sign');_t88={};_context47.n=2;return getApprovalDrawerSchema(instance,events);case 2:_t89=_context47.v;_t90={componentId:"",args:_t88,actionType:"drawer",drawer:_t89};_t91={"actionType":"wait","args":{"time":1000//延时等底部签批栏drawer弹出再执行下面的添加审批单内部底边距脚本,不等的话拿不到drawer高度
1668
1668
  }};_t92={"actionType":"custom","script":function script(context,doAction,event){// 每次点开底部签批栏添加审批单内部底边距以解决签批栏会挡住申请单内容的问题
1669
- var instancePageContent=document.querySelector(".steedos-amis-instance-view .antd-Page-content");var approvalDrawerContent=document.querySelector(".approval-drawer .antd-Drawer-content");if(instancePageContent&&approvalDrawerContent){$(instancePageContent).css("paddingBottom","".concat(approvalDrawerContent.clientHeight+10,"px"));}}};_t93=[_t90,_t91,_t92];_t94={actions:_t93};_t95={click:_t94};_t96={"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:_t87,onEvent:_t95,id:"steedos-approve-button",level:"primary",className:_t96});}},_callee47);}));return function getApproveButton(_x288,_x289){return _ref51.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 _ref52=_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,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113,_t114,_t115,_t116;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') {
1669
+ var instancePageContent=document.querySelector(".steedos-amis-instance-view .antd-Page-content");var approvalDrawerContent=document.querySelector(".approval-drawer .antd-Drawer-content");if(instancePageContent&&approvalDrawerContent){$(instancePageContent).css("paddingBottom","".concat(approvalDrawerContent.clientHeight+10,"px"));}}};_t93=[_t90,_t91,_t92];_t94={actions:_t93};_t95={click:_t94};_t96={"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:_t87,onEvent:_t95,id:"steedos-approve-button",level:"primary",className:_t96});}},_callee47);}));return function getApproveButton(_x288,_x289){return _ref51.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 scrollToBottom(){\n setTimeout(function(){\n var instanceViewBody = document.querySelector(\".steedos-amis-instance-view .antd-Page-content .steedos-amis-instance-view-body\");\n if (instanceViewBody){\n $(instanceViewBody).animate({scrollTop: $(instanceViewBody).prop(\"scrollHeight\")});\n }\n }, 1000);\n }\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 scrollToBottom();\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 scrollToBottom();\n }\n lastAtBottom = atBottom;\n });\n }, 1000);\n })();\n ";};var getFlowFormSchema=/*#__PURE__*/function(){var _ref52=_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,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112,_t113,_t114,_t115,_t116;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') {
1670
1670
  if((box=='inbox'||box=='draft')&&!!!window.disableAutoOpenApproveDrawer){// 滚动条滚动到底部弹出底部签批drawer窗口
1671
1671
  initedEvents.push({"actionType":"custom","script":getScrollToBottomAutoOpenApproveDrawerScript(),"args":{}});}// console.log('formContentSchema....', formContentSchema)
1672
1672
  _t97="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t98={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"sm:rounded-tl sm:rounded-tr"};_t99={".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-amis-instance-view.steedos-instance-style-table .antd-Page-body":{"width":"1024px"},".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:_t100=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t101=_context48.v;_context48.n=7;return getRelatedRecords(instance);case 7:_t102=_context48.v;_t103={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t104=formContentSchema;_context48.n=8;return getApplicantTableView(instance);case 8:_t105=_context48.v;_t106=[_t103,_t104,_t105];_t107={// validateError: {