@steedos-widgets/amis-object 6.10.2-beta.2 → 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/amis/AmisInstanceDetail.d.ts +8 -2
- package/dist/amis-object.umd.js +7 -24
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +19 -19
- package/dist/meta.js +627 -633
- package/package.json +3 -3
|
@@ -628,9 +628,15 @@ export declare const AmisInstanceDetail: (props: any) => Promise<{
|
|
|
628
628
|
regions: string[];
|
|
629
629
|
onEvent: {
|
|
630
630
|
"@data.@instanceDetail.changed": {
|
|
631
|
-
actions: {
|
|
631
|
+
actions: ({
|
|
632
632
|
actionType: string;
|
|
633
|
-
|
|
633
|
+
script: string;
|
|
634
|
+
componentId?: undefined;
|
|
635
|
+
} | {
|
|
636
|
+
componentId: string;
|
|
637
|
+
actionType: string;
|
|
638
|
+
script?: undefined;
|
|
639
|
+
})[];
|
|
634
640
|
};
|
|
635
641
|
inited: {
|
|
636
642
|
actions: any[];
|
package/dist/amis-object.umd.js
CHANGED
|
@@ -416,9 +416,9 @@ function _getCardSchema(){_getCardSchema=_asyncToGenerator(/*#__PURE__*/_regener
|
|
|
416
416
|
* @Author: baozhoutao@steedos.com
|
|
417
417
|
* @Date: 2022-11-01 15:51:00
|
|
418
418
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
419
|
-
* @LastEditTime: 2025-
|
|
419
|
+
* @LastEditTime: 2025-10-14 15:53:35
|
|
420
420
|
* @Description:
|
|
421
|
-
*/var getSchema$5=/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(uiSchema,ctx){var schemaApiAdaptor,getSelectedRowsScript;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:schemaApiAdaptor="\n let formSchema = {\n \"type\": \"steedos-object-form\",\n \"label\": \"\u5BF9\u8C61\u8868\u5355\",\n \"objectApiName\": \"${objectName}\",\n \"recordId\": \"\",\n \"mode\": \"edit\",\n };\n\n if (payload && payload.schema) {\n formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;\n }\n\n const fields = ".concat(JSON.stringify(uiSchema.fields),";\n const selectedRowResponseResult = api.body.selectedRowResponseResult;\n let defaultData = {}; \n\n if(!_.isEmpty(selectedRowResponseResult)){\n const fieldsKeys = _.keys(fields);\n // \u5982\u679C\u65B0\u5EFA\u8BB0\u5F55\u65F6\u590D\u5236\u7684\u6570\u636E\u4E2D\u6709omit\u6216\u5176\u4ED6\u4E0D\u76F8\u5173\u5B57\u6BB5\u6570\u636E\u65F6\u4E0D\u5E94\u8BE5\u4E00\u8D77\u4FDD\u5B58\u5230\u6570\u636E\u5E93\uFF0C\n // \u539F\u89C4\u5219\u89C1\uFF1Ahttps://github.com/steedos/steedos-frontend/issues/297\n _.forEach(selectedRowResponseResult, (val, key) => {\n if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true && key != 'owner') {\n defaultData[key] = val;\n }\n })\n }\n\n const _master = api.body._master;\n if(_master && _master._isRelated){\n const relatedKey = _master.relatedKey;\n const masterObjectName = _master.objectName;\n const recordId = _master.recordId || _master.record._id;\n let relatedKeySaveValue = recordId;\n const relatedField = fields[relatedKey];\n if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){\n relatedKeySaveValue = _master.record[relatedField.reference_to_field];\n }\n let relatedKeyValue; \n if(relatedField && !_.isString(relatedField.reference_to)){\n relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };\n }else if (relatedField && relatedField.multiple) {\n relatedKeyValue = [relatedKeySaveValue];\n } else {\n relatedKeyValue = relatedKeySaveValue;\n }\n defaultData[relatedKey]=relatedKeyValue;\n }\n\n if(!_.isEmpty(defaultData)){\n if(payload.schema){\n // \u8868\u5355\u5FAE\u9875\u9762\u7B2C\u4E00\u5C42\u8981\u6C42\u662Fpage\n formSchema.data.defaultData = defaultData;\n }else{\n formSchema.defaultData = defaultData;\n }\n }\n return {\n data: formSchema\n };\n ");getSelectedRowsScript="\n const isLookup = event.data.isLookup;\n if(isLookup){\n // lookup\u5F39\u51FA\u7A97\u53E3\u7684\u65B0\u5EFA\u529F\u80FD\u4E0D\u9700\u8981\u652F\u6301\u590D\u5236\u65B0\u5EFA\n return;\n }\n const uiSchema = event.data.uiSchema;\n const objectName = event.data.objectName;\n const crudId = event.data.crudId || \"listview_\" + objectName;\n const listViewRef = event.context.scoped.getComponentById(crudId);\n const selectedItems = listViewRef && listViewRef.props.store.toJSON().selectedItems || [];\n event.data.selectedIds = _.map(selectedItems, uiSchema.idFieldName || '_id');\n ";return _context3.a(2,{"type":"service","body":[{"type":"button","level":"primary","label":instance.t('frontend_form_new'),"id":"u:standard_new","onEvent":{"click":{"weight":0,"actions":[{"actionType":"custom","script":getSelectedRowsScript},{"actionType":"ajax","outputVar":"selectedRowResponseResult","args":{"api":{"url":"${context.rootUrl}/api/v1/${uiSchema.name}/${selectedIds|first}","method":"get"}},"expression":"${selectedIds.length > 0}"},{"actionType":"dialog","dialog":{"type":"dialog","data":{"$master":"$$","_master":"${_master}","_master._isRelated":"${_isRelated}","_master.relatedKey":"${relatedKey}","appId":"${appId}","objectName":"${objectName}","context":"${context}","global":"${global}","listViewId":"${listViewId}","displayAs":"${displayAs}","uiSchema":"${uiSchema}","isLookup":"${isLookup}","listName":"${listName}","selectedRowResponseResult":"${selectedRowResponseResult}","_lookupObjectName":"${_lookupObjectName}"},"title":instance.t('frontend_form_new')+" ${uiSchema.label | raw}","body":[{"type":"service","id":"u:1678e148c4d2","messages":{},"schemaApi":{"data":{"isLookup":"${isLookup}","_master":"${_master}","url":"${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}","selectedRowResponseResult":"${selectedRowResponseResult}"},"url":"${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}","method":"get","messages":{},"headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"requestAdaptor":"return { ...api, url: api.body.url }","adaptor":schemaApiAdaptor}}],"showCloseButton":true,"id":"u:
|
|
421
|
+
*/var getSchema$5=/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(uiSchema,ctx){var schemaApiAdaptor,getSelectedRowsScript;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:schemaApiAdaptor="\n let formSchema = {\n \"type\": \"steedos-object-form\",\n \"label\": \"\u5BF9\u8C61\u8868\u5355\",\n \"objectApiName\": \"${objectName}\",\n \"recordId\": \"\",\n \"mode\": \"edit\",\n };\n\n if (payload && payload.schema) {\n formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;\n }\n\n const fields = ".concat(JSON.stringify(uiSchema.fields),";\n const selectedRowResponseResult = api.body.selectedRowResponseResult;\n let defaultData = {}; \n\n if(!_.isEmpty(selectedRowResponseResult)){\n const fieldsKeys = _.keys(fields);\n // \u5982\u679C\u65B0\u5EFA\u8BB0\u5F55\u65F6\u590D\u5236\u7684\u6570\u636E\u4E2D\u6709omit\u6216\u5176\u4ED6\u4E0D\u76F8\u5173\u5B57\u6BB5\u6570\u636E\u65F6\u4E0D\u5E94\u8BE5\u4E00\u8D77\u4FDD\u5B58\u5230\u6570\u636E\u5E93\uFF0C\n // \u539F\u89C4\u5219\u89C1\uFF1Ahttps://github.com/steedos/steedos-frontend/issues/297\n _.forEach(selectedRowResponseResult, (val, key) => {\n if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true && key != 'owner') {\n defaultData[key] = val;\n }\n })\n }\n\n const _master = api.body._master;\n if(_master && _master._isRelated){\n const relatedKey = _master.relatedKey;\n const masterObjectName = _master.objectName;\n const recordId = _master.recordId || _master.record._id;\n let relatedKeySaveValue = recordId;\n const relatedField = fields[relatedKey];\n if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){\n relatedKeySaveValue = _master.record[relatedField.reference_to_field];\n }\n let relatedKeyValue; \n if(relatedField && !_.isString(relatedField.reference_to)){\n relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };\n }else if (relatedField && relatedField.multiple) {\n relatedKeyValue = [relatedKeySaveValue];\n } else {\n relatedKeyValue = relatedKeySaveValue;\n }\n defaultData[relatedKey]=relatedKeyValue;\n }\n\n if(!_.isEmpty(defaultData)){\n if(payload.schema){\n // \u8868\u5355\u5FAE\u9875\u9762\u7B2C\u4E00\u5C42\u8981\u6C42\u662Fpage\n formSchema.data.defaultData = defaultData;\n }else{\n formSchema.defaultData = defaultData;\n }\n }\n return {\n data: formSchema\n };\n ");getSelectedRowsScript="\n const isLookup = event.data.isLookup;\n if(isLookup){\n // lookup\u5F39\u51FA\u7A97\u53E3\u7684\u65B0\u5EFA\u529F\u80FD\u4E0D\u9700\u8981\u652F\u6301\u590D\u5236\u65B0\u5EFA\n return;\n }\n const uiSchema = event.data.uiSchema;\n const objectName = event.data.objectName;\n const crudId = event.data.crudId || \"listview_\" + objectName;\n const listViewRef = event.context.scoped.getComponentById(crudId);\n const selectedItems = listViewRef && listViewRef.props.store.toJSON().selectedItems || [];\n event.data.selectedIds = _.map(selectedItems, uiSchema.idFieldName || '_id');\n ";return _context3.a(2,{"type":"service","body":[{"type":"button","level":"primary","label":instance.t('frontend_form_new'),"id":"u:standard_new","onEvent":{"click":{"weight":0,"actions":[{"actionType":"custom","script":getSelectedRowsScript},{"actionType":"ajax","outputVar":"selectedRowResponseResult","args":{"api":{"url":"${context.rootUrl}/api/v1/${uiSchema.name}/${selectedIds|first}","method":"get"}},"expression":"${selectedIds.length > 0}"},{"actionType":"dialog","dialog":{"type":"dialog","data":{"$master":"$$","_master":"${_master}","_master._isRelated":"${_isRelated}","_master.relatedKey":"${relatedKey}","appId":"${appId}","objectName":"${objectName}","context":"${context}","global":"${global}","listViewId":"${listViewId}","displayAs":"${displayAs}","uiSchema":"${uiSchema}","isLookup":"${isLookup}","listName":"${listName}","selectedRowResponseResult":"${selectedRowResponseResult}","_lookupObjectName":"${_lookupObjectName}"},"title":instance.t('frontend_form_new')+" ${uiSchema.label | raw}","body":[{"type":"service","id":"u:1678e148c4d2","messages":{},"schemaApi":{"data":{"isLookup":"${isLookup}","_master":"${_master}","url":"${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}","selectedRowResponseResult":"${selectedRowResponseResult}"},"url":"${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}","method":"get","messages":{},"headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"requestAdaptor":"return { ...api, url: api.body.url }","adaptor":schemaApiAdaptor}}],"showCloseButton":true,"id":"u:standard_new_dialog","closeOnEsc":false,"closeOnOutside":false,"size":"lg","actions":[{type:'button',actionType:'cancel',label:instance.t('frontend_form_cancel'),className:'form-btn-cancel'},{type:'button',label:instance.t('frontend_form_save_and_new'),actionType:'confirm',close:false,id:"confirmAndNew",className:'form-btn-save_and_new',"onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:standard_new_dialog","args":{"value":{"__saveAndNewRecord":true}}}]}}},{type:'button',actionType:'confirm',label:instance.t('frontend_form_save'),primary:true,className:'form-btn-save'}]}}]}}}],"regions":["body"],"className":"p-0 border-0","id":"u:aef99d937b10"});}},_callee3);}));return function getSchema$5(_x67,_x68){return _ref9.apply(this,arguments);};}();/*
|
|
422
422
|
* @Author: baozhoutao@steedos.com
|
|
423
423
|
* @Date: 2022-11-01 15:49:58
|
|
424
424
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
@@ -1723,27 +1723,10 @@ style:{borderLeftColor:"#000000",borderTopColor:"#000000",borderRightColor:"#000
|
|
|
1723
1723
|
stepsSchema=[];stepFields=[];fields=[];unGroupFields=[];_$1.each(instance.fields,function(field){if(field.type==="section"){fields.push(field);}else{unGroupFields.push(field);}});if(unGroupFields.length>0){fields=[{type:"section",name:"General",code:"General",fields:unGroupFields}].concat(fields);}_iterator5=_createForOfIteratorHelper(fields);_context44.p=1;_iterator5.s();case 2:if((_step5=_iterator5.n()).done){_context44.n=12;break;}field=_step5.value;if(!(field.type==="section"&&field.fields)){_context44.n=11;break;}stepFields=[];fieldSchema=void 0;_iterator6=_createForOfIteratorHelper(field.fields);_context44.p=3;_iterator6.s();case 4:if((_step6=_iterator6.n()).done){_context44.n=7;break;}childField=_step6.value;_context44.n=5;return getTdInputTpl(childField,true);case 5:fieldSchema=_context44.v;if(fieldSchema.type==="steedos-field"&&fieldSchema.config){if(fieldSchema.config.amis){fieldSchema.config.amis.mode=formMode;}else{fieldSchema.config.amis={mode:formMode};}}else{fieldSchema.mode=formMode;}stepFields.push(fieldSchema);case 6:_context44.n=4;break;case 7:_context44.n=9;break;case 8:_context44.p=8;_t78=_context44.v;_iterator6.e(_t78);case 9:_context44.p=9;_iterator6.f();return _context44.f(9);case 10:stepsSchema.push({"title":field.name,"body":stepFields});case 11:_context44.n=2;break;case 12:_context44.n=14;break;case 13:_context44.p=13;_t79=_context44.v;_iterator5.e(_t79);case 14:_context44.p=14;_iterator5.f();return _context44.f(14);case 15:isReadonlyBox=instance.box!=='inbox'&&instance.box!=='draft';if(isReadonlyBox){// 只读的审批箱中最后一步的保存按钮要隐藏
|
|
1724
1724
|
if(stepsSchema.length==1){stepsSchema[stepsSchema.length-1].actions=[];}else if(stepsSchema.length>1){stepsSchema[stepsSchema.length-1].actions=[{"label":"Prev","type":"button","actionType":"prev"}];}}return _context44.a(2,stepsSchema);}},_callee44,null,[[3,8,9,10],[1,13,14,15]]);}));return function getFormSteps(_x283){return _ref47.apply(this,arguments);};}();var getFormWizardView=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(instance){var wizardMode,formSchema,_t80,_t81,_t82,_t83;return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:wizardMode=instance.form.current.wizard_mode||"vertical";//vertical,horizontal
|
|
1725
1725
|
_t80="instance-form-view-wizard ".concat(wizardMode==="horizontal"?"pt-4":"pt-1"," mt-3");_t81=wizardMode;_context45.n=1;return getFormSteps(instance);case 1:_t82=_context45.v;_t83={"change":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data}"}}]},"finished":{//点最后一步完成按钮触发暂存按钮事件保存数据
|
|
1726
|
-
"actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t80,mode:_t81,steps:_t82,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t83};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x284){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"applicant",value:getSteedosAuth().userId,disabled:instance$1.box!=='draft'};_context46.n=1;return lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t84.assign.call(_t84,_t85,_context46.v);_context46.n=3;break;case 2:applicantInput={label:false,mode:"horizontal",className:"m-none p-none",disabled:true,type:"tpl",tpl:'<div>${applicant_name}</div>',id:"u:2016b04355f4"};case 3:if(applicantInput){if(applicantInput.className){applicantInput.className="".concat(applicantInput.className," inline-left");}else{applicantInput.className="inline-left";}}return _context46.a(2,{type:"table-view",className:"instance-applicant-view",trs:[{background:"#FFFFFF",tds:[{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instances_applicant_name_prefix')+"</div>",id:"u:ee62634201bf"},applicantInput],id:"u:6c24c1bb99c9",style:{padding:"none"}},{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instance_submit_date_prefix')+"</div>",id:"u:6d0a7763d527"},{label:false,mode:"horizontal",className:"m-none p-none inline-left",disabled:true,type:"tpl",inputFormat:"YYYY-MM-DD",valueFormat:"YYYY-MM-DDT00:00:00.000[Z]",tpl:'<div>${submit_date}</div>',id:"u:2016b04355f4"}],id:"u:c8b8214ac931",style:{padding:"none"}}]}],id:"u:047f3669468b",style:{borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none"}});}},_callee46);}));return function getApplicantTableView(_x285){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,submitEvents){var _t86,_t87,_t88,_t89,_t90,_t91,_t92;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance$1.approve||instance$1.box!='inbox'&&instance$1.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t86=instance.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance$1,submitEvents);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0"});}},_callee47);}));return function getApproveButton(_x286,_x287){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance$1,box){var _instance$1$formVersi;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance$1.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance$1);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance$1);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$1$formVersi=instance$1.formVersion)===null||_instance$1$formVersi===void 0?void 0:_instance$1$formVersi.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance$1.formVersion.amis_schema).onEvent;initedEvents=onEvent.inited.actions||[];changeEvents=onEvent.change.actions||[];submitEvents=onEvent.submit.actions||[];}console.log('getFlowFormSchema formContentSchema',formContentSchema);_t93="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t94={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance$1._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t95={".steedos-amis-instance-view-body":{"height":"calc(100% - 65px)"},".instance-approve-history .antd-Table-table thead":{"display":"none"},".instance-approve-history .antd-Table-heading":{"font-size":"14px","font-weight":"500","padding-left":"0px"},".antd-List-heading":{"font-size":"14px","font-weight":"500"},".steedos-object-record-detail-header .antd-Grid-col--mdAuto":{"padding":"0px !important"},".antd-List-placeholder":{"display":"none"},".steedos-amis-instance-view .antd-Table-fixedTop":{"top":"-13px"},".steedos-amis-instance-view .antd-Table-fixedTop:after":{"box-shadow":"none"},".antd-List-items":{"border":'0px'},".antd-ListItem":{"border-top":"0px !important","background":"transparent !important"}};_context48.n=5;return getAttachments(instance$1);case 5:_t96=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t97=_context48.v;_context48.n=7;return getRelatedRecords(instance$1);case 7:_t98=_context48.v;_t99={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance$1.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t100=formContentSchema;_context48.n=8;return getApplicantTableView(instance$1);case 8:_t101=_context48.v;_t102=[_t99,_t100,_t101];_t103={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":instance.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
1726
|
+
"actions":[{"actionType":"click","componentId":"u:instance_save"}]}};formSchema={type:"wizard",className:_t80,mode:_t81,steps:_t82,actionFinishLabel:"${'CustomAction.instances.instance_save' | t}",id:"instance_wizard",target:"instance_form","onEvent":_t83};return _context45.a(2,formSchema);}},_callee45);}));return function getFormWizardView(_x284){return _ref48.apply(this,arguments);};}();var getApplicantTableView=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(instance$1){var applicantInput,_t84,_t85;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:applicantInput=null;if(!(instance$1.state==='draft')){_context46.n=2;break;}_t84=Object;_t85={name:"applicant",value:getSteedosAuth().userId,disabled:instance$1.box!=='draft'};_context46.n=1;return lookupToAmis({name:"applicant",label:false,reference_to:"space_users",reference_to_field:'user',multiple:false},false,{});case 1:applicantInput=_t84.assign.call(_t84,_t85,_context46.v);_context46.n=3;break;case 2:applicantInput={label:false,mode:"horizontal",className:"m-none p-none",disabled:true,type:"tpl",tpl:'<div>${applicant_name}</div>',id:"u:2016b04355f4"};case 3:if(applicantInput){if(applicantInput.className){applicantInput.className="".concat(applicantInput.className," inline-left");}else{applicantInput.className="inline-left";}}return _context46.a(2,{type:"table-view",className:"instance-applicant-view",trs:[{background:"#FFFFFF",tds:[{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instances_applicant_name_prefix')+"</div>",id:"u:ee62634201bf"},applicantInput],id:"u:6c24c1bb99c9",style:{padding:"none"}},{className:"td-title",background:"#FFFFFF",align:"left",width:"50%",colspan:"",body:[{type:"tpl",tpl:"<div class='inline-left'>"+instance.t('frontend_workflow_instance_submit_date_prefix')+"</div>",id:"u:6d0a7763d527"},{label:false,mode:"horizontal",className:"m-none p-none inline-left",disabled:true,type:"tpl",inputFormat:"YYYY-MM-DD",valueFormat:"YYYY-MM-DDT00:00:00.000[Z]",tpl:'<div>${submit_date}</div>',id:"u:2016b04355f4"}],id:"u:c8b8214ac931",style:{padding:"none"}}]}],id:"u:047f3669468b",style:{borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none"}});}},_callee46);}));return function getApplicantTableView(_x285){return _ref49.apply(this,arguments);};}();var getApproveButton=/*#__PURE__*/function(){var _ref50=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(instance$1,submitEvents){var _t86,_t87,_t88,_t89,_t90,_t91,_t92;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:if(!(!instance$1.approve||instance$1.box!='inbox'&&instance$1.box!='draft')){_context47.n=1;break;}return _context47.a(2,null);case 1:_t86=instance.t('frontend_workflow_instance_button_sign');_t87={};_context47.n=2;return getApprovalDrawerSchema(instance$1,submitEvents);case 2:_t88=_context47.v;_t89={componentId:"",args:_t87,actionType:"drawer",drawer:_t88};_t90=[_t89];_t91={actions:_t90};_t92={click:_t91};return _context47.a(2,{type:"button",label:_t86,onEvent:_t92,id:"steedos-approve-button",level:"primary",className:"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0"});}},_callee47);}));return function getApproveButton(_x286,_x287){return _ref50.apply(this,arguments);};}();var getFlowFormSchema=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(instance$1,box){var _instance$1$formVersi;var formStyle,formContentSchema,amisSchemaStr,initedEvents,changeEvents,submitEvents,onEvent,_t93,_t94,_t95,_t96,_t97,_t98,_t99,_t100,_t101,_t102,_t103,_t104,_t105,_t106,_t107,_t108,_t109,_t110,_t111,_t112;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:formStyle=instance$1.form.current.style||"table";if(!(formStyle==="wizard")){_context48.n=2;break;}_context48.n=1;return getFormWizardView(instance$1);case 1:formContentSchema=_context48.v;_context48.n=4;break;case 2:_context48.n=3;return getFormTableView(instance$1);case 3:formContentSchema=_context48.v;case 4:amisSchemaStr=(_instance$1$formVersi=instance$1.formVersion)===null||_instance$1$formVersi===void 0?void 0:_instance$1$formVersi.amis_schema;initedEvents=[];changeEvents=[];submitEvents=[];if(amisSchemaStr){onEvent=JSON.parse(instance$1.formVersion.amis_schema).onEvent;initedEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.inited.actions)||[];changeEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.change.actions)||[];submitEvents=(onEvent===null||onEvent===void 0?void 0:onEvent.submit.actions)||[];}console.log('getFlowFormSchema formContentSchema',formContentSchema);_t93="steedos-amis-instance-view sm:rounded "+"steedos-instance-style-"+formStyle;_t94={"type":"steedos-record-detail-header","label":"标题面板","objectApiName":"instances","recordId":instance$1._id,"id":"u:e6b2adbe0e21","showRecordTitle":false,"className":"p-0 m-0 p0 m0 bg-gray-50 sm:rounded-tl sm:rounded-tr"};_t95={".steedos-amis-instance-view-body":{"height":"calc(100% - 65px)"},".instance-approve-history .antd-Table-table thead":{"display":"none"},".instance-approve-history .antd-Table-heading":{"font-size":"14px","font-weight":"500","padding-left":"0px"},".antd-List-heading":{"font-size":"14px","font-weight":"500"},".steedos-object-record-detail-header .antd-Grid-col--mdAuto":{"padding":"0px !important"},".antd-List-placeholder":{"display":"none"},".steedos-amis-instance-view .antd-Table-fixedTop":{"top":"-13px"},".steedos-amis-instance-view .antd-Table-fixedTop:after":{"box-shadow":"none"},".antd-List-items":{"border":'0px'},".antd-ListItem":{"border-top":"0px !important","background":"transparent !important"}};_context48.n=5;return getAttachments(instance$1);case 5:_t96=_context48.v;_context48.n=6;return getRelatedInstances();case 6:_t97=_context48.v;_context48.n=7;return getRelatedRecords(instance$1);case 7:_t98=_context48.v;_t99={type:"tpl",id:"u:f5bb0ad602a6",tpl:"<div class=\"instance-name\">".concat(instance$1.title,"</div>"),inline:true,wrapperComponent:"",style:{fontFamily:"",fontSize:12,textAlign:"center"}};_t100=formContentSchema;_context48.n=8;return getApplicantTableView(instance$1);case 8:_t101=_context48.v;_t102=[_t99,_t100,_t101];_t103={validateError:{weight:0,actions:[{"componentId":"","args":{"msgType":"info","position":"top-right","closeButton":true,"showIcon":true,"title":instance.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
1727
1727
|
"msg":instance.t('frontend_workflow_submit_validate_error_msg')//"请填写必填字段"
|
|
1728
|
-
},"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t104={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t102,id:"instance_form",onEvent:_t103};_context48.n=9;return getInstanceApprovalHistory();case 9:_t105=_context48.v;_context48.n=10;return getApproveButton(instance$1,submitEvents);case 10:_t106=_context48.v;_t107=[_t96,_t97,_t98,_t104,_t105,_t106];_t108={};_t109={};_t110=["body","header"];_t111={"@data.@instanceDetail.changed":{actions:[{actionType:"reload"}]},"inited":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data.context.approveValues}"},"expression":"${event.data.context.form.current.style === 'wizard'}"// 表单为 wizard 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
|
|
1729
|
-
}].concat(_toConsumableArray(initedEvents))}
|
|
1730
|
-
// weight: 0,
|
|
1731
|
-
// actions: [
|
|
1732
|
-
// // {
|
|
1733
|
-
// // componentId: "steedos-approve-button",
|
|
1734
|
-
// // actionType: "click",
|
|
1735
|
-
// // },
|
|
1736
|
-
// // {
|
|
1737
|
-
// // "componentId": "",
|
|
1738
|
-
// // "args": {},
|
|
1739
|
-
// // "actionType": "drawer",
|
|
1740
|
-
// // "drawer": await getApprovalDrawerSchema()
|
|
1741
|
-
// // }
|
|
1742
|
-
// ],
|
|
1743
|
-
// }
|
|
1744
|
-
};_t112={"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"messages":{},"requestAdaptor":"\n api.data = {\n query: `\n {\n instance: instances__findOne(id:\"".concat(instance$1._id,"\"){\n related_instances: related_instances__expand{\n _id,\n name\n }\n }\n }\n `\n }\n return api;\n "),"adaptor":"\n payload.data = {\n related_instances: payload.data.instance.related_instances\n };\n return payload;\n ","data":{// "&": "$$",
|
|
1745
|
-
// "context": "${context}",
|
|
1746
|
-
"judge":"${new_judge}"}};return _context48.a(2,{type:"page",name:"instancePage",className:_t93,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t94,"css":_t95,body:_t107,id:"u:63849ea39e12",messages:_t108,pullRefresh:_t109,regions:_t110,onEvent:_t111,initApi:_t112,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x288,_x289){return _ref51.apply(this,arguments);};}();/*
|
|
1728
|
+
},"actionType":"toast"}]},change:{weight:0,actions:[{"actionType":"reload","componentId":"u:next_step","args":{}}].concat(_toConsumableArray(changeEvents))}};_t104={type:"form",debug:false,wrapWithPanel:false,resetAfterSubmit:true,body:_t102,id:"instance_form",onEvent:_t103};_context48.n=9;return getInstanceApprovalHistory();case 9:_t105=_context48.v;_context48.n=10;return getApproveButton(instance$1,submitEvents);case 10:_t106=_context48.v;_t107=[_t96,_t97,_t98,_t104,_t105,_t106];_t108={};_t109={};_t110=["body","header"];_t111={"@data.@instanceDetail.changed":{actions:[{actionType:"custom",script:"debugger;"},{componentId:"u:instancePage",actionType:"reload"}]},"inited":{"actions":[{"actionType":"setValue","componentId":"instance_form","args":{"value":"${event.data.context.approveValues}"},"expression":"${event.data.context.form.current.style === 'wizard'}"// 表单为 wizard 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
|
|
1729
|
+
}].concat(_toConsumableArray(initedEvents))}};_t112={"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"messages":{},"requestAdaptor":"\n api.data = {\n query: `\n {\n instance: instances__findOne(id:\"".concat(instance$1._id,"\"){\n related_instances: related_instances__expand{\n _id,\n name\n }\n }\n }\n `\n }\n return api;\n "),"adaptor":"\n payload.data = {\n related_instances: payload.data.instance.related_instances\n };\n return payload;\n ","data":{"judge":"${new_judge}"}};return _context48.a(2,{type:"page",name:"instancePage",className:_t93,bodyClassName:"overflow-y-auto h-full steedos-amis-instance-view-body",headerClassName:"p-0","title":_t94,"css":_t95,body:_t107,id:"u:instancePage",messages:_t108,pullRefresh:_t109,regions:_t110,onEvent:_t111,initApi:_t112,initFetch:true});}},_callee48);}));return function getFlowFormSchema(_x288,_x289){return _ref51.apply(this,arguments);};}();/*
|
|
1747
1730
|
* @Author: baozhoutao@steedos.com
|
|
1748
1731
|
* @Date: 2022-10-08 16:26:26
|
|
1749
1732
|
* @LastEditors: baozhoutao@steedos.com
|
|
@@ -2729,8 +2712,8 @@ if(!listName){listName=name;}return name===listName||listView._id===listName;});
|
|
|
2729
2712
|
crud=Object.assign({mode:crudMode},crud);}if(!(ctx&&ctx.defaults)){schemaKeys=_$1.difference(_$1.keys($schema),["type","showHeader","id","crud","crudDataFilter","onCrudDataFilter","env","rebuildOn","crudMode"]);listSchema=_$1.pick(props,schemaKeys);// className不传入crud组件,crud单独识别crudClassName属性
|
|
2730
2713
|
listSchema.className=crudClassName;listSchema.onEvent={};// 为啥要将一个内置event放在此处?
|
|
2731
2714
|
// 下面expression中_isRelated参数判断的是列表视图分栏模式下,新建、编辑、删除相关子表记录时不应该刷新左侧(主表)列表视图组件
|
|
2732
|
-
listSchema.onEvent["@data.changed.".concat(objectApiName)]={"actions":[{"args":{"link":"/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?side_object=${objectName}&side_listview_id=${listName}","blank":false},"actionType":"link","expression":"${!!!event.data.recordId && event.data.__deletedRecord != true && event.data._isRelated != true && event.data.reload !=true}"//是新建, 则进入详细页面.
|
|
2733
|
-
},{"actionType":"reload","expression":"${(event.data.reload || event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}"//不是新建, 或分栏模式下新建主对象记录,
|
|
2715
|
+
listSchema.onEvent["@data.changed.".concat(objectApiName)]={"actions":[{"args":{"link":"/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?side_object=${objectName}&side_listview_id=${listName}","blank":false},"actionType":"link","expression":"${!!!event.data.recordId && event.data.__deletedRecord != true && event.data._isRelated != true && event.data.reload !=true && !event.data.__saveAndNewRecord}"//是新建, 则进入详细页面.
|
|
2716
|
+
},{"actionType":"reload","expression":"${(event.data.reload || event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split' || event.data.__saveAndNewRecord === true) && event.data._isRelated != true}"//不是新建, 或分栏模式下新建主对象记录, 则刷新列表,保存并新建按钮点击时刷新列表而不进入详细页面
|
|
2734
2717
|
}]};//触发amis crud 高度重算
|
|
2735
2718
|
listSchema.onEvent["selectedChange"]={"actions":[{"actionType":"broadcast","args":{"eventName":"@height.changed.".concat(objectApiName)},"data":{"timeOut":500}}]};defaults={listSchema:Object.assign({},listSchema,crud)};}setDataToComponentId=ctx&&ctx.setDataToComponentId;if(!setDataToComponentId){setDataToComponentId="service_listview_".concat(objectApiName);}amisSchemaData=Object.assign({},data,defaultData);listViewId=(ctx===null||ctx===void 0?void 0:ctx.listViewId)||amisSchemaData.listViewId;allData=createObject(data,defaultData);listViewSchemaProps=_assign(_assign({top:top,perPage:perPage,defaults:defaults},ctx),{listViewId:listViewId,setDataToComponentId:setDataToComponentId,filterVisible:filterVisible,showDisplayAs:showDisplayAs,displayAs:displayAs,headerToolbarItems:headerToolbarItems,rowClassNameExpr:rowClassNameExpr,hiddenColumnOperation:hiddenColumnOperation,columns:columns,crudDataFilter:crudDataFilter,onCrudDataFilter:onCrudDataFilter,amisData:allData,env:env,requestAdaptor:requestAdaptor,adaptor:adaptor});if(!headerSchema){headerSchema=getObjectListHeader(uiSchema,listName,ctx);}headerSchema.className="steedos-object-listview-header "+headerSchema.className||"";serviceData=Object.assign({},{showDisplayAs:showDisplayAs,displayAs:displayAs,recordPermissions:uiSchema.permissions,_id:null,$listviewId:listName,isObjectListview:true});if(_$1.has(props,'objectApiName')){serviceData.objectName=objectApiName;}if(_$1.has(props,'listName')&&_$1.has(props,'$$editor')){serviceData.listName=listName;}if(!_$1.has(data,'uiSchema')){serviceData.uiSchema=uiSchema;}serviceData.defaultListName=listName?listName:(_h=_$1.first(_$1.values(uiSchema.list_views)))===null||_h===void 0?void 0:_h.name;if(!showHeader){headerSchema={};}_data={defaultListName:listName?listName:(_j=_$1.first(_$1.values(uiSchema.list_views)))===null||_j===void 0?void 0:_j.name,recordPermissions:uiSchema.permissions,isObjectListview:true,_reloadKey:_reloadKey};if(!data.objectName){_data.objectName=objectApiName;}if(!data.listName){_data.listName=listName;}if(!data.uiSchema){_data.uiSchema=uiSchema;}if(_$1.has(props,'$$editor')){_data=serviceData;}if(_$1.has(crud,'id')){_data.crudId=crud.id;}schema={type:"service",id:'u:steedos-object-listview',_reloadKey:_reloadKey,data:_data,style:style,className:"".concat(className," h-full steedos-object-listview ").concat(displayAs==='split'?'':''),body:[{"type":"wrapper","size":"none","className":"flex flex-1 h-full",body:[sideSchema?{"type":"wrapper","size":"none","className":"flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col","body":sideSchema}:null,{"type":"wrapper","size":"none","className":sideSchema?"flex-1 focus:outline-none lg:order-last w-96 h-full":'w-full h-full',"body":{type:"wrapper",className:"p-0 bg-white steedos-object-listview-content-wrapper flex flex-col ".concat(formFactor==='SMALL'?'':'m-4 shadow rounded'," ").concat(displayAs==='split'?'mr-1':''),body:__spreadArray(__spreadArray([],__read(headerSchema),false),[{"type":"service","id":"service_schema_api_"+objectApiName,_reloadKey:_reloadKey,"className":" steedos-object-listview-content grow bg-white ".concat(displayAs==='split'?'p-0 m-0':'px-3 py-0 m-1'),//这里加grow是因为crud card模式下底部会有灰色背影
|
|
2736
2719
|
"schemaApi":{// 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
|