@steedos-widgets/amis-lib 3.6.0-beta.4 → 3.6.0-beta.5
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 +95 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +95 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +26 -23
- package/dist/index.umd.js.map +1 -1
- package/dist/types/workflow/flow.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -545,7 +545,7 @@ function getNameTpl(field, ctx){
|
|
|
545
545
|
if(ctx && ctx.isLookup){
|
|
546
546
|
linkTarget = "target='_blank'";
|
|
547
547
|
}
|
|
548
|
-
return `<a href="${href}" ${linkTarget}>\${${field.name}}</a>`
|
|
548
|
+
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
function getRelatedFieldTpl(field, ctx){
|
|
@@ -1102,7 +1102,7 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
1102
1102
|
* @Author: baozhoutao@steedos.com
|
|
1103
1103
|
* @Date: 2022-10-28 14:15:09
|
|
1104
1104
|
* @LastEditors: liaodaxue
|
|
1105
|
-
* @LastEditTime: 2023-
|
|
1105
|
+
* @LastEditTime: 2023-12-29 10:46:50
|
|
1106
1106
|
* @Description:
|
|
1107
1107
|
*/
|
|
1108
1108
|
|
|
@@ -1156,7 +1156,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1156
1156
|
dataType: "form-data",
|
|
1157
1157
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
1158
1158
|
requestAdaptor: `
|
|
1159
|
-
const
|
|
1159
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1160
|
+
const { _master, global } = superData;
|
|
1160
1161
|
// const { recordId, objectName } = _master;
|
|
1161
1162
|
const { spaceId, userId, user } = global;
|
|
1162
1163
|
/*
|
|
@@ -1174,8 +1175,9 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1174
1175
|
return api;
|
|
1175
1176
|
`,
|
|
1176
1177
|
adaptor: `
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1178
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1179
|
+
const { context:pageContext } = superData;
|
|
1180
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${tableName}/";
|
|
1179
1181
|
payload = {
|
|
1180
1182
|
status: response.status == 200 ? 0 : response.status,
|
|
1181
1183
|
msg: response.statusText,
|
|
@@ -1779,8 +1781,9 @@ async function getQuickEditSchema(field, options){
|
|
|
1779
1781
|
case "avatar":
|
|
1780
1782
|
case "image":
|
|
1781
1783
|
quickEditSchema.body[0].receiver.adaptor = `
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
1785
|
+
const { context:pageContext } = superData;
|
|
1786
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${field.type}s/";
|
|
1784
1787
|
payload = {
|
|
1785
1788
|
status: response.status == 200 ? 0 : response.status,
|
|
1786
1789
|
msg: response.statusText,
|
|
@@ -2443,7 +2446,7 @@ async function getTableOperation(ctx){
|
|
|
2443
2446
|
type: 'steedos-object-button',
|
|
2444
2447
|
name: button.name,
|
|
2445
2448
|
objectName: button.objectName,
|
|
2446
|
-
|
|
2449
|
+
visibleOnAlias: getButtonVisibleOn$1(button),
|
|
2447
2450
|
className: 'antd-Button--default'
|
|
2448
2451
|
});
|
|
2449
2452
|
});
|
|
@@ -2568,7 +2571,8 @@ async function getTableSchema$1(fields, options){
|
|
|
2568
2571
|
}
|
|
2569
2572
|
|
|
2570
2573
|
if(!isLookup && !hiddenColumnOperation){
|
|
2571
|
-
|
|
2574
|
+
const toolbarOperation = await getTableOperation(options);
|
|
2575
|
+
columns.push(toolbarOperation);
|
|
2572
2576
|
}
|
|
2573
2577
|
|
|
2574
2578
|
}
|
|
@@ -5780,6 +5784,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5780
5784
|
`;
|
|
5781
5785
|
const onCancelScript = `
|
|
5782
5786
|
// console.log("===onCancelScript=form==");
|
|
5787
|
+
let isLookup = event.data.isLookup;
|
|
5788
|
+
let __lookupField = event.data.__lookupField;
|
|
5783
5789
|
const scope = event.context.scoped;
|
|
5784
5790
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
5785
5791
|
return n.props.type === "form";
|
|
@@ -5827,7 +5833,20 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5827
5833
|
// });
|
|
5828
5834
|
|
|
5829
5835
|
// 清除__changedFilterFormValues中的值
|
|
5830
|
-
crud && crud.setData({__changedFilterFormValues: {}});
|
|
5836
|
+
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
5837
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
5838
|
+
if(isLookup && __lookupField){
|
|
5839
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
5840
|
+
if(__lookupField.reference_to_field){
|
|
5841
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
5842
|
+
}
|
|
5843
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
5844
|
+
}
|
|
5845
|
+
if(crud){
|
|
5846
|
+
let crudData = crud.getData();
|
|
5847
|
+
crudData[__changedFilterFormValuesKey] = {};
|
|
5848
|
+
crud.setData(crudData);
|
|
5849
|
+
}
|
|
5831
5850
|
filterForm.handleFormSubmit(event);
|
|
5832
5851
|
// crud.handleFilterSubmit(removedValues);
|
|
5833
5852
|
|
|
@@ -7755,7 +7774,12 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7755
7774
|
__changedSearchBoxValues["${keywordsSearchBoxName}"] = event.data["${keywordsSearchBoxName}"];
|
|
7756
7775
|
// crudService && crudService.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7757
7776
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
7758
|
-
crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7777
|
+
// crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
7778
|
+
if(crud){
|
|
7779
|
+
let crudData = crud.getData();
|
|
7780
|
+
crudData.__changedSearchBoxValues = __changedSearchBoxValues;
|
|
7781
|
+
crud.setData(crudData);
|
|
7782
|
+
}
|
|
7759
7783
|
`;
|
|
7760
7784
|
|
|
7761
7785
|
// onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
|
|
@@ -7768,9 +7792,19 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7768
7792
|
// const scope = event.context.scoped;
|
|
7769
7793
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
7770
7794
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
7795
|
+
let isLookup = event.data.isLookup;
|
|
7796
|
+
let __lookupField = event.data.__lookupField;
|
|
7797
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
7798
|
+
if(isLookup && __lookupField){
|
|
7799
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
7800
|
+
if(__lookupField.reference_to_field){
|
|
7801
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
7802
|
+
}
|
|
7803
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
7804
|
+
}
|
|
7771
7805
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
7772
7806
|
setTimeout(function(){
|
|
7773
|
-
filterForm.setValues(event.data
|
|
7807
|
+
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
7774
7808
|
}, 500);
|
|
7775
7809
|
`;
|
|
7776
7810
|
|
|
@@ -7791,8 +7825,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7791
7825
|
"name": keywordsSearchBoxName,
|
|
7792
7826
|
"placeholder": "搜索此列表",
|
|
7793
7827
|
"value": crudKeywords,
|
|
7794
|
-
"clearable": true
|
|
7795
|
-
|
|
7828
|
+
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
7829
|
+
"clearAndSubmit": true,
|
|
7796
7830
|
"searchImediately": false,
|
|
7797
7831
|
"onEvent": {
|
|
7798
7832
|
"search": {
|
|
@@ -8072,6 +8106,9 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8072
8106
|
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
8073
8107
|
`;
|
|
8074
8108
|
let onChangeScript = `
|
|
8109
|
+
let isLookup = event.data.isLookup;
|
|
8110
|
+
let __lookupField = event.data.__lookupField;
|
|
8111
|
+
console.log("==onChangeScript=isLookup===", isLookup);
|
|
8075
8112
|
const scope = event.context.scoped;
|
|
8076
8113
|
// let filterFormValues = event.data;
|
|
8077
8114
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -8083,7 +8120,20 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8083
8120
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
8084
8121
|
// crudService && crudService.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8085
8122
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
8086
|
-
crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8123
|
+
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
8124
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
8125
|
+
if(isLookup && __lookupField){
|
|
8126
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
8127
|
+
if(__lookupField.reference_to_field){
|
|
8128
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
8129
|
+
}
|
|
8130
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
8131
|
+
}
|
|
8132
|
+
if(crud){
|
|
8133
|
+
let crudData = crud.getData();
|
|
8134
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
8135
|
+
crud.setData(crudData);
|
|
8136
|
+
}
|
|
8087
8137
|
`;
|
|
8088
8138
|
return {
|
|
8089
8139
|
"title": "",
|
|
@@ -10481,13 +10531,24 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10481
10531
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
10482
10532
|
|
|
10483
10533
|
source.requestAdaptor = `
|
|
10484
|
-
let
|
|
10534
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
10535
|
+
let __lookupField = api.data.$self.__lookupField;
|
|
10536
|
+
if(__lookupField){
|
|
10537
|
+
let lookupTag = "__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
10538
|
+
if(__lookupField.reference_to_field){
|
|
10539
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
10540
|
+
}
|
|
10541
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
10542
|
+
}
|
|
10543
|
+
let __changedFilterFormValues = api.data.$self[__changedFilterFormValuesKey] || {};
|
|
10485
10544
|
let __changedSearchBoxValues = api.data.$self.__changedSearchBoxValues || {};
|
|
10486
10545
|
// 把表单搜索和快速搜索中的change事件中记录的过滤条件也拼到$self中,是为解决触发搜索请求时,两边输入的过滤条件都带上,即:
|
|
10487
10546
|
// 有时在搜索表单中输入过滤条件事,忘记点击回车键或搜索按钮,而是进一步修改快速搜索框中的关键字点击其中回车键触发搜索
|
|
10488
10547
|
// 这种情况下,触发的搜索请求中没有带上搜索表单中输入的过滤条件。
|
|
10489
10548
|
// 反过来先在快速搜索框中输入过滤条件却不点击其中回车键触发搜索,而是到搜索表单中触发搜索请求也是一样的。
|
|
10490
|
-
|
|
10549
|
+
if(api.data.$self.op !== 'loadOptions'){
|
|
10550
|
+
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10551
|
+
}
|
|
10491
10552
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10492
10553
|
var filters = [];
|
|
10493
10554
|
var pageSize = api.data.pageSize || 10;
|
|
@@ -10694,7 +10755,12 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10694
10755
|
"objectName": refObjectConfig.name,
|
|
10695
10756
|
"uiSchema": refObjectConfig,
|
|
10696
10757
|
"listName": listName,// 需要按视图取可搜索项
|
|
10697
|
-
"isLookup": true
|
|
10758
|
+
"isLookup": true,
|
|
10759
|
+
"__lookupField": {
|
|
10760
|
+
"name": field.name,
|
|
10761
|
+
"reference_to": refObjectConfig.name,
|
|
10762
|
+
"reference_to_field": field.reference_to_field
|
|
10763
|
+
}
|
|
10698
10764
|
});
|
|
10699
10765
|
|
|
10700
10766
|
if(!pickerSchema.onEvent){
|
|
@@ -11063,6 +11129,14 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11063
11129
|
|
|
11064
11130
|
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
11065
11131
|
let enableEnhancedLookup = _$1.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
11132
|
+
let amisVersion = getComparableAmisVersion();
|
|
11133
|
+
if(amisVersion >= 3.6){
|
|
11134
|
+
// amis 3.6.3单选的树picker有严重bug(https://github.com/baidu/amis/issues/9279),先强制使用下拉方式显示
|
|
11135
|
+
// amis 3.6.3多选的树会自动把下层节点,及下下层等所有子节点自动选中,跟amis 3.2不一样,而且目前没有开关,这不适合目前的业务场景,也先强制使用下拉方式显示
|
|
11136
|
+
if(enableEnhancedLookup && refObject.enable_tree){
|
|
11137
|
+
enableEnhancedLookup = false;
|
|
11138
|
+
}
|
|
11139
|
+
}
|
|
11066
11140
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
11067
11141
|
if(enableEnhancedLookup == true){
|
|
11068
11142
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
@@ -14801,8 +14875,8 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
14801
14875
|
/*
|
|
14802
14876
|
* @Author: baozhoutao@steedos.com
|
|
14803
14877
|
* @Date: 2022-09-07 16:20:45
|
|
14804
|
-
* @LastEditors:
|
|
14805
|
-
* @LastEditTime: 2023-
|
|
14878
|
+
* @LastEditors: liaodaxue
|
|
14879
|
+
* @LastEditTime: 2023-12-29 16:06:35
|
|
14806
14880
|
* @Description:
|
|
14807
14881
|
*/
|
|
14808
14882
|
|
|
@@ -15628,7 +15702,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
15628
15702
|
"messages": {
|
|
15629
15703
|
},
|
|
15630
15704
|
"requestAdaptor": `
|
|
15631
|
-
const { context } = api.data;
|
|
15632
15705
|
api.data = {
|
|
15633
15706
|
query: \`
|
|
15634
15707
|
{
|
|
@@ -15651,7 +15724,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
15651
15724
|
`,
|
|
15652
15725
|
"data": {
|
|
15653
15726
|
// "&": "$$",
|
|
15654
|
-
"context": "${context}",
|
|
15727
|
+
// "context": "${context}",
|
|
15655
15728
|
"judge": "${new_judge}",
|
|
15656
15729
|
}
|
|
15657
15730
|
},
|