@steedos-widgets/amis-lib 1.3.22-beta.3 → 1.3.22-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 +82 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +82 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -5765,6 +5765,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5765
5765
|
`;
|
|
5766
5766
|
const onCancelScript = `
|
|
5767
5767
|
// console.log("===onCancelScript=form==");
|
|
5768
|
+
let isLookup = event.data.isLookup;
|
|
5769
|
+
let __lookupField = event.data.__lookupField;
|
|
5768
5770
|
const scope = event.context.scoped;
|
|
5769
5771
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
5770
5772
|
return n.props.type === "form";
|
|
@@ -5812,7 +5814,20 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5812
5814
|
// });
|
|
5813
5815
|
|
|
5814
5816
|
// 清除__changedFilterFormValues中的值
|
|
5815
|
-
crud && crud.setData({__changedFilterFormValues: {}});
|
|
5817
|
+
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
5818
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
5819
|
+
if(isLookup && __lookupField){
|
|
5820
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
5821
|
+
if(__lookupField.reference_to_field){
|
|
5822
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
5823
|
+
}
|
|
5824
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
5825
|
+
}
|
|
5826
|
+
if(crud){
|
|
5827
|
+
let crudData = crud.getData();
|
|
5828
|
+
crudData[__changedFilterFormValuesKey] = {};
|
|
5829
|
+
crud.setData(crudData);
|
|
5830
|
+
}
|
|
5816
5831
|
filterForm.handleFormSubmit(event);
|
|
5817
5832
|
// crud.handleFilterSubmit(removedValues);
|
|
5818
5833
|
|
|
@@ -7740,7 +7755,12 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7740
7755
|
__changedSearchBoxValues["${keywordsSearchBoxName}"] = event.data["${keywordsSearchBoxName}"];
|
|
7741
7756
|
// crudService && crudService.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7742
7757
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
7743
|
-
crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7758
|
+
// crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7759
|
+
if(crud){
|
|
7760
|
+
let crudData = crud.getData();
|
|
7761
|
+
crudData.__changedSearchBoxValues = __changedSearchBoxValues;
|
|
7762
|
+
crud.setData(crudData);
|
|
7763
|
+
}
|
|
7744
7764
|
`;
|
|
7745
7765
|
|
|
7746
7766
|
// onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
|
|
@@ -7753,9 +7773,19 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7753
7773
|
// const scope = event.context.scoped;
|
|
7754
7774
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
7755
7775
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
7776
|
+
let isLookup = event.data.isLookup;
|
|
7777
|
+
let __lookupField = event.data.__lookupField;
|
|
7778
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
7779
|
+
if(isLookup && __lookupField){
|
|
7780
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
7781
|
+
if(__lookupField.reference_to_field){
|
|
7782
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
7783
|
+
}
|
|
7784
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
7785
|
+
}
|
|
7756
7786
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
7757
7787
|
setTimeout(function(){
|
|
7758
|
-
filterForm.setValues(event.data
|
|
7788
|
+
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
7759
7789
|
}, 500);
|
|
7760
7790
|
`;
|
|
7761
7791
|
|
|
@@ -7776,8 +7806,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7776
7806
|
"name": keywordsSearchBoxName,
|
|
7777
7807
|
"placeholder": "搜索此列表",
|
|
7778
7808
|
"value": crudKeywords,
|
|
7779
|
-
"clearable": true
|
|
7780
|
-
|
|
7809
|
+
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
7810
|
+
"clearAndSubmit": true,
|
|
7781
7811
|
"searchImediately": false,
|
|
7782
7812
|
"onEvent": {
|
|
7783
7813
|
"search": {
|
|
@@ -8057,6 +8087,9 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8057
8087
|
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
8058
8088
|
`;
|
|
8059
8089
|
let onChangeScript = `
|
|
8090
|
+
let isLookup = event.data.isLookup;
|
|
8091
|
+
let __lookupField = event.data.__lookupField;
|
|
8092
|
+
console.log("==onChangeScript=isLookup===", isLookup);
|
|
8060
8093
|
const scope = event.context.scoped;
|
|
8061
8094
|
// let filterFormValues = event.data;
|
|
8062
8095
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -8068,7 +8101,20 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8068
8101
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
8069
8102
|
// crudService && crudService.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8070
8103
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
8071
|
-
crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8104
|
+
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8105
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
8106
|
+
if(isLookup && __lookupField){
|
|
8107
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
8108
|
+
if(__lookupField.reference_to_field){
|
|
8109
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
8110
|
+
}
|
|
8111
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
8112
|
+
}
|
|
8113
|
+
if(crud){
|
|
8114
|
+
let crudData = crud.getData();
|
|
8115
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
8116
|
+
crud.setData(crudData);
|
|
8117
|
+
}
|
|
8072
8118
|
`;
|
|
8073
8119
|
return {
|
|
8074
8120
|
"title": "",
|
|
@@ -10460,13 +10506,24 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10460
10506
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
10461
10507
|
|
|
10462
10508
|
source.requestAdaptor = `
|
|
10463
|
-
let
|
|
10509
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
10510
|
+
let __lookupField = api.data.$self.__lookupField;
|
|
10511
|
+
if(__lookupField){
|
|
10512
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
10513
|
+
if(__lookupField.reference_to_field){
|
|
10514
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
10515
|
+
}
|
|
10516
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
10517
|
+
}
|
|
10518
|
+
let __changedFilterFormValues = api.data.$self[__changedFilterFormValuesKey] || {};
|
|
10464
10519
|
let __changedSearchBoxValues = api.data.$self.__changedSearchBoxValues || {};
|
|
10465
10520
|
// 把表单搜索和快速搜索中的change事件中记录的过滤条件也拼到$self中,是为解决触发搜索请求时,两边输入的过滤条件都带上,即:
|
|
10466
10521
|
// 有时在搜索表单中输入过滤条件事,忘记点击回车键或搜索按钮,而是进一步修改快速搜索框中的关键字点击其中回车键触发搜索
|
|
10467
10522
|
// 这种情况下,触发的搜索请求中没有带上搜索表单中输入的过滤条件。
|
|
10468
10523
|
// 反过来先在快速搜索框中输入过滤条件却不点击其中回车键触发搜索,而是到搜索表单中触发搜索请求也是一样的。
|
|
10469
|
-
|
|
10524
|
+
if(api.data.$self.op !== 'loadOptions'){
|
|
10525
|
+
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10526
|
+
}
|
|
10470
10527
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10471
10528
|
var filters = [];
|
|
10472
10529
|
var pageSize = api.data.pageSize || 10;
|
|
@@ -10670,7 +10727,12 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10670
10727
|
"objectName": refObjectConfig.name,
|
|
10671
10728
|
"uiSchema": refObjectConfig,
|
|
10672
10729
|
"listName": listName,// 需要按视图取可搜索项
|
|
10673
|
-
"isLookup": true
|
|
10730
|
+
"isLookup": true,
|
|
10731
|
+
"__lookupField": {
|
|
10732
|
+
"name": field.name,
|
|
10733
|
+
"reference_to": refObjectConfig.name,
|
|
10734
|
+
"reference_to_field": field.reference_to_field
|
|
10735
|
+
}
|
|
10674
10736
|
});
|
|
10675
10737
|
|
|
10676
10738
|
if(!pickerSchema.onEvent){
|
|
@@ -12432,7 +12494,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12432
12494
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12433
12495
|
* @Date: 2023-11-15 09:50:22
|
|
12434
12496
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12435
|
-
* @LastEditTime: 2023-12-
|
|
12497
|
+
* @LastEditTime: 2023-12-26 11:15:04
|
|
12436
12498
|
*/
|
|
12437
12499
|
|
|
12438
12500
|
/**
|
|
@@ -12460,20 +12522,22 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
12460
12522
|
name: field.name,
|
|
12461
12523
|
quickEdit: {
|
|
12462
12524
|
"type": "steedos-field",
|
|
12463
|
-
"config": field,
|
|
12464
|
-
|
|
12525
|
+
"config": Object.assign({}, field, {
|
|
12526
|
+
label: false
|
|
12527
|
+
})
|
|
12465
12528
|
}
|
|
12466
12529
|
}
|
|
12467
12530
|
}
|
|
12468
12531
|
else {
|
|
12469
12532
|
return {
|
|
12470
12533
|
"type": "steedos-field",
|
|
12471
|
-
"config": field,
|
|
12534
|
+
"config": Object.assign({}, field, {
|
|
12535
|
+
label: false
|
|
12536
|
+
}),
|
|
12472
12537
|
"static": true,
|
|
12473
12538
|
"readonly": true,
|
|
12474
12539
|
label: field.label,
|
|
12475
|
-
name: field.name
|
|
12476
|
-
hideLabel: true
|
|
12540
|
+
name: field.name
|
|
12477
12541
|
}
|
|
12478
12542
|
}
|
|
12479
12543
|
}
|
|
@@ -12719,7 +12783,9 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
12719
12783
|
let __wrapperServiceId = "${tableServiceId}";
|
|
12720
12784
|
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
12721
12785
|
let wrapperServiceData = wrapperService.getData();
|
|
12722
|
-
|
|
12786
|
+
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
12787
|
+
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
12788
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
12723
12789
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
12724
12790
|
let mode = "${mode}";
|
|
12725
12791
|
if(mode === "new"){
|