@steedos-widgets/sortable 3.6.0-beta.4 → 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/assets.json +5 -5
- package/dist/sortable.cjs.js +146 -20
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +146 -20
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +146 -20
- package/package.json +3 -3
package/dist/sortable.esm.js
CHANGED
|
@@ -54116,7 +54116,7 @@ function getNameTpl(field, ctx){
|
|
|
54116
54116
|
if(ctx && ctx.isLookup){
|
|
54117
54117
|
linkTarget = "target='_blank'";
|
|
54118
54118
|
}
|
|
54119
|
-
return `<a href="${href}" ${linkTarget}>\${${field.name}}</a>`
|
|
54119
|
+
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
54120
54120
|
}
|
|
54121
54121
|
|
|
54122
54122
|
function getRelatedFieldTpl(field, ctx){
|
|
@@ -54441,7 +54441,7 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
54441
54441
|
* @Author: baozhoutao@steedos.com
|
|
54442
54442
|
* @Date: 2022-10-28 14:15:09
|
|
54443
54443
|
* @LastEditors: liaodaxue
|
|
54444
|
-
* @LastEditTime: 2023-
|
|
54444
|
+
* @LastEditTime: 2023-12-29 10:46:50
|
|
54445
54445
|
* @Description:
|
|
54446
54446
|
*/
|
|
54447
54447
|
|
|
@@ -54495,7 +54495,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
54495
54495
|
dataType: "form-data",
|
|
54496
54496
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
54497
54497
|
requestAdaptor: `
|
|
54498
|
-
const
|
|
54498
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
54499
|
+
const { _master, global } = superData;
|
|
54499
54500
|
// const { recordId, objectName } = _master;
|
|
54500
54501
|
const { spaceId, userId, user } = global;
|
|
54501
54502
|
/*
|
|
@@ -54513,8 +54514,9 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
54513
54514
|
return api;
|
|
54514
54515
|
`,
|
|
54515
54516
|
adaptor: `
|
|
54516
|
-
const
|
|
54517
|
-
|
|
54517
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
54518
|
+
const { context:pageContext } = superData;
|
|
54519
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${tableName}/";
|
|
54518
54520
|
payload = {
|
|
54519
54521
|
status: response.status == 200 ? 0 : response.status,
|
|
54520
54522
|
msg: response.statusText,
|
|
@@ -55118,8 +55120,9 @@ async function getQuickEditSchema(field, options){
|
|
|
55118
55120
|
case "avatar":
|
|
55119
55121
|
case "image":
|
|
55120
55122
|
quickEditSchema.body[0].receiver.adaptor = `
|
|
55121
|
-
const
|
|
55122
|
-
|
|
55123
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
55124
|
+
const { context:pageContext } = superData;
|
|
55125
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${field.type}s/";
|
|
55123
55126
|
payload = {
|
|
55124
55127
|
status: response.status == 200 ? 0 : response.status,
|
|
55125
55128
|
msg: response.statusText,
|
|
@@ -55782,7 +55785,7 @@ async function getTableOperation(ctx){
|
|
|
55782
55785
|
type: 'steedos-object-button',
|
|
55783
55786
|
name: button.name,
|
|
55784
55787
|
objectName: button.objectName,
|
|
55785
|
-
|
|
55788
|
+
visibleOnAlias: getButtonVisibleOn$1(button),
|
|
55786
55789
|
className: 'antd-Button--default'
|
|
55787
55790
|
});
|
|
55788
55791
|
});
|
|
@@ -55907,7 +55910,8 @@ async function getTableSchema$1(fields, options){
|
|
|
55907
55910
|
}
|
|
55908
55911
|
|
|
55909
55912
|
if(!isLookup && !hiddenColumnOperation){
|
|
55910
|
-
|
|
55913
|
+
const toolbarOperation = await getTableOperation(options);
|
|
55914
|
+
columns.push(toolbarOperation);
|
|
55911
55915
|
}
|
|
55912
55916
|
|
|
55913
55917
|
}
|
|
@@ -56429,6 +56433,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
56429
56433
|
`;
|
|
56430
56434
|
const onCancelScript = `
|
|
56431
56435
|
// console.log("===onCancelScript=form==");
|
|
56436
|
+
let isLookup = event.data.isLookup;
|
|
56437
|
+
let __lookupField = event.data.__lookupField;
|
|
56432
56438
|
const scope = event.context.scoped;
|
|
56433
56439
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
56434
56440
|
return n.props.type === "form";
|
|
@@ -56476,7 +56482,20 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
56476
56482
|
// });
|
|
56477
56483
|
|
|
56478
56484
|
// 清除__changedFilterFormValues中的值
|
|
56479
|
-
crud && crud.setData({__changedFilterFormValues: {}});
|
|
56485
|
+
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
56486
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
56487
|
+
if(isLookup && __lookupField){
|
|
56488
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
56489
|
+
if(__lookupField.reference_to_field){
|
|
56490
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
56491
|
+
}
|
|
56492
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
56493
|
+
}
|
|
56494
|
+
if(crud){
|
|
56495
|
+
let crudData = crud.getData();
|
|
56496
|
+
crudData[__changedFilterFormValuesKey] = {};
|
|
56497
|
+
crud.setData(crudData);
|
|
56498
|
+
}
|
|
56480
56499
|
filterForm.handleFormSubmit(event);
|
|
56481
56500
|
// crud.handleFilterSubmit(removedValues);
|
|
56482
56501
|
|
|
@@ -57943,7 +57962,12 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
57943
57962
|
__changedSearchBoxValues["${keywordsSearchBoxName}"] = event.data["${keywordsSearchBoxName}"];
|
|
57944
57963
|
// crudService && crudService.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
57945
57964
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
57946
|
-
crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
57965
|
+
// crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
57966
|
+
if(crud){
|
|
57967
|
+
let crudData = crud.getData();
|
|
57968
|
+
crudData.__changedSearchBoxValues = __changedSearchBoxValues;
|
|
57969
|
+
crud.setData(crudData);
|
|
57970
|
+
}
|
|
57947
57971
|
`;
|
|
57948
57972
|
|
|
57949
57973
|
// onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
|
|
@@ -57956,9 +57980,19 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
57956
57980
|
// const scope = event.context.scoped;
|
|
57957
57981
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
57958
57982
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
57983
|
+
let isLookup = event.data.isLookup;
|
|
57984
|
+
let __lookupField = event.data.__lookupField;
|
|
57985
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
57986
|
+
if(isLookup && __lookupField){
|
|
57987
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
57988
|
+
if(__lookupField.reference_to_field){
|
|
57989
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
57990
|
+
}
|
|
57991
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
57992
|
+
}
|
|
57959
57993
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
57960
57994
|
setTimeout(function(){
|
|
57961
|
-
filterForm.setValues(event.data
|
|
57995
|
+
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
57962
57996
|
}, 500);
|
|
57963
57997
|
`;
|
|
57964
57998
|
|
|
@@ -57979,8 +58013,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
57979
58013
|
"name": keywordsSearchBoxName,
|
|
57980
58014
|
"placeholder": "搜索此列表",
|
|
57981
58015
|
"value": crudKeywords,
|
|
57982
|
-
"clearable": true
|
|
57983
|
-
|
|
58016
|
+
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
58017
|
+
"clearAndSubmit": true,
|
|
57984
58018
|
"searchImediately": false,
|
|
57985
58019
|
"onEvent": {
|
|
57986
58020
|
"search": {
|
|
@@ -58260,18 +58294,34 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
58260
58294
|
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
58261
58295
|
`;
|
|
58262
58296
|
let onChangeScript = `
|
|
58297
|
+
let isLookup = event.data.isLookup;
|
|
58298
|
+
let __lookupField = event.data.__lookupField;
|
|
58263
58299
|
const scope = event.context.scoped;
|
|
58264
58300
|
// let filterFormValues = event.data;
|
|
58265
58301
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
58266
58302
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
58267
58303
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
58268
58304
|
let filterFormValues = filterFormService.getData();
|
|
58305
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
58269
58306
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
58270
58307
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
58271
58308
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
58272
58309
|
// crudService && crudService.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
58273
58310
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
58274
|
-
crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
58311
|
+
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
58312
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
58313
|
+
if(isLookup && __lookupField){
|
|
58314
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
58315
|
+
if(__lookupField.reference_to_field){
|
|
58316
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
58317
|
+
}
|
|
58318
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
58319
|
+
}
|
|
58320
|
+
if(crud){
|
|
58321
|
+
let crudData = crud.getData();
|
|
58322
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
58323
|
+
crud.setData(crudData);
|
|
58324
|
+
}
|
|
58275
58325
|
`;
|
|
58276
58326
|
return {
|
|
58277
58327
|
"title": "",
|
|
@@ -58874,6 +58924,58 @@ function getReferenceToSync(field) {
|
|
|
58874
58924
|
}
|
|
58875
58925
|
|
|
58876
58926
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
58927
|
+
let apiAdaptor = `
|
|
58928
|
+
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
58929
|
+
const records = payload.data.options;
|
|
58930
|
+
let isTreeOptionsComputed = false;
|
|
58931
|
+
if(records.length === 1 && records[0].children){
|
|
58932
|
+
isTreeOptionsComputed = true;
|
|
58933
|
+
}
|
|
58934
|
+
if(isTreeOptionsComputed){
|
|
58935
|
+
return payload;
|
|
58936
|
+
}
|
|
58937
|
+
const treeRecords = [];
|
|
58938
|
+
const getChildren = (records, childrenIds) => {
|
|
58939
|
+
if (!childrenIds) {
|
|
58940
|
+
return;
|
|
58941
|
+
}
|
|
58942
|
+
const children = _.filter(records, (record) => {
|
|
58943
|
+
return _.includes(childrenIds, record.value)
|
|
58944
|
+
});
|
|
58945
|
+
_.each(children, (item) => {
|
|
58946
|
+
if (item.children) {
|
|
58947
|
+
item.children = getChildren(records, item.children)
|
|
58948
|
+
}
|
|
58949
|
+
})
|
|
58950
|
+
return children;
|
|
58951
|
+
}
|
|
58952
|
+
|
|
58953
|
+
const getRoot = (records) => {
|
|
58954
|
+
for (var i = 0; i < records.length; i++) {
|
|
58955
|
+
records[i].noParent = 0;
|
|
58956
|
+
if (!!records[i].parent) {
|
|
58957
|
+
biaozhi = 1
|
|
58958
|
+
for (var j = 0; j < records.length; j++) {
|
|
58959
|
+
if (records[i].parent == records[j].value)
|
|
58960
|
+
biaozhi = 0;
|
|
58961
|
+
}
|
|
58962
|
+
if (biaozhi == 1) records[i].noParent = 1;
|
|
58963
|
+
} else records[i].noParent = 1;
|
|
58964
|
+
}
|
|
58965
|
+
}
|
|
58966
|
+
getRoot(records);
|
|
58967
|
+
console.log(records)
|
|
58968
|
+
|
|
58969
|
+
_.each(records, (record) => {
|
|
58970
|
+
if (record.noParent == 1) {
|
|
58971
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
58972
|
+
}
|
|
58973
|
+
});
|
|
58974
|
+
console.log(treeRecords)
|
|
58975
|
+
|
|
58976
|
+
payload.data.options = treeRecords;
|
|
58977
|
+
return payload;
|
|
58978
|
+
`;
|
|
58877
58979
|
const treeSchema = {
|
|
58878
58980
|
"type": "input-tree",
|
|
58879
58981
|
"className":"steedos-select-user-tree",
|
|
@@ -58884,8 +58986,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
58884
58986
|
"headers": {
|
|
58885
58987
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
58886
58988
|
},
|
|
58887
|
-
"adaptor":
|
|
58888
|
-
"requestAdaptor": "\n ",
|
|
58989
|
+
"adaptor": apiAdaptor,
|
|
58889
58990
|
"data": {
|
|
58890
58991
|
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
58891
58992
|
},
|
|
@@ -59086,13 +59187,24 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
59086
59187
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
59087
59188
|
|
|
59088
59189
|
source.requestAdaptor = `
|
|
59089
|
-
let
|
|
59190
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
59191
|
+
let __lookupField = api.data.$self.__lookupField;
|
|
59192
|
+
if(__lookupField){
|
|
59193
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
59194
|
+
if(__lookupField.reference_to_field){
|
|
59195
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
59196
|
+
}
|
|
59197
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
59198
|
+
}
|
|
59199
|
+
let __changedFilterFormValues = api.data.$self[__changedFilterFormValuesKey] || {};
|
|
59090
59200
|
let __changedSearchBoxValues = api.data.$self.__changedSearchBoxValues || {};
|
|
59091
59201
|
// 把表单搜索和快速搜索中的change事件中记录的过滤条件也拼到$self中,是为解决触发搜索请求时,两边输入的过滤条件都带上,即:
|
|
59092
59202
|
// 有时在搜索表单中输入过滤条件事,忘记点击回车键或搜索按钮,而是进一步修改快速搜索框中的关键字点击其中回车键触发搜索
|
|
59093
59203
|
// 这种情况下,触发的搜索请求中没有带上搜索表单中输入的过滤条件。
|
|
59094
59204
|
// 反过来先在快速搜索框中输入过滤条件却不点击其中回车键触发搜索,而是到搜索表单中触发搜索请求也是一样的。
|
|
59095
|
-
|
|
59205
|
+
if(api.data.$self.op !== 'loadOptions'){
|
|
59206
|
+
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
59207
|
+
}
|
|
59096
59208
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
59097
59209
|
var filters = [];
|
|
59098
59210
|
var pageSize = api.data.pageSize || 10;
|
|
@@ -59299,7 +59411,12 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
59299
59411
|
"objectName": refObjectConfig.name,
|
|
59300
59412
|
"uiSchema": refObjectConfig,
|
|
59301
59413
|
"listName": listName,// 需要按视图取可搜索项
|
|
59302
|
-
"isLookup": true
|
|
59414
|
+
"isLookup": true,
|
|
59415
|
+
"__lookupField": {
|
|
59416
|
+
"name": field.name,
|
|
59417
|
+
"reference_to": refObjectConfig.name,
|
|
59418
|
+
"reference_to_field": field.reference_to_field
|
|
59419
|
+
}
|
|
59303
59420
|
});
|
|
59304
59421
|
|
|
59305
59422
|
if(!pickerSchema.onEvent){
|
|
@@ -59668,6 +59785,15 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
59668
59785
|
|
|
59669
59786
|
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
59670
59787
|
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
59788
|
+
let amisVersion = getComparableAmisVersion();
|
|
59789
|
+
if(amisVersion >= 3.6){
|
|
59790
|
+
// amis 3.6.3单选和多选的树picker都有bug(https://github.com/baidu/amis/issues/9279,https://github.com/baidu/amis/issues/9295),我们改amis源码修正了
|
|
59791
|
+
// amis 3.6.3多选的下拉树组件有bug,多选树字段的选中值在编辑模式展开树时不会自动勾选树里面的节点,而是始终勾选显示在最外面的选中值选项(即defaultValueOptions),amis 3.2没有这个问题
|
|
59792
|
+
// 这里强制禁用多选下拉树,统一改为弹出树,如果以后需要下拉树功能,可以把下拉树组件改为一次性加载所有树节点数据模式来跳过这个问题
|
|
59793
|
+
if(!enableEnhancedLookup && refObject.enable_tree && field.multiple){
|
|
59794
|
+
enableEnhancedLookup = true;
|
|
59795
|
+
}
|
|
59796
|
+
}
|
|
59671
59797
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
59672
59798
|
if(enableEnhancedLookup == true){
|
|
59673
59799
|
return await lookupToAmisPicker(field, readonly, ctx);
|