@steedos-widgets/amis-lib 6.3.0-beta.19 → 6.3.0-beta.21
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 +2 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -602,11 +602,12 @@ recordPermissions:objectSchema.permissions,uiSchema:objectSchema// loaded: false
|
|
|
602
602
|
if(objectSchema.name==='organizations'){labelFieldName='name';}tableOptions=Object.assign({idFieldName:objectSchema.idFieldName,labelFieldName:labelFieldName,permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit,crudId:listSchema.id||id,enable_tree:objectSchema.enable_tree},options);tableOptions.amisData=createObject(options.amisData||{},{});_context85.next=48;return getTableSchema$1(objectSchema,fields,tableOptions);case 48:table=_context85.sent;// delete table.mode;
|
|
603
603
|
//image与avatar需要在提交修改时特别处理
|
|
604
604
|
imageNames=___default["default"].compact(___default["default"].map(___default["default"].filter(fields,function(field){return["image","avatar"].includes(field.type);}),'name'));quickSaveApiRequestAdaptor="\n var graphqlOrder = \"\";\n var imageNames = ".concat(JSON.stringify(imageNames),";\n const rowsDiff = _.cloneDeep(api.data.rowsDiff);\n rowsDiff.forEach(function (item, index) {\n for(key in item){\n // image\u3001select\u7B49\u5B57\u6BB5\u6E05\u7A7A\u503C\u540E\u4FDD\u5B58\u7684\u7A7A\u5B57\u7B26\u4E32\u8F6C\u6362\u4E3Anull\u3002\n if(item[key] === ''){\n item[key] = null;\n }\n if(_.includes(imageNames, key)){\n if(typeof item[key] == \"string\"){\n const match = item[key].match(/\\/([^\\/]+)$/);\n item[key] = match && match.length > 1?match[1]:\"\";\n }else{\n item[key] = _.map(item[key], function(ele){\n const match = ele.match(/\\/([^\\/]+)$/);\n return match && match.length > 1?match[1]:\"\";\n })\n }\n }\n }\n item = _.omit(item, '_display');\n const itemOrder = 'update' + index + ':' + api.data.objectName + '__update(id:\"' + item._id + '\", doc:' + JSON.stringify(JSON.stringify(_.omit(item, '_id'))) + ') {_id}';\n graphqlOrder += itemOrder;\n })\n graphqlOrder = 'mutation {' + graphqlOrder + '}';\n return {\n ...api,\n data: {\n query: graphqlOrder\n }\n }\n ");_context85.t12=Object;_context85.t13={};_context85.t14=table;_context85.t15=id;_context85.t16=id;_context85.next=58;return getTableApi(objectSchema,fields,options);case 58:_context85.t17=_context85.sent;_context85.t18=options.tableHiddenOn;_context85.t19="flex-auto ".concat(crudClassName||"");_context85.t20={"mb-0":true,"is-steedos-crud-data-empty":"${!items || COUNT(items) == 0}"};_context85.t21=crudClassName;_context85.t22={url:"${context.rootUrl}/graphql",method:"post",dataType:"json",headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"},requestAdaptor:quickSaveApiRequestAdaptor};_context85.t23=options.rowClassNameExpr||"<%= data._id === data.recordId ? 'steedos-record-tr steedos-record-tr-' + data._id + ' steedos-record-selected' : 'steedos-record-tr steedos-record-tr-' + data._id %>";_context85.t24={type:'crud',primaryField:'_id',affixHeader:false,id:_context85.t15,name:_context85.t16,keepItemSelectionOnPageChange:true,api:_context85.t17,hiddenOn:_context85.t18,className:_context85.t19,bodyClassName:_context85.t20,crudClassName:_context85.t21,quickSaveApi:_context85.t22,rowClassNameExpr:_context85.t23};_context85.t25=bodyProps;body=_context85.t12.assign.call(_context85.t12,_context85.t13,_context85.t14,_context85.t24,_context85.t25);case 68:body=defaultsDeep({},listSchema,body);_context85.next=71;return getCrudSchemaWithDataFilter(body,{crudDataFilter:crudDataFilter,onCrudDataFilter:onCrudDataFilter,amisData:amisData,env:env});case 71:body=_context85.sent;crudModeClassName="";if(body.mode){crudModeClassName="steedos-crud-mode-".concat(body.mode);}body.quickSaveApi.adaptor="\n if(payload.errors){\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n }\n var scope = SteedosUI.getRef(context.scopeId);\n var scopeParent = scope && scope.parent;\n var crudScoped = scopeParent.getComponentById('".concat(body.id,"');\n setTimeout(()=>{\n crudScoped && crudScoped.control.updateAutoFillHeight();\n }, 500);\n return payload;\n ");if(body.columns&&options.formFactor!='SMALL'){//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
605
|
-
body.columns.splice(body.columns.length-1,0,{name:'_display',type:'static',width:1,placeholder:"",id:objectSchema.name+"_display_${_index}",tpl:"${''}"});}
|
|
605
|
+
body.columns.splice(body.columns.length-1,0,{name:'_display',type:'static',width:1,placeholder:"",id:objectSchema.name+"_display_${_index}",tpl:"${''}"});}// 去除数组中的异常值,如null,undefined等
|
|
606
|
+
body.columns=___default["default"].compact(body.columns);if(defaults){headerSchema=defaults.headerSchema;footerSchema=defaults.footerSchema;if(headerSchema||footerSchema){wrappedBody=[body];if(headerSchema){if(___default["default"].isArray(headerSchema)){wrappedBody=___default["default"].union(headerSchema,wrappedBody);}else{wrappedBody.unshift(headerSchema);}}if(footerSchema){if(___default["default"].isArray(footerSchema)){wrappedBody=___default["default"].union(wrappedBody,footerSchema);}else{wrappedBody.push(footerSchema);}}body=wrappedBody;}}// console.timeEnd('getObjectCRUD');
|
|
606
607
|
// TODO: data应该只留loaded,其他属性都改为从上层传递下来
|
|
607
608
|
return _context85.abrupt("return",{type:'service',className:crudModeClassName,//目前crud的service层id不认用户自定义id,只支持默认规则id,许多地方的格式都写死了service_listview_${objectname}
|
|
608
609
|
id:"service_".concat(id),name:"page",data:options.amisData,body:body,//监听广播事件,重算crud高度
|
|
609
|
-
onEvent:_defineProperty({},"@height.changed.".concat(objectSchema.name),{"actions":[{"actionType":"custom","script":"\n var crudScoped = event.context.scoped.getComponentById('".concat(body.id,"');\n var timeOut = event.data.timeOut || 500;\n setTimeout(()=>{\n crudScoped && crudScoped.control.updateAutoFillHeight();\n }, timeOut);\n ")}]})});case
|
|
610
|
+
onEvent:_defineProperty({},"@height.changed.".concat(objectSchema.name),{"actions":[{"actionType":"custom","script":"\n var crudScoped = event.context.scoped.getComponentById('".concat(body.id,"');\n var timeOut = event.data.timeOut || 500;\n setTimeout(()=>{\n crudScoped && crudScoped.control.updateAutoFillHeight();\n }, timeOut);\n ")}]})});case 79:case"end":return _context85.stop();}}},_callee85);}));return _getObjectCRUD.apply(this,arguments);}var getFormFields$1=function getFormFields$1(objectSchema,formProps){/**
|
|
610
611
|
* fieldsExtend: 重写字段定义
|
|
611
612
|
* fields: 包含的字段
|
|
612
613
|
* excludedFields: 排除的字段
|