@steedos-widgets/amis-object 3.6.2-beta.13 → 3.6.2-beta.14

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.
@@ -134,14 +134,18 @@ var value=sessionStorage.getItem(key);var defaultDisplay="grid";if(uiSchema.enab
134
134
  },getObjectListViewPath:function getObjectListViewPath(_ref3){var formFactor=_ref3.formFactor,appId=_ref3.appId,objectName=_ref3.objectName,listViewName=_ref3.listViewName;return"/app/".concat(appId,"/").concat(objectName,"/grid/").concat(listViewName);},getObjectDetailPath:function getObjectDetailPath(props){var formFactor=props.formFactor,appId=props.appId,objectName=props.objectName,recordId=props.recordId,listViewName=props.listViewName,_templateType=props._templateType;if(_templateType==='JavaScript'){return"/app/".concat(appId,"/").concat(objectName,"/view/").concat(recordId,"?side_object=<%=item.objectName%>&side_listview_id=<%=item.listName%>");}return"/app/".concat(appId,"/").concat(objectName,"/view/").concat(recordId,"?side_object=${objectName}&side_listview_id=${listName}");},getObjectRelatedViewPath:function getObjectRelatedViewPath(_ref4){var formFactor=_ref4.formFactor,appId=_ref4.appId,masterObjectName=_ref4.masterObjectName,masterRecordId=_ref4.masterRecordId,objectName=_ref4.objectName,foreignKey=_ref4.foreignKey;return"/app/".concat(appId,"/").concat(masterObjectName,"/").concat(masterRecordId,"/").concat(objectName,"/grid?related_field_name=").concat(foreignKey);}};/*
135
135
  * @Author: baozhoutao@steedos.com
136
136
  * @Date: 2022-07-20 16:29:22
137
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
138
- * @LastEditTime: 2023-12-28 14:59:08
137
+ * @LastEditors: liaodaxue
138
+ * @LastEditTime: 2024-01-25 14:44:17
139
139
  * @Description:
140
140
  */function getImageFieldUrl(url){if(window.Meteor&&window.Meteor.isCordova!=true){// '//'的位置
141
141
  var doubleSlashIndex=url.indexOf('//');var urlIndex=url.indexOf('/',doubleSlashIndex+2);var rootUrl=url.substring(urlIndex);return rootUrl;}return url;}if(typeof window!='undefined'){window.getImageFieldUrl=getImageFieldUrl;}function getContrastColor(bgColor){var backgroundColor=bgColor.charAt(0)==='#'?bgColor.substring(1,7):bgColor;var r=parseInt(backgroundColor.substr(0,2),16);var g=parseInt(backgroundColor.substr(2,2),16);var b=parseInt(backgroundColor.substr(4,2),16);var brightness=(r*299+g*587+b*114)/1000;return brightness<128?"#ffffff":"#000000";}function getLookupListView(refObjectConfig){if(!refObjectConfig){return null;}var listNameAll="all";var listNameLookup="lookup";var listViewAll,listViewLookup;_.each(refObjectConfig.list_views,function(view,name){if(name===listNameAll){listViewAll=view;if(!listViewAll.name){listViewAll.name=name;}}else if(name===listNameLookup){listViewLookup=view;if(!listViewLookup.name){listViewLookup.name=name;}}});var listView=listViewLookup||listViewAll;return listView;}/**
142
142
  * 获取可比较的amis版本号
143
143
  * @returns 只返回前两位版本,第三位忽略,比如3.6.3返回3.6
144
- */function getComparableAmisVersion(){var amis=window.amisRequire&&window.amisRequire('amis')||window.Amis;var amisVersion=amis&&amis.version;if(amisVersion){var comparableVersions=amisVersion.split(".");var comparableVersion=parseFloat(comparableVersions[0].toString()+"."+comparableVersions[1].toString());return comparableVersion;}}/*
144
+ */function getComparableAmisVersion(){var amis=window.amisRequire&&window.amisRequire('amis')||window.Amis;var amisVersion=amis&&amis.version;if(amisVersion){var comparableVersions=amisVersion.split(".");var comparableVersion=parseFloat(comparableVersions[0].toString()+"."+comparableVersions[1].toString());return comparableVersion;}}/**
145
+ * 判断浏览器类型
146
+ * @returns 按需返回浏览器类型;
147
+ */function getBowserType(){var userAgent=navigator.userAgent;if(userAgent.indexOf("Chrome")!==-1&&userAgent.indexOf("Safari")!==-1&&userAgent.indexOf("Edg")===-1){return"Chrome";}else if(userAgent.indexOf("Firefox")!==-1){return"Firefox";}else if(userAgent.indexOf("Safari")!==-1&&userAgent.indexOf("Chrome")===-1&&userAgent.indexOf("Edge")===-1){return"Safari";}else if(userAgent.indexOf("Edg")!==-1){return"Edge";}else{return"Unknown browser";// 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
148
+ }}/*
145
149
  * @Author: baozhoutao@steedos.com
146
150
  * @Date: 2022-05-23 09:53:08
147
151
  * @LastEditors: liaodaxue
@@ -188,7 +192,7 @@ TempDisplayField="";quickEditSchema.body[0].onEvent={};quickEditOnEvent=function
188
192
  第一种是减少选项时(判断新的数据是否比老的数据短),按照index删除_display中对应选项,保证回显没问题;
189
193
  第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
190
194
  */TempDisplayField="\n const preData = _.cloneDeep(event.data.__super.".concat(field.name,");\n if(preData && event.data.").concat(field.name,".length < preData.length){\n let deletedIndex;\n preData.forEach(function(item,index){\n if(_.indexOf(event.data.").concat(field.name,", item) == -1) _display[\"").concat(field.name,"\"].splice(index, 1);\n })\n }else{\n _display[\"").concat(field.name,"\"] = [];\n event.data.value.forEach(function(val,index){\n const item = _.find(event.data.selectedItems, { ").concat(valueField,": val });\n _display[\"").concat(field.name,"\"].push(\n {\n \"label\": item.").concat(labelField,",\n \"value\": item[event.data.uiSchema.idFieldName],\n \"objectName\": \"").concat(field.reference_to,"\"\n }\n )\n })\n }\n \n ");}else{TempDisplayField="\n if(event.data.value){\n _display[\"".concat(field.name,"\"] = {\n \"label\": event.data.selectedItems.").concat(labelField,",\n \"value\": event.data.selectedItems[event.data.uiSchema.idFieldName],\n \"objectName\": \"").concat(field.reference_to,"\"\n }\n }else{\n _display[\"").concat(field.name,"\"] = {}\n }\n ");}quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 25:TempDisplayField="\n _display[\"".concat(field.name,"\"] = event.data.selectedItems.label;\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 28:TempDisplayField="\n _display[\"".concat(field.name,"\"] = event.data.value.toFixed(").concat(field.scale,") + '%';\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 31:TempDisplayField="\n _display[\"".concat(field.name,"\"] = moment(event.data.value).utc().format('HH:mm');\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 34:TempDisplayField="\n _display[\"".concat(field.name,"\"] = moment(event.data.value).utc().format('YYYY-MM-DD');\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 37:TempDisplayField="\n _display[\"".concat(field.name,"\"] = moment(event.data.value).format('YYYY-MM-DD HH:mm');\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 40:TempDisplayField="\n _display[\"".concat(field.name,"\"] = event.data.value?\"\u221A\":\"\";\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 43:TempDisplayField="\n _display[\"".concat(field.name,"\"] = event.data.value && event.data.value.toFixed(").concat(field.scale,");\n ");quickEditSchema.body[0].onEvent["change"]=quickEditOnEvent(TempDisplayField);return _context58.abrupt("break",53);case 46:removeDisplayField="";if(field.multiple){TempDisplayField="\n _display[\"".concat(field.name,"\"].push({\n \"name\": event.data.result.name,\n \"url\": event.data.result.url,\n \"type\": event.data.item.type,\n \"size\": event.data.item.size\n });\n ");removeDisplayField="\n _.remove(_display[\"".concat(field.name,"\"], function(file){return file.url == event.data.item.url});\n ");}else{TempDisplayField=" \n _display[\"".concat(field.name,"\"] = {\n \"name\": event.data.result.name,\n \"url\": event.data.result.url,\n \"type\": event.data.item.type,\n \"size\": event.data.item.size\n };\n ");removeDisplayField="\n if(_display[\"".concat(field.name,"\"].url == event.data.item.url){\n _display[\"").concat(field.name,"\"] = {};\n }\n ");}quickEditSchema.body[0].onEvent["success"]=quickEditOnEvent(TempDisplayField);quickEditSchema.body[0].onEvent["remove"]=quickEditOnEvent(removeDisplayField);return _context58.abrupt("break",53);case 51:quickEditSchema.body[0].receiver.adaptor="\n const superData = (typeof context != 'undefined') ? context : api.body; \n const { context:pageContext } = superData; \n var rootUrl = pageContext.rootUrl + \"/api/files/".concat(field.type,"s/\";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: rootUrl + payload._id,//\u4E3A\u4E86\u5B9E\u73B0\u56FE\u7247crud\u7684\u56DE\u663E\uFF0C\u9700\u8981\u5C06value\u4ECEid\u6539\u4E3Aurl\uFF0C\u5F53\u4FDD\u5B58\u6570\u636E\u6570\u636E\u65F6\uFF0C\u518D\u5728\u53D1\u9001\u9002\u914D\u5668\u5185\u91CD\u65B0\u5C06id\u63D0\u53D6\u51FA\u6765\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ");return _context58.abrupt("break",53);case 53:quickEditSchema.body[0].visibleOn="${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";quickEditSchema.body.push({"type":"service","body":[{"type":"tpl","tpl":instance.t('frontend_records_no_allowedit'),"visibleOn":"${!quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}"},{"type":"spinner","showOn":"${quickedit_record_permissions_loading}"}],"onEvent":{"init":{"actions":[//amis3.6无法从数据域中直接拿到正确的selectitems,需要通过crud组件的getSelected()函数获取
191
- {"actionType":"custom","script":"\n crudScoped = event.context.scoped.getComponentById('".concat(options.crudId,"');\n const selectedItems = crudScoped && crudScoped.control.getSelected();\n doAction({\n \"componentId\": \"").concat(quickEditId,"\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n selectedItems\n }\n }\n });\n ")},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions_loading":true}}},{"actionType":"ajax","args":{"api":{"url":"${context.rootUrl}/service/api/@\${objectName}/recordPermissions/${_id}","method":"get","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"cache":30000,"messages":{"failed":"失败了呢。。"}}}},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions_loading":false}}},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions":"${event.data}"}}}]}}});if(field.type!='avatar'&&field.type!='image'&&field.type!='file'&&isAmisVersionforBatchEdit){quickEditSchema.body.push({"name":"isBatchEdit","type":"checkbox","option":[{"type":"tpl","tpl":"更新${COUNT(selectedItems)}个选定记录"},{"type":"spinner","showOn":"${batchPermissionLoading}","size":"sm","className":"mr-4"}],"visibleOn":"${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}","disabledOn":"${batchPermissionLoading}","onEvent":{"change":{"actions":[{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"batchPermissionLoading":true}},"expression":"${event.data.value}"},{"actionType":"ajax","args":{"api":{"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"data":{"query":"{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"},"adaptor":"\n const noPermission = [];\n payload.data.rows.forEach(function (row) {\n if(!row._permissions.allowEdit){\n noPermission.push(row._id);\n }\n })\n payload.data.noPermission = noPermission;\n return payload;\n "}},"expression":"${event.data.value}"},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"batchPermissionLoading":false}},"expression":"${event.data.value}"},{"actionType":"dialog","dialog":{"title":"记录权限","showCloseButton":false,"body":[{"type":"tpl","tpl":"当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"}],"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"\n const noPermission = event.data.noPermission;\n const crudComponent = event.context.scoped.getComponentById(\"".concat(options.crudId,"\");\n const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();\n noPermission.forEach(function (item) {\n crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));\n })\n ")},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"isBatchEdit":true}}}]},"cancel":{"actions":[{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"isBatchEdit":false}}}]}}},"expression":"${COUNT(event.data.noPermission)>0}"}]}}});}_context58.next=59;break;case 58:quickEditSchema=false;case 59://amis3.2以下禁用lookup的单元格编辑
195
+ {"actionType":"custom","script":"\n crudScoped = event.context.scoped.getComponentById('".concat(options.crudId,"');\n const selectedItems = crudScoped && crudScoped.control.getSelected();\n doAction({\n \"componentId\": \"").concat(quickEditId,"\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n selectedItems\n }\n }\n });\n ")},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions_loading":true}}},{"actionType":"ajax","args":{"api":{"url":"${context.rootUrl}/service/api/@\${objectName}/recordPermissions/${_id}","method":"get","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"cache":30000,"messages":{"failed":"失败了呢。。"}}},"expression":"${!recordPermissions.modifyAllRecords}"},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions_loading":false}}},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"quickedit_record_permissions":"${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"}}}]}}});if(field.type!='avatar'&&field.type!='image'&&field.type!='file'&&isAmisVersionforBatchEdit){quickEditSchema.body.push({"name":"isBatchEdit","type":"checkbox","option":[{"type":"tpl","tpl":"更新${COUNT(selectedItems)}个选定记录"},{"type":"spinner","showOn":"${batchPermissionLoading}","size":"sm","className":"mr-4"}],"visibleOn":"${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}","disabledOn":"${batchPermissionLoading}","onEvent":{"change":{"actions":[{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"batchPermissionLoading":true}},"expression":"${event.data.value}"},{"actionType":"ajax","args":{"api":{"url":"${context.rootUrl}/graphql","method":"post","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"},"data":{"query":"{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"},"adaptor":"\n const noPermission = [];\n payload.data.rows.forEach(function (row) {\n if(!row._permissions.allowEdit){\n noPermission.push(row._id);\n }\n })\n payload.data.noPermission = noPermission;\n return payload;\n "}},"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"batchPermissionLoading":false}},"expression":"${event.data.value}"},{"actionType":"dialog","dialog":{"title":"记录权限","showCloseButton":false,"body":[{"type":"tpl","tpl":"当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"}],"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"\n const noPermission = event.data.noPermission;\n const crudComponent = event.context.scoped.getComponentById(\"".concat(options.crudId,"\");\n let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();\n noPermission.forEach(function (item) {\n crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));\n _.remove(selectedItems, (selected) => selected._id === item);\n })\n doAction({\n \"componentId\": \"").concat(quickEditId,"\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n selectedItems\n }\n }\n });\n ")},{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"isBatchEdit":true}}}]},"cancel":{"actions":[{"actionType":"setValue","componentId":quickEditId,"args":{"value":{"isBatchEdit":false}}}]}}},"expression":"${COUNT(event.data.noPermission)>0}"}]}}});}_context58.next=59;break;case 58:quickEditSchema=false;case 59://amis3.2以下禁用lookup的单元格编辑
192
196
  if(field.type=="lookup"&&!isAmisVersionforBatchEdit){quickEditSchema=false;}//TODO:附件多选时会覆盖老数据,暂时禁用
193
197
  if(field.type=="file"&&field.multiple){quickEditSchema=false;}//TODO:location字段在列表中快速编辑后存在bug,保存时可能会丢失部分数据,暂时禁用
194
198
  if(field.type=="location"){quickEditSchema=false;}if(field.type=="color"){quickEditSchema={type:"input-color"};}case 63:return _context58.abrupt("return",quickEditSchema);case 64:case"end":return _context58.stop();}}},_callee58);}));return _getQuickEditSchema.apply(this,arguments);}function getFieldWidth(width){var defaultWidth=null;if(typeof width=='string'){if(isNaN(width)){return width||defaultWidth;}else{return Number(width)||defaultWidth;}}else if(typeof width=='number'){return width;}else{return defaultWidth;}}function getTableColumns$1(_x19,_x20){return _getTableColumns$.apply(this,arguments);}/**
@@ -208,22 +212,22 @@ if(field.type=="location"){quickEditSchema=false;}if(field.type=="color"){quickE
208
212
  "size": "none",
209
213
  "className": "flex items-center justify-between"//每行样式类
210
214
  }
211
- */function _getTableColumns$(){_getTableColumns$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(fields,options){var _options$permissions;var columns,allowEdit,_iterator6,_step7,field,quickEditSchema,className,columnItem,previewFileScript,map,_field$amis,_field$amis2,_field$amis3,tpl,type,href;return _regeneratorRuntime().wrap(function _callee59$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:columns=[];if(!options.isLookup&&!options.isInputTable){if(!options.enable_tree){columns.push({name:'_index',type:'text',width:32,placeholder:""});}}allowEdit=((_options$permissions=options.permissions)===null||_options$permissions===void 0?void 0:_options$permissions.allowEdit)&&!options.isLookup&&options.enable_inline_edit!=false;_iterator6=_createForOfIteratorHelper(fields);_context59.prev=4;_iterator6.s();case 6:if((_step7=_iterator6.n()).done){_context59.next=51;break;}field=_step7.value;if(!(field.hidden||field.extra)){_context59.next=10;break;}return _context59.abrupt("continue",49);case 10:if(!allowEdit){_context59.next=16;break;}_context59.next=13;return getQuickEditSchema(field,options);case 13:_context59.t0=_context59.sent;_context59.next=17;break;case 16:_context59.t0=allowEdit;case 17:quickEditSchema=_context59.t0;className="";if(/Safari/.test(navigator.userAgent)){className+=" whitespace-nowrap ";}else{if(field.wrap!=true){className+=" whitespace-nowrap ";}else{className+=" break-words ";}}columnItem=void 0;if(!((field.is_name||field.name===options.labelFieldName)&&options.objectName==='cms_files')){_context59.next=26;break;}previewFileScript="\n var data = event.data;\n var file_name = data.versions ? data.name : \"".concat(field.label,"\";\n var file_id = data._id;\n SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});\n ");columnItem={"type":"button","label":"<%=data.versions ? data.name : \"".concat(field.label,"\"%>"),className:className,"level":"link","onEvent":{"click":{"actions":[{"args":{"api":{"url":"${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}","method":"get","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"}}},"actionType":"download",// "expression": "!!!window?.nw?.require"//浏览器上直接下载
215
+ */function _getTableColumns$(){_getTableColumns$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(fields,options){var _options$permissions;var columns,allowEdit,_iterator6,_step7,_field$amis,_field$amis2,field,quickEditSchema,className,bowserType,fieldAmis,columnItem,previewFileScript,map,tpl,type,href;return _regeneratorRuntime().wrap(function _callee59$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:columns=[];if(!options.isLookup&&!options.isInputTable){if(!options.enable_tree){columns.push({name:'_index',type:'text',width:32,placeholder:""});}}allowEdit=((_options$permissions=options.permissions)===null||_options$permissions===void 0?void 0:_options$permissions.allowEdit)&&!options.isLookup&&options.enable_inline_edit!=false;_iterator6=_createForOfIteratorHelper(fields);_context59.prev=4;_iterator6.s();case 6:if((_step7=_iterator6.n()).done){_context59.next=53;break;}field=_step7.value;if(!(field.hidden||field.extra)){_context59.next=10;break;}return _context59.abrupt("continue",51);case 10:if(!allowEdit){_context59.next=16;break;}_context59.next=13;return getQuickEditSchema(field,options);case 13:_context59.t0=_context59.sent;_context59.next=17;break;case 16:_context59.t0=allowEdit;case 17:quickEditSchema=_context59.t0;className="";bowserType=getBowserType();if(bowserType==="Safari"){className+=" whitespace-nowrap ";}else{if(field.wrap!=true){className+=" whitespace-nowrap ";}else{className+=" break-words ";}}if(_typeof2((_field$amis=field.amis)===null||_field$amis===void 0?void 0:_field$amis.className)=="object"){className=_objectSpread2(_defineProperty2({},className,"true"),field.amis.className);}else if(typeof((_field$amis2=field.amis)===null||_field$amis2===void 0?void 0:_field$amis2.className)=="string"){className="".concat(className," ").concat(field.amis.className," ");}fieldAmis=_$1__namespace.clone(field.amis);fieldAmis===null||fieldAmis===void 0?true:delete fieldAmis.className;columnItem=void 0;if(!((field.is_name||field.name===options.labelFieldName)&&options.objectName==='cms_files')){_context59.next=30;break;}previewFileScript="\n var data = event.data;\n var file_name = data.versions ? data.name : \"".concat(field.label,"\";\n var file_id = data._id;\n SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});\n ");columnItem={"type":"button","label":"<%=data.versions ? data.name : \"".concat(field.label,"\"%>"),className:className,"level":"link","onEvent":{"click":{"actions":[{"args":{"api":{"url":"${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}","method":"get","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"}}},"actionType":"download",// "expression": "!!!window?.nw?.require"//浏览器上直接下载
212
216
  "expression":"!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
213
217
  },{"args":{},"actionType":"custom","script":previewFileScript,// "expression": "!!window?.nw?.require" //PC客户端预览附件
214
218
  "expression":"!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
215
- }]}}};_context59.next=48;break;case 26:if(!(field.type==='toggle')){_context59.next=30;break;}columnItem=Object.assign({},{type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},field.amis,{name:field.name});_context59.next=48;break;case 30:if(!(field.type==='avatar'||field.type==='image'||field.type==='file')){_context59.next=34;break;}columnItem=Object.assign({},_objectSpread2({type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},getAmisFileReadonlySchema(field)),field.amis,{name:field.name});_context59.next=48;break;case 34:if(!(field.type==='select')){_context59.next=39;break;}map=getSelectMap(field.options);columnItem=Object.assign({},{type:"static-mapping",name:field.name,label:field.label,map:map,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,inputClassName:"inline","static":true},field.amis,{name:field.name});_context59.next=48;break;case 39:_context59.next=41;return getFieldTpl(field,options);case 41:tpl=_context59.sent;type='static-text';if(tpl){type='static';}else if(field.type==='html'){type='static-markdown';}else if(field.type==='url'){if(field.show_as_qr){type='static-qr-code';}else{type='input-url';}}if(field.type==='textarea'){className+='min-w-56';}// if(field.type === 'date'){
219
+ }]}}};_context59.next=50;break;case 30:if(!(field.type==='toggle')){_context59.next=34;break;}columnItem=Object.assign({},{type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},fieldAmis,{name:field.name});_context59.next=50;break;case 34:if(!(field.type==='avatar'||field.type==='image'||field.type==='file')){_context59.next=38;break;}columnItem=Object.assign({},_objectSpread2({type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},getAmisFileReadonlySchema(field)),fieldAmis,{name:field.name});_context59.next=50;break;case 38:if(!(field.type==='select')){_context59.next=43;break;}map=getSelectMap(field.options);columnItem=Object.assign({},{type:"static-mapping",name:field.name,label:field.label,map:map,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,inputClassName:"inline","static":true},fieldAmis,{name:field.name});_context59.next=50;break;case 43:_context59.next=45;return getFieldTpl(field,options);case 45:tpl=_context59.sent;type='static-text';if(tpl){type='static';}else if(field.type==='html'){type='static-markdown';}else if(field.type==='url'){if(field.show_as_qr){type='static-qr-code';}else{type='input-url';}}if(field.type==='textarea'){className+='min-w-56';}// if(field.type === 'date'){
216
220
  // className += 'date-min-w';
217
221
  // }
218
222
  // if(field.type === 'datetime'){
219
223
  // className += 'datetime-min-w';
220
224
  // }
221
225
  //field上的amis属性里的clssname需要单独判断类型合并
222
- if(_typeof2((_field$amis=field.amis)===null||_field$amis===void 0?void 0:_field$amis.className)=="object"){className=_objectSpread2(_defineProperty2({},className,"true"),field.amis.className);}else if(typeof((_field$amis2=field.amis)===null||_field$amis2===void 0?void 0:_field$amis2.className)=="string"){className="".concat(className," ").concat(field.amis.className," ");}(_field$amis3=field.amis)===null||_field$amis3===void 0?true:delete _field$amis3.className;if(!field.hidden&&!field.extra){columnItem=Object.assign({},{name:field.name,label:field.label,sortable:field.sortable,// searchable: field.searchable,
226
+ if(!field.hidden&&!field.extra){columnItem=Object.assign({},{name:field.name,label:field.label,sortable:field.sortable,// searchable: field.searchable,
223
227
  width:getFieldWidth(field.width),type:type,tpl:tpl,toggled:field.toggled,className:className,inputClassName:"inline","static":true,options:field.type==='html'?{html:true}:null// toggled: true
224
- },field.amis,{name:field.name});if(field.type==='color'){columnItem.type='color';columnItem.defaultColor=null;}}case 48:if(columnItem){if(quickEditSchema){columnItem.quickEdit=quickEditSchema;columnItem.quickEditEnabledOn="${is_system !== true}";}columnItem.id="".concat(options.objectName,"_").concat(field.name,"_${_index}");columns.push(columnItem);}case 49:_context59.next=6;break;case 51:_context59.next=56;break;case 53:_context59.prev=53;_context59.t1=_context59["catch"](4);_iterator6.e(_context59.t1);case 56:_context59.prev=56;_iterator6.f();return _context59.finish(56);case 59:// columns.push(getOperation(fields));
228
+ },fieldAmis,{name:field.name});if(field.type==='color'){columnItem.type='color';columnItem.defaultColor=null;}}case 50:if(columnItem){if(quickEditSchema){columnItem.quickEdit=quickEditSchema;columnItem.quickEditEnabledOn="${is_system !== true}";}columnItem.id="".concat(options.objectName,"_").concat(field.name,"_${_index}");columns.push(columnItem);}case 51:_context59.next=6;break;case 53:_context59.next=58;break;case 55:_context59.prev=55;_context59.t1=_context59["catch"](4);_iterator6.e(_context59.t1);case 58:_context59.prev=58;_iterator6.f();return _context59.finish(58);case 61:// columns.push(getOperation(fields));
225
229
  if(!options.isLookup&&!options.isInputTable&&!_$1__namespace.some(columns,{name:options.labelFieldName})){// 没有名称字段时显示序号字段为链接,lookup弹出的picker不需要此功能
226
- href=Router$1.getObjectDetailPath(_objectSpread2(_objectSpread2({},options),{},{formFactor:options.formFactor,appId:"${appId}",objectName:options.objectName||"${objectName}",recordId:"${".concat(options.idFieldName,"}")}));columns[0].type="tpl";columns[0].tpl="<a href=\"".concat(href,"\">${").concat(columns[0].name,"}</a>");}return _context59.abrupt("return",columns);case 61:case"end":return _context59.stop();}}},_callee59,null,[[4,53,56,59]]);}));return _getTableColumns$.apply(this,arguments);}function getMobileLines(tpls){var lines=[];var maxLineCount=3;var lineChildren=[];var isNewLine=false;var isLeft=true;var lineChildrenClassName="";var lineClassName="flex items-center justify-between";tpls.forEach(function(item){var _item$field$amis,_item$field$amis2;if(isNewLine&&lines.length<maxLineCount){lines.push({"type":"wrapper","body":lineChildren,"size":"none","className":lineClassName});lineChildren=[];}if(isLeft){// 左侧半行
230
+ href=Router$1.getObjectDetailPath(_objectSpread2(_objectSpread2({},options),{},{formFactor:options.formFactor,appId:"${appId}",objectName:options.objectName||"${objectName}",recordId:"${".concat(options.idFieldName,"}")}));columns[0].type="tpl";columns[0].tpl="<a href=\"".concat(href,"\">${").concat(columns[0].name,"}</a>");}return _context59.abrupt("return",columns);case 63:case"end":return _context59.stop();}}},_callee59,null,[[4,55,58,61]]);}));return _getTableColumns$.apply(this,arguments);}function getMobileLines(tpls){var lines=[];var maxLineCount=3;var lineChildren=[];var isNewLine=false;var isLeft=true;var lineChildrenClassName="";var lineClassName="flex items-center justify-between";tpls.forEach(function(item){var _item$field$amis,_item$field$amis2;if(isNewLine&&lines.length<maxLineCount){lines.push({"type":"wrapper","body":lineChildren,"size":"none","className":lineClassName});lineChildren=[];}if(isLeft){// 左侧半行
227
231
  lineChildrenClassName="steedos-listview-item-left truncate h-5";if(item.field.is_wide){// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
228
232
  lineChildrenClassName="steedos-listview-item-wide";}if(lines.length===0){// 第一个字段加粗黑色显示
229
233
  lineChildrenClassName+=" font-bold text-gray-800";}}else{// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
@@ -624,12 +628,12 @@ recordPermissions:objectSchema.permissions,uiSchema:objectSchema// loaded: false
624
628
  });body=null;id="listview_".concat(objectSchema.name);if(!(options.formFactor==='SMALL'&&false)){_context84.next=42;break;}delete bodyProps.bulkActions;delete bodyProps.headerToolbar;delete bodyProps.footerToolbar;_context84.next=27;return getCardSchema(fields,Object.assign({idFieldName:objectSchema.idFieldName,labelFieldName:objectSchema.NAME_FIELD_KEY||'name'},options,{actions:false}));case 27:card=_context84.sent;_context84.t3=Object;_context84.t4={};_context84.t5=card;_context84.t6=id;_context84.t7=id;_context84.next=35;return getTableApi(objectSchema,fields,options);case 35:_context84.t8=_context84.sent;_context84.t9=options.tableHiddenOn;_context84.t10={type:'crud',primaryField:'_id',id:_context84.t6,name:_context84.t7,keepItemSelectionOnPageChange:false,api:_context84.t8,hiddenOn:_context84.t9};_context84.t11=bodyProps;body=_context84.t3.assign.call(_context84.t3,_context84.t4,_context84.t5,_context84.t10,_context84.t11);_context84.next=71;break;case 42:labelFieldName=objectSchema.NAME_FIELD_KEY||'name';// organizations 对象的历史遗留问题, fullname 被标记为了 名称字段. 在此处特殊处理.
625
629
  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||{},{});_context84.next=48;return getTableSchema$1(fields,tableOptions);case 48:table=_context84.sent;// delete table.mode;
626
630
  //image与avatar需要在提交修改时特别处理
627
- imageNames=_$1__default["default"].compact(_$1__default["default"].map(_$1__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 ");autoFillHeight=true;if(options.isRelated||window.innerWidth<768){autoFillHeight=false;}_context84.t12=Object;_context84.t13={};_context84.t14=table;_context84.t15=id;_context84.t16=id;_context84.next=60;return getTableApi(objectSchema,fields,options);case 60:_context84.t17=_context84.sent;_context84.t18=options.tableHiddenOn;_context84.t19=autoFillHeight;_context84.t20="flex-auto ".concat(crudClassName||"");_context84.t21={"mb-0":true,"is-steedos-crud-data-empty":"${!items || COUNT(items) == 0}"};_context84.t22=crudClassName;_context84.t23={url:"${context.rootUrl}/graphql",method:"post",dataType:"json",headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"},requestAdaptor:quickSaveApiRequestAdaptor,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 return payload;\n "};_context84.t24=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 %>";_context84.t25={type:'crud',primaryField:'_id',affixHeader:false,id:_context84.t15,name:_context84.t16,keepItemSelectionOnPageChange:true,api:_context84.t17,hiddenOn:_context84.t18,autoFillHeight:_context84.t19,className:_context84.t20,bodyClassName:_context84.t21,crudClassName:_context84.t22,quickSaveApi:_context84.t23,rowClassNameExpr:_context84.t24};_context84.t26=bodyProps;body=_context84.t12.assign.call(_context84.t12,_context84.t13,_context84.t14,_context84.t25,_context84.t26);case 71:body=defaultsDeep({},listSchema,body);_context84.next=74;return getCrudSchemaWithDataFilter(body,{crudDataFilter:crudDataFilter,onCrudDataFilter:onCrudDataFilter,amisData:amisData,env:env});case 74:body=_context84.sent;crudModeClassName="";if(body.mode){crudModeClassName="steedos-crud-mode-".concat(body.mode);}if(body.columns&&options.formFactor!='SMALL'){//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
631
+ imageNames=_$1__default["default"].compact(_$1__default["default"].map(_$1__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 ");autoFillHeight=true;if(options.isRelated||window.innerWidth<768){autoFillHeight=false;}_context84.t12=Object;_context84.t13={};_context84.t14=table;_context84.t15=id;_context84.t16=id;_context84.next=60;return getTableApi(objectSchema,fields,options);case 60:_context84.t17=_context84.sent;_context84.t18=options.tableHiddenOn;_context84.t19=autoFillHeight;_context84.t20="flex-auto ".concat(crudClassName||"");_context84.t21={"mb-0":true,"is-steedos-crud-data-empty":"${!items || COUNT(items) == 0}"};_context84.t22=crudClassName;_context84.t23={url:"${context.rootUrl}/graphql",method:"post",dataType:"json",headers:{Authorization:"Bearer ${context.tenantId},${context.authToken}"},requestAdaptor:quickSaveApiRequestAdaptor};_context84.t24=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 %>";_context84.t25={type:'crud',primaryField:'_id',affixHeader:false,id:_context84.t15,name:_context84.t16,keepItemSelectionOnPageChange:true,api:_context84.t17,hiddenOn:_context84.t18,autoFillHeight:_context84.t19,className:_context84.t20,bodyClassName:_context84.t21,crudClassName:_context84.t22,quickSaveApi:_context84.t23,rowClassNameExpr:_context84.t24};_context84.t26=bodyProps;body=_context84.t12.assign.call(_context84.t12,_context84.t13,_context84.t14,_context84.t25,_context84.t26);case 71:body=defaultsDeep({},listSchema,body);_context84.next=74;return getCrudSchemaWithDataFilter(body,{crudDataFilter:crudDataFilter,onCrudDataFilter:onCrudDataFilter,amisData:amisData,env:env});case 74:body=_context84.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 debugger;\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,用于批量编辑
628
632
  body.columns.splice(body.columns.length-1,0,{name:'_display',type:'static',width:1,placeholder:"",id:objectSchema.name+"_display_${_index}",tpl:"${''}"});}if(defaults){headerSchema=defaults.headerSchema;footerSchema=defaults.footerSchema;if(headerSchema||footerSchema){wrappedBody=[body];if(headerSchema){if(_$1__default["default"].isArray(headerSchema)){wrappedBody=_$1__default["default"].union(headerSchema,wrappedBody);}else{wrappedBody.unshift(headerSchema);}}if(footerSchema){if(_$1__default["default"].isArray(footerSchema)){wrappedBody=_$1__default["default"].union(wrappedBody,footerSchema);}else{wrappedBody.push(footerSchema);}}body=wrappedBody;}}// console.timeEnd('getObjectCRUD');
629
633
  // TODO: data应该只留loaded,其他属性都改为从上层传递下来
630
634
  return _context84.abrupt("return",{type:'service',className:crudModeClassName,//目前crud的service层id不认用户自定义id,只支持默认规则id,许多地方的格式都写死了service_listview_${objectname}
631
635
  id:"service_".concat(id),name:"page",data:options.amisData,body:body,//监听广播事件,重算crud高度
632
- onEvent:_defineProperty2({},"@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 80:case"end":return _context84.stop();}}},_callee84);}));return _getObjectCRUD.apply(this,arguments);}var getFormFields$1=function getFormFields$1(objectSchema,formProps){/**
636
+ onEvent:_defineProperty2({},"@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 81:case"end":return _context84.stop();}}},_callee84);}));return _getObjectCRUD.apply(this,arguments);}var getFormFields$1=function getFormFields$1(objectSchema,formProps){/**
633
637
  * fieldsExtend: 重写字段定义
634
638
  * fields: 包含的字段
635
639
  * excludedFields: 排除的字段
@@ -995,7 +999,7 @@ sectionFieldsVisibleOn=_$1__namespace.map(_$1__namespace.compact(_$1__namespace.
995
999
  * @Author: 殷亮辉 yinlianghui@hotoa.com
996
1000
  * @Date: 2023-11-15 09:50:22
997
1001
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
998
- * @LastEditTime: 2024-01-24 14:56:03
1002
+ * @LastEditTime: 2024-01-25 14:11:50
999
1003
  */function getTablePrimaryKey(props){return props.primaryKey||"_id";}/**
1000
1004
  * 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
1001
1005
  * @param {*} value 子表组件字段值,数组
@@ -1027,7 +1031,8 @@ var newItemValue=_$1.clone(itemValue);if(newItemValue.children){newItemValue.chi
1027
1031
  newItem.name=newItem.name.replace(new RegExp("^".concat(fieldPrefix)),"");return newItem;});}/**
1028
1032
  * @param {*} props
1029
1033
  * @param {*} mode edit/new/readonly
1030
- */function getFormFields(props){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"edit";var fieldPrefix=props.fieldPrefix;var fields=props.fields||[];if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}return(fields||[]).map(function(item){var formItem={"type":"steedos-field","name":item.name,"config":item};if(mode==="readonly"){formItem["static"]=true;}return formItem;})||[];}function getInputTableCell(field,showAsInlineEditMode){if(showAsInlineEditMode){return{label:field.label,name:field.name,quickEdit:{"type":"steedos-field","mode":"inline","config":Object.assign({},field,{label:false})}};}else{return{"type":"steedos-field","config":Object.assign({},field,{label:false}),inInputTable:true,"static":true,"readonly":true,label:field.label,name:field.name};}}function getComponentId(name,tag){var id="";switch(name){case"table_service":id="service_wrapper__".concat(tag);break;case"form_pagination":id="service_popup_pagination_wrapper__".concat(tag);break;case"form":id="form_popup__".concat(tag);break;case"dialog":id="dialog_popup__".concat(tag);break;default:id="".concat(name,"__").concat(tag);break;}return id;}/**
1034
+ */function getFormFields(props){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"edit";var fieldPrefix=props.fieldPrefix;var fields=props.fields||[];if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}return(fields||[]).map(function(item){var formItem={"type":"steedos-field","name":item.name,"config":item};if(mode==="readonly"){formItem["static"]=true;}return formItem;})||[];}function getInputTableCell(field,showAsInlineEditMode){if(showAsInlineEditMode){return{label:field.label,name:field.name,quickEdit:{"type":"steedos-field","mode":"inline","config":Object.assign({},field,{label:false})}};}else{// 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
1035
+ return{"type":"service",label:field.label,name:field.name,"body":[{"type":"steedos-field","config":Object.assign({},field,{label:false}),inInputTable:true,"static":true,"readonly":true}]};}}function getComponentId(name,tag){var id="";switch(name){case"table_service":id="service_wrapper__".concat(tag);break;case"form_pagination":id="service_popup_pagination_wrapper__".concat(tag);break;case"form":id="form_popup__".concat(tag);break;case"dialog":id="dialog_popup__".concat(tag);break;default:id="".concat(name,"__").concat(tag);break;}return id;}/**
1031
1036
  * @param {*} props
1032
1037
  * @param {*} mode edit/new/readonly
1033
1038
  */function getInputTableColumns(_x218){return _getInputTableColumns.apply(this,arguments);}/**
@@ -1252,7 +1257,11 @@ value=getTableValueWithPrimaryKeyValue(value,primaryKey);}else{// 默认情况
1252
1257
  // 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
1253
1258
  // 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
1254
1259
  // 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
1255
- value=getTableValueWithoutPrimaryKeyValue(value,primaryKey);}if(amis.pipeOut){if(typeof amis.pipeOut==='function'){return amis.pipeOut(value,data);}}return value;};inputTableSchema={"type":"input-table","mode":"normal","name":_context19.t0,"draggable":_context19.t1,"showIndex":_context19.t2,"perPage":_context19.t3,"id":_context19.t4,"columns":_context19.t5,"strictMode":_context19.t6,"showTableAddBtn":false,"showFooterAddBtn":false,"className":_context19.t7,"pipeIn":_context19.t8,"pipeOut":_context19.t9};if(buttonsForColumnOperations.length){inputTableSchema.columns.push({"name":"__op__","type":"operation","buttons":buttonsForColumnOperations,"width":buttonsForColumnOperations.length>1?"60px":"20px"});}if(amis){// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
1260
+ value=getTableValueWithoutPrimaryKeyValue(value,primaryKey);}if(amis.pipeOut){if(typeof amis.pipeOut==='function'){return amis.pipeOut(value,data);}}return value;};inputTableSchema={"type":"input-table","mode":"normal","name":_context19.t0,"draggable":_context19.t1,"showIndex":_context19.t2,"perPage":_context19.t3,"id":_context19.t4,"columns":_context19.t5,"strictMode":_context19.t6,"showTableAddBtn":false,"showFooterAddBtn":false,"className":_context19.t7,"pipeIn":_context19.t8,"pipeOut":_context19.t9};if(buttonsForColumnOperations.length){inputTableSchema.columns.push({"name":"__op__","type":"operation","buttons":buttonsForColumnOperations,"width":buttonsForColumnOperations.length>1?"60px":"20px"});}// if (showAsInlineEditMode) {
1261
+ // // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
1262
+ // inputTableSchema.needConfirm = false;
1263
+ // }
1264
+ if(amis){// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
1256
1265
  delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
1257
1266
  delete amis.pipeIn;//该属性在上面合并过了
1258
1267
  delete amis.pipeOut;//该属性在上面合并过了