@steedos-widgets/amis-lib 3.6.0-beta.6 → 3.6.0-beta.9
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 +111 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +111 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +20 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +6 -2
- package/dist/types/lib/converter/amis/fields/table.d.ts +3 -1
- package/dist/types/lib/converter/amis/header.d.ts +1 -0
- package/dist/types/lib/converter/amis/index.d.ts +8 -0
- package/dist/types/lib/objects.d.ts +9 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1670,7 +1670,6 @@ async function getQuickEditSchema(field, options){
|
|
|
1670
1670
|
{
|
|
1671
1671
|
"actionType": "custom",
|
|
1672
1672
|
"script": `
|
|
1673
|
-
|
|
1674
1673
|
var _display = _.cloneDeep(event.data._display);
|
|
1675
1674
|
${displayField}
|
|
1676
1675
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
@@ -1841,6 +1840,23 @@ async function getQuickEditSchema(field, options){
|
|
|
1841
1840
|
"onEvent":{
|
|
1842
1841
|
"init":{
|
|
1843
1842
|
"actions":[
|
|
1843
|
+
//amis3.6无法从数据域中直接拿到正确的selectitems,需要通过crud组件的getSelected()函数获取
|
|
1844
|
+
{
|
|
1845
|
+
"actionType": "custom",
|
|
1846
|
+
"script": `
|
|
1847
|
+
crudScoped = event.context.scoped.getComponentById('${options.crudId}');
|
|
1848
|
+
const selectedItems = crudScoped && crudScoped.control.getSelected();
|
|
1849
|
+
doAction({
|
|
1850
|
+
"componentId": "${quickEditId}",
|
|
1851
|
+
"actionType": "setValue",
|
|
1852
|
+
"args": {
|
|
1853
|
+
"value": {
|
|
1854
|
+
selectedItems
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
`
|
|
1859
|
+
},
|
|
1844
1860
|
{
|
|
1845
1861
|
"actionType": "setValue",
|
|
1846
1862
|
"componentId": quickEditId,
|
|
@@ -2604,6 +2620,14 @@ async function getTableSchema$1(fields, options){
|
|
|
2604
2620
|
|
|
2605
2621
|
}
|
|
2606
2622
|
|
|
2623
|
+
const treeConfig = {};
|
|
2624
|
+
|
|
2625
|
+
if(options.enable_tree){
|
|
2626
|
+
treeConfig.expandConfig = {
|
|
2627
|
+
expand: 'first'
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2607
2631
|
return {
|
|
2608
2632
|
mode: "table",
|
|
2609
2633
|
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
@@ -2619,6 +2643,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2619
2643
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
2620
2644
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
2621
2645
|
columnsTogglable: false,
|
|
2646
|
+
...treeConfig
|
|
2622
2647
|
}
|
|
2623
2648
|
}
|
|
2624
2649
|
|
|
@@ -2935,17 +2960,6 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2935
2960
|
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
2936
2961
|
assignIndexToTreeRecords(payload.data.rows, '');
|
|
2937
2962
|
}
|
|
2938
|
-
try{
|
|
2939
|
-
setTimeout(() => {
|
|
2940
|
-
let expandBtn = $('.steedos-object-listview-content .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn');
|
|
2941
|
-
if(expandBtn && expandBtn.length > 0 && !expandBtn.hasClass("is-active")){
|
|
2942
|
-
expandBtn[0].click();
|
|
2943
|
-
}
|
|
2944
|
-
}, 600);
|
|
2945
|
-
}
|
|
2946
|
-
catch(ex){
|
|
2947
|
-
console.error("tree数据格式展开异常:", ex);
|
|
2948
|
-
}
|
|
2949
2963
|
}
|
|
2950
2964
|
|
|
2951
2965
|
|
|
@@ -5773,12 +5787,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5773
5787
|
// }
|
|
5774
5788
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
5775
5789
|
// 点击搜索的时候自动收起搜索栏
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5790
|
+
//触发amis crud 高度重算
|
|
5791
|
+
doAction({
|
|
5792
|
+
"actionType": "broadcast",
|
|
5793
|
+
"args": {
|
|
5794
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
5795
|
+
},
|
|
5796
|
+
"data": {
|
|
5797
|
+
"timeOut": 500
|
|
5798
|
+
}
|
|
5799
|
+
});
|
|
5782
5800
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
5783
5801
|
return n.props.type === "service";
|
|
5784
5802
|
});
|
|
@@ -5880,9 +5898,16 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
5880
5898
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
5881
5899
|
filterFormService.setData({showFieldsFilter: !!!filterFormService.props.data.showFieldsFilter});
|
|
5882
5900
|
//触发amis crud 高度重算
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5901
|
+
doAction({
|
|
5902
|
+
"actionType": "broadcast",
|
|
5903
|
+
"args": {
|
|
5904
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
5905
|
+
},
|
|
5906
|
+
"data": {
|
|
5907
|
+
"timeOut": 100
|
|
5908
|
+
}
|
|
5909
|
+
});
|
|
5910
|
+
|
|
5886
5911
|
// 移除搜索按钮上的红点
|
|
5887
5912
|
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5888
5913
|
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
@@ -6039,9 +6064,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6039
6064
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
6040
6065
|
}
|
|
6041
6066
|
//触发amis crud 高度重算
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6067
|
+
doAction({
|
|
6068
|
+
"actionType": "broadcast",
|
|
6069
|
+
"args": {
|
|
6070
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
6071
|
+
},
|
|
6072
|
+
"data": {
|
|
6073
|
+
"timeOut": 100
|
|
6074
|
+
}
|
|
6075
|
+
});
|
|
6045
6076
|
// ===END===
|
|
6046
6077
|
`;
|
|
6047
6078
|
return {
|
|
@@ -6536,7 +6567,10 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6536
6567
|
"@history_paths.changed": {
|
|
6537
6568
|
"actions": [
|
|
6538
6569
|
{
|
|
6539
|
-
"actionType": "reload"
|
|
6570
|
+
"actionType": "reload",
|
|
6571
|
+
// amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
|
|
6572
|
+
"data": {
|
|
6573
|
+
}
|
|
6540
6574
|
}
|
|
6541
6575
|
]
|
|
6542
6576
|
}
|
|
@@ -7744,13 +7778,16 @@ const filterService = filterForm.context.getComponents().find(function(n){
|
|
|
7744
7778
|
});
|
|
7745
7779
|
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
7746
7780
|
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
}
|
|
7753
|
-
|
|
7781
|
+
//触发amis crud 高度重算
|
|
7782
|
+
doAction({
|
|
7783
|
+
"actionType": "broadcast",
|
|
7784
|
+
"args": {
|
|
7785
|
+
"eventName": "@height.changed." + event.data.objectName
|
|
7786
|
+
},
|
|
7787
|
+
"data": {
|
|
7788
|
+
"timeOut": 1000
|
|
7789
|
+
}
|
|
7790
|
+
});
|
|
7754
7791
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
7755
7792
|
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
7756
7793
|
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
@@ -8114,12 +8151,16 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8114
8151
|
return;
|
|
8115
8152
|
}
|
|
8116
8153
|
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8154
|
+
//触发amis crud 高度重算
|
|
8155
|
+
doAction({
|
|
8156
|
+
"actionType": "broadcast",
|
|
8157
|
+
"args": {
|
|
8158
|
+
"eventName": "@height.changed.${objectSchema.name}"
|
|
8159
|
+
},
|
|
8160
|
+
"data": {
|
|
8161
|
+
"timeOut": 1000
|
|
8162
|
+
}
|
|
8163
|
+
});
|
|
8123
8164
|
resizeWindow();
|
|
8124
8165
|
const scope = event.context.scoped;
|
|
8125
8166
|
// let filterFormValues = event.data;
|
|
@@ -8468,7 +8509,24 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8468
8509
|
id: `service_${id}`,
|
|
8469
8510
|
name: `page`,
|
|
8470
8511
|
data: options.amisData,
|
|
8471
|
-
body: body
|
|
8512
|
+
body: body,
|
|
8513
|
+
//监听广播事件,重算crud高度
|
|
8514
|
+
onEvent: {
|
|
8515
|
+
[`@height.changed.${objectSchema.name}`]: {
|
|
8516
|
+
"actions": [
|
|
8517
|
+
{
|
|
8518
|
+
"actionType": "custom",
|
|
8519
|
+
"script": `
|
|
8520
|
+
var crudScoped = event.context.scoped.getComponentById('${body.id}');
|
|
8521
|
+
var timeOut = event.data.timeOut || 500;
|
|
8522
|
+
setTimeout(()=>{
|
|
8523
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
8524
|
+
}, timeOut);
|
|
8525
|
+
`
|
|
8526
|
+
}
|
|
8527
|
+
]
|
|
8528
|
+
}
|
|
8529
|
+
}
|
|
8472
8530
|
}
|
|
8473
8531
|
}
|
|
8474
8532
|
|
|
@@ -10764,14 +10822,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10764
10822
|
}
|
|
10765
10823
|
});
|
|
10766
10824
|
payload.data.rows = treeRecords;
|
|
10767
|
-
try{
|
|
10768
|
-
setTimeout(() => {
|
|
10769
|
-
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
|
|
10770
|
-
}, 600);
|
|
10771
|
-
}
|
|
10772
|
-
catch(ex){
|
|
10773
|
-
console.error("tree数据格式展开异常:", ex);
|
|
10774
|
-
}
|
|
10775
10825
|
}
|
|
10776
10826
|
return payload;
|
|
10777
10827
|
`;
|
|
@@ -10798,6 +10848,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10798
10848
|
labelFieldName,
|
|
10799
10849
|
top: top,
|
|
10800
10850
|
isLookup: true,
|
|
10851
|
+
enable_tree: refObjectConfig.enable_tree,
|
|
10801
10852
|
...ctx
|
|
10802
10853
|
});
|
|
10803
10854
|
|
|
@@ -11216,18 +11267,28 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11216
11267
|
enableEnhancedLookup = true;
|
|
11217
11268
|
}
|
|
11218
11269
|
}
|
|
11270
|
+
let amisSchema;
|
|
11219
11271
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
11220
11272
|
if(enableEnhancedLookup == true){
|
|
11221
|
-
|
|
11273
|
+
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
11222
11274
|
}else if(refObject.enable_tree) {
|
|
11223
|
-
|
|
11275
|
+
amisSchema = await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
11224
11276
|
labelField: referenceTo.labelField?.name || 'name',
|
|
11225
11277
|
valueField: referenceTo.valueField?.name || '_id',
|
|
11226
11278
|
objectName: referenceTo.objectName
|
|
11227
11279
|
}));
|
|
11228
11280
|
}else {
|
|
11229
|
-
|
|
11281
|
+
amisSchema = await lookupToAmisSelect(field, readonly, ctx);
|
|
11282
|
+
}
|
|
11283
|
+
let refLookupPage = refObject.pages && refObject.pages.lookup;
|
|
11284
|
+
if(refLookupPage){
|
|
11285
|
+
if(typeof refLookupPage == 'string'){
|
|
11286
|
+
refLookupPage = JSON.parse(refLookupPage);
|
|
11287
|
+
}
|
|
11288
|
+
// Object.assign(amisSchema, refLookupPage);
|
|
11289
|
+
// amisSchema = _.defaultsDeep({}, refLookupPage, amisSchema);
|
|
11230
11290
|
}
|
|
11291
|
+
return amisSchema;
|
|
11231
11292
|
}
|
|
11232
11293
|
|
|
11233
11294
|
async function lookupToAmisSelectUser(field, readonly, ctx){
|