@steedos-widgets/amis-lib 1.1.4-beta.2 → 1.1.4-beta.4
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 +51 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +51 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +51 -18
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/objectsRelated.d.ts +11 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1046,7 +1046,7 @@
|
|
|
1046
1046
|
|
|
1047
1047
|
async function getSource$1(field, ctx) {
|
|
1048
1048
|
// data.query 最终格式 "{ \tleftOptions:organizations(filters: {__filters}){value:_id,label:name,children}, children:organizations(filters: {__filters}){ref:_id,children}, defaultValueOptions:space_users(filters: {__options_filters}){user,name} }"
|
|
1049
|
-
const data = await getFindQuery({ name: refOrgsObjectName }, null, [{ name: "_id", alias: "value" }, { name: "name", alias: "label" }, { name: "children" }], {
|
|
1049
|
+
const data = await getFindQuery({ name: refOrgsObjectName }, null, [{ name: "_id", alias: "value" },{name: "parent"}, { name: "name", alias: "label" }, { name: "children" }], {
|
|
1050
1050
|
alias: "leftOptions",
|
|
1051
1051
|
filters: "{__filters}"
|
|
1052
1052
|
});
|
|
@@ -1076,7 +1076,7 @@
|
|
|
1076
1076
|
// data["&"] = "$$";
|
|
1077
1077
|
|
|
1078
1078
|
const requestAdaptor = `
|
|
1079
|
-
var filters = [
|
|
1079
|
+
var filters = [];
|
|
1080
1080
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
1081
1081
|
var defaultValue = api.data.$value;
|
|
1082
1082
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
@@ -1089,17 +1089,18 @@
|
|
|
1089
1089
|
`;
|
|
1090
1090
|
const adaptor = `
|
|
1091
1091
|
const data = payload.data;
|
|
1092
|
+
const rows = data.leftOptions
|
|
1092
1093
|
data.children = data.children.map(function (child) {
|
|
1093
1094
|
// child.defer = !!(child.children && child.children.length);
|
|
1094
1095
|
child.defer = true;
|
|
1095
1096
|
delete child.children;
|
|
1096
1097
|
return child;
|
|
1097
1098
|
});
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1099
|
+
|
|
1100
|
+
var getTreeOptions = SteedosUI.getTreeOptions
|
|
1101
|
+
data.leftOptions = getTreeOptions(rows);
|
|
1102
|
+
|
|
1103
|
+
|
|
1103
1104
|
var defaultValueOptions = data.defaultValueOptions;
|
|
1104
1105
|
data.children = _.union(data.children, defaultValueOptions);
|
|
1105
1106
|
delete data.defaultValueOptions;
|
|
@@ -2058,7 +2059,7 @@
|
|
|
2058
2059
|
if(visible.trim().startsWith('function')){
|
|
2059
2060
|
return `${visible}.apply({
|
|
2060
2061
|
object: uiSchema
|
|
2061
|
-
}, [objectName, _id, record.recordPermissions, data])`
|
|
2062
|
+
}, [objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data])`
|
|
2062
2063
|
}
|
|
2063
2064
|
return visible;
|
|
2064
2065
|
}
|
|
@@ -4000,6 +4001,19 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
4000
4001
|
if(enable_tree){
|
|
4001
4002
|
const records = payload.data.rows;
|
|
4002
4003
|
const treeRecords = [];
|
|
4004
|
+
|
|
4005
|
+
const getParentIds = (records)=>{
|
|
4006
|
+
const ids = _.map(records, (item)=>{
|
|
4007
|
+
return item._id;
|
|
4008
|
+
});
|
|
4009
|
+
const parents = _.filter(records,(record)=>{
|
|
4010
|
+
return !record.parent || !_.includes(ids,record.parent);
|
|
4011
|
+
})
|
|
4012
|
+
const parentsIds = _.map(parents,(item)=>{
|
|
4013
|
+
return item._id;
|
|
4014
|
+
})
|
|
4015
|
+
return parentsIds;
|
|
4016
|
+
}
|
|
4003
4017
|
const getChildren = (records, childrenIds)=>{
|
|
4004
4018
|
if(!childrenIds){
|
|
4005
4019
|
return;
|
|
@@ -4015,8 +4029,9 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
4015
4029
|
return children;
|
|
4016
4030
|
}
|
|
4017
4031
|
|
|
4032
|
+
const parentIds = getParentIds(records);
|
|
4018
4033
|
_.each(records, (record)=>{
|
|
4019
|
-
if(!record.parent){
|
|
4034
|
+
if(!record.parent || _.includes(parentIds, record._id)){
|
|
4020
4035
|
treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));
|
|
4021
4036
|
}
|
|
4022
4037
|
});
|
|
@@ -5690,7 +5705,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
5690
5705
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
5691
5706
|
disableStatistics: options.queryCount === false
|
|
5692
5707
|
}),
|
|
5693
|
-
filter:
|
|
5708
|
+
filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
|
|
5694
5709
|
};
|
|
5695
5710
|
if(options.formFactor !== 'SMALL'){
|
|
5696
5711
|
Object.assign(bodyProps, {
|
|
@@ -5705,7 +5720,11 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
5705
5720
|
options.queryCount = true; // 禁止翻页的时候, 需要查找总数
|
|
5706
5721
|
}else if(top){
|
|
5707
5722
|
bodyProps.footerToolbar = [];
|
|
5708
|
-
options.
|
|
5723
|
+
if(options.isRelated){
|
|
5724
|
+
options.queryCount = true;
|
|
5725
|
+
}else {
|
|
5726
|
+
options.queryCount = false;
|
|
5727
|
+
}
|
|
5709
5728
|
}
|
|
5710
5729
|
|
|
5711
5730
|
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs, hiddenCount: options.queryCount === false});
|
|
@@ -6253,7 +6272,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
6253
6272
|
// return 'false';
|
|
6254
6273
|
// }
|
|
6255
6274
|
if(visible.trim().startsWith('function')){
|
|
6256
|
-
return `${visible}(objectName, _id, record.recordPermissions, data)`
|
|
6275
|
+
return `${visible}(objectName, _id, typeof record === 'undefined' ? (typeof recordPermissions === 'undefined' ? {} : recordPermissions) : record.recordPermissions, data)`
|
|
6257
6276
|
}
|
|
6258
6277
|
return visible;
|
|
6259
6278
|
}
|
|
@@ -6322,14 +6341,15 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
6322
6341
|
formFactor: "${formFactor}",
|
|
6323
6342
|
context: `\${context}`
|
|
6324
6343
|
},
|
|
6325
|
-
"responseData": {
|
|
6326
|
-
"recordPermissions": "$$"
|
|
6327
|
-
},
|
|
6328
6344
|
headers: {
|
|
6329
6345
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6330
6346
|
},
|
|
6331
6347
|
adaptor: `
|
|
6332
|
-
payload
|
|
6348
|
+
payload = {
|
|
6349
|
+
record: {
|
|
6350
|
+
recordPermissions: payload
|
|
6351
|
+
}
|
|
6352
|
+
};
|
|
6333
6353
|
return payload;
|
|
6334
6354
|
`,
|
|
6335
6355
|
}
|
|
@@ -6741,6 +6761,11 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
6741
6761
|
}else{
|
|
6742
6762
|
filters = [filters, 'and', eventDurationFilters]
|
|
6743
6763
|
}
|
|
6764
|
+
|
|
6765
|
+
if(api.data.$self.additionalFilters){
|
|
6766
|
+
filters.push(api.data.$self.additionalFilters)
|
|
6767
|
+
}
|
|
6768
|
+
|
|
6744
6769
|
var pageSize = api.data.pageSize || 10;
|
|
6745
6770
|
var pageNo = api.data.pageNo || 1;
|
|
6746
6771
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -7204,6 +7229,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
7204
7229
|
"type": "steedos-fullcalendar",
|
|
7205
7230
|
"label": "",
|
|
7206
7231
|
"name": "fullcalendar",
|
|
7232
|
+
"placeholder":"${additionalFilters}",//用于触发reload
|
|
7207
7233
|
"editable": permissions.allowEdit,
|
|
7208
7234
|
"selectable": permissions.allowCreate,
|
|
7209
7235
|
"selectMirror": permissions.allowCreate,
|
|
@@ -7291,8 +7317,8 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
7291
7317
|
/*
|
|
7292
7318
|
* @Author: baozhoutao@steedos.com
|
|
7293
7319
|
* @Date: 2022-07-05 15:55:39
|
|
7294
|
-
* @LastEditors:
|
|
7295
|
-
* @LastEditTime: 2023-03-
|
|
7320
|
+
* @LastEditors: Please set LastEditors
|
|
7321
|
+
* @LastEditTime: 2023-03-30 17:44:53
|
|
7296
7322
|
* @Description:
|
|
7297
7323
|
*/
|
|
7298
7324
|
|
|
@@ -7367,6 +7393,13 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
|
|
|
7367
7393
|
let { top, perPage, hiddenEmptyTable, appId, relatedLabel, className, columns, sort, filters, visible_on } = ctx;
|
|
7368
7394
|
// console.log('getRecordDetailRelatedListSchema==>',objectName,recordId,relatedObjectName)
|
|
7369
7395
|
const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
7396
|
+
if(!relatedObjectUiSchema){
|
|
7397
|
+
// 子表对象不存在时直接返回空值.
|
|
7398
|
+
return {
|
|
7399
|
+
uiSchema: {},
|
|
7400
|
+
amisSchema: {}
|
|
7401
|
+
}
|
|
7402
|
+
}
|
|
7370
7403
|
const { label , fields } = relatedObjectUiSchema;
|
|
7371
7404
|
if(!relatedLabel){
|
|
7372
7405
|
relatedLabel = label;
|