@steedos-widgets/amis-lib 3.6.4-beta.7 → 3.6.4-beta.8
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 +22 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +22 -41
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +25 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -946,8 +946,8 @@ sectionFieldsVisibleOn=___namespace.map(___namespace.compact(___namespace.map(fi
|
|
|
946
946
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
947
947
|
* @Date: 2023-11-15 09:50:22
|
|
948
948
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
949
|
-
* @LastEditTime: 2024-02
|
|
950
|
-
*/
|
|
949
|
+
* @LastEditTime: 2024-03-02 16:07:17
|
|
950
|
+
*/ /**
|
|
951
951
|
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
952
952
|
* amis #9520修正后此函数及相关代码可以移除
|
|
953
953
|
* @param {*} value 子表组件字段值,数组
|
|
@@ -999,10 +999,26 @@ newItem.name=newItem.name.replace(new RegExp("^".concat(fieldPrefix)),"");return
|
|
|
999
999
|
* @param {*} fields 子表组件字段集合,数组
|
|
1000
1000
|
* @param {*} fieldPrefix 字段前缀
|
|
1001
1001
|
* @returns 转换后的子表组件字段值
|
|
1002
|
-
*/function getTableFieldsPrependFieldPrefix(fields,
|
|
1002
|
+
*/ // function getTableFieldsPrependFieldPrefix(fields, fieldPrefix) {
|
|
1003
|
+
// return (fields || []).map((item) => {
|
|
1004
|
+
// const newItem = clone(item);
|
|
1005
|
+
// newItem.name = `${fieldPrefix}${item.name}`;
|
|
1006
|
+
// newItem.__originalName = item.name;
|
|
1007
|
+
// return newItem;
|
|
1008
|
+
// });
|
|
1009
|
+
// }
|
|
1010
|
+
/**
|
|
1003
1011
|
* @param {*} props
|
|
1004
1012
|
* @param {*} mode edit/new/readonly
|
|
1005
|
-
*/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);}
|
|
1013
|
+
*/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){// 这里不可以用quickEdit,因为amis存在bug:input-table内的字段在行编辑模式时会受到外层相同name的字段的影响 https://github.com/baidu/amis/issues/9653
|
|
1014
|
+
return{"type":"steedos-field","config":Object.assign({},field,{label:false}),// quickEdit: {
|
|
1015
|
+
// "type": "steedos-field",
|
|
1016
|
+
// "mode": "inline",
|
|
1017
|
+
// "config": Object.assign({}, field, {
|
|
1018
|
+
// label: false
|
|
1019
|
+
// })
|
|
1020
|
+
// },
|
|
1021
|
+
label:field.label,name:field.name};}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;}/**
|
|
1006
1022
|
* @param {*} props
|
|
1007
1023
|
* @param {*} mode edit/new/readonly
|
|
1008
1024
|
*/function getInputTableColumns(_x223,_x224){return _getInputTableColumns.apply(this,arguments);}/**
|
|
@@ -1010,7 +1026,7 @@ newItem.name=newItem.name.replace(new RegExp("^".concat(fieldPrefix)),"");return
|
|
|
1010
1026
|
* @param {*} mode edit/new/readonly
|
|
1011
1027
|
* @returns 翻页组件
|
|
1012
1028
|
*/function _getInputTableColumns(){_getInputTableColumns=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee120(props,buttonsForColumnOperations){var columns,inlineEditMode,showAsInlineEditMode,fieldPrefix,fields,popOverContainerSelector,popOverContainer,classList;return _regeneratorRuntime().wrap(function _callee120$(_context120){while(1){switch(_context120.prev=_context120.next){case 0:columns=props.columns||[];inlineEditMode=props.inlineEditMode;showAsInlineEditMode=inlineEditMode&&props.editable;// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
1013
|
-
fieldPrefix=props.fieldPrefix;fields=_$1.cloneDeep(props.fields||[]);if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}
|
|
1029
|
+
fieldPrefix=props.fieldPrefix;fields=_$1.cloneDeep(props.fields||[]);if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}if(inlineEditMode==true){popOverContainerSelector="";popOverContainer=props.popOverContainer&&props.popOverContainer();//获取到当前input-table所处的popOverContainer(可能是modal-dialog中),
|
|
1014
1030
|
//给所有的下拉框字段配置popOverContainerSelector,使下拉框组件的弹出框挂载到当前dialog上,防止被dialog遮挡
|
|
1015
1031
|
if(popOverContainer){classList=Array.prototype.slice.call(popOverContainer.parentElement.classList);if(classList.includes('amis-dialog-widget')){popOverContainerSelector='.'+classList.join('.')+' .antd-Modal-content';}}fields.forEach(function(field){//lookup存在下拉框模式;弹出模式用的是picker组件,不认popOverContainerSelector属性,所以统一加上
|
|
1016
1032
|
if(field.type=="select"||field.type=="lookup"){field.amis=_objectSpread(_objectSpread({},field.amis),{},{popOverContainerSelector:popOverContainerSelector});}});}if(!(columns&&columns.length)){_context120.next=11;break;}return _context120.abrupt("return",columns.map(function(column,index){var field,extendColumnProps={};if(typeof column==="string"){// 如果字符串,则取出要显示的列配置
|
|
@@ -1034,7 +1050,7 @@ showPagination=false;}var buttonPrevId=getComponentId("button_prev",props.id);va
|
|
|
1034
1050
|
*/function getFormPaginationWrapper(props,form,mode){// console.log("==getFormPaginationWrapper===", props, mode);
|
|
1035
1051
|
var serviceId=getComponentId("form_pagination",props.id);var tableServiceId=getComponentId("table_service",props.id);var primaryKey=getTablePrimaryKey(props);var innerForm=Object.assign({},form,{"data":{// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
1036
1052
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
1037
|
-
"&":"${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"}});var formBody=[{"type":"wrapper","size":"none","className":"flex justify-end sticky top-0 right-0 left-0 z-20 bg-white","body":[getFormPagination(props,mode)]},{"type":"service","body":[innerForm],"data":{"&":"${__parentForm}"}}];var onServiceInitedScript="\n // \u4EE5\u4E0B\u811A\u672C\u89E3\u51B3\u4E86\u6709\u65F6\u5F39\u51FA\u7F16\u8F91\u8868\u5355\u65F6\uFF0C\u8868\u5355\u4E2D\u7684\u503C\u6BD4\u6700\u540E\u4E00\u6B21\u7F16\u8F91\u4FDD\u5B58\u7684\u503C\u4F1A\u5EF6\u8FDF\u4E00\u62CD\u3002\n // \u6BD4\u5982\uFF1AinlineEditMode\u6A21\u5F0F\u65F6\uFF0C\u7528\u6237\u5728\u8868\u683C\u5355\u5143\u683C\u4E2D\u76F4\u63A5\u4FEE\u6539\u6570\u636E\uFF0C\u7136\u540E\u5F39\u51FA\u7684\u8868\u5355form\u4E2D\u5E76\u6CA1\u6709\u5305\u542B\u5355\u5143\u683C\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\n // \u53E6\u5916\u6709\u7684\u5730\u65B9\u5728\u975EinlineEditMode\u6A21\u5F0F\u65F6\u4E5F\u4F1A\u6709\u8FD9\u79CD\u5EF6\u8FDF\u4E00\u62CD\u95EE\u9898\uFF0C\u6BD4\u5982\u5BF9\u8C61\u5B57\u6BB5\u4E2D\u4E0B\u62C9\u6846\u7C7B\u578B\u5B57\u6BB5\u7684\u201D\u9009\u62E9\u9879\u201C\u5C5E\u6027\n // \u518D\u6BD4\u5982\u5DE5\u4F5C\u6D41\u89C4\u5219\u8BE6\u7EC6\u9875\u9762\u4FEE\u6539\u4E86\u5B50\u8868\u5B57\u6BB5\u201D\u65F6\u95F4\u89E6\u53D1\u5668\u201C\u503C\u540E\uFF0C\u5728\u53EA\u8BFB\u754C\u9762\u70B9\u51FB\u67E5\u770B\u6309\u94AE\u5F39\u51FA\u7684\u8868\u5355\u4E2D__tableItems\u503C\u662F\u4FEE\u6539\u524D\u7684\u503C\n // \u5904\u7406\u601D\u8DEF\u662F\u6BCF\u6B21\u5F39\u51FAform\u4E4B\u524D\u5148\u628A\u5176__tableItems\u540C\u6B65\u66F4\u65B0\u4E3A\u6700\u65B0\u503C\uFF0C\u8FD9\u6837\u5C31\u80FD\u5728\u5F39\u51FAform\u4E2D\u5305\u542B\u5355\u5143\u683C\u4E2D\u505A\u7684\u4FEE\u6539\n // \u6CE8\u610F\uFF1Aservice init\u4E8B\u4EF6\u53EA\u4F1A\u5728\u6BCF\u6B21\u5F39\u51FA\u7A97\u53E3\u65F6\u624D\u6267\u884C\uFF0C\u5728\u89E6\u53D1\u7FFB\u9875\u65F6\u5E76\u4E0D\u4F1A\u89E6\u53D1service init\u4E8B\u4EF6\n let scope = event.context.scoped;\n let __wrapperServiceId = \"".concat(tableServiceId,"\";\n let wrapperService = scope.getComponentById(__wrapperServiceId);\n let wrapperServiceData = wrapperService.getData();\n // \u8FD9\u91CC\u4E0D\u53EF\u4EE5\u7528event.data[\"").concat(props.name,"\"]\u56E0\u4E3Aamis input talbe\u6709\u4E00\u5C42\u5355\u72EC\u7684\u4F5C\u7528\u57DF\uFF0C\u5176\u503C\u4F1A\u5EF6\u8FDF\u4E00\u62CD\n // \u8FD9\u91CC\u5982\u679C\u4E0D.clone\u7684\u8BDD\uFF0C\u5728\u5F39\u51FA\u7A97\u53E3\u4E2D\u663E\u793A\u7684\u5B50\u8868\u7EC4\u4EF6\uFF0C\u6DFB\u52A0\u884C\u540E\u70B9\u7A97\u53E3\u7684\u53D6\u6D88\u6309\u94AE\u5173\u95ED\u7A97\u53E3\u540E\u65E0\u6CD5\u628A\u4E4B\u524D\u7684\u64CD\u4F5C\u8FD8\u539F\uFF0C\u5373\u628A\u4E4B\u524D\u6DFB\u52A0\u7684\u884C\u81EA\u52A8\u79FB\u9664\n let lastestFieldValue = _.clone(wrapperServiceData[\"").concat(props.name,"\"] || []);\n let fieldPrefix = \"").concat(props.fieldPrefix||'',"\";\n if(fieldPrefix){\n let getTableValueWithoutFieldPrefix = new Function('v', 'f', \"return (\" + ").concat(getTableValueWithoutFieldPrefix.toString()," + \")(v, f)\");\n lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);\n }\n
|
|
1053
|
+
"&":"${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"}});var formBody=[{"type":"wrapper","size":"none","className":"flex justify-end sticky top-0 right-0 left-0 z-20 bg-white","body":[getFormPagination(props,mode)]},{"type":"service","body":[innerForm],"data":{"&":"${__parentForm}"}}];var onServiceInitedScript="\n // \u4EE5\u4E0B\u811A\u672C\u89E3\u51B3\u4E86\u6709\u65F6\u5F39\u51FA\u7F16\u8F91\u8868\u5355\u65F6\uFF0C\u8868\u5355\u4E2D\u7684\u503C\u6BD4\u6700\u540E\u4E00\u6B21\u7F16\u8F91\u4FDD\u5B58\u7684\u503C\u4F1A\u5EF6\u8FDF\u4E00\u62CD\u3002\n // \u6BD4\u5982\uFF1AinlineEditMode\u6A21\u5F0F\u65F6\uFF0C\u7528\u6237\u5728\u8868\u683C\u5355\u5143\u683C\u4E2D\u76F4\u63A5\u4FEE\u6539\u6570\u636E\uFF0C\u7136\u540E\u5F39\u51FA\u7684\u8868\u5355form\u4E2D\u5E76\u6CA1\u6709\u5305\u542B\u5355\u5143\u683C\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\n // \u53E6\u5916\u6709\u7684\u5730\u65B9\u5728\u975EinlineEditMode\u6A21\u5F0F\u65F6\u4E5F\u4F1A\u6709\u8FD9\u79CD\u5EF6\u8FDF\u4E00\u62CD\u95EE\u9898\uFF0C\u6BD4\u5982\u5BF9\u8C61\u5B57\u6BB5\u4E2D\u4E0B\u62C9\u6846\u7C7B\u578B\u5B57\u6BB5\u7684\u201D\u9009\u62E9\u9879\u201C\u5C5E\u6027\n // \u518D\u6BD4\u5982\u5DE5\u4F5C\u6D41\u89C4\u5219\u8BE6\u7EC6\u9875\u9762\u4FEE\u6539\u4E86\u5B50\u8868\u5B57\u6BB5\u201D\u65F6\u95F4\u89E6\u53D1\u5668\u201C\u503C\u540E\uFF0C\u5728\u53EA\u8BFB\u754C\u9762\u70B9\u51FB\u67E5\u770B\u6309\u94AE\u5F39\u51FA\u7684\u8868\u5355\u4E2D__tableItems\u503C\u662F\u4FEE\u6539\u524D\u7684\u503C\n // \u5904\u7406\u601D\u8DEF\u662F\u6BCF\u6B21\u5F39\u51FAform\u4E4B\u524D\u5148\u628A\u5176__tableItems\u540C\u6B65\u66F4\u65B0\u4E3A\u6700\u65B0\u503C\uFF0C\u8FD9\u6837\u5C31\u80FD\u5728\u5F39\u51FAform\u4E2D\u5305\u542B\u5355\u5143\u683C\u4E2D\u505A\u7684\u4FEE\u6539\n // \u6CE8\u610F\uFF1Aservice init\u4E8B\u4EF6\u53EA\u4F1A\u5728\u6BCF\u6B21\u5F39\u51FA\u7A97\u53E3\u65F6\u624D\u6267\u884C\uFF0C\u5728\u89E6\u53D1\u7FFB\u9875\u65F6\u5E76\u4E0D\u4F1A\u89E6\u53D1service init\u4E8B\u4EF6\n let scope = event.context.scoped;\n let __wrapperServiceId = \"".concat(tableServiceId,"\";\n let wrapperService = scope.getComponentById(__wrapperServiceId);\n let wrapperServiceData = wrapperService.getData();\n // \u8FD9\u91CC\u4E0D\u53EF\u4EE5\u7528event.data[\"").concat(props.name,"\"]\u56E0\u4E3Aamis input talbe\u6709\u4E00\u5C42\u5355\u72EC\u7684\u4F5C\u7528\u57DF\uFF0C\u5176\u503C\u4F1A\u5EF6\u8FDF\u4E00\u62CD\n // \u8FD9\u91CC\u5982\u679C\u4E0D.clone\u7684\u8BDD\uFF0C\u5728\u5F39\u51FA\u7A97\u53E3\u4E2D\u663E\u793A\u7684\u5B50\u8868\u7EC4\u4EF6\uFF0C\u6DFB\u52A0\u884C\u540E\u70B9\u7A97\u53E3\u7684\u53D6\u6D88\u6309\u94AE\u5173\u95ED\u7A97\u53E3\u540E\u65E0\u6CD5\u628A\u4E4B\u524D\u7684\u64CD\u4F5C\u8FD8\u539F\uFF0C\u5373\u628A\u4E4B\u524D\u6DFB\u52A0\u7684\u884C\u81EA\u52A8\u79FB\u9664\n let lastestFieldValue = _.clone(wrapperServiceData[\"").concat(props.name,"\"] || []);\n let fieldPrefix = \"").concat(props.fieldPrefix||'',"\";\n if(fieldPrefix){\n let getTableValueWithoutFieldPrefix = new Function('v', 'f', \"return (\" + ").concat(getTableValueWithoutFieldPrefix.toString()," + \")(v, f)\");\n lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);\n }\n //\u4E0D\u53EF\u4EE5\u76F4\u63A5\u50CFevent.data.__tableItems = lastestFieldValue; \u8FD9\u6837\u6574\u4E2A\u8D4B\u503C\uFF0C\u5426\u5219\u4F5C\u7528\u57DF\u4F1A\u65AD\n let mode = \"").concat(mode||'',"\";\n if(mode === \"new\"){\n // \u70B9\u51FB\u5B50\u8868\u7EC4\u4EF6\u5E95\u90E8\u65B0\u589E\u6309\u94AE\u65F6\u65B0\u589E\u4E00\u6761\u7A7A\u767D\u884C\u5E76\u81EA\u52A8\u7FFB\u9875\u5230\u65B0\u589E\u884C\n // \u6CE8\u610F\u70B9\u51FB\u5F39\u51FA\u7684\u5B50\u8868\u884C\u8BE6\u7EC6\u8868\u5355\u4E2D\u7684\u65B0\u589E\u6309\u94AE\u4E0D\u4F1A\u8FDB\u6B64service init\u4E8B\u4EF6\u51FD\u6570\u4E2D\n let newItem = {};\n event.data.__tableItems.push(newItem);\n lastestFieldValue.push(newItem);\n event.data.index = lastestFieldValue.length - 1;\n event.data.__page = lastestFieldValue.length;\n // \u8FD9\u91CC\u65B0\u589E\u7A7A\u767D\u884C\u65F6\u8981\u628A\u503C\u540C\u6B65\u4FDD\u5B58\u5230\u5B50\u8868\u7EC4\u4EF6\u4E2D\uFF0C\u5982\u679C\u4E0D\u540C\u6B65\u4FDD\u5B58\u7684\u8BDD\uFF0C\u7528\u6237\u70B9\u51FB\u5F39\u51FA\u8868\u5355\u53F3\u4E0A\u89D2\u7684\u5173\u95ED\u7A97\u53E3\u65F6\u4E0D\u4F1A\u81EA\u52A8\u5220\u9664\u8FD9\u91CC\u81EA\u52A8\u589E\u52A0\u7684\u7A7A\u767D\u884C\uFF0C\u540C\u6B65\u540E\u53EF\u4EE5\u8BA9\u7528\u6237\u624B\u52A8\u5220\u9664\u6B64\u884C\n doAction({\n \"componentId\": \"").concat(props.id,"\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": lastestFieldValue\n }\n });\n }\n event.data.__tableItems.forEach(function(n,i){\n event.data.__tableItems[i] = lastestFieldValue[i];\n });\n\n var parent = event.data.parent;\n var fieldValue = event.data.__tableItems;\n if(parent){\n // \u5982\u679C\u662F\u5B50\u884C\uFF0C\u5373\u5728\u8282\u70B9\u5D4C\u5957\u60C5\u51B5\u4E0B\uFF0C\u5F53\u524D\u8282\u70B9\u5982\u679C\u662Fchildren\u5C5E\u6027\u4E0B\u7684\u5B50\u8282\u70B9\u65F6\uFF0C\u5219\u7B97\u51FA\u5176\u6240\u5C5E\u7236\u884C\u7684\u7D22\u5F15\u503C\n var primaryKey = \"").concat(primaryKey,"\";\n event.data.__parentIndex = _.findIndex(fieldValue, function(item){\n return item[primaryKey] == parent[primaryKey];\n });\n if(event.data.__parentIndex < 0){\n let tableId = \"").concat(props.id,"\";\n let table = scope.getComponentById(tableId)\n // autoGeneratePrimaryKeyValue\u4E0D\u4E3Atrue\u7684\u60C5\u51B5\u4E0B\uFF0C\u5373\u5B50\u8868\u7EC4\u4EF6input-table\u7684pipeOut\u51FD\u6570\u4E2D\u4F1A\u79FB\u9664\u8868\u5355\u4E86\u5B50\u8868\u5B57\u6BB5\u7684primaryKey\u5B57\u6BB5\u503C\uFF0C\n // \u6B64\u65F6\u884CprimaryKey\u5B57\u6BB5\u503C\u4E3A\u7A7A\uFF0C\u4F46\u662FpipeIn\u51FD\u6570\u4E2D\u5DF2\u7ECF\u4E3Ainput-table\u81EA\u52A8\u751F\u6210\u8FC7primaryKey\u5B57\u6BB5\u503C\u4E86\uFF0C\u53EA\u662F\u6CA1\u6709\u8F93\u51FA\u5230\u8868\u5355\u5B57\u6BB5\u503C\u4E2D\u800C\u5DF2\n // \u6240\u4EE5\u4E0A\u9762\u4ECE\u8868\u5355\u5B57\u6BB5\u503C\u4E2D\u6CA1\u627E\u5230__parentIndex\uFF0C\u662F\u56E0\u4E3A\u6B64\u65F6\u884CprimaryKey\u5B57\u6BB5\u503C\u53EA\u7ECF\u8FC7pipeIn\u4FDD\u5B58\u5230table\u7EC4\u4EF6\u5185\u800C\u6CA1\u6709\u4FDD\u5B58\u5230tableService\n event.data.__parentIndex = _.findIndex(table.props.value, function(item){\n return item[primaryKey] == parent[primaryKey];\n });\n }\n }\n ");var schema={"type":"service","id":serviceId,"schemaApi":{// "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
|
|
1038
1054
|
"url":"${context.rootUrl}/api/v1/spaces/none","trackExpression":"${index}","method":"get","adaptor":"\n const formBody = ".concat(JSON.stringify(formBody),";\n return {\n \"body\": formBody\n }\n "),"cache":600000},// "body": formBody,
|
|
1039
1055
|
"data":{"__page":"${index + 1}","__parentIndex":null//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
1040
1056
|
// "__total": `\${${props.name}.length}`,
|
|
@@ -1217,7 +1233,7 @@ if(props.enableDialog===false){actions=[{"actionType":"custom","script":"\n
|
|
|
1217
1233
|
// },
|
|
1218
1234
|
// "componentId": props.id
|
|
1219
1235
|
// },
|
|
1220
|
-
{"actionType":"custom","script":onDeleteItemScript}];}case 44:return _context122.abrupt("return",actions);case 45:case"end":return _context122.stop();}}},_callee122);}));return _getButtonActions.apply(this,arguments);}function getButtonNew(_x228){return _getButtonNew.apply(this,arguments);}function _getButtonNew(){_getButtonNew=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee123(props){return _regeneratorRuntime().wrap(function _callee123$(_context123){while(1){switch(_context123.prev=_context123.next){case 0:_context123.next=2;return getButtonActions(props,"new");case 2:_context123.t0=_context123.sent;_context123.t1={"actions":_context123.t0};_context123.t2={"click":_context123.t1};return _context123.abrupt("return",{"label":"新增","type":"button","icon":"fa fa-plus","onEvent":_context123.t2,"level":"link","className":"text-gray-500","size":"xs"});case 6:case"end":return _context123.stop();}}},_callee123);}));return _getButtonNew.apply(this,arguments);}function getButtonEdit(_x229,_x230){return _getButtonEdit.apply(this,arguments);}function _getButtonEdit(){_getButtonEdit=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee124(props,showAsInlineEditMode){return _regeneratorRuntime().wrap(function _callee124$(_context124){while(1){switch(_context124.prev=_context124.next){case 0:_context124.t0="fa fa-".concat(showAsInlineEditMode?"expand-alt":"pencil");_context124.next=3;return getButtonActions(props,"edit");case 3:_context124.t1=_context124.sent;_context124.t2={"actions":_context124.t1};_context124.t3={"click":_context124.t2};return _context124.abrupt("return",{"type":"button","label":"","icon":_context124.t0,"level":"link","className":"text-gray-400","onEvent":_context124.t3});case 7:case"end":return _context124.stop();}}},_callee124);}));return _getButtonEdit.apply(this,arguments);}function getButtonView(_x231){return _getButtonView.apply(this,arguments);}function _getButtonView(){_getButtonView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(props){return _regeneratorRuntime().wrap(function _callee125$(_context125){while(1){switch(_context125.prev=_context125.next){case 0:_context125.next=2;return getButtonActions(props,"readonly");case 2:_context125.t0=_context125.sent;_context125.t1={"actions":_context125.t0};_context125.t2={"click":_context125.t1};return _context125.abrupt("return",{"type":"button","label":"","icon":"fa fa-expand-alt","level":"link","className":"text-gray-400","onEvent":_context125.t2});case 6:case"end":return _context125.stop();}}},_callee125);}));return _getButtonView.apply(this,arguments);}function getButtonDelete(_x232){return _getButtonDelete.apply(this,arguments);}function _getButtonDelete(){_getButtonDelete=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee126(props){return _regeneratorRuntime().wrap(function _callee126$(_context126){while(1){switch(_context126.prev=_context126.next){case 0:_context126.t0={"tpl":"确定要删除吗?","type":"tpl"};_context126.t1={"type":"button","label":"取消","className":"mr-2"};_context126.next=4;return getButtonActions(props,"delete");case 4:_context126.t2=_context126.sent;_context126.t3={"actions":_context126.t2};_context126.t4={"click":_context126.t3};_context126.t5={"type":"button","label":"删除","level":"danger","onEvent":_context126.t4};_context126.t6=[_context126.t1,_context126.t5];_context126.t7={"type":"flex","justify":"flex-end","className":"mt-3","items":_context126.t6};_context126.t8=[_context126.t0,_context126.t7];_context126.t9={"type":"wrapper","size":"md","className":"w-80","body":_context126.t8};_context126.t10=[_context126.t9];return _context126.abrupt("return",{"type":"dropdown-button","level":"link","btnClassName":"text-gray-400 steedos-delete-button","icon":"fa fa-trash-alt","size":"xs","hideCaret":true,"closeOnClick":true,"body":_context126.t10});case 14:case"end":return _context126.stop();}}},_callee126);}));return _getButtonDelete.apply(this,arguments);}var getAmisInputTableSchema=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(props){var primaryKey,showOperation,fieldPrefix,fields,serviceId,buttonsForColumnOperations,inlineEditMode,showAsInlineEditMode,showEditButton,buttonEditSchema,buttonViewSchema,buttonDeleteSchema,amis,inputTableSchema,isAnyFieldHasDependOn,schemaBody,footerToolbar,buttonNewSchema,headerToolbar,className,schema;return _regeneratorRuntime().wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:if(!props.id){props.id="steedos_input_table_"+props.name+"_"+Math.random().toString(36).substr(2,9);}primaryKey=getTablePrimaryKey(props);showOperation=props.showOperation;if(showOperation!==false){showOperation=true;}fieldPrefix=props.fieldPrefix;fields=props.fields||[];if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}
|
|
1236
|
+
{"actionType":"custom","script":onDeleteItemScript}];}case 44:return _context122.abrupt("return",actions);case 45:case"end":return _context122.stop();}}},_callee122);}));return _getButtonActions.apply(this,arguments);}function getButtonNew(_x228){return _getButtonNew.apply(this,arguments);}function _getButtonNew(){_getButtonNew=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee123(props){return _regeneratorRuntime().wrap(function _callee123$(_context123){while(1){switch(_context123.prev=_context123.next){case 0:_context123.next=2;return getButtonActions(props,"new");case 2:_context123.t0=_context123.sent;_context123.t1={"actions":_context123.t0};_context123.t2={"click":_context123.t1};return _context123.abrupt("return",{"label":"新增","type":"button","icon":"fa fa-plus","onEvent":_context123.t2,"level":"link","className":"text-gray-500","size":"xs"});case 6:case"end":return _context123.stop();}}},_callee123);}));return _getButtonNew.apply(this,arguments);}function getButtonEdit(_x229,_x230){return _getButtonEdit.apply(this,arguments);}function _getButtonEdit(){_getButtonEdit=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee124(props,showAsInlineEditMode){return _regeneratorRuntime().wrap(function _callee124$(_context124){while(1){switch(_context124.prev=_context124.next){case 0:_context124.t0="fa fa-".concat(showAsInlineEditMode?"expand-alt":"pencil");_context124.next=3;return getButtonActions(props,"edit");case 3:_context124.t1=_context124.sent;_context124.t2={"actions":_context124.t1};_context124.t3={"click":_context124.t2};return _context124.abrupt("return",{"type":"button","label":"","icon":_context124.t0,"level":"link","className":"text-gray-400","onEvent":_context124.t3});case 7:case"end":return _context124.stop();}}},_callee124);}));return _getButtonEdit.apply(this,arguments);}function getButtonView(_x231){return _getButtonView.apply(this,arguments);}function _getButtonView(){_getButtonView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(props){return _regeneratorRuntime().wrap(function _callee125$(_context125){while(1){switch(_context125.prev=_context125.next){case 0:_context125.next=2;return getButtonActions(props,"readonly");case 2:_context125.t0=_context125.sent;_context125.t1={"actions":_context125.t0};_context125.t2={"click":_context125.t1};return _context125.abrupt("return",{"type":"button","label":"","icon":"fa fa-expand-alt","level":"link","className":"text-gray-400","onEvent":_context125.t2});case 6:case"end":return _context125.stop();}}},_callee125);}));return _getButtonView.apply(this,arguments);}function getButtonDelete(_x232){return _getButtonDelete.apply(this,arguments);}function _getButtonDelete(){_getButtonDelete=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee126(props){return _regeneratorRuntime().wrap(function _callee126$(_context126){while(1){switch(_context126.prev=_context126.next){case 0:_context126.t0={"tpl":"确定要删除吗?","type":"tpl"};_context126.t1={"type":"button","label":"取消","className":"mr-2"};_context126.next=4;return getButtonActions(props,"delete");case 4:_context126.t2=_context126.sent;_context126.t3={"actions":_context126.t2};_context126.t4={"click":_context126.t3};_context126.t5={"type":"button","label":"删除","level":"danger","onEvent":_context126.t4};_context126.t6=[_context126.t1,_context126.t5];_context126.t7={"type":"flex","justify":"flex-end","className":"mt-3","items":_context126.t6};_context126.t8=[_context126.t0,_context126.t7];_context126.t9={"type":"wrapper","size":"md","className":"w-80","body":_context126.t8};_context126.t10=[_context126.t9];return _context126.abrupt("return",{"type":"dropdown-button","level":"link","btnClassName":"text-gray-400 steedos-delete-button","icon":"fa fa-trash-alt","size":"xs","hideCaret":true,"closeOnClick":true,"body":_context126.t10});case 14:case"end":return _context126.stop();}}},_callee126);}));return _getButtonDelete.apply(this,arguments);}var getAmisInputTableSchema=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(props){var primaryKey,showOperation,fieldPrefix,fields,serviceId,buttonsForColumnOperations,inlineEditMode,showAsInlineEditMode,showEditButton,buttonEditSchema,buttonViewSchema,buttonDeleteSchema,amis,inputTableSchema,isAnyFieldHasDependOn,schemaBody,footerToolbar,buttonNewSchema,headerToolbar,className,schema;return _regeneratorRuntime().wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:if(!props.id){props.id="steedos_input_table_"+props.name+"_"+Math.random().toString(36).substr(2,9);}primaryKey=getTablePrimaryKey(props);showOperation=props.showOperation;if(showOperation!==false){showOperation=true;}fieldPrefix=props.fieldPrefix;fields=props.fields||[];if(fieldPrefix){fields=getTableFieldsWithoutFieldPrefix(fields,fieldPrefix);}serviceId=getComponentId("table_service",props.id);buttonsForColumnOperations=[];inlineEditMode=props.inlineEditMode;showAsInlineEditMode=inlineEditMode&&props.editable;if(!showOperation){_context19.next=32;break;}if(!(props.enableDialog!==false)){_context19.next=27;break;}if(!props.editable){_context19.next=23;break;}showEditButton=true;if(showAsInlineEditMode){// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
1221
1237
|
showEditButton=true;// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
1222
1238
|
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
1223
1239
|
// showEditButton = true;
|
|
@@ -1227,10 +1243,10 @@ showEditButton=true;// // inline edit模式下只在有列被隐藏时才需要
|
|
|
1227
1243
|
// }
|
|
1228
1244
|
}// 编辑时显示编辑按钮
|
|
1229
1245
|
if(!showEditButton){_context19.next=21;break;}_context19.next=19;return getButtonEdit(props,showAsInlineEditMode);case 19:buttonEditSchema=_context19.sent;buttonsForColumnOperations.push(buttonEditSchema);case 21:_context19.next=27;break;case 23:_context19.next=25;return getButtonView(props);case 25:buttonViewSchema=_context19.sent;buttonsForColumnOperations.push(buttonViewSchema);case 27:if(!props.removable){_context19.next=32;break;}_context19.next=30;return getButtonDelete(props);case 30:buttonDeleteSchema=_context19.sent;buttonsForColumnOperations.push(buttonDeleteSchema);case 32:amis=props["input-table"]||props.amis||{};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
1230
|
-
_context19.t0=props.name;_context19.t1=props.draggable;_context19.t2=props.showIndex;_context19.t3=props.perPage;_context19.t4=props.id;_context19.next=40;return getInputTableColumns(props,buttonsForColumnOperations);case 40:_context19.t5=_context19.sent;_context19.t6=props.strictMode;_context19.t7=props.tableClassName;_context19.t8=function pipeIn(value,data){if(fieldPrefix){value=getTableValueWithoutFieldPrefix(value,fieldPrefix);}
|
|
1246
|
+
_context19.t0=props.name;_context19.t1=props.draggable;_context19.t2=props.showIndex;_context19.t3=props.perPage;_context19.t4=props.id;_context19.next=40;return getInputTableColumns(props,buttonsForColumnOperations);case 40:_context19.t5=_context19.sent;_context19.t6=props.strictMode;_context19.t7=props.tableClassName;_context19.t8=function pipeIn(value,data){if(fieldPrefix){value=getTableValueWithoutFieldPrefix(value,fieldPrefix);}value=getTableValueWithEmptyValue(value,fields);if(primaryKey){// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
1231
1247
|
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
1232
1248
|
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
1233
|
-
value=getTableValueWithPrimaryKeyValue(value,primaryKey);}if(amis.pipeIn){if(typeof amis.pipeIn==='function'){return amis.pipeIn(value,data);}}return value;};_context19.t9=function pipeOut(value,data){value=(value||[]).map(function(item){delete item.__fix_rerender_after_children_modified_tag;return item;});if(fieldPrefix){value=getTableValuePrependFieldPrefix(value,fieldPrefix,primaryKey);}
|
|
1249
|
+
value=getTableValueWithPrimaryKeyValue(value,primaryKey);}if(amis.pipeIn){if(typeof amis.pipeIn==='function'){return amis.pipeIn(value,data);}}return value;};_context19.t9=function pipeOut(value,data){value=(value||[]).map(function(item){delete item.__fix_rerender_after_children_modified_tag;return item;});if(fieldPrefix){value=getTableValuePrependFieldPrefix(value,fieldPrefix,primaryKey);}value=getTableValueWithoutEmptyValue(value,fields);if(props.autoGeneratePrimaryKeyValue===true){// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
1234
1250
|
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
1235
1251
|
value=getTableValueWithPrimaryKeyValue(value,primaryKey);}else{// 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
|
|
1236
1252
|
// 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
|