@steedos-widgets/amis-object 1.3.2-beta.4 → 1.3.2-beta.5
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-object.umd.js
CHANGED
|
@@ -724,7 +724,7 @@ function getRelatedListSchema(_x180,_x181,_x182){return _getRelatedListSchema.ap
|
|
|
724
724
|
* @Author: baozhoutao@steedos.com
|
|
725
725
|
* @Date: 2022-07-05 15:55:39
|
|
726
726
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
727
|
-
* @LastEditTime: 2023-09-14
|
|
727
|
+
* @LastEditTime: 2023-09-14 11:34:23
|
|
728
728
|
* @Description:
|
|
729
729
|
*/function _getRelatedListSchema(){_getRelatedListSchema=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee103(objectName,listViewName,ctx){var uiSchema,listView,listViewProps,listViewColumns,listViewSort,listviewFilter,filtersFunction,defaults,adaptor,amisSchema;return _regeneratorRuntime().wrap(function _callee103$(_context103){while(1){switch(_context103.prev=_context103.next){case 0:_context103.next=2;return _getUISchema2(objectName);case 2:uiSchema=_context103.sent;listView=uiSchema.list_views;listViewProps=getRelatedListProps(uiSchema,listViewName,ctx);// console.log('listViewProps==>', listViewProps)
|
|
730
730
|
listViewColumns=listViewProps.columns,listViewSort=listViewProps.sort,listviewFilter=listViewProps.filter,filtersFunction=listViewProps.filtersFunction;defaults=ctx.defaults||{};if(!(!defaults.headerSchema&&ctx.showHeader)){_context103.next=11;break;}_context103.next=10;return getObjectListHeader(uiSchema,listViewName);case 10:defaults.headerSchema=_context103.sent;case 11:if(!ctx.showHeader){defaults.headerSchema=null;}ctx.defaults=defaults;// 由于steedos-object-table组件的上下文覆盖规则异常,此处手动删除无需的ctx参数
|
|
@@ -756,7 +756,8 @@ defaults.headerSchema=null;/**
|
|
|
756
756
|
*/if(localListViewProps){localListViewProps=JSON.parse(localListViewProps);// localListViewProps.perPage = 3;
|
|
757
757
|
listSchema={};if(localListViewProps.orderBy){listSchema.orderBy=localListViewProps.orderBy;}if(localListViewProps.orderDir){listSchema.orderDir=localListViewProps.orderDir;}if(localListViewProps.perPage){listSchema.defaultParams={perPage:localListViewProps.perPage};}defaults.listSchema=_$1.defaultsDeep({},listSchema,defaults.listSchema||{});}}catch(ex){console.error("本地存储中crud参数解析异常:",ex);}ctx.defaults=defaults;if(listViewName=="recent"){listview_filters="\n function(filters, data) {\n var result = Steedos.authRequest('/graphql', {\n type: 'POST',\n async: false,\n data: JSON.stringify({\n query: '{object_recent_viewed(filters: [[\"record.o\",\"=\",\"' + data.objectName + '\"],[\"space\",\"=\",\"' + data.context.tenantId + '\"],[\"owner\",\"=\",\"' + data.context.userId + '\"]],sort:\"modified desc\",top:50){ _id,record} }'\n }),\n });\n var _ids = []\n result.data.object_recent_viewed.forEach(function (item) {\n _ids = _ids.concat(item.record.ids)\n })\n return [\"_id\", \"=\", _ids];\n }\n ";}amisSchema={"type":"steedos-object-table","objectApiName":objectName,"columns":listViewColumns,"extraColumns":listView.extra_columns,"filters":listviewFilter,"filtersFunction":listview_filters,"sort":sort,"ctx":ctx,"requestAdaptor":listView.requestAdaptor,"adaptor":listView.adaptor,"headerToolbarItems":ctx.headerToolbarItems,"filterVisible":ctx.filterVisible,"rowClassNameExpr":ctx.rowClassNameExpr};// console.log(`getListSchema===>`,amisSchema)
|
|
758
758
|
return _context108.abrupt("return",{uiSchema:uiSchema,amisSchema:amisSchema});case 26:case"end":return _context108.stop();}}},_callee108);}));return _getListSchema.apply(this,arguments);}function convertColumnsToTableFields(_x195,_x196){return _convertColumnsToTableFields.apply(this,arguments);}// 获取对象表格
|
|
759
|
-
function _convertColumnsToTableFields(){_convertColumnsToTableFields=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee109(columns,uiSchema){var ctx,fields,_iterator15,_step16,column,fieldName,displayName,filedInfo,rfUiSchema,rfFieldInfo,_fieldName,_displayName,_filedInfo,_rfUiSchema,_rfFieldInfo,_args109=arguments;return _regeneratorRuntime().wrap(function _callee109$(_context109){while(1){switch(_context109.prev=_context109.next){case 0:ctx=_args109.length>2&&_args109[2]!==undefined?_args109[2]:{};fields=[];_iterator15=_createForOfIteratorHelper(columns);_context109.prev=3;_iterator15.s();case 5:if((_step16=_iterator15.n()).done){_context109.next=39;break;}column=_step16.value;if(!_$1.isString(column)){_context109.next=23;break;}if(!(column.indexOf('.')>0)){_context109.next=20;break;}fieldName=column.split('.')[0];displayName=column.split('.')[1];filedInfo=uiSchema.fields[fieldName];if(!(filedInfo&&(filedInfo.type==='lookup'||filedInfo.type==='master_detail')&&_$1.isString(filedInfo.reference_to))){_context109.next=18;break;}_context109.next=15;return _getUISchema2(filedInfo.reference_to);case 15:rfUiSchema=_context109.sent;rfFieldInfo=rfUiSchema.fields[displayName];fields.push(Object.assign({},rfFieldInfo,{name:"".concat(fieldName,"__expand.").concat(displayName),expand:true,expandInfo:{fieldName:fieldName,displayName:displayName}},ctx));case 18:_context109.next=21;break;case 20:if(uiSchema.fields[column]){fields.push(Object.assign({},uiSchema.fields[column],ctx));}else if(ctx.extra){
|
|
759
|
+
function _convertColumnsToTableFields(){_convertColumnsToTableFields=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee109(columns,uiSchema){var ctx,fields,_iterator15,_step16,column,fieldName,displayName,filedInfo,rfUiSchema,rfFieldInfo,_fieldName,_displayName,_filedInfo,_rfUiSchema,_rfFieldInfo,_args109=arguments;return _regeneratorRuntime().wrap(function _callee109$(_context109){while(1){switch(_context109.prev=_context109.next){case 0:ctx=_args109.length>2&&_args109[2]!==undefined?_args109[2]:{};fields=[];_iterator15=_createForOfIteratorHelper(columns);_context109.prev=3;_iterator15.s();case 5:if((_step16=_iterator15.n()).done){_context109.next=39;break;}column=_step16.value;if(!_$1.isString(column)){_context109.next=23;break;}if(!(column.indexOf('.')>0)){_context109.next=20;break;}fieldName=column.split('.')[0];displayName=column.split('.')[1];filedInfo=uiSchema.fields[fieldName];if(!(filedInfo&&(filedInfo.type==='lookup'||filedInfo.type==='master_detail')&&_$1.isString(filedInfo.reference_to))){_context109.next=18;break;}_context109.next=15;return _getUISchema2(filedInfo.reference_to);case 15:rfUiSchema=_context109.sent;rfFieldInfo=rfUiSchema.fields[displayName];fields.push(Object.assign({},rfFieldInfo,{name:"".concat(fieldName,"__expand.").concat(displayName),expand:true,expandInfo:{fieldName:fieldName,displayName:displayName}},ctx));case 18:_context109.next=21;break;case 20:if(uiSchema.fields[column]){fields.push(Object.assign({},uiSchema.fields[column],ctx));}else if(ctx.extra){// 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
|
|
760
|
+
fields.push({name:column});}case 21:_context109.next=37;break;case 23:if(!_$1.isObject(column)){_context109.next=37;break;}if(!(column.field.indexOf('.')>0)){_context109.next=36;break;}_fieldName=column.field.split('.')[0];_displayName=column.field.split('.')[1];_filedInfo=uiSchema.fields[_fieldName];if(!(_filedInfo&&(_filedInfo.type==='lookup'||_filedInfo.type==='master_detail')&&_$1.isString(_filedInfo.reference_to))){_context109.next=34;break;}_context109.next=31;return _getUISchema2(_filedInfo.reference_to);case 31:_rfUiSchema=_context109.sent;_rfFieldInfo=_rfUiSchema.fields[_displayName];fields.push(Object.assign({},_rfFieldInfo,ctx,{name:"".concat(_fieldName,"__expand.").concat(_displayName),expand:true,expandInfo:{fieldName:_fieldName,displayName:_displayName}},{width:column.width,wrap:column.wrap,// wrap = true 是没效果的
|
|
760
761
|
amis:column.amis}));case 34:_context109.next=37;break;case 36:if(uiSchema.fields[column.field]){fields.push(Object.assign({},uiSchema.fields[column.field],ctx,{width:column.width,wrap:column.wrap,// wrap = true 是没效果的
|
|
761
762
|
amis:column.amis}));}case 37:_context109.next=5;break;case 39:_context109.next=44;break;case 41:_context109.prev=41;_context109.t0=_context109["catch"](3);_iterator15.e(_context109.t0);case 44:_context109.prev=44;_iterator15.f();return _context109.finish(44);case 47:return _context109.abrupt("return",fields);case 48:case"end":return _context109.stop();}}},_callee109,null,[[3,41,44,47]]);}));return _convertColumnsToTableFields.apply(this,arguments);}function getTableSchema(_x197,_x198,_x199){return _getTableSchema.apply(this,arguments);}// 获取对象日历
|
|
762
763
|
function _getTableSchema(){_getTableSchema=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee110(appName,objectName,columns){var ctx,uiSchema,sort,sortField,sortOrder,sortStr,fields,extraColumns,extraFields,amisSchema,_args110=arguments;return _regeneratorRuntime().wrap(function _callee110$(_context110){while(1){switch(_context110.prev=_context110.next){case 0:ctx=_args110.length>3&&_args110[3]!==undefined?_args110[3]:{};_context110.next=3;return _getUISchema2(objectName);case 3:uiSchema=_context110.sent;sort=ctx.sort;if(!sort){sortField=ctx.sortField;sortOrder=ctx.sortOrder;if(sortField){sortStr=sortField+' '+sortOrder||'asc';sort=sortStr;}}_context110.next=8;return convertColumnsToTableFields(columns,uiSchema);case 8:fields=_context110.sent;extraColumns=ctx.extraColumns;if(!extraColumns){_context110.next=15;break;}_context110.next=13;return convertColumnsToTableFields(extraColumns,uiSchema,{extra:true});case 13:extraFields=_context110.sent;fields=fields.concat(extraFields);case 15:_context110.t0=getObjectCRUD;_context110.t1=uiSchema;_context110.t2=fields;_context110.t3=_objectSpread2;_context110.t4=_objectSpread2({tabId:objectName,appId:appName,objectName:objectName},ctx);_context110.t5={};_context110.t6=ctx.filters;_context110.t7=sort;_context110.t8=ctx.headerToolbarItems;_context110.next=26;return getListViewItemButtons(uiSchema,ctx);case 26:_context110.t9=_context110.sent;_context110.t10={filter:_context110.t6,sort:_context110.t7,headerToolbarItems:_context110.t8,buttons:_context110.t9};_context110.t11=(0,_context110.t3)(_context110.t4,_context110.t5,_context110.t10);_context110.next=31;return(0,_context110.t0)(_context110.t1,_context110.t2,_context110.t11);case 31:amisSchema=_context110.sent;console.log('getTableSchema====>amisSchema',amisSchema);// console.timeEnd('getTableSchema');
|
|
@@ -1118,10 +1119,10 @@ return[2/*return*/,schema];case 8:return[3/*break*/,10];case 9:error_1=_h.sent()
|
|
|
1118
1119
|
* @Author: baozhoutao@steedos.com
|
|
1119
1120
|
* @Date: 2023-01-14 16:41:24
|
|
1120
1121
|
* @LastEditors: baozhoutao@steedos.com
|
|
1121
|
-
* @LastEditTime: 2023-09-
|
|
1122
|
+
* @LastEditTime: 2023-09-14 13:08:43
|
|
1122
1123
|
* @Description:
|
|
1123
1124
|
*/var getSelectFlowSchema=function getSelectFlowSchema(id,props){var label=props.label,data=props.data,name=props.name,required=props.required,_a=props.action,action=_a===void 0?"query":_a,_b=props.distributeInstanceId,distributeInstanceId=_b===void 0?"":_b,_c=props.distributeStepId,distributeStepId=_c===void 0?"":_c,_d=props.mode,mode=_d===void 0?"input-tree":_d,className=props.className,onEvent=props.onEvent,_e=props.multiple,multiple=_e===void 0?false:_e,delimiter=props.delimiter,joinValues=props.joinValues,extractValue=props.extractValue,searchable=props.searchable,_f=props.showIcon,showIcon=_f===void 0?true:_f,_g=props.showRadio,showRadio=_g===void 0?false:_g,showOutline=props.showOutline,initiallyOpen=props.initiallyOpen,unfoldedLevel=props.unfoldedLevel,treeContainerClassName=props.treeContainerClassName,_h=props.amis,amis=_h===void 0?{}:_h;// console.log(`=====onEvent`, onEvent)
|
|
1124
|
-
return _assign$({type:mode,id:id,label:label,name:name,options:[],multiple:multiple,delimiter:delimiter,joinValues:joinValues,extractValue:extractValue,searchable:searchable,showOutline:showOutline,initiallyOpen:initiallyOpen,unfoldedLevel:unfoldedLevel,// className: `overflow-y-auto ` + className,
|
|
1125
|
+
var allData=props.allData;if(allData!=true){allData=false;}return _assign$({type:mode,id:id,label:label,name:name,options:[],multiple:multiple,delimiter:delimiter,joinValues:joinValues,extractValue:extractValue,searchable:searchable,showOutline:showOutline,initiallyOpen:initiallyOpen,unfoldedLevel:unfoldedLevel,// className: `overflow-y-auto ` + className,
|
|
1125
1126
|
className:className,required:required,treeContainerClassName:treeContainerClassName,heightAuto:true,menuTpl:mode==='input-tree'?{type:"tpl",tpl:"<div class='flex'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${value == 'startFlows' ? '' : 'hidden'}'><button class='antd-Button antd-Button--link m-none p-none'>设置</button></span></div>",onEvent:{click:{weight:0,actions:[{actionType:"dialog",dialog:{type:"dialog",size:"lg",title:{type:"tpl",id:"u:0bce3c33b6e5",tpl:'<p>设置星标流程</p>'},body:[{type:"form",title:"表单",debug:false,body:[{type:"steedos-field",name:"startFlows",field:{name:"startFlows",type:'lookup',label:"流程名称",required:true,reference_to:'flows',multiple:true}// type: "steedos-select-flow",
|
|
1126
1127
|
// label: "流程名称",
|
|
1127
1128
|
// name: "startFlows",
|
|
@@ -1137,7 +1138,7 @@ className:className,required:required,treeContainerClassName:treeContainerClassN
|
|
|
1137
1138
|
// },
|
|
1138
1139
|
// },
|
|
1139
1140
|
// onlyLeaf: true
|
|
1140
|
-
}],id:"u:742f9c0dc8a1",mode:"normal",initApi:{url:"${context.rootUrl}/api/steedos_keyvalues/startFlows",method:"get",dataType:"json",headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"}},api:{url:"${context.rootUrl}/api/steedos_keyvalues/startFlows",method:"post",dataType:"json",data:{"startFlows":"${startFlows}"},headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"},messages:{success:"设置成功!",failed:"设置失败"}},onEvent:{submitSucc:{actions:[{componentId:"",args:{},actionType:"closeDialog"}]}}}],id:"u:519ca64b1934",actions:[{type:"button",label:"取消",onEvent:{click:{actions:[{componentId:"",args:{},actionType:"closeDialog"}]}},id:"u:1d0d136fe2f0"},{type:"button",label:"确定",onEvent:{click:{actions:[{args:{},actionType:"validate",componentId:"u:742f9c0dc8a1"},{componentId:"u:742f9c0dc8a1",args:{},actionType:"submit"}]}},id:"u:f7f767bed23f",level:"primary"}]},expression:"${event.data.value === 'startFlows' ? true : false}"}]}}}:'',source:{method:"post",url:"${context.rootUrl}/graphql?keywords=${keywords}",requestAdaptor:"\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id||"","';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action,"\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId,"\", distributeStepId: \"").concat(distributeStepId,"\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),adaptor:"\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n // if(payload.data.options.length === 1 && payload.data.options[0].children.length === 1){\n // payload.data.value = payload.data.options[0].children[0].value\n // }\n return payload;\n ","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"}},"showIcon":showIcon,"showRadio":showRadio,"onlyLeaf":true,"onEvent":onEvent,"static":!!props["static"],"onlyChildren":true},amis);};/**
|
|
1141
|
+
}],id:"u:742f9c0dc8a1",mode:"normal",initApi:{url:"${context.rootUrl}/api/steedos_keyvalues/startFlows",method:"get",dataType:"json",headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"}},api:{url:"${context.rootUrl}/api/steedos_keyvalues/startFlows",method:"post",dataType:"json",data:{"startFlows":"${startFlows}"},headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"},messages:{success:"设置成功!",failed:"设置失败"}},onEvent:{submitSucc:{actions:[{componentId:"",args:{},actionType:"closeDialog"}]}}}],id:"u:519ca64b1934",actions:[{type:"button",label:"取消",onEvent:{click:{actions:[{componentId:"",args:{},actionType:"closeDialog"}]}},id:"u:1d0d136fe2f0"},{type:"button",label:"确定",onEvent:{click:{actions:[{args:{},actionType:"validate",componentId:"u:742f9c0dc8a1"},{componentId:"u:742f9c0dc8a1",args:{},actionType:"submit"}]}},id:"u:f7f767bed23f",level:"primary"}]},expression:"${event.data.value === 'startFlows' ? true : false}"}]}}}:'',source:{method:"post",url:"${context.rootUrl}/graphql?keywords=${keywords}",requestAdaptor:"\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id||"","';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action,"\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId,"\", distributeStepId: \"").concat(distributeStepId,"\", allData: ").concat(allData,"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),adaptor:"\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n // if(payload.data.options.length === 1 && payload.data.options[0].children.length === 1){\n // payload.data.value = payload.data.options[0].children[0].value\n // }\n return payload;\n ","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"}},"showIcon":showIcon,"showRadio":showRadio,"onlyLeaf":true,"onEvent":onEvent,"static":!!props["static"],"onlyChildren":true},amis);};/**
|
|
1141
1142
|
*
|
|
1142
1143
|
* @css
|
|
1143
1144
|
* max-h-[80vh]
|