@steedos-widgets/amis-object 1.3.22-beta.2 → 1.3.22-beta.3
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/amis-object.cjs.css +7 -0
- package/dist/amis-object.cjs.js +147 -103
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +7 -0
- package/dist/amis-object.esm.js +147 -103
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +7 -0
- package/dist/amis-object.umd.js +105 -58
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
|
@@ -1873,6 +1873,13 @@ body.steedos {
|
|
|
1873
1873
|
.steedos-object-table.is-steedos-tree-table thead tr th:nth-child(2) {
|
|
1874
1874
|
display: table-cell;
|
|
1875
1875
|
}
|
|
1876
|
+
.steedos-object-table.is-steedos-tree-table .is-steedos-crud-data-empty thead tr th:nth-child(2),
|
|
1877
|
+
.steedos-object-table.is-steedos-tree-table .is-steedos-crud-data-empty thead tr th:nth-child(3) {
|
|
1878
|
+
display: table-cell;
|
|
1879
|
+
}
|
|
1880
|
+
.steedos-object-table.is-steedos-tree-table .is-steedos-crud-data-empty thead tr th:nth-child(1) {
|
|
1881
|
+
display: none;
|
|
1882
|
+
}
|
|
1876
1883
|
.steedos-object-table .is-steedos-crud-data-empty thead tr th:nth-child(3) {
|
|
1877
1884
|
display: table-cell;
|
|
1878
1885
|
}
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -4795,6 +4795,7 @@ async function getQuickEditSchema(field, options){
|
|
|
4795
4795
|
{
|
|
4796
4796
|
"actionType": "custom",
|
|
4797
4797
|
"script": `
|
|
4798
|
+
|
|
4798
4799
|
var _display = _.cloneDeep(event.data._display);
|
|
4799
4800
|
${displayField}
|
|
4800
4801
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
@@ -5181,7 +5182,9 @@ async function getTableColumns$1(fields, options){
|
|
|
5181
5182
|
if(!options.isLookup && !options.isInputTable){
|
|
5182
5183
|
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
5183
5184
|
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
5184
|
-
|
|
5185
|
+
if(!options.enable_tree){
|
|
5186
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
5187
|
+
}
|
|
5185
5188
|
}
|
|
5186
5189
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
5187
5190
|
|
|
@@ -6032,7 +6035,21 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6032
6035
|
|
|
6033
6036
|
if(enable_tree){
|
|
6034
6037
|
const records = payload.data.rows || [];
|
|
6035
|
-
const getTreeOptions = SteedosUI.getTreeOptions
|
|
6038
|
+
const getTreeOptions = SteedosUI.getTreeOptions;
|
|
6039
|
+
const assignIndexToTreeRecords = function(tree, parentIndex) {
|
|
6040
|
+
tree.forEach(function (node, index) {
|
|
6041
|
+
// 构建当前节点的 _index
|
|
6042
|
+
var currentIndex = parentIndex ? parentIndex + '-' + (index + 1) : '' + (index + 1);
|
|
6043
|
+
|
|
6044
|
+
// 赋值给节点
|
|
6045
|
+
node._index = currentIndex;
|
|
6046
|
+
|
|
6047
|
+
// 如果有子节点,递归调用函数
|
|
6048
|
+
if (node.children && node.children.length > 0) {
|
|
6049
|
+
assignIndexToTreeRecords(node.children, currentIndex);
|
|
6050
|
+
}
|
|
6051
|
+
});
|
|
6052
|
+
};
|
|
6036
6053
|
let isTreeOptionsComputed = false;
|
|
6037
6054
|
if(records.length === 1 && records[0].children){
|
|
6038
6055
|
isTreeOptionsComputed = true;
|
|
@@ -6040,6 +6057,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6040
6057
|
if(!isTreeOptionsComputed){
|
|
6041
6058
|
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
6042
6059
|
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6060
|
+
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6043
6061
|
}
|
|
6044
6062
|
try{
|
|
6045
6063
|
setTimeout(() => {
|
|
@@ -11396,7 +11414,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11396
11414
|
let tableOptions = Object.assign({
|
|
11397
11415
|
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
11398
11416
|
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit,
|
|
11399
|
-
crudId: listSchema.id || id
|
|
11417
|
+
crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
|
|
11400
11418
|
}, options);
|
|
11401
11419
|
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
11402
11420
|
const table = await getTableSchema$1(fields, tableOptions);
|
|
@@ -15583,7 +15601,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15583
15601
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15584
15602
|
* @Date: 2023-11-15 09:50:22
|
|
15585
15603
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15586
|
-
* @LastEditTime: 2023-12-
|
|
15604
|
+
* @LastEditTime: 2023-12-25 13:13:56
|
|
15587
15605
|
*/
|
|
15588
15606
|
|
|
15589
15607
|
/**
|
|
@@ -15830,7 +15848,7 @@ function getFormPagination(props, mode) {
|
|
|
15830
15848
|
* @returns 带翻页容器的wrapper
|
|
15831
15849
|
*/
|
|
15832
15850
|
function getFormPaginationWrapper(props, form, mode) {
|
|
15833
|
-
console.log("==getFormPaginationWrapper===", props, mode);
|
|
15851
|
+
// console.log("==getFormPaginationWrapper===", props, mode);
|
|
15834
15852
|
let serviceId = getComponentId("form_pagination", props.id);
|
|
15835
15853
|
let tableServiceId = getComponentId("table_service", props.id);
|
|
15836
15854
|
let innerForm = Object.assign({}, form, {
|
|
@@ -15870,8 +15888,26 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
15870
15888
|
let __wrapperServiceId = "${tableServiceId}";
|
|
15871
15889
|
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
15872
15890
|
let wrapperServiceData = wrapperService.getData();
|
|
15873
|
-
let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
15891
|
+
let lastestFieldValue = wrapperServiceData["${props.name}"] || [];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
15874
15892
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
15893
|
+
let mode = "${mode}";
|
|
15894
|
+
if(mode === "new"){
|
|
15895
|
+
// 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
|
|
15896
|
+
// 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
|
|
15897
|
+
let newItem = {};
|
|
15898
|
+
event.data.__tableItems.push(newItem);
|
|
15899
|
+
lastestFieldValue.push(newItem);
|
|
15900
|
+
event.data.index = lastestFieldValue.length - 1;
|
|
15901
|
+
event.data.__page = lastestFieldValue.length;
|
|
15902
|
+
// 这里新增空白行时要把值同步保存到子表组件中,如果不同步保存的话,用户点击弹出表单右上角的关闭窗口时不会自动删除这里自动增加的空白行,同步后可以让用户手动删除此行
|
|
15903
|
+
doAction({
|
|
15904
|
+
"componentId": "${props.id}",
|
|
15905
|
+
"actionType": "setValue",
|
|
15906
|
+
"args": {
|
|
15907
|
+
"value": lastestFieldValue
|
|
15908
|
+
}
|
|
15909
|
+
});
|
|
15910
|
+
}
|
|
15875
15911
|
event.data.__tableItems.forEach(function(n,i){
|
|
15876
15912
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
15877
15913
|
});
|
|
@@ -15935,7 +15971,8 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
15935
15971
|
"canAccessSuperData": false,
|
|
15936
15972
|
"className": "steedos-object-form steedos-amis-form"
|
|
15937
15973
|
};
|
|
15938
|
-
if (mode === "edit") {
|
|
15974
|
+
if (mode === "edit" || mode === "new") {
|
|
15975
|
+
// 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
|
|
15939
15976
|
let onEditItemSubmitScript = `
|
|
15940
15977
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
15941
15978
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
@@ -15974,66 +16011,66 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
15974
16011
|
}
|
|
15975
16012
|
});
|
|
15976
16013
|
}
|
|
15977
|
-
else if (mode === "new") {
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
}
|
|
16014
|
+
// else if (mode === "new") {
|
|
16015
|
+
// let onNewItemSubmitScript = `
|
|
16016
|
+
// let newItem = JSON.parse(JSON.stringify(event.data));
|
|
16017
|
+
// if(event.data["${props.name}"]){
|
|
16018
|
+
// // let fieldValue = event.data.__tableItems;
|
|
16019
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
16020
|
+
// let fieldValue = event.data["${props.name}"];
|
|
16021
|
+
// fieldValue.push(newItem);
|
|
16022
|
+
// doAction({
|
|
16023
|
+
// "componentId": "${props.id}",
|
|
16024
|
+
// "actionType": "setValue",
|
|
16025
|
+
// "args": {
|
|
16026
|
+
// "value": fieldValue
|
|
16027
|
+
// }
|
|
16028
|
+
// });
|
|
16029
|
+
// }
|
|
16030
|
+
// else{
|
|
16031
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
16032
|
+
// doAction({
|
|
16033
|
+
// "componentId": "${props.id}",
|
|
16034
|
+
// "actionType": "setValue",
|
|
16035
|
+
// "args": {
|
|
16036
|
+
// "value": [newItem]
|
|
16037
|
+
// }
|
|
16038
|
+
// });
|
|
16039
|
+
// }
|
|
16040
|
+
// `;
|
|
16041
|
+
// Object.assign(schema, {
|
|
16042
|
+
// "onEvent": {
|
|
16043
|
+
// "submit": {
|
|
16044
|
+
// "weight": 0,
|
|
16045
|
+
// "actions": [
|
|
16046
|
+
// {
|
|
16047
|
+
// "actionType": "custom",
|
|
16048
|
+
// "script": onNewItemSubmitScript
|
|
16049
|
+
// },
|
|
16050
|
+
// // {
|
|
16051
|
+
// // "componentId": props.id,
|
|
16052
|
+
// // "actionType": "addItem",//input-table组件的needConfirm属性为true时,addItem动作会把新加的行显示为编辑状态,所以只能使用上面的custom script来setValue实现添加行
|
|
16053
|
+
// // "args": {
|
|
16054
|
+
// // "index": `\${${props.name}.length || 9000}`,//这里加9000是因为字段如果没放在form组件内,props.name.length拿不到值
|
|
16055
|
+
// // "item": {
|
|
16056
|
+
// // "&": "$$"
|
|
16057
|
+
// // }
|
|
16058
|
+
// // }
|
|
16059
|
+
// // }
|
|
16060
|
+
// ]
|
|
16061
|
+
// }
|
|
16062
|
+
// }
|
|
16063
|
+
// });
|
|
16064
|
+
// }
|
|
16028
16065
|
schema = getFormPaginationWrapper(props, schema, mode);
|
|
16029
16066
|
return schema;
|
|
16030
16067
|
}
|
|
16031
16068
|
|
|
16032
16069
|
|
|
16033
16070
|
/**
|
|
16034
|
-
*
|
|
16071
|
+
* 编辑、新增、删除、查看按钮actions
|
|
16035
16072
|
* @param {*} props
|
|
16036
|
-
* @param {*} mode edit/new/readonly
|
|
16073
|
+
* @param {*} mode edit/new/readonly/delete
|
|
16037
16074
|
*/
|
|
16038
16075
|
async function getButtonActions(props, mode) {
|
|
16039
16076
|
let actions = [];
|
|
@@ -16124,6 +16161,7 @@ async function getButtonActions(props, mode) {
|
|
|
16124
16161
|
}
|
|
16125
16162
|
];
|
|
16126
16163
|
if(props.addable){
|
|
16164
|
+
// 有新增行权限时额外添加新增和复制按钮
|
|
16127
16165
|
dialogButtons = [
|
|
16128
16166
|
{
|
|
16129
16167
|
"type": "button",
|
|
@@ -16188,7 +16226,8 @@ async function getButtonActions(props, mode) {
|
|
|
16188
16226
|
// "__tableItems": `\${${props.name}}`
|
|
16189
16227
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16190
16228
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16191
|
-
"__tableItems": `\${${props.name}|json|toJson}`
|
|
16229
|
+
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16230
|
+
"__tableItems": `\${(${props.name} || [])|json|toJson}`
|
|
16192
16231
|
},
|
|
16193
16232
|
"actions": dialogButtons,
|
|
16194
16233
|
"onEvent": {
|
|
@@ -16211,11 +16250,12 @@ async function getButtonActions(props, mode) {
|
|
|
16211
16250
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16212
16251
|
}
|
|
16213
16252
|
if (mode == "new") {
|
|
16214
|
-
|
|
16253
|
+
`
|
|
16215
16254
|
let newItem = {};
|
|
16216
16255
|
if(event.data["${props.name}"]){
|
|
16217
16256
|
// let fieldValue = event.data.__tableItems;
|
|
16218
16257
|
// 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
16258
|
+
// let fieldValue = _.clone(event.data["${props.name}"]);
|
|
16219
16259
|
let fieldValue = event.data["${props.name}"];
|
|
16220
16260
|
fieldValue.push(newItem);
|
|
16221
16261
|
doAction({
|
|
@@ -16239,11 +16279,9 @@ async function getButtonActions(props, mode) {
|
|
|
16239
16279
|
event.data.index = 1;
|
|
16240
16280
|
}
|
|
16241
16281
|
`;
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
};
|
|
16246
|
-
actions = [actionNewLine, actionShowEditDialog];
|
|
16282
|
+
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16283
|
+
// actions = [actionNewLine, actionShowEditDialog];
|
|
16284
|
+
actions = [actionShowEditDialog];
|
|
16247
16285
|
}
|
|
16248
16286
|
else if (mode == "edit") {
|
|
16249
16287
|
actions = [actionShowEditDialog];
|
|
@@ -16281,12 +16319,47 @@ async function getButtonActions(props, mode) {
|
|
|
16281
16319
|
// "__tableItems": `\${${props.name}}`
|
|
16282
16320
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16283
16321
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16284
|
-
"__tableItems": `\${${props.name}|json|toJson}`
|
|
16285
|
-
|
|
16322
|
+
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16323
|
+
"__tableItems": `\${(${props.name} || [])|json|toJson}`
|
|
16324
|
+
},
|
|
16286
16325
|
}
|
|
16287
16326
|
}
|
|
16288
16327
|
];
|
|
16289
16328
|
}
|
|
16329
|
+
else if (mode == "delete") {
|
|
16330
|
+
let tableServiceId = getComponentId("table_service", props.id);
|
|
16331
|
+
let onDeleteItemScript = `
|
|
16332
|
+
// let fieldValue = event.data["${props.name}"];
|
|
16333
|
+
let scope = event.context.scoped;
|
|
16334
|
+
let __wrapperServiceId = "${tableServiceId}";
|
|
16335
|
+
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
16336
|
+
let wrapperServiceData = wrapperService.getData();
|
|
16337
|
+
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16338
|
+
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
16339
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16340
|
+
lastestFieldValue.splice(event.data.index, 1);
|
|
16341
|
+
doAction({
|
|
16342
|
+
"componentId": "${props.id}",
|
|
16343
|
+
"actionType": "setValue",
|
|
16344
|
+
"args": {
|
|
16345
|
+
"value": lastestFieldValue
|
|
16346
|
+
}
|
|
16347
|
+
});
|
|
16348
|
+
`;
|
|
16349
|
+
actions = [
|
|
16350
|
+
// {
|
|
16351
|
+
// "actionType": "deleteItem",
|
|
16352
|
+
// "args": {
|
|
16353
|
+
// "index": "${index+','}" //这里不加逗号后续会报错,语法是逗号分隔可以删除多行
|
|
16354
|
+
// },
|
|
16355
|
+
// "componentId": props.id
|
|
16356
|
+
// },
|
|
16357
|
+
{
|
|
16358
|
+
"actionType": "custom",
|
|
16359
|
+
"script": onDeleteItemScript
|
|
16360
|
+
}
|
|
16361
|
+
];
|
|
16362
|
+
}
|
|
16290
16363
|
return actions;
|
|
16291
16364
|
}
|
|
16292
16365
|
|
|
@@ -16332,24 +16405,7 @@ async function getButtonView(props) {
|
|
|
16332
16405
|
};
|
|
16333
16406
|
}
|
|
16334
16407
|
|
|
16335
|
-
function getButtonDelete(props) {
|
|
16336
|
-
let tableServiceId = getComponentId("table_service", props.id);
|
|
16337
|
-
let onDeleteItemScript = `
|
|
16338
|
-
// let fieldValue = event.data["${props.name}"];
|
|
16339
|
-
let scope = event.context.scoped;
|
|
16340
|
-
let __wrapperServiceId = "${tableServiceId}";
|
|
16341
|
-
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
16342
|
-
let wrapperServiceData = wrapperService.getData();
|
|
16343
|
-
let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16344
|
-
lastestFieldValue.splice(event.data.index, 1);
|
|
16345
|
-
doAction({
|
|
16346
|
-
"componentId": "${props.id}",
|
|
16347
|
-
"actionType": "setValue",
|
|
16348
|
-
"args": {
|
|
16349
|
-
"value": lastestFieldValue
|
|
16350
|
-
}
|
|
16351
|
-
});
|
|
16352
|
-
`;
|
|
16408
|
+
async function getButtonDelete(props) {
|
|
16353
16409
|
return {
|
|
16354
16410
|
"type": "button",
|
|
16355
16411
|
"label": "",
|
|
@@ -16357,19 +16413,7 @@ function getButtonDelete(props) {
|
|
|
16357
16413
|
"level": "link",
|
|
16358
16414
|
"onEvent": {
|
|
16359
16415
|
"click": {
|
|
16360
|
-
"actions":
|
|
16361
|
-
// {
|
|
16362
|
-
// "actionType": "deleteItem",
|
|
16363
|
-
// "args": {
|
|
16364
|
-
// "index": "${index+','}" //这里不加逗号后续会报错,语法是逗号分隔可以删除多行
|
|
16365
|
-
// },
|
|
16366
|
-
// "componentId": props.id
|
|
16367
|
-
// },
|
|
16368
|
-
{
|
|
16369
|
-
"actionType": "custom",
|
|
16370
|
-
"script": onDeleteItemScript
|
|
16371
|
-
}
|
|
16372
|
-
]
|
|
16416
|
+
"actions": await getButtonActions(props, "delete")
|
|
16373
16417
|
}
|
|
16374
16418
|
}
|
|
16375
16419
|
};
|
|
@@ -16409,7 +16453,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
16409
16453
|
buttonsForColumnOperations.push(buttonViewSchema);
|
|
16410
16454
|
}
|
|
16411
16455
|
if (props.removable) {
|
|
16412
|
-
let buttonDeleteSchema = getButtonDelete(props);
|
|
16456
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
16413
16457
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
16414
16458
|
}
|
|
16415
16459
|
let inputTableSchema = {
|
|
@@ -20752,7 +20796,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
20752
20796
|
schemaApi: {
|
|
20753
20797
|
"method": "get",
|
|
20754
20798
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
20755
|
-
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instances'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
20799
|
+
"adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instance_tasks'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
|
|
20756
20800
|
"headers": {
|
|
20757
20801
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20758
20802
|
}
|
|
@@ -21505,7 +21549,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21505
21549
|
defaultSource = {
|
|
21506
21550
|
"method": "post",
|
|
21507
21551
|
"url": "${context.rootUrl}/graphql",
|
|
21508
|
-
"requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
|
|
21552
|
+
"requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
|
|
21509
21553
|
"trackExpression": "${" + steedosField.name + "}",
|
|
21510
21554
|
"cache": 3000
|
|
21511
21555
|
};
|