@steedos-widgets/sortable 1.3.22-beta.3 → 3.6.0-beta.10
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 +285 -70
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +285 -70
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +285 -70
- package/package.json +3 -3
package/dist/sortable.umd.js
CHANGED
|
@@ -20280,8 +20280,8 @@
|
|
|
20280
20280
|
/*
|
|
20281
20281
|
* @Author: baozhoutao@steedos.com
|
|
20282
20282
|
* @Date: 2022-07-20 16:29:22
|
|
20283
|
-
* @LastEditors:
|
|
20284
|
-
* @LastEditTime: 2023-
|
|
20283
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20284
|
+
* @LastEditTime: 2023-12-28 14:59:08
|
|
20285
20285
|
* @Description:
|
|
20286
20286
|
*/
|
|
20287
20287
|
|
|
@@ -20338,6 +20338,21 @@
|
|
|
20338
20338
|
return listView;
|
|
20339
20339
|
}
|
|
20340
20340
|
|
|
20341
|
+
|
|
20342
|
+
/**
|
|
20343
|
+
* 获取可比较的amis版本号
|
|
20344
|
+
* @returns 只返回前两位版本,第三位忽略,比如3.6.3返回3.6
|
|
20345
|
+
*/
|
|
20346
|
+
function getComparableAmisVersion() {
|
|
20347
|
+
let amis = (window.amisRequire && window.amisRequire('amis')) || window.Amis;
|
|
20348
|
+
let amisVersion = amis && amis.version;
|
|
20349
|
+
if(amisVersion){
|
|
20350
|
+
let comparableVersions = amisVersion.split(".");
|
|
20351
|
+
let comparableVersion = parseFloat(comparableVersions[0].toString() + "." + comparableVersions[1].toString());
|
|
20352
|
+
return comparableVersion;
|
|
20353
|
+
}
|
|
20354
|
+
}
|
|
20355
|
+
|
|
20341
20356
|
function getNumberTpl(field){
|
|
20342
20357
|
return `<span>\${_display.${field.name}}</span>`
|
|
20343
20358
|
}
|
|
@@ -20406,7 +20421,7 @@
|
|
|
20406
20421
|
if(ctx && ctx.isLookup){
|
|
20407
20422
|
linkTarget = "target='_blank'";
|
|
20408
20423
|
}
|
|
20409
|
-
return `<a href="${href}" ${linkTarget}>\${${field.name}}</a>`
|
|
20424
|
+
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
20410
20425
|
}
|
|
20411
20426
|
|
|
20412
20427
|
function getRelatedFieldTpl(field, ctx){
|
|
@@ -20731,7 +20746,7 @@
|
|
|
20731
20746
|
* @Author: baozhoutao@steedos.com
|
|
20732
20747
|
* @Date: 2022-10-28 14:15:09
|
|
20733
20748
|
* @LastEditors: liaodaxue
|
|
20734
|
-
* @LastEditTime: 2023-
|
|
20749
|
+
* @LastEditTime: 2023-12-29 10:46:50
|
|
20735
20750
|
* @Description:
|
|
20736
20751
|
*/
|
|
20737
20752
|
|
|
@@ -20785,7 +20800,8 @@
|
|
|
20785
20800
|
dataType: "form-data",
|
|
20786
20801
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
20787
20802
|
requestAdaptor: `
|
|
20788
|
-
const
|
|
20803
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
20804
|
+
const { _master, global } = superData;
|
|
20789
20805
|
// const { recordId, objectName } = _master;
|
|
20790
20806
|
const { spaceId, userId, user } = global;
|
|
20791
20807
|
/*
|
|
@@ -20803,8 +20819,9 @@
|
|
|
20803
20819
|
return api;
|
|
20804
20820
|
`,
|
|
20805
20821
|
adaptor: `
|
|
20806
|
-
const
|
|
20807
|
-
|
|
20822
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
20823
|
+
const { context:pageContext } = superData;
|
|
20824
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${tableName}/";
|
|
20808
20825
|
payload = {
|
|
20809
20826
|
status: response.status == 200 ? 0 : response.status,
|
|
20810
20827
|
msg: response.statusText,
|
|
@@ -21270,7 +21287,6 @@
|
|
|
21270
21287
|
{
|
|
21271
21288
|
"actionType": "custom",
|
|
21272
21289
|
"script": `
|
|
21273
|
-
|
|
21274
21290
|
var _display = _.cloneDeep(event.data._display);
|
|
21275
21291
|
${displayField}
|
|
21276
21292
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
@@ -21408,8 +21424,9 @@
|
|
|
21408
21424
|
case "avatar":
|
|
21409
21425
|
case "image":
|
|
21410
21426
|
quickEditSchema.body[0].receiver.adaptor = `
|
|
21411
|
-
const
|
|
21412
|
-
|
|
21427
|
+
const superData = (typeof context != 'undefined') ? context : api.body;
|
|
21428
|
+
const { context:pageContext } = superData;
|
|
21429
|
+
var rootUrl = pageContext.rootUrl + "/api/files/${field.type}s/";
|
|
21413
21430
|
payload = {
|
|
21414
21431
|
status: response.status == 200 ? 0 : response.status,
|
|
21415
21432
|
msg: response.statusText,
|
|
@@ -21440,9 +21457,26 @@
|
|
|
21440
21457
|
"onEvent":{
|
|
21441
21458
|
"init":{
|
|
21442
21459
|
"actions":[
|
|
21460
|
+
//amis3.6无法从数据域中直接拿到正确的selectitems,需要通过crud组件的getSelected()函数获取
|
|
21461
|
+
{
|
|
21462
|
+
"actionType": "custom",
|
|
21463
|
+
"script": `
|
|
21464
|
+
crudScoped = event.context.scoped.getComponentById('${options.crudId}');
|
|
21465
|
+
const selectedItems = crudScoped && crudScoped.control.getSelected();
|
|
21466
|
+
doAction({
|
|
21467
|
+
"componentId": "${quickEditId}",
|
|
21468
|
+
"actionType": "setValue",
|
|
21469
|
+
"args": {
|
|
21470
|
+
"value": {
|
|
21471
|
+
selectedItems
|
|
21472
|
+
}
|
|
21473
|
+
}
|
|
21474
|
+
});
|
|
21475
|
+
`
|
|
21476
|
+
},
|
|
21443
21477
|
{
|
|
21444
21478
|
"actionType": "setValue",
|
|
21445
|
-
"componentId":
|
|
21479
|
+
"componentId": quickEditId,
|
|
21446
21480
|
"args": {
|
|
21447
21481
|
"value":{
|
|
21448
21482
|
"quickedit_record_permissions_loading": true
|
|
@@ -21467,7 +21501,7 @@
|
|
|
21467
21501
|
},
|
|
21468
21502
|
{
|
|
21469
21503
|
"actionType": "setValue",
|
|
21470
|
-
"componentId":
|
|
21504
|
+
"componentId": quickEditId,
|
|
21471
21505
|
"args": {
|
|
21472
21506
|
"value":{
|
|
21473
21507
|
"quickedit_record_permissions_loading": false
|
|
@@ -21476,7 +21510,7 @@
|
|
|
21476
21510
|
},
|
|
21477
21511
|
{
|
|
21478
21512
|
"actionType": "setValue",
|
|
21479
|
-
"componentId":
|
|
21513
|
+
"componentId": quickEditId,
|
|
21480
21514
|
"args": {
|
|
21481
21515
|
"value":{
|
|
21482
21516
|
"quickedit_record_permissions": "${event.data}"
|
|
@@ -21655,8 +21689,6 @@
|
|
|
21655
21689
|
async function getTableColumns(fields, options){
|
|
21656
21690
|
const columns = [];
|
|
21657
21691
|
if(!options.isLookup && !options.isInputTable){
|
|
21658
|
-
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
21659
|
-
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
21660
21692
|
if(!options.enable_tree){
|
|
21661
21693
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
21662
21694
|
}
|
|
@@ -21814,8 +21846,8 @@
|
|
|
21814
21846
|
const href = Router.getObjectDetailPath({
|
|
21815
21847
|
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
21816
21848
|
});
|
|
21817
|
-
columns[
|
|
21818
|
-
columns[
|
|
21849
|
+
columns[0].type = "tpl";
|
|
21850
|
+
columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
|
|
21819
21851
|
}
|
|
21820
21852
|
return columns;
|
|
21821
21853
|
}
|
|
@@ -22074,7 +22106,7 @@
|
|
|
22074
22106
|
type: 'steedos-object-button',
|
|
22075
22107
|
name: button.name,
|
|
22076
22108
|
objectName: button.objectName,
|
|
22077
|
-
|
|
22109
|
+
visibleOnAlias: getButtonVisibleOn$1(button),
|
|
22078
22110
|
className: 'antd-Button--default'
|
|
22079
22111
|
});
|
|
22080
22112
|
});
|
|
@@ -22199,8 +22231,18 @@
|
|
|
22199
22231
|
}
|
|
22200
22232
|
|
|
22201
22233
|
if(!isLookup && !hiddenColumnOperation){
|
|
22202
|
-
|
|
22234
|
+
const toolbarOperation = await getTableOperation(options);
|
|
22235
|
+
columns.push(toolbarOperation);
|
|
22203
22236
|
}
|
|
22237
|
+
|
|
22238
|
+
}
|
|
22239
|
+
|
|
22240
|
+
const treeConfig = {};
|
|
22241
|
+
|
|
22242
|
+
if(options.enable_tree){
|
|
22243
|
+
treeConfig.expandConfig = {
|
|
22244
|
+
expand: 'first'
|
|
22245
|
+
};
|
|
22204
22246
|
}
|
|
22205
22247
|
|
|
22206
22248
|
return {
|
|
@@ -22218,6 +22260,7 @@
|
|
|
22218
22260
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
22219
22261
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
22220
22262
|
columnsTogglable: false,
|
|
22263
|
+
...treeConfig
|
|
22221
22264
|
}
|
|
22222
22265
|
}
|
|
22223
22266
|
|
|
@@ -22682,12 +22725,16 @@
|
|
|
22682
22725
|
// }
|
|
22683
22726
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
22684
22727
|
// 点击搜索的时候自动收起搜索栏
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22728
|
+
//触发amis crud 高度重算
|
|
22729
|
+
doAction({
|
|
22730
|
+
"actionType": "broadcast",
|
|
22731
|
+
"args": {
|
|
22732
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
22733
|
+
},
|
|
22734
|
+
"data": {
|
|
22735
|
+
"timeOut": 500
|
|
22736
|
+
}
|
|
22737
|
+
});
|
|
22691
22738
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
22692
22739
|
return n.props.type === "service";
|
|
22693
22740
|
});
|
|
@@ -22720,6 +22767,8 @@
|
|
|
22720
22767
|
`;
|
|
22721
22768
|
const onCancelScript = `
|
|
22722
22769
|
// console.log("===onCancelScript=form==");
|
|
22770
|
+
let isLookup = event.data.isLookup;
|
|
22771
|
+
let __lookupField = event.data.__lookupField;
|
|
22723
22772
|
const scope = event.context.scoped;
|
|
22724
22773
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
22725
22774
|
return n.props.type === "form";
|
|
@@ -22767,16 +22816,36 @@
|
|
|
22767
22816
|
// });
|
|
22768
22817
|
|
|
22769
22818
|
// 清除__changedFilterFormValues中的值
|
|
22770
|
-
crud && crud.setData({__changedFilterFormValues: {}});
|
|
22819
|
+
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
22820
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
22821
|
+
if(isLookup && __lookupField){
|
|
22822
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
22823
|
+
if(__lookupField.reference_to_field){
|
|
22824
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
22825
|
+
}
|
|
22826
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
22827
|
+
}
|
|
22828
|
+
if(crud){
|
|
22829
|
+
let crudData = crud.getData();
|
|
22830
|
+
crudData[__changedFilterFormValuesKey] = {};
|
|
22831
|
+
crud.setData(crudData);
|
|
22832
|
+
}
|
|
22771
22833
|
filterForm.handleFormSubmit(event);
|
|
22772
22834
|
// crud.handleFilterSubmit(removedValues);
|
|
22773
22835
|
|
|
22774
22836
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
22775
22837
|
filterFormService.setData({showFieldsFilter: !!!filterFormService.props.data.showFieldsFilter});
|
|
22776
22838
|
//触发amis crud 高度重算
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22839
|
+
doAction({
|
|
22840
|
+
"actionType": "broadcast",
|
|
22841
|
+
"args": {
|
|
22842
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
22843
|
+
},
|
|
22844
|
+
"data": {
|
|
22845
|
+
"timeOut": 100
|
|
22846
|
+
}
|
|
22847
|
+
});
|
|
22848
|
+
|
|
22780
22849
|
// 移除搜索按钮上的红点
|
|
22781
22850
|
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
22782
22851
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -22933,9 +23002,15 @@
|
|
|
22933
23002
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
22934
23003
|
}
|
|
22935
23004
|
//触发amis crud 高度重算
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
23005
|
+
doAction({
|
|
23006
|
+
"actionType": "broadcast",
|
|
23007
|
+
"args": {
|
|
23008
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
23009
|
+
},
|
|
23010
|
+
"data": {
|
|
23011
|
+
"timeOut": 100
|
|
23012
|
+
}
|
|
23013
|
+
});
|
|
22939
23014
|
// ===END===
|
|
22940
23015
|
`;
|
|
22941
23016
|
return {
|
|
@@ -24177,13 +24252,16 @@ const filterService = filterForm.context.getComponents().find(function(n){
|
|
|
24177
24252
|
});
|
|
24178
24253
|
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
24179
24254
|
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
}
|
|
24186
|
-
|
|
24255
|
+
//触发amis crud 高度重算
|
|
24256
|
+
doAction({
|
|
24257
|
+
"actionType": "broadcast",
|
|
24258
|
+
"args": {
|
|
24259
|
+
"eventName": "@height.changed." + event.data.objectName
|
|
24260
|
+
},
|
|
24261
|
+
"data": {
|
|
24262
|
+
"timeOut": 1000
|
|
24263
|
+
}
|
|
24264
|
+
});
|
|
24187
24265
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
24188
24266
|
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
24189
24267
|
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
@@ -24234,7 +24312,12 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24234
24312
|
__changedSearchBoxValues["${keywordsSearchBoxName}"] = event.data["${keywordsSearchBoxName}"];
|
|
24235
24313
|
// crudService && crudService.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
24236
24314
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
24237
|
-
crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
24315
|
+
// crud && crud.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
24316
|
+
if(crud){
|
|
24317
|
+
let crudData = crud.getData();
|
|
24318
|
+
crudData.__changedSearchBoxValues = __changedSearchBoxValues;
|
|
24319
|
+
crud.setData(crudData);
|
|
24320
|
+
}
|
|
24238
24321
|
`;
|
|
24239
24322
|
|
|
24240
24323
|
// onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
|
|
@@ -24247,9 +24330,19 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24247
24330
|
// const scope = event.context.scoped;
|
|
24248
24331
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
24249
24332
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
24333
|
+
let isLookup = event.data.isLookup;
|
|
24334
|
+
let __lookupField = event.data.__lookupField;
|
|
24335
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
24336
|
+
if(isLookup && __lookupField){
|
|
24337
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
24338
|
+
if(__lookupField.reference_to_field){
|
|
24339
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
24340
|
+
}
|
|
24341
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
24342
|
+
}
|
|
24250
24343
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
24251
24344
|
setTimeout(function(){
|
|
24252
|
-
filterForm.setValues(event.data
|
|
24345
|
+
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
24253
24346
|
}, 500);
|
|
24254
24347
|
`;
|
|
24255
24348
|
|
|
@@ -24270,8 +24363,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24270
24363
|
"name": keywordsSearchBoxName,
|
|
24271
24364
|
"placeholder": "搜索此列表",
|
|
24272
24365
|
"value": crudKeywords,
|
|
24273
|
-
"clearable": true
|
|
24274
|
-
|
|
24366
|
+
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
24367
|
+
"clearAndSubmit": true,
|
|
24275
24368
|
"searchImediately": false,
|
|
24276
24369
|
"onEvent": {
|
|
24277
24370
|
"search": {
|
|
@@ -24532,12 +24625,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24532
24625
|
return;
|
|
24533
24626
|
}
|
|
24534
24627
|
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24628
|
+
//触发amis crud 高度重算
|
|
24629
|
+
doAction({
|
|
24630
|
+
"actionType": "broadcast",
|
|
24631
|
+
"args": {
|
|
24632
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
24633
|
+
},
|
|
24634
|
+
"data": {
|
|
24635
|
+
"timeOut": 1000
|
|
24636
|
+
}
|
|
24637
|
+
});
|
|
24541
24638
|
resizeWindow();
|
|
24542
24639
|
const scope = event.context.scoped;
|
|
24543
24640
|
// let filterFormValues = event.data;
|
|
@@ -24551,18 +24648,34 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24551
24648
|
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
24552
24649
|
`;
|
|
24553
24650
|
let onChangeScript = `
|
|
24651
|
+
let isLookup = event.data.isLookup;
|
|
24652
|
+
let __lookupField = event.data.__lookupField;
|
|
24554
24653
|
const scope = event.context.scoped;
|
|
24555
24654
|
// let filterFormValues = event.data;
|
|
24556
24655
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
24557
24656
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
24558
24657
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
24559
24658
|
let filterFormValues = filterFormService.getData();
|
|
24659
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
24560
24660
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
24561
24661
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
24562
24662
|
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
24563
24663
|
// crudService && crudService.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
24564
24664
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
24565
|
-
crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
24665
|
+
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
24666
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
24667
|
+
if(isLookup && __lookupField){
|
|
24668
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
24669
|
+
if(__lookupField.reference_to_field){
|
|
24670
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
24671
|
+
}
|
|
24672
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
24673
|
+
}
|
|
24674
|
+
if(crud){
|
|
24675
|
+
let crudData = crud.getData();
|
|
24676
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
24677
|
+
crud.setData(crudData);
|
|
24678
|
+
}
|
|
24566
24679
|
`;
|
|
24567
24680
|
return {
|
|
24568
24681
|
"title": "",
|
|
@@ -25165,6 +25278,60 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25165
25278
|
}
|
|
25166
25279
|
|
|
25167
25280
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
25281
|
+
let apiAdaptor = `
|
|
25282
|
+
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
25283
|
+
const records = payload.data.options;
|
|
25284
|
+
let isTreeOptionsComputed = false;
|
|
25285
|
+
if(records.length === 1 && records[0].children){
|
|
25286
|
+
isTreeOptionsComputed = true;
|
|
25287
|
+
}
|
|
25288
|
+
if(isTreeOptionsComputed){
|
|
25289
|
+
return payload;
|
|
25290
|
+
}
|
|
25291
|
+
const treeRecords = [];
|
|
25292
|
+
const getChildren = (records, childrenIds) => {
|
|
25293
|
+
if (!childrenIds) {
|
|
25294
|
+
return;
|
|
25295
|
+
}
|
|
25296
|
+
const children = _.filter(records, (record) => {
|
|
25297
|
+
return _.includes(childrenIds, record.value)
|
|
25298
|
+
});
|
|
25299
|
+
_.each(children, (item) => {
|
|
25300
|
+
if (item.children) {
|
|
25301
|
+
item.children = getChildren(records, item.children)
|
|
25302
|
+
}else{
|
|
25303
|
+
item.children = [];
|
|
25304
|
+
}
|
|
25305
|
+
})
|
|
25306
|
+
return children;
|
|
25307
|
+
}
|
|
25308
|
+
|
|
25309
|
+
const getRoot = (records) => {
|
|
25310
|
+
for (var i = 0; i < records.length; i++) {
|
|
25311
|
+
records[i].noParent = 0;
|
|
25312
|
+
if (!!records[i].parent) {
|
|
25313
|
+
biaozhi = 1
|
|
25314
|
+
for (var j = 0; j < records.length; j++) {
|
|
25315
|
+
if (records[i].parent == records[j].value)
|
|
25316
|
+
biaozhi = 0;
|
|
25317
|
+
}
|
|
25318
|
+
if (biaozhi == 1) records[i].noParent = 1;
|
|
25319
|
+
} else records[i].noParent = 1;
|
|
25320
|
+
}
|
|
25321
|
+
}
|
|
25322
|
+
getRoot(records);
|
|
25323
|
+
console.log(records)
|
|
25324
|
+
|
|
25325
|
+
_.each(records, (record) => {
|
|
25326
|
+
if (record.noParent == 1) {
|
|
25327
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
25328
|
+
}
|
|
25329
|
+
});
|
|
25330
|
+
console.log(treeRecords)
|
|
25331
|
+
|
|
25332
|
+
payload.data.options = treeRecords;
|
|
25333
|
+
return payload;
|
|
25334
|
+
`;
|
|
25168
25335
|
const treeSchema = {
|
|
25169
25336
|
"type": "input-tree",
|
|
25170
25337
|
"className":"steedos-select-user-tree",
|
|
@@ -25175,8 +25342,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25175
25342
|
"headers": {
|
|
25176
25343
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
25177
25344
|
},
|
|
25178
|
-
"adaptor":
|
|
25179
|
-
"requestAdaptor": "\n ",
|
|
25345
|
+
"adaptor": apiAdaptor,
|
|
25180
25346
|
"data": {
|
|
25181
25347
|
"query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}"
|
|
25182
25348
|
},
|
|
@@ -25377,13 +25543,24 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25377
25543
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
25378
25544
|
|
|
25379
25545
|
source.requestAdaptor = `
|
|
25380
|
-
let
|
|
25546
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
25547
|
+
let __lookupField = api.data.$self.__lookupField;
|
|
25548
|
+
if(__lookupField){
|
|
25549
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
25550
|
+
if(__lookupField.reference_to_field){
|
|
25551
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
25552
|
+
}
|
|
25553
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
25554
|
+
}
|
|
25555
|
+
let __changedFilterFormValues = api.data.$self[__changedFilterFormValuesKey] || {};
|
|
25381
25556
|
let __changedSearchBoxValues = api.data.$self.__changedSearchBoxValues || {};
|
|
25382
25557
|
// 把表单搜索和快速搜索中的change事件中记录的过滤条件也拼到$self中,是为解决触发搜索请求时,两边输入的过滤条件都带上,即:
|
|
25383
25558
|
// 有时在搜索表单中输入过滤条件事,忘记点击回车键或搜索按钮,而是进一步修改快速搜索框中的关键字点击其中回车键触发搜索
|
|
25384
25559
|
// 这种情况下,触发的搜索请求中没有带上搜索表单中输入的过滤条件。
|
|
25385
25560
|
// 反过来先在快速搜索框中输入过滤条件却不点击其中回车键触发搜索,而是到搜索表单中触发搜索请求也是一样的。
|
|
25386
|
-
|
|
25561
|
+
if(api.data.$self.op !== 'loadOptions'){
|
|
25562
|
+
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
25563
|
+
}
|
|
25387
25564
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
25388
25565
|
var filters = [];
|
|
25389
25566
|
var pageSize = api.data.pageSize || 10;
|
|
@@ -25478,8 +25655,19 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25478
25655
|
})
|
|
25479
25656
|
payload.data.rows = rows;
|
|
25480
25657
|
*/
|
|
25658
|
+
if(enable_tree){
|
|
25659
|
+
const rows = _.map(payload.data.rows, (item)=>{
|
|
25660
|
+
delete item.children;
|
|
25661
|
+
delete item.parent;
|
|
25662
|
+
return item;
|
|
25663
|
+
})
|
|
25664
|
+
payload.data.rows = rows;
|
|
25665
|
+
}
|
|
25481
25666
|
return payload;
|
|
25482
25667
|
}
|
|
25668
|
+
if(!payload.data.rows){
|
|
25669
|
+
payload.data.rows = [];
|
|
25670
|
+
}
|
|
25483
25671
|
if(enable_tree){
|
|
25484
25672
|
const records = payload.data.rows;
|
|
25485
25673
|
const treeRecords = [];
|
|
@@ -25506,6 +25694,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25506
25694
|
_.each(children, (item)=>{
|
|
25507
25695
|
if(item.children){
|
|
25508
25696
|
item.children = getChildren(records, item.children)
|
|
25697
|
+
}else{
|
|
25698
|
+
item.children = [];
|
|
25509
25699
|
}
|
|
25510
25700
|
})
|
|
25511
25701
|
return children;
|
|
@@ -25518,14 +25708,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25518
25708
|
}
|
|
25519
25709
|
});
|
|
25520
25710
|
payload.data.rows = treeRecords;
|
|
25521
|
-
try{
|
|
25522
|
-
setTimeout(() => {
|
|
25523
|
-
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
|
|
25524
|
-
}, 600);
|
|
25525
|
-
}
|
|
25526
|
-
catch(ex){
|
|
25527
|
-
console.error("tree数据格式展开异常:", ex);
|
|
25528
|
-
}
|
|
25529
25711
|
}
|
|
25530
25712
|
return payload;
|
|
25531
25713
|
`;
|
|
@@ -25552,6 +25734,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25552
25734
|
labelFieldName,
|
|
25553
25735
|
top: top,
|
|
25554
25736
|
isLookup: true,
|
|
25737
|
+
enable_tree: refObjectConfig.enable_tree,
|
|
25555
25738
|
...ctx
|
|
25556
25739
|
});
|
|
25557
25740
|
|
|
@@ -25567,7 +25750,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25567
25750
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
25568
25751
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
25569
25752
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
25570
|
-
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
25753
|
+
let isHasFilters = (field.filters || field.filtersFunction || field._filtersFunction) ? true : false;
|
|
25571
25754
|
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
25572
25755
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
25573
25756
|
new_button.align = "right";
|
|
@@ -25587,7 +25770,12 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25587
25770
|
"objectName": refObjectConfig.name,
|
|
25588
25771
|
"uiSchema": refObjectConfig,
|
|
25589
25772
|
"listName": listName,// 需要按视图取可搜索项
|
|
25590
|
-
"isLookup": true
|
|
25773
|
+
"isLookup": true,
|
|
25774
|
+
"__lookupField": {
|
|
25775
|
+
"name": field.name,
|
|
25776
|
+
"reference_to": refObjectConfig.name,
|
|
25777
|
+
"reference_to_field": field.reference_to_field
|
|
25778
|
+
}
|
|
25591
25779
|
});
|
|
25592
25780
|
|
|
25593
25781
|
if(!pickerSchema.onEvent){
|
|
@@ -25760,7 +25948,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25760
25948
|
sendOn.push(`this.${fName}`);
|
|
25761
25949
|
});
|
|
25762
25950
|
if(depend_on.length > 0){
|
|
25763
|
-
apiInfo.url = `${apiInfo.url}
|
|
25951
|
+
apiInfo.url = `${apiInfo.url}&${depend_on.join('&')}`;
|
|
25764
25952
|
apiInfo.sendOn = `${sendOn.join(' && ')}`;
|
|
25765
25953
|
}
|
|
25766
25954
|
}
|
|
@@ -25868,6 +26056,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25868
26056
|
autoComplete: apiInfo,
|
|
25869
26057
|
searchable: true,
|
|
25870
26058
|
};
|
|
26059
|
+
let amisVersion = getComparableAmisVersion();
|
|
26060
|
+
if(amisVersion >= 3.6){
|
|
26061
|
+
// amis 3.6中不加source会造成子表组件中弹出行编辑窗口的lookup字段有时不请求接口(概率现象,同一个地方反复操作有时请求有时不请求)
|
|
26062
|
+
// 但是同时配置autoComplete和source会多请求一次接口
|
|
26063
|
+
// TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
|
|
26064
|
+
data.source = apiInfo;
|
|
26065
|
+
}
|
|
25871
26066
|
//删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
|
|
25872
26067
|
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
25873
26068
|
<span role='img' aria-label='smile' class='anticon anticon-smile'>
|
|
@@ -25949,18 +26144,37 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25949
26144
|
|
|
25950
26145
|
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
25951
26146
|
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
26147
|
+
let amisVersion = getComparableAmisVersion();
|
|
26148
|
+
if(amisVersion >= 3.6){
|
|
26149
|
+
// amis 3.6.3单选和多选的树picker都有bug(https://github.com/baidu/amis/issues/9279,https://github.com/baidu/amis/issues/9295),我们改amis源码修正了
|
|
26150
|
+
// amis 3.6.3多选的下拉树组件有bug,多选树字段的选中值在编辑模式展开树时不会自动勾选树里面的节点,而是始终勾选显示在最外面的选中值选项(即defaultValueOptions),amis 3.2没有这个问题
|
|
26151
|
+
// 这里强制禁用多选下拉树,统一改为弹出树,如果以后需要下拉树功能,可以把下拉树组件改为一次性加载所有树节点数据模式来跳过这个问题
|
|
26152
|
+
if(!enableEnhancedLookup && refObject.enable_tree && field.multiple){
|
|
26153
|
+
enableEnhancedLookup = true;
|
|
26154
|
+
}
|
|
26155
|
+
}
|
|
26156
|
+
let amisSchema;
|
|
25952
26157
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
25953
26158
|
if(enableEnhancedLookup == true){
|
|
25954
|
-
|
|
26159
|
+
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
25955
26160
|
}else if(refObject.enable_tree) {
|
|
25956
|
-
|
|
26161
|
+
amisSchema = await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
25957
26162
|
labelField: referenceTo.labelField?.name || 'name',
|
|
25958
26163
|
valueField: referenceTo.valueField?.name || '_id',
|
|
25959
26164
|
objectName: referenceTo.objectName
|
|
25960
26165
|
}));
|
|
25961
26166
|
}else {
|
|
25962
|
-
|
|
26167
|
+
amisSchema = await lookupToAmisSelect(field, readonly, ctx);
|
|
25963
26168
|
}
|
|
26169
|
+
let refLookupPage = refObject.pages && refObject.pages.lookup;
|
|
26170
|
+
if(refLookupPage){
|
|
26171
|
+
if(typeof refLookupPage == 'string'){
|
|
26172
|
+
refLookupPage = JSON.parse(refLookupPage);
|
|
26173
|
+
}
|
|
26174
|
+
// Object.assign(amisSchema, refLookupPage);
|
|
26175
|
+
// amisSchema = _.defaultsDeep({}, refLookupPage, amisSchema);
|
|
26176
|
+
}
|
|
26177
|
+
return amisSchema;
|
|
25964
26178
|
}
|
|
25965
26179
|
|
|
25966
26180
|
async function lookupToAmisIdsPicker(field, readonly, ctx){
|
|
@@ -26598,7 +26812,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26598
26812
|
},
|
|
26599
26813
|
pipeOut: (value, oldValue, data) => {
|
|
26600
26814
|
if(value){
|
|
26601
|
-
|
|
26815
|
+
const result = value/100;
|
|
26816
|
+
return Number(result.toFixed(field.scale+2));
|
|
26602
26817
|
}
|
|
26603
26818
|
return value;
|
|
26604
26819
|
},
|
|
@@ -26830,7 +27045,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26830
27045
|
}
|
|
26831
27046
|
if(!lodash.exports.isEmpty(convertData)){
|
|
26832
27047
|
if(field.is_wide || convertData.type === 'group'){
|
|
26833
|
-
convertData.className = 'col-span-2 m-
|
|
27048
|
+
convertData.className = 'col-span-2 m-0';
|
|
26834
27049
|
}else {
|
|
26835
27050
|
convertData.className = 'm-1';
|
|
26836
27051
|
}
|