@steedos-widgets/amis-lib 1.2.10 → 1.2.11
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 +68 -49
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +68 -49
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +68 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +7 -5
- package/dist/types/lib/converter/amis/header.d.ts +9 -5
- package/dist/types/lib/converter/amis/toolbar.d.ts +7 -5
- package/dist/types/lib/converter/amis/toolbars/setting_listview/columns.d.ts +1 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +1 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/filters.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +1 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/rename.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/share.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/sort.d.ts +1 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +6 -4
- package/dist/types/lib/objects.d.ts +2 -0
- package/dist/types/schema/standard_import_data.amis.d.ts +5 -0
- package/dist/types/standard/button.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
* @Author: baozhoutao@steedos.com
|
|
430
430
|
* @Date: 2022-05-23 09:53:08
|
|
431
431
|
* @LastEditors: Please set LastEditors
|
|
432
|
-
* @LastEditTime: 2023-05-
|
|
432
|
+
* @LastEditTime: 2023-05-22 15:13:18
|
|
433
433
|
* @Description:
|
|
434
434
|
*/
|
|
435
435
|
|
|
@@ -486,8 +486,9 @@
|
|
|
486
486
|
let map = {};
|
|
487
487
|
_$1.forEach(selectOptions,(option)=>{
|
|
488
488
|
const optionValue = option.value + '';
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
const optionColor = option.color + '';
|
|
490
|
+
if(optionColor){
|
|
491
|
+
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
491
492
|
const color = getContrastColor(background);
|
|
492
493
|
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
493
494
|
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
@@ -1893,9 +1894,10 @@
|
|
|
1893
1894
|
{
|
|
1894
1895
|
name: "template_url",
|
|
1895
1896
|
label: "导入模板",
|
|
1896
|
-
type: "
|
|
1897
|
-
|
|
1898
|
-
|
|
1897
|
+
type: "markdown",
|
|
1898
|
+
options: {
|
|
1899
|
+
html: true
|
|
1900
|
+
},
|
|
1899
1901
|
className: "whitespace-nowrap",
|
|
1900
1902
|
},
|
|
1901
1903
|
null,
|
|
@@ -2742,6 +2744,7 @@
|
|
|
2742
2744
|
if (!ctx) {
|
|
2743
2745
|
ctx = {};
|
|
2744
2746
|
}
|
|
2747
|
+
const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
|
|
2745
2748
|
const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
|
|
2746
2749
|
const onSearchScript = `
|
|
2747
2750
|
const scope = event.context.scoped;
|
|
@@ -2758,7 +2761,7 @@
|
|
|
2758
2761
|
// // 这会造成handleFilterSubmit时把移除掉的搜索项字段之前的值加到过滤条件中
|
|
2759
2762
|
// for(var k in filterFormValues){
|
|
2760
2763
|
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
2761
|
-
// removedValues[k] =
|
|
2764
|
+
// removedValues[k] = null;
|
|
2762
2765
|
// }
|
|
2763
2766
|
// }
|
|
2764
2767
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
@@ -2797,7 +2800,7 @@
|
|
|
2797
2800
|
const removedValues = {};
|
|
2798
2801
|
for(var k in filterFormValues){
|
|
2799
2802
|
if(/^__searchable__/.test(k)){
|
|
2800
|
-
removedValues[k] =
|
|
2803
|
+
removedValues[k] = null;
|
|
2801
2804
|
}
|
|
2802
2805
|
}
|
|
2803
2806
|
if(!event.data.isLookup){
|
|
@@ -2808,7 +2811,7 @@
|
|
|
2808
2811
|
if(localListViewProps){
|
|
2809
2812
|
localListViewProps = JSON.parse(localListViewProps);
|
|
2810
2813
|
for(var k in localListViewProps){
|
|
2811
|
-
removedValues[k] =
|
|
2814
|
+
removedValues[k] = null;
|
|
2812
2815
|
}
|
|
2813
2816
|
}
|
|
2814
2817
|
}
|
|
@@ -2966,7 +2969,7 @@
|
|
|
2966
2969
|
});
|
|
2967
2970
|
const removedValues = {};
|
|
2968
2971
|
removedKeys.forEach(function(key){
|
|
2969
|
-
removedValues[key] =
|
|
2972
|
+
removedValues[key] = null;
|
|
2970
2973
|
});
|
|
2971
2974
|
filterForm.setValues(removedValues);//这里使用filterInnerForm也可以
|
|
2972
2975
|
|
|
@@ -2979,10 +2982,14 @@
|
|
|
2979
2982
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
2980
2983
|
if(localListViewProps){
|
|
2981
2984
|
localListViewProps = JSON.parse(localListViewProps);
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2985
|
+
_.each(localListViewProps, function(n,k){
|
|
2986
|
+
// __searchable__开头的不在searchableFields范围则清除其值
|
|
2987
|
+
let isRemoved = !!removedFields.find(function(fieldName){
|
|
2988
|
+
return new RegExp("__searchable__\.*" + fieldName + "$").test(k);
|
|
2989
|
+
});
|
|
2990
|
+
if(isRemoved){
|
|
2991
|
+
delete localListViewProps[k];
|
|
2992
|
+
}
|
|
2986
2993
|
});
|
|
2987
2994
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
2988
2995
|
}
|
|
@@ -3016,9 +3023,10 @@
|
|
|
3016
3023
|
"body": [
|
|
3017
3024
|
{
|
|
3018
3025
|
"type": "button",
|
|
3026
|
+
"id": btnSearchId,
|
|
3019
3027
|
"label": "搜索",
|
|
3020
3028
|
"icon": "fa fa-search",
|
|
3021
|
-
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3029
|
+
// "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3022
3030
|
"onEvent": {
|
|
3023
3031
|
"click": {
|
|
3024
3032
|
"actions": [
|
|
@@ -3034,7 +3042,7 @@
|
|
|
3034
3042
|
"type": "button",
|
|
3035
3043
|
"label": "取消",
|
|
3036
3044
|
"name": "btn_filter_form_cancel",
|
|
3037
|
-
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3045
|
+
// "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3038
3046
|
"onEvent": {
|
|
3039
3047
|
"click": {
|
|
3040
3048
|
"actions": [
|
|
@@ -3149,6 +3157,10 @@
|
|
|
3149
3157
|
"actionType": "custom",
|
|
3150
3158
|
"script": onSearchableFieldsChangeScript
|
|
3151
3159
|
},
|
|
3160
|
+
{
|
|
3161
|
+
"actionType": "click",
|
|
3162
|
+
"componentId": btnSearchId
|
|
3163
|
+
},
|
|
3152
3164
|
{
|
|
3153
3165
|
"componentId": "",
|
|
3154
3166
|
"args": {},
|
|
@@ -3503,7 +3515,7 @@
|
|
|
3503
3515
|
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
3504
3516
|
"inline": false,
|
|
3505
3517
|
"wrapperComponent": "",
|
|
3506
|
-
"className": "leading-5 text-xl font-bold"
|
|
3518
|
+
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
3507
3519
|
}
|
|
3508
3520
|
],
|
|
3509
3521
|
"columnClassName": "p-l-xs"
|
|
@@ -3512,6 +3524,7 @@
|
|
|
3512
3524
|
"className": "flex justify-between"
|
|
3513
3525
|
}
|
|
3514
3526
|
],
|
|
3527
|
+
"columnClassName": "flex-initial",
|
|
3515
3528
|
"md": "auto",
|
|
3516
3529
|
});
|
|
3517
3530
|
}
|
|
@@ -3532,7 +3545,7 @@
|
|
|
3532
3545
|
{
|
|
3533
3546
|
"type": "grid",
|
|
3534
3547
|
"columns": gridBody,
|
|
3535
|
-
"className": "flex justify-between"
|
|
3548
|
+
"className": "flex justify-between flex-nowrap"
|
|
3536
3549
|
}
|
|
3537
3550
|
],
|
|
3538
3551
|
"hiddenOn": "${recordLoaded != true}"
|
|
@@ -3749,12 +3762,13 @@
|
|
|
3749
3762
|
"type": "dialog",
|
|
3750
3763
|
"title": "新建 列表视图",
|
|
3751
3764
|
"data": {
|
|
3752
|
-
"&":
|
|
3765
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
3753
3766
|
"all": "${uiSchema.list_views.all}",
|
|
3754
3767
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
3755
3768
|
"appId": "${appId}",
|
|
3756
3769
|
"global": "${global}",
|
|
3757
3770
|
"targetObjectName": "${objectName}",
|
|
3771
|
+
"context": "${context}"
|
|
3758
3772
|
},
|
|
3759
3773
|
"body": [
|
|
3760
3774
|
{
|
|
@@ -3898,12 +3912,13 @@
|
|
|
3898
3912
|
"type": "dialog",
|
|
3899
3913
|
"title": "复制 列表视图",
|
|
3900
3914
|
"data": {
|
|
3901
|
-
"&":
|
|
3915
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
3902
3916
|
"listName": "${listName}",
|
|
3903
3917
|
"targetObjectName": "${objectName}",
|
|
3904
3918
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
3905
3919
|
"appId": "${appId}",
|
|
3906
|
-
"global": "${global}"
|
|
3920
|
+
"global": "${global}",
|
|
3921
|
+
"context": "${context}"
|
|
3907
3922
|
},
|
|
3908
3923
|
"body": [
|
|
3909
3924
|
{
|
|
@@ -4045,7 +4060,8 @@
|
|
|
4045
4060
|
"data": {
|
|
4046
4061
|
"targetObjectName": "${objectName}",
|
|
4047
4062
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4048
|
-
"appId": "${appId}"
|
|
4063
|
+
"appId": "${appId}",
|
|
4064
|
+
"context": "${context}"
|
|
4049
4065
|
},
|
|
4050
4066
|
"body": [
|
|
4051
4067
|
{
|
|
@@ -4102,6 +4118,7 @@
|
|
|
4102
4118
|
"title": "共享设置",
|
|
4103
4119
|
"data": {
|
|
4104
4120
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4121
|
+
"context": "${context}"
|
|
4105
4122
|
},
|
|
4106
4123
|
"body": [
|
|
4107
4124
|
{
|
|
@@ -4147,7 +4164,8 @@
|
|
|
4147
4164
|
"targetObjectName": "${objectName}",
|
|
4148
4165
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4149
4166
|
"listName": "${listName}",
|
|
4150
|
-
"appId": "${appId}"
|
|
4167
|
+
"appId": "${appId}",
|
|
4168
|
+
"context": "${context}"
|
|
4151
4169
|
},
|
|
4152
4170
|
"body": [
|
|
4153
4171
|
{
|
|
@@ -4291,11 +4309,12 @@
|
|
|
4291
4309
|
"type": "dialog",
|
|
4292
4310
|
"title": "显示的列",
|
|
4293
4311
|
"data": {
|
|
4294
|
-
"&":
|
|
4312
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4295
4313
|
"targetObjectName": "${objectName}",
|
|
4296
4314
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4297
4315
|
"listName": "${listName}",
|
|
4298
|
-
"appId": "${appId}"
|
|
4316
|
+
"appId": "${appId}",
|
|
4317
|
+
"context": "${context}"
|
|
4299
4318
|
},
|
|
4300
4319
|
"body": [
|
|
4301
4320
|
{
|
|
@@ -4444,11 +4463,12 @@
|
|
|
4444
4463
|
"type": "dialog",
|
|
4445
4464
|
"title": "默认排序规则",
|
|
4446
4465
|
"data": {
|
|
4447
|
-
"&":
|
|
4466
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4448
4467
|
"targetObjectName": "${objectName}",
|
|
4449
4468
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4450
4469
|
"listName": "${listName}",
|
|
4451
|
-
"appId": "${appId}"
|
|
4470
|
+
"appId": "${appId}",
|
|
4471
|
+
"context": "${context}"
|
|
4452
4472
|
},
|
|
4453
4473
|
"body": [
|
|
4454
4474
|
{
|
|
@@ -5138,24 +5158,13 @@ else{
|
|
|
5138
5158
|
"actionType": "custom",
|
|
5139
5159
|
"script": `
|
|
5140
5160
|
const scope = event.context.scoped;
|
|
5141
|
-
|
|
5142
|
-
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
5143
|
-
// return n.props.type === "form";
|
|
5144
|
-
// });
|
|
5145
|
-
// var filterFormValues = filterForm.getValues();
|
|
5146
|
-
filterFormValues={
|
|
5161
|
+
var filterFormValues={
|
|
5147
5162
|
"__searchable__organizations_parents":event.data.value.value
|
|
5148
5163
|
}
|
|
5149
5164
|
var listView = scope.parent.getComponents().find(function(n){
|
|
5150
5165
|
return n.props.type === "crud";
|
|
5151
5166
|
});
|
|
5152
|
-
|
|
5153
|
-
// for(var k in filterFormValues){
|
|
5154
|
-
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
5155
|
-
// removedValues[k] = "";
|
|
5156
|
-
// }
|
|
5157
|
-
// }
|
|
5158
|
-
listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
5167
|
+
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
5159
5168
|
`
|
|
5160
5169
|
}
|
|
5161
5170
|
]
|
|
@@ -5269,7 +5278,7 @@ else{
|
|
|
5269
5278
|
|
|
5270
5279
|
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
5271
5280
|
|
|
5272
|
-
if(source.url){
|
|
5281
|
+
if(source.url && !ctx.inFilterForm){
|
|
5273
5282
|
const depend_on = [];
|
|
5274
5283
|
const sendOn = [];
|
|
5275
5284
|
___namespace.each(field.depend_on, (fName)=>{
|
|
@@ -5333,9 +5342,10 @@ else{
|
|
|
5333
5342
|
filters.push(fieldFilters);
|
|
5334
5343
|
}
|
|
5335
5344
|
|
|
5345
|
+
const inFilterForm = ${ctx.inFilterForm};
|
|
5336
5346
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5337
5347
|
|
|
5338
|
-
if(filtersFunction){
|
|
5348
|
+
if(filtersFunction && !inFilterForm){
|
|
5339
5349
|
const _filters = filtersFunction(filters, api.data.$self.__super.__super);
|
|
5340
5350
|
if(_filters && _filters.length > 0){
|
|
5341
5351
|
filters.push(_filters);
|
|
@@ -5555,7 +5565,8 @@ else{
|
|
|
5555
5565
|
sort = getListViewSort(listView);
|
|
5556
5566
|
}
|
|
5557
5567
|
|
|
5558
|
-
|
|
5568
|
+
// 列表视图搜索栏中,即inFilterForm=true时,不需要执行depend_on
|
|
5569
|
+
if(apiInfo.url && !ctx.inFilterForm){
|
|
5559
5570
|
const depend_on = [];
|
|
5560
5571
|
const sendOn = [];
|
|
5561
5572
|
___namespace.each(field.depend_on, (fName)=>{
|
|
@@ -5592,9 +5603,10 @@ else{
|
|
|
5592
5603
|
filters.push(fieldFilters);
|
|
5593
5604
|
}
|
|
5594
5605
|
|
|
5606
|
+
const inFilterForm = ${ctx.inFilterForm};
|
|
5595
5607
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5596
5608
|
|
|
5597
|
-
if(filtersFunction){
|
|
5609
|
+
if(filtersFunction && !inFilterForm){
|
|
5598
5610
|
const _filters = filtersFunction(filters, api.data.$);
|
|
5599
5611
|
if(_filters && _filters.length > 0){
|
|
5600
5612
|
filters.push(_filters);
|
|
@@ -5620,7 +5632,14 @@ else{
|
|
|
5620
5632
|
referenceTo ? referenceTo.valueField.name : '';
|
|
5621
5633
|
if(field.optionsFunction || field._optionsFunction){
|
|
5622
5634
|
apiInfo.adaptor = `
|
|
5623
|
-
|
|
5635
|
+
var options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
|
|
5636
|
+
if(api.data.$term){
|
|
5637
|
+
options = _.filter(options, function(o) {
|
|
5638
|
+
var label = o.label;
|
|
5639
|
+
return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
|
|
5640
|
+
});
|
|
5641
|
+
}
|
|
5642
|
+
payload.data.options = options;
|
|
5624
5643
|
return payload;
|
|
5625
5644
|
`;
|
|
5626
5645
|
}
|
|
@@ -5756,7 +5775,7 @@ else{
|
|
|
5756
5775
|
source.data.$term = "$term";
|
|
5757
5776
|
source.data.$self = "$$";
|
|
5758
5777
|
|
|
5759
|
-
if(idsDependOn && source.url){
|
|
5778
|
+
if(idsDependOn && source.url && !ctx.inFilterForm){
|
|
5760
5779
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
5761
5780
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
5762
5781
|
}
|
|
@@ -6598,7 +6617,7 @@ else{
|
|
|
6598
6617
|
convertData.className = fieldTypeClassName;
|
|
6599
6618
|
}
|
|
6600
6619
|
|
|
6601
|
-
if(field.visible_on){
|
|
6620
|
+
if(field.visible_on && !ctx.inFilterForm){
|
|
6602
6621
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
6603
6622
|
if(field.visible_on.startsWith("{{")){
|
|
6604
6623
|
convertData.visibleOn = `${field.visible_on.substring(2, field.visible_on.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -6691,7 +6710,7 @@ else{
|
|
|
6691
6710
|
_field.multiple = true;
|
|
6692
6711
|
_field.is_wide = false;
|
|
6693
6712
|
_field.defaultValue = undefined;
|
|
6694
|
-
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true}));
|
|
6713
|
+
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|
|
6695
6714
|
if(amisField){
|
|
6696
6715
|
return amisField;
|
|
6697
6716
|
}
|
|
@@ -7693,7 +7712,7 @@ else{
|
|
|
7693
7712
|
tpl: tpl,
|
|
7694
7713
|
toggled: field.toggled,
|
|
7695
7714
|
className,
|
|
7696
|
-
|
|
7715
|
+
options: field.type === 'html' ? {html: true} : null
|
|
7697
7716
|
// toggled: true
|
|
7698
7717
|
}, field.amis, {name: field.name}));
|
|
7699
7718
|
}
|