@steedos-widgets/amis-lib 3.6.0-beta.5 → 3.6.0-beta.7
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 +80 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +19 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +6 -4
- package/dist/types/lib/converter/amis/fields/table.d.ts +3 -1
- package/dist/types/lib/converter/amis/header.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2577,6 +2577,14 @@ async function getTableSchema$1(fields, options){
|
|
|
2577
2577
|
|
|
2578
2578
|
}
|
|
2579
2579
|
|
|
2580
|
+
const treeConfig = {};
|
|
2581
|
+
|
|
2582
|
+
if(options.enable_tree){
|
|
2583
|
+
treeConfig.expandConfig = {
|
|
2584
|
+
expand: 'first'
|
|
2585
|
+
};
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2580
2588
|
return {
|
|
2581
2589
|
mode: "table",
|
|
2582
2590
|
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
@@ -2592,6 +2600,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2592
2600
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
2593
2601
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
2594
2602
|
columnsTogglable: false,
|
|
2603
|
+
...treeConfig
|
|
2595
2604
|
}
|
|
2596
2605
|
}
|
|
2597
2606
|
|
|
@@ -2908,17 +2917,6 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2908
2917
|
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
2909
2918
|
assignIndexToTreeRecords(payload.data.rows, '');
|
|
2910
2919
|
}
|
|
2911
|
-
try{
|
|
2912
|
-
setTimeout(() => {
|
|
2913
|
-
let expandBtn = $('.steedos-object-listview-content .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn');
|
|
2914
|
-
if(expandBtn && expandBtn.length > 0 && !expandBtn.hasClass("is-active")){
|
|
2915
|
-
expandBtn[0].click();
|
|
2916
|
-
}
|
|
2917
|
-
}, 600);
|
|
2918
|
-
}
|
|
2919
|
-
catch(ex){
|
|
2920
|
-
console.error("tree数据格式展开异常:", ex);
|
|
2921
|
-
}
|
|
2922
2920
|
}
|
|
2923
2921
|
|
|
2924
2922
|
|
|
@@ -5836,7 +5834,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5836
5834
|
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
5837
5835
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
5838
5836
|
if(isLookup && __lookupField){
|
|
5839
|
-
let lookupTag = "
|
|
5837
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
5840
5838
|
if(__lookupField.reference_to_field){
|
|
5841
5839
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
5842
5840
|
}
|
|
@@ -6509,7 +6507,10 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6509
6507
|
"@history_paths.changed": {
|
|
6510
6508
|
"actions": [
|
|
6511
6509
|
{
|
|
6512
|
-
"actionType": "reload"
|
|
6510
|
+
"actionType": "reload",
|
|
6511
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
6512
|
+
"data": {
|
|
6513
|
+
}
|
|
6513
6514
|
}
|
|
6514
6515
|
]
|
|
6515
6516
|
}
|
|
@@ -7796,7 +7797,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7796
7797
|
let __lookupField = event.data.__lookupField;
|
|
7797
7798
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
7798
7799
|
if(isLookup && __lookupField){
|
|
7799
|
-
let lookupTag = "
|
|
7800
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
7800
7801
|
if(__lookupField.reference_to_field){
|
|
7801
7802
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
7802
7803
|
}
|
|
@@ -8108,13 +8109,13 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8108
8109
|
let onChangeScript = `
|
|
8109
8110
|
let isLookup = event.data.isLookup;
|
|
8110
8111
|
let __lookupField = event.data.__lookupField;
|
|
8111
|
-
console.log("==onChangeScript=isLookup===", isLookup);
|
|
8112
8112
|
const scope = event.context.scoped;
|
|
8113
8113
|
// let filterFormValues = event.data;
|
|
8114
8114
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8115
8115
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
8116
8116
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
8117
8117
|
let filterFormValues = filterFormService.getData();
|
|
8118
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
8118
8119
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
8119
8120
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
8120
8121
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -8123,7 +8124,7 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8123
8124
|
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8124
8125
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
8125
8126
|
if(isLookup && __lookupField){
|
|
8126
|
-
let lookupTag = "
|
|
8127
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
8127
8128
|
if(__lookupField.reference_to_field){
|
|
8128
8129
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
8129
8130
|
}
|
|
@@ -10319,6 +10320,58 @@ function getReferenceToSync(field) {
|
|
|
10319
10320
|
}
|
|
10320
10321
|
|
|
10321
10322
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
10323
|
+
let apiAdaptor = `
|
|
10324
|
+
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
10325
|
+
const records = payload.data.options;
|
|
10326
|
+
let isTreeOptionsComputed = false;
|
|
10327
|
+
if(records.length === 1 && records[0].children){
|
|
10328
|
+
isTreeOptionsComputed = true;
|
|
10329
|
+
}
|
|
10330
|
+
if(isTreeOptionsComputed){
|
|
10331
|
+
return payload;
|
|
10332
|
+
}
|
|
10333
|
+
const treeRecords = [];
|
|
10334
|
+
const getChildren = (records, childrenIds) => {
|
|
10335
|
+
if (!childrenIds) {
|
|
10336
|
+
return;
|
|
10337
|
+
}
|
|
10338
|
+
const children = _.filter(records, (record) => {
|
|
10339
|
+
return _.includes(childrenIds, record.value)
|
|
10340
|
+
});
|
|
10341
|
+
_.each(children, (item) => {
|
|
10342
|
+
if (item.children) {
|
|
10343
|
+
item.children = getChildren(records, item.children)
|
|
10344
|
+
}
|
|
10345
|
+
})
|
|
10346
|
+
return children;
|
|
10347
|
+
}
|
|
10348
|
+
|
|
10349
|
+
const getRoot = (records) => {
|
|
10350
|
+
for (var i = 0; i < records.length; i++) {
|
|
10351
|
+
records[i].noParent = 0;
|
|
10352
|
+
if (!!records[i].parent) {
|
|
10353
|
+
biaozhi = 1
|
|
10354
|
+
for (var j = 0; j < records.length; j++) {
|
|
10355
|
+
if (records[i].parent == records[j].value)
|
|
10356
|
+
biaozhi = 0;
|
|
10357
|
+
}
|
|
10358
|
+
if (biaozhi == 1) records[i].noParent = 1;
|
|
10359
|
+
} else records[i].noParent = 1;
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
getRoot(records);
|
|
10363
|
+
console.log(records)
|
|
10364
|
+
|
|
10365
|
+
_.each(records, (record) => {
|
|
10366
|
+
if (record.noParent == 1) {
|
|
10367
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
10368
|
+
}
|
|
10369
|
+
});
|
|
10370
|
+
console.log(treeRecords)
|
|
10371
|
+
|
|
10372
|
+
payload.data.options = treeRecords;
|
|
10373
|
+
return payload;
|
|
10374
|
+
`;
|
|
10322
10375
|
const treeSchema = {
|
|
10323
10376
|
"type": "input-tree",
|
|
10324
10377
|
"className":"steedos-select-user-tree",
|
|
@@ -10329,8 +10382,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10329
10382
|
"headers": {
|
|
10330
10383
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10331
10384
|
},
|
|
10332
|
-
"adaptor":
|
|
10333
|
-
"requestAdaptor": "\n ",
|
|
10385
|
+
"adaptor": apiAdaptor,
|
|
10334
10386
|
"data": {
|
|
10335
10387
|
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
10336
10388
|
},
|
|
@@ -10534,7 +10586,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10534
10586
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
10535
10587
|
let __lookupField = api.data.$self.__lookupField;
|
|
10536
10588
|
if(__lookupField){
|
|
10537
|
-
let lookupTag = "
|
|
10589
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
10538
10590
|
if(__lookupField.reference_to_field){
|
|
10539
10591
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
10540
10592
|
}
|
|
@@ -10686,14 +10738,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10686
10738
|
}
|
|
10687
10739
|
});
|
|
10688
10740
|
payload.data.rows = treeRecords;
|
|
10689
|
-
try{
|
|
10690
|
-
setTimeout(() => {
|
|
10691
|
-
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
|
|
10692
|
-
}, 600);
|
|
10693
|
-
}
|
|
10694
|
-
catch(ex){
|
|
10695
|
-
console.error("tree数据格式展开异常:", ex);
|
|
10696
|
-
}
|
|
10697
10741
|
}
|
|
10698
10742
|
return payload;
|
|
10699
10743
|
`;
|
|
@@ -10720,6 +10764,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10720
10764
|
labelFieldName,
|
|
10721
10765
|
top: top,
|
|
10722
10766
|
isLookup: true,
|
|
10767
|
+
enable_tree: refObjectConfig.enable_tree,
|
|
10723
10768
|
...ctx
|
|
10724
10769
|
});
|
|
10725
10770
|
|
|
@@ -11131,10 +11176,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11131
11176
|
let enableEnhancedLookup = _$1.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
11132
11177
|
let amisVersion = getComparableAmisVersion();
|
|
11133
11178
|
if(amisVersion >= 3.6){
|
|
11134
|
-
// amis 3.6.3
|
|
11135
|
-
// amis 3.6.3
|
|
11136
|
-
|
|
11137
|
-
|
|
11179
|
+
// amis 3.6.3单选和多选的树picker都有bug(https://github.com/baidu/amis/issues/9279,https://github.com/baidu/amis/issues/9295),我们改amis源码修正了
|
|
11180
|
+
// amis 3.6.3多选的下拉树组件有bug,多选树字段的选中值在编辑模式展开树时不会自动勾选树里面的节点,而是始终勾选显示在最外面的选中值选项(即defaultValueOptions),amis 3.2没有这个问题
|
|
11181
|
+
// 这里强制禁用多选下拉树,统一改为弹出树,如果以后需要下拉树功能,可以把下拉树组件改为一次性加载所有树节点数据模式来跳过这个问题
|
|
11182
|
+
if(!enableEnhancedLookup && refObject.enable_tree && field.multiple){
|
|
11183
|
+
enableEnhancedLookup = true;
|
|
11138
11184
|
}
|
|
11139
11185
|
}
|
|
11140
11186
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
@@ -12536,8 +12582,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12536
12582
|
/*
|
|
12537
12583
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12538
12584
|
* @Date: 2023-11-15 09:50:22
|
|
12539
|
-
* @LastEditors:
|
|
12540
|
-
* @LastEditTime:
|
|
12585
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12586
|
+
* @LastEditTime: 2024-01-02 15:43:50
|
|
12541
12587
|
*/
|
|
12542
12588
|
|
|
12543
12589
|
/**
|
|
@@ -13166,6 +13212,7 @@ async function getButtonActions(props, mode) {
|
|
|
13166
13212
|
// "__parentForm": "${__super.__super || {}}",
|
|
13167
13213
|
// "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
13168
13214
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
13215
|
+
"_master": "${_master}",
|
|
13169
13216
|
"global": "${global}",
|
|
13170
13217
|
"uiSchema": "${uiSchema}",
|
|
13171
13218
|
"index": "${index}",
|