@steedos-widgets/amis-object 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/amis/AmisGlobalHeader.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +1 -0
- package/dist/amis-object.cjs.js +91 -36
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +91 -36
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +23 -20
- 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.js
CHANGED
|
@@ -5758,6 +5758,14 @@ async function getTableSchema$1(fields, options){
|
|
|
5758
5758
|
|
|
5759
5759
|
}
|
|
5760
5760
|
|
|
5761
|
+
const treeConfig = {};
|
|
5762
|
+
|
|
5763
|
+
if(options.enable_tree){
|
|
5764
|
+
treeConfig.expandConfig = {
|
|
5765
|
+
expand: 'first'
|
|
5766
|
+
};
|
|
5767
|
+
}
|
|
5768
|
+
|
|
5761
5769
|
return {
|
|
5762
5770
|
mode: "table",
|
|
5763
5771
|
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
@@ -5773,6 +5781,7 @@ async function getTableSchema$1(fields, options){
|
|
|
5773
5781
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
5774
5782
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
5775
5783
|
columnsTogglable: false,
|
|
5784
|
+
...treeConfig
|
|
5776
5785
|
}
|
|
5777
5786
|
}
|
|
5778
5787
|
|
|
@@ -6089,17 +6098,6 @@ async function getTableApi(mainObject, fields, options){
|
|
|
6089
6098
|
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
6090
6099
|
assignIndexToTreeRecords(payload.data.rows, '');
|
|
6091
6100
|
}
|
|
6092
|
-
try{
|
|
6093
|
-
setTimeout(() => {
|
|
6094
|
-
let expandBtn = $('.steedos-object-listview-content .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn');
|
|
6095
|
-
if(expandBtn && expandBtn.length > 0 && !expandBtn.hasClass("is-active")){
|
|
6096
|
-
expandBtn[0].click();
|
|
6097
|
-
}
|
|
6098
|
-
}, 600);
|
|
6099
|
-
}
|
|
6100
|
-
catch(ex){
|
|
6101
|
-
console.error("tree数据格式展开异常:", ex);
|
|
6102
|
-
}
|
|
6103
6101
|
}
|
|
6104
6102
|
|
|
6105
6103
|
|
|
@@ -9017,7 +9015,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
9017
9015
|
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
9018
9016
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
9019
9017
|
if(isLookup && __lookupField){
|
|
9020
|
-
let lookupTag = "
|
|
9018
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
9021
9019
|
if(__lookupField.reference_to_field){
|
|
9022
9020
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
9023
9021
|
}
|
|
@@ -9690,7 +9688,10 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
9690
9688
|
"@history_paths.changed": {
|
|
9691
9689
|
"actions": [
|
|
9692
9690
|
{
|
|
9693
|
-
"actionType": "reload"
|
|
9691
|
+
"actionType": "reload",
|
|
9692
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
9693
|
+
"data": {
|
|
9694
|
+
}
|
|
9694
9695
|
}
|
|
9695
9696
|
]
|
|
9696
9697
|
}
|
|
@@ -10977,7 +10978,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
10977
10978
|
let __lookupField = event.data.__lookupField;
|
|
10978
10979
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
10979
10980
|
if(isLookup && __lookupField){
|
|
10980
|
-
let lookupTag = "
|
|
10981
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
10981
10982
|
if(__lookupField.reference_to_field){
|
|
10982
10983
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
10983
10984
|
}
|
|
@@ -11289,13 +11290,13 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11289
11290
|
let onChangeScript = `
|
|
11290
11291
|
let isLookup = event.data.isLookup;
|
|
11291
11292
|
let __lookupField = event.data.__lookupField;
|
|
11292
|
-
console.log("==onChangeScript=isLookup===", isLookup);
|
|
11293
11293
|
const scope = event.context.scoped;
|
|
11294
11294
|
// let filterFormValues = event.data;
|
|
11295
11295
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
11296
11296
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
11297
11297
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
11298
11298
|
let filterFormValues = filterFormService.getData();
|
|
11299
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
11299
11300
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
11300
11301
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
11301
11302
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -11304,7 +11305,7 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
11304
11305
|
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
11305
11306
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
11306
11307
|
if(isLookup && __lookupField){
|
|
11307
|
-
let lookupTag = "
|
|
11308
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
11308
11309
|
if(__lookupField.reference_to_field){
|
|
11309
11310
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
11310
11311
|
}
|
|
@@ -13500,6 +13501,58 @@ function getReferenceToSync(field) {
|
|
|
13500
13501
|
}
|
|
13501
13502
|
|
|
13502
13503
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
13504
|
+
let apiAdaptor = `
|
|
13505
|
+
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
13506
|
+
const records = payload.data.options;
|
|
13507
|
+
let isTreeOptionsComputed = false;
|
|
13508
|
+
if(records.length === 1 && records[0].children){
|
|
13509
|
+
isTreeOptionsComputed = true;
|
|
13510
|
+
}
|
|
13511
|
+
if(isTreeOptionsComputed){
|
|
13512
|
+
return payload;
|
|
13513
|
+
}
|
|
13514
|
+
const treeRecords = [];
|
|
13515
|
+
const getChildren = (records, childrenIds) => {
|
|
13516
|
+
if (!childrenIds) {
|
|
13517
|
+
return;
|
|
13518
|
+
}
|
|
13519
|
+
const children = _.filter(records, (record) => {
|
|
13520
|
+
return _.includes(childrenIds, record.value)
|
|
13521
|
+
});
|
|
13522
|
+
_.each(children, (item) => {
|
|
13523
|
+
if (item.children) {
|
|
13524
|
+
item.children = getChildren(records, item.children)
|
|
13525
|
+
}
|
|
13526
|
+
})
|
|
13527
|
+
return children;
|
|
13528
|
+
}
|
|
13529
|
+
|
|
13530
|
+
const getRoot = (records) => {
|
|
13531
|
+
for (var i = 0; i < records.length; i++) {
|
|
13532
|
+
records[i].noParent = 0;
|
|
13533
|
+
if (!!records[i].parent) {
|
|
13534
|
+
biaozhi = 1
|
|
13535
|
+
for (var j = 0; j < records.length; j++) {
|
|
13536
|
+
if (records[i].parent == records[j].value)
|
|
13537
|
+
biaozhi = 0;
|
|
13538
|
+
}
|
|
13539
|
+
if (biaozhi == 1) records[i].noParent = 1;
|
|
13540
|
+
} else records[i].noParent = 1;
|
|
13541
|
+
}
|
|
13542
|
+
}
|
|
13543
|
+
getRoot(records);
|
|
13544
|
+
console.log(records)
|
|
13545
|
+
|
|
13546
|
+
_.each(records, (record) => {
|
|
13547
|
+
if (record.noParent == 1) {
|
|
13548
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
13549
|
+
}
|
|
13550
|
+
});
|
|
13551
|
+
console.log(treeRecords)
|
|
13552
|
+
|
|
13553
|
+
payload.data.options = treeRecords;
|
|
13554
|
+
return payload;
|
|
13555
|
+
`;
|
|
13503
13556
|
const treeSchema = {
|
|
13504
13557
|
"type": "input-tree",
|
|
13505
13558
|
"className":"steedos-select-user-tree",
|
|
@@ -13510,8 +13563,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
13510
13563
|
"headers": {
|
|
13511
13564
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
13512
13565
|
},
|
|
13513
|
-
"adaptor":
|
|
13514
|
-
"requestAdaptor": "\n ",
|
|
13566
|
+
"adaptor": apiAdaptor,
|
|
13515
13567
|
"data": {
|
|
13516
13568
|
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
13517
13569
|
},
|
|
@@ -13715,7 +13767,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13715
13767
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
13716
13768
|
let __lookupField = api.data.$self.__lookupField;
|
|
13717
13769
|
if(__lookupField){
|
|
13718
|
-
let lookupTag = "
|
|
13770
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
13719
13771
|
if(__lookupField.reference_to_field){
|
|
13720
13772
|
lookupTag += "__" + __lookupField.reference_to_field;
|
|
13721
13773
|
}
|
|
@@ -13867,14 +13919,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13867
13919
|
}
|
|
13868
13920
|
});
|
|
13869
13921
|
payload.data.rows = treeRecords;
|
|
13870
|
-
try{
|
|
13871
|
-
setTimeout(() => {
|
|
13872
|
-
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
|
|
13873
|
-
}, 600);
|
|
13874
|
-
}
|
|
13875
|
-
catch(ex){
|
|
13876
|
-
console.error("tree数据格式展开异常:", ex);
|
|
13877
|
-
}
|
|
13878
13922
|
}
|
|
13879
13923
|
return payload;
|
|
13880
13924
|
`;
|
|
@@ -13901,6 +13945,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
13901
13945
|
labelFieldName,
|
|
13902
13946
|
top: top,
|
|
13903
13947
|
isLookup: true,
|
|
13948
|
+
enable_tree: refObjectConfig.enable_tree,
|
|
13904
13949
|
...ctx
|
|
13905
13950
|
});
|
|
13906
13951
|
|
|
@@ -14312,10 +14357,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
14312
14357
|
let enableEnhancedLookup = _$1__namespace.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
14313
14358
|
let amisVersion = getComparableAmisVersion();
|
|
14314
14359
|
if(amisVersion >= 3.6){
|
|
14315
|
-
// amis 3.6.3
|
|
14316
|
-
// amis 3.6.3
|
|
14317
|
-
|
|
14318
|
-
|
|
14360
|
+
// amis 3.6.3单选和多选的树picker都有bug(https://github.com/baidu/amis/issues/9279,https://github.com/baidu/amis/issues/9295),我们改amis源码修正了
|
|
14361
|
+
// amis 3.6.3多选的下拉树组件有bug,多选树字段的选中值在编辑模式展开树时不会自动勾选树里面的节点,而是始终勾选显示在最外面的选中值选项(即defaultValueOptions),amis 3.2没有这个问题
|
|
14362
|
+
// 这里强制禁用多选下拉树,统一改为弹出树,如果以后需要下拉树功能,可以把下拉树组件改为一次性加载所有树节点数据模式来跳过这个问题
|
|
14363
|
+
if(!enableEnhancedLookup && refObject.enable_tree && field.multiple){
|
|
14364
|
+
enableEnhancedLookup = true;
|
|
14319
14365
|
}
|
|
14320
14366
|
}
|
|
14321
14367
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
@@ -15717,8 +15763,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15717
15763
|
/*
|
|
15718
15764
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15719
15765
|
* @Date: 2023-11-15 09:50:22
|
|
15720
|
-
* @LastEditors:
|
|
15721
|
-
* @LastEditTime:
|
|
15766
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
15767
|
+
* @LastEditTime: 2024-01-02 15:43:50
|
|
15722
15768
|
*/
|
|
15723
15769
|
|
|
15724
15770
|
/**
|
|
@@ -16347,6 +16393,7 @@ async function getButtonActions(props, mode) {
|
|
|
16347
16393
|
// "__parentForm": "${__super.__super || {}}",
|
|
16348
16394
|
// "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
16349
16395
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
16396
|
+
"_master": "${_master}",
|
|
16350
16397
|
"global": "${global}",
|
|
16351
16398
|
"uiSchema": "${uiSchema}",
|
|
16352
16399
|
"index": "${index}",
|
|
@@ -19641,7 +19688,13 @@ var AmisObjectButton = function (props) {
|
|
|
19641
19688
|
}
|
|
19642
19689
|
if (schema) {
|
|
19643
19690
|
//3.6版本的schema.data内多了event变量,影响了组件渲染
|
|
19644
|
-
|
|
19691
|
+
if (schema.data) {
|
|
19692
|
+
delete schema.data.event;
|
|
19693
|
+
}
|
|
19694
|
+
if (renderData) {
|
|
19695
|
+
delete renderData.event;
|
|
19696
|
+
}
|
|
19697
|
+
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
19645
19698
|
}
|
|
19646
19699
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, button && amisSchema ? (React__default["default"].createElement(React__default["default"].Fragment, null, render('body', schema, {
|
|
19647
19700
|
// 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个,
|
|
@@ -21380,7 +21433,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
21380
21433
|
* @Author: baozhoutao@steedos.com
|
|
21381
21434
|
* @Date: 2022-09-01 14:44:57
|
|
21382
21435
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
21383
|
-
* @LastEditTime:
|
|
21436
|
+
* @LastEditTime: 2024-01-04 09:24:11
|
|
21384
21437
|
* @Description:
|
|
21385
21438
|
*/
|
|
21386
21439
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21407,7 +21460,9 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
21407
21460
|
"@history_paths.changed": {
|
|
21408
21461
|
"actions": [
|
|
21409
21462
|
{
|
|
21410
|
-
"actionType": "reload"
|
|
21463
|
+
"actionType": "reload",
|
|
21464
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算
|
|
21465
|
+
"data": {}
|
|
21411
21466
|
}
|
|
21412
21467
|
]
|
|
21413
21468
|
}
|