@steedos-widgets/amis-lib 3.6.0-beta.5 → 3.6.0-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 +66 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +66 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +12 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +0 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -5836,7 +5836,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5836
5836
|
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
5837
5837
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
5838
5838
|
if(isLookup && __lookupField){
|
|
5839
|
-
let lookupTag = "
|
|
5839
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
5840
5840
|
if(__lookupField.reference_to_field){
|
|
5841
5841
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
5842
5842
|
}
|
|
@@ -7796,7 +7796,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7796
7796
|
let __lookupField = event.data.__lookupField;
|
|
7797
7797
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
7798
7798
|
if(isLookup && __lookupField){
|
|
7799
|
-
let lookupTag = "
|
|
7799
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
7800
7800
|
if(__lookupField.reference_to_field){
|
|
7801
7801
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
7802
7802
|
}
|
|
@@ -8108,13 +8108,13 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8108
8108
|
let onChangeScript = `
|
|
8109
8109
|
let isLookup = event.data.isLookup;
|
|
8110
8110
|
let __lookupField = event.data.__lookupField;
|
|
8111
|
-
console.log("==onChangeScript=isLookup===", isLookup);
|
|
8112
8111
|
const scope = event.context.scoped;
|
|
8113
8112
|
// let filterFormValues = event.data;
|
|
8114
8113
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8115
8114
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
8116
8115
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
8117
8116
|
let filterFormValues = filterFormService.getData();
|
|
8117
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
8118
8118
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
8119
8119
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
8120
8120
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -8123,7 +8123,7 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8123
8123
|
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8124
8124
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
8125
8125
|
if(isLookup && __lookupField){
|
|
8126
|
-
let lookupTag = "
|
|
8126
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
8127
8127
|
if(__lookupField.reference_to_field){
|
|
8128
8128
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
8129
8129
|
}
|
|
@@ -10319,6 +10319,58 @@ function getReferenceToSync(field) {
|
|
|
10319
10319
|
}
|
|
10320
10320
|
|
|
10321
10321
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
10322
|
+
let apiAdaptor = `
|
|
10323
|
+
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
10324
|
+
const records = payload.data.options;
|
|
10325
|
+
let isTreeOptionsComputed = false;
|
|
10326
|
+
if(records.length === 1 && records[0].children){
|
|
10327
|
+
isTreeOptionsComputed = true;
|
|
10328
|
+
}
|
|
10329
|
+
if(isTreeOptionsComputed){
|
|
10330
|
+
return payload;
|
|
10331
|
+
}
|
|
10332
|
+
const treeRecords = [];
|
|
10333
|
+
const getChildren = (records, childrenIds) => {
|
|
10334
|
+
if (!childrenIds) {
|
|
10335
|
+
return;
|
|
10336
|
+
}
|
|
10337
|
+
const children = _.filter(records, (record) => {
|
|
10338
|
+
return _.includes(childrenIds, record.value)
|
|
10339
|
+
});
|
|
10340
|
+
_.each(children, (item) => {
|
|
10341
|
+
if (item.children) {
|
|
10342
|
+
item.children = getChildren(records, item.children)
|
|
10343
|
+
}
|
|
10344
|
+
})
|
|
10345
|
+
return children;
|
|
10346
|
+
}
|
|
10347
|
+
|
|
10348
|
+
const getRoot = (records) => {
|
|
10349
|
+
for (var i = 0; i < records.length; i++) {
|
|
10350
|
+
records[i].noParent = 0;
|
|
10351
|
+
if (!!records[i].parent) {
|
|
10352
|
+
biaozhi = 1
|
|
10353
|
+
for (var j = 0; j < records.length; j++) {
|
|
10354
|
+
if (records[i].parent == records[j].value)
|
|
10355
|
+
biaozhi = 0;
|
|
10356
|
+
}
|
|
10357
|
+
if (biaozhi == 1) records[i].noParent = 1;
|
|
10358
|
+
} else records[i].noParent = 1;
|
|
10359
|
+
}
|
|
10360
|
+
}
|
|
10361
|
+
getRoot(records);
|
|
10362
|
+
console.log(records)
|
|
10363
|
+
|
|
10364
|
+
_.each(records, (record) => {
|
|
10365
|
+
if (record.noParent == 1) {
|
|
10366
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
10367
|
+
}
|
|
10368
|
+
});
|
|
10369
|
+
console.log(treeRecords)
|
|
10370
|
+
|
|
10371
|
+
payload.data.options = treeRecords;
|
|
10372
|
+
return payload;
|
|
10373
|
+
`;
|
|
10322
10374
|
const treeSchema = {
|
|
10323
10375
|
"type": "input-tree",
|
|
10324
10376
|
"className":"steedos-select-user-tree",
|
|
@@ -10329,8 +10381,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10329
10381
|
"headers": {
|
|
10330
10382
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
10331
10383
|
},
|
|
10332
|
-
"adaptor":
|
|
10333
|
-
"requestAdaptor": "\n ",
|
|
10384
|
+
"adaptor": apiAdaptor,
|
|
10334
10385
|
"data": {
|
|
10335
10386
|
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
10336
10387
|
},
|
|
@@ -10534,7 +10585,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10534
10585
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
10535
10586
|
let __lookupField = api.data.$self.__lookupField;
|
|
10536
10587
|
if(__lookupField){
|
|
10537
|
-
let lookupTag = "
|
|
10588
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
10538
10589
|
if(__lookupField.reference_to_field){
|
|
10539
10590
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
10540
10591
|
}
|
|
@@ -11131,10 +11182,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11131
11182
|
let enableEnhancedLookup = _$1.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
11132
11183
|
let amisVersion = getComparableAmisVersion();
|
|
11133
11184
|
if(amisVersion >= 3.6){
|
|
11134
|
-
// amis 3.6.3
|
|
11135
|
-
// amis 3.6.3
|
|
11136
|
-
|
|
11137
|
-
|
|
11185
|
+
// amis 3.6.3单选和多选的树picker都有bug(https://github.com/baidu/amis/issues/9279,https://github.com/baidu/amis/issues/9295),我们改amis源码修正了
|
|
11186
|
+
// amis 3.6.3多选的下拉树组件有bug,多选树字段的选中值在编辑模式展开树时不会自动勾选树里面的节点,而是始终勾选显示在最外面的选中值选项(即defaultValueOptions),amis 3.2没有这个问题
|
|
11187
|
+
// 这里强制禁用多选下拉树,统一改为弹出树,如果以后需要下拉树功能,可以把下拉树组件改为一次性加载所有树节点数据模式来跳过这个问题
|
|
11188
|
+
if(!enableEnhancedLookup && refObject.enable_tree && field.multiple){
|
|
11189
|
+
enableEnhancedLookup = true;
|
|
11138
11190
|
}
|
|
11139
11191
|
}
|
|
11140
11192
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
@@ -12536,8 +12588,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12536
12588
|
/*
|
|
12537
12589
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12538
12590
|
* @Date: 2023-11-15 09:50:22
|
|
12539
|
-
* @LastEditors:
|
|
12540
|
-
* @LastEditTime:
|
|
12591
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12592
|
+
* @LastEditTime: 2024-01-02 15:43:50
|
|
12541
12593
|
*/
|
|
12542
12594
|
|
|
12543
12595
|
/**
|
|
@@ -13166,6 +13218,7 @@ async function getButtonActions(props, mode) {
|
|
|
13166
13218
|
// "__parentForm": "${__super.__super || {}}",
|
|
13167
13219
|
// "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
13168
13220
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
13221
|
+
"_master": "${_master}",
|
|
13169
13222
|
"global": "${global}",
|
|
13170
13223
|
"uiSchema": "${uiSchema}",
|
|
13171
13224
|
"index": "${index}",
|