@steedos-widgets/amis-lib 6.3.0-beta.20 → 6.3.0-beta.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 +5 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +6 -5
- 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: 排除的字段
|
|
@@ -1031,7 +1032,7 @@ sectionFieldsVisibleOn=___namespace.map(___namespace.compact(___namespace.map(fi
|
|
|
1031
1032
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1032
1033
|
* @Date: 2023-11-15 09:50:22
|
|
1033
1034
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1034
|
-
* @LastEditTime: 2024-
|
|
1035
|
+
* @LastEditTime: 2024-06-11 15:38:16
|
|
1035
1036
|
*/ /**
|
|
1036
1037
|
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
1037
1038
|
* amis #9520修正后此函数及相关代码可以移除
|
|
@@ -1252,7 +1253,7 @@ dialogButtons=[{"type":"button","label":"新增","tooltip":"保存并新增一
|
|
|
1252
1253
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
1253
1254
|
// "__parentForm": "${__super.__super || {}}",
|
|
1254
1255
|
// "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
1255
|
-
"__parentForm":mode=="new"?"$$":parentFormData,"_master":"${_master}","global":"${global}","uiSchema":"${uiSchema}","index":"${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
1256
|
+
"__parentForm":mode=="new"?"$$":parentFormData,"_master":"${_master}","global":"${global}","context":"${context}","uiSchema":"${uiSchema}","index":"${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
1256
1257
|
"parent":"${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
1257
1258
|
// "__tableItems": `\${${props.name}}`
|
|
1258
1259
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
@@ -1303,7 +1304,7 @@ if(props.enableDialog===false){actions=[{"actionType":"custom","script":"\n
|
|
|
1303
1304
|
// 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
|
|
1304
1305
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
1305
1306
|
// "__parentForm": "${__super.__super || {}}",
|
|
1306
|
-
"__parentForm":parentFormData,"_master":"${_master}","global":"${global}","uiSchema":"${uiSchema}","index":"${index}","parent":"${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
1307
|
+
"__parentForm":parentFormData,"_master":"${_master}","global":"${global}","context":"${context}","uiSchema":"${uiSchema}","index":"${index}","parent":"${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
1307
1308
|
// "__tableItems": `\${${props.name}}`
|
|
1308
1309
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
1309
1310
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|