@steedos-widgets/amis-lib 3.6.4-beta.5 → 3.6.4-beta.6
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 +11 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -134,10 +134,10 @@ width:getFieldWidth(field.width),type:type,tpl:tpl,toggled:field.toggled,classNa
|
|
|
134
134
|
}};if(!(field.is_name||field.name===options.labelFieldName)){drawerRecordDetailSchema.objectApiName=field.reference_to;drawerRecordDetailSchema.recordId="${_display.".concat(field.name,".value}");}columnItem.onEvent={"click":{"actions":[{"actionType":"drawer","drawer":{"type":"drawer","title":" ","headerClassName":"hidden","size":"lg","bodyClassName":"p-0 m-0","closeOnEsc":true,"closeOnOutside":true,"resizable":true,"actions":[],"body":[drawerRecordDetailSchema],"className":"steedos-record-detail-drawer app-popover","id":"u:fc5f055afa8c"},"preventDefault":true}]}};}}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:_context56.next=6;break;case 53:_context56.next=58;break;case 55:_context56.prev=55;_context56.t1=_context56["catch"](4);_iterator6.e(_context56.t1);case 58:_context56.prev=58;_iterator6.f();return _context56.finish(58);case 61:// columns.push(getOperation(fields));
|
|
135
135
|
if(!options.isLookup&&!options.isInputTable&&!___namespace.some(columns,{name:options.labelFieldName})){// 没有名称字段时显示序号字段为链接,lookup弹出的picker不需要此功能
|
|
136
136
|
href=Router.getObjectDetailPath(_objectSpread(_objectSpread({},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 _context56.abrupt("return",columns);case 63:case"end":return _context56.stop();}}},_callee56,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 mb-1";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){// 左侧半行
|
|
137
|
-
lineChildrenClassName="steedos-listview-item-left truncate
|
|
137
|
+
lineChildrenClassName="steedos-listview-item-left truncate";if(item.field.is_wide){// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
138
138
|
lineChildrenClassName="steedos-listview-item-wide";}if(lines.length===0){// 第一个字段加粗黑色显示
|
|
139
139
|
lineChildrenClassName+=" font-bold text-gray-800";}}else{// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
140
|
-
lineChildrenClassName="steedos-listview-item-right truncate ml-2 flex flex-shrink-0
|
|
140
|
+
lineChildrenClassName="steedos-listview-item-right truncate ml-2 flex flex-shrink-0";}//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
141
141
|
var className;if(_typeof((_item$field$amis=item.field.amis)===null||_item$field$amis===void 0?void 0:_item$field$amis.className)=="object"){className=_objectSpread(_defineProperty({},lineChildrenClassName,"true"),item.field.amis.className);}else if(typeof((_item$field$amis2=item.field.amis)===null||_item$field$amis2===void 0?void 0:_item$field$amis2.className)=="string"){className="".concat(lineChildrenClassName," ").concat(item.field.amis.className," ");}else{className=lineChildrenClassName;}lineChildren.push({"type":"tpl","tpl":item.tpl,className:className});if(item.field.is_wide){// 宽字段占整行
|
|
142
142
|
isLeft=true;isNewLine=true;}else{isLeft=!isLeft;isNewLine=isLeft;}});if(lineChildren.length&&lines.length<maxLineCount){lines.push({"type":"wrapper","body":lineChildren,"size":"none","className":lineClassName});}return lines;}function getMobileTableColumns(_x23,_x24){return _getMobileTableColumns.apply(this,arguments);}function _getMobileTableColumns(){_getMobileTableColumns=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(fields,options){var columns,nameField,tpls,_iterator7,_step8,field,tpl,url,columnLines,column,_window$Meteor2;return _regeneratorRuntime().wrap(function _callee57$(_context57){while(1){switch(_context57.prev=_context57.next){case 0:columns=[];nameField={};tpls=[];_iterator7=_createForOfIteratorHelper(fields);_context57.prev=4;_iterator7.s();case 6:if((_step8=_iterator7.n()).done){_context57.next=29;break;}field=_step8.value;tpl="";if(!(field.is_name||field.name===options.labelFieldName)){_context57.next=17;break;}nameField=field;options=Object.assign({},options,{onlyDisplayLookLabel:true});_context57.next=14;return getFieldTpl(field,options);case 14:tpl=_context57.sent;_context57.next=25;break;case 17:if(!(field.type==='avatar'||field.type==='image'||field.type==='file')){_context57.next=21;break;}// 图片和附件类型字段暂时显示为附件名称,后续需要再优化
|
|
143
143
|
tpl="${_display.".concat(field.name,".name}");_context57.next=25;break;case 21:if(field.type==='lookup'||field.type==='master_detail'){options=Object.assign({},options,{onlyDisplayLookLabel:true});}_context57.next=24;return getFieldTpl(field,options);case 24:tpl=_context57.sent;case 25:if(!tpl){tpl="${".concat(field.name,"}");}if(!field.hidden&&!field.extra){tpls.push({field:field,tpl:tpl});}case 27:_context57.next=6;break;case 29:_context57.next=34;break;case 31:_context57.prev=31;_context57.t0=_context57["catch"](4);_iterator7.e(_context57.t0);case 34:_context57.prev=34;_iterator7.f();return _context57.finish(34);case 37:url=getNameTplUrl(nameField,options);columnLines=getMobileLines(tpls);column={name:nameField.name,label:options.displayAs=='split'?'':nameField.label,sortable:nameField.sortable,type:"button",level:"link",actionType:"link",link:url,innerClassName:{"steedos-listview-item block text-gray-500":"true","max-w-[360px]":"${display == 'split'}"},body:{"type":"wrapper","body":columnLines,"size":"none","className":"p-1"}};if(options.objectName==='cms_files'){if((_window$Meteor2=window.Meteor)!==null&&_window$Meteor2!==void 0&&_window$Meteor2.isCordova){column=_objectSpread(_objectSpread({},column),{},{actionType:"",link:"",onEvent:{"click":{"actions":[{"script":"\n let cms_url = '';\n let value = event.data.versions[0];\n if(value){\n if(value.url){\n cms_url = value.url;\n }else{\n cms_url = Steedos.absoluteUrl(\"/api/files/files/\"+value+\"?download=true\");\n }\n }\n Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);\n ","actionType":"custom"}],"weight":0}}});}else{column=_objectSpread(_objectSpread({},column),{},{actionType:"",link:"",onEvent:{"click":{"actions":[{"args":{"api":{"url":url,"method":"get","headers":{"Authorization":"Bearer ${context.tenantId},${context.authToken}"}}},"actionType":"download"}],"weight":0}}});}}columns.push(column);return _context57.abrupt("return",columns);case 43:case"end":return _context57.stop();}}},_callee57,null,[[4,31,34,37]]);}));return _getMobileTableColumns.apply(this,arguments);}function getDefaultParams$1(options){return{perPage:options.top||options.perPage||config.listView.perPage};}function getButtonVisibleOn$1(button){var visible=button.visible;if(button._visible){visible=button._visible;}if(_$1.isBoolean(visible)){visible=visible.toString();}if(visible){// if(visible.indexOf("Meteor.") > 0 || visible.indexOf("Creator.") > 0 || visible.indexOf("Session.") > 0){
|
|
@@ -417,7 +417,7 @@ _ref55=options||{},_ref55$showRecordTitl=_ref55.showRecordTitle,showRecordTitle=
|
|
|
417
417
|
name=objectSchema.name,label=objectSchema.label,icon=objectSchema.icon,NAME_FIELD_KEY=objectSchema.NAME_FIELD_KEY;amisButtonsSchema=[];if(options.showButtons!=false){amisButtonsSchema=getObjectDetailButtonsSchemas(objectSchema,recordId,options);}amisButtonsSchema.push({"type":"button","visibleOn":"${_inDrawer === true || _inRecordMini === true}","className":"ant-dropdown-trigger slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small slds-icon ml-1 flex","onEvent":{"click":{"actions":[{"actionType":"custom","script":"const data = event.data; window.open(`/app/${data.app_id}/${data.objectName}/view/${data.recordId}?side_object=${data.side_object}&side_listview_id=${data.side_listview_id}`)"}]}},"body":[{"type":"steedos-icon","category":"utility","name":"new_window","colorVariant":"default","className":"slds-button_icon slds-global-header__icon w-4"}]});backButtonsSchema=null;if(options.showBackButton!=false){backButtonsSchema=getBackButtonSchema();}// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
418
418
|
reg=new RegExp('_','g');standardIcon=icon&&icon.replace(reg,'-');gridBody=[];if(showRecordTitle){gridBody.push({"body":[{"type":"grid","columns":[{"body":[backButtonsSchema,{"type":"button","visibleOn":"${_inDrawer === true}","className":"flex mr-4","onEvent":{"click":{"actions":[{"componentId":"","args":{},"actionType":"closeDrawer"}]}},"body":[{"type":"steedos-icon","category":"utility","name":"close","colorVariant":"default","className":"slds-button_icon slds-global-header__icon w-4"}]},{"type":"tpl","className":"block",// "tpl": `<img class='slds-icon slds-icon_container slds-icon-standard-${standardIcon}' src='\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg'>`
|
|
419
419
|
"tpl":"<svg class=\"slds-icon slds-icon_container slds-icon-standard-".concat(standardIcon," slds-page-header__icon\" aria-hidden=\"true\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#").concat(icon,"\"></use></svg>")}],"md":"auto","className":"","columnClassName":"flex justify-center items-center"},{"body":[{"type":"tpl","tpl":"".concat(label),"inline":false,"wrapperComponent":"","className":"leading-4 text-md"},{"type":"tpl","tpl":"${NAME_FIELD_VALUE}","inline":false,"wrapperComponent":"","className":"record-detail-header-name leading-5 text-xl font-bold"}],"columnClassName":"p-l-xs"}],"className":"flex justify-between"}],"columnClassName":"flex-initial","md":"auto"});}gridBody.push({"body":{"type":"flex","items":amisButtonsSchema},"md":"auto"// "hiddenOn": "${recordLoaded != true}"
|
|
420
|
-
});body=[{"type":"wrapper","className":"p-4 border-b","body":[{"type":"grid","columns":gridBody,"className":"flex justify-between flex-nowrap"}],"hiddenOn":"${recordLoaded != true}"}];if(showRecordTitle){body.push({"type":"wrapper","className":"p-4","body":[{"type":"grid","columns":[gridBody[0]],"className":"flex justify-between"}],"hiddenOn":"${recordLoaded == true}"});}max=10;if(options.formFactor==='SMALL'){max=4;}else{divWidth=window.innerWidth;if(options.display==='split'){divWidth=divWidth-388;}if(document.body.classList.contains('sidebar')){divWidth=divWidth-210;}// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
420
|
+
});body=[{"type":"wrapper","className":"p-4 border-b","body":[{"type":"grid","columns":gridBody,"className":"flex justify-between flex-nowrap"}],"hiddenOn":"${recordLoaded != true}"}];if(showRecordTitle){body.push({"type":"wrapper","className":"p-4","body":[{"type":"grid","columns":[gridBody[0]],"className":"flex justify-between"}],"hiddenOn":"${recordLoaded == true}"});}max=10;if(options.formFactor==='SMALL'){max=4;}else{divWidth=window.innerWidth;if(options.display==='split'){divWidth=divWidth-388;}if(document.body.classList.contains('sidebar')){divWidth=divWidth-210;}if(options._inDrawer){try{divWidth=new Number($("html").css("font-size").replace('px',''))*60;}catch(error){console.error(error);divWidth=16*60;}}// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
421
421
|
max=Math.trunc(divWidth/200);if(max>10){max=10;}}// console.log('=======================max=========================', max)
|
|
422
422
|
if(objectSchema.compactLayouts){details=[];_.each(_.slice(_.difference(objectSchema.compactLayouts,[objectSchema.NAME_FIELD_KEY]),0,max),function(fieldName){var field=objectSchema.fields[fieldName];if(field){details.push({type:'steedos-field',"static":true,config:field});}});// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
423
423
|
// lg:grid-cols-1
|