@steedos-widgets/amis-lib 1.3.17 → 1.3.18
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 +92 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +93 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +41 -35
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/columns.d.ts +0 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +6 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +19 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +25 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2013,9 +2013,9 @@ function getFieldWidth(width){
|
|
|
2013
2013
|
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
2014
2014
|
if(typeof width == 'string'){
|
|
2015
2015
|
if(isNaN(width)){
|
|
2016
|
-
return width;
|
|
2016
|
+
return width || defaultWidth;
|
|
2017
2017
|
}else {
|
|
2018
|
-
return Number(width);
|
|
2018
|
+
return Number(width) || defaultWidth;
|
|
2019
2019
|
}
|
|
2020
2020
|
}else if(typeof width == 'number'){
|
|
2021
2021
|
return width;
|
|
@@ -2116,6 +2116,7 @@ async function getTableColumns(fields, options){
|
|
|
2116
2116
|
width: getFieldWidth(field.width),
|
|
2117
2117
|
toggled: field.toggled,
|
|
2118
2118
|
className,
|
|
2119
|
+
inputClassName: "inline",
|
|
2119
2120
|
static: true,
|
|
2120
2121
|
}, field.amis, {name: field.name});
|
|
2121
2122
|
}
|
|
@@ -2153,6 +2154,7 @@ async function getTableColumns(fields, options){
|
|
|
2153
2154
|
tpl: tpl,
|
|
2154
2155
|
toggled: field.toggled,
|
|
2155
2156
|
className,
|
|
2157
|
+
inputClassName: "inline",
|
|
2156
2158
|
static: true,
|
|
2157
2159
|
options: field.type === 'html' ? {html: true} : null
|
|
2158
2160
|
// toggled: true
|
|
@@ -2174,8 +2176,8 @@ async function getTableColumns(fields, options){
|
|
|
2174
2176
|
const href = Router.getObjectDetailPath({
|
|
2175
2177
|
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
2176
2178
|
});
|
|
2177
|
-
columns[
|
|
2178
|
-
columns[
|
|
2179
|
+
columns[1].type = "tpl";
|
|
2180
|
+
columns[1].tpl = `<a href="${href}">\${${columns[1].name}}</a>`;
|
|
2179
2181
|
}
|
|
2180
2182
|
return columns;
|
|
2181
2183
|
}
|
|
@@ -2871,7 +2873,25 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2871
2873
|
if(enable_tree){
|
|
2872
2874
|
const records = payload.data.rows || [];
|
|
2873
2875
|
const getTreeOptions = SteedosUI.getTreeOptions
|
|
2874
|
-
|
|
2876
|
+
let isTreeOptionsComputed = false;
|
|
2877
|
+
if(records.length === 1 && records[0].children){
|
|
2878
|
+
isTreeOptionsComputed = true;
|
|
2879
|
+
}
|
|
2880
|
+
if(!isTreeOptionsComputed){
|
|
2881
|
+
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
2882
|
+
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
2883
|
+
}
|
|
2884
|
+
try{
|
|
2885
|
+
setTimeout(() => {
|
|
2886
|
+
let expandBtn = $('.steedos-object-listview-content .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn');
|
|
2887
|
+
if(expandBtn && expandBtn.length > 0 && !expandBtn.hasClass("is-active")){
|
|
2888
|
+
expandBtn[0].click();
|
|
2889
|
+
}
|
|
2890
|
+
}, 600);
|
|
2891
|
+
}
|
|
2892
|
+
catch(ex){
|
|
2893
|
+
console.error("tree数据格式展开异常:", ex);
|
|
2894
|
+
}
|
|
2875
2895
|
}
|
|
2876
2896
|
|
|
2877
2897
|
|
|
@@ -6735,78 +6755,97 @@ function fields$1(){
|
|
|
6735
6755
|
|
|
6736
6756
|
function fieldsExtend$4(){
|
|
6737
6757
|
return {
|
|
6758
|
+
"group": "",
|
|
6738
6759
|
"label": {
|
|
6739
6760
|
"is_wide": true
|
|
6740
6761
|
},
|
|
6741
6762
|
"name": {
|
|
6763
|
+
"group": "",
|
|
6742
6764
|
"amis": {
|
|
6743
6765
|
"hidden": true,
|
|
6744
6766
|
"required": false
|
|
6745
6767
|
}
|
|
6746
6768
|
},
|
|
6747
6769
|
"object_name": {
|
|
6770
|
+
"group": "",
|
|
6748
6771
|
"amis": {
|
|
6749
6772
|
"hidden": true
|
|
6750
6773
|
}
|
|
6751
6774
|
},
|
|
6752
6775
|
"filter_scope": {
|
|
6776
|
+
"group": "",
|
|
6753
6777
|
"amis": {
|
|
6754
6778
|
"hidden": true,
|
|
6755
6779
|
"required": false
|
|
6756
6780
|
}
|
|
6757
6781
|
},
|
|
6758
6782
|
"columns": {
|
|
6783
|
+
"group": "",
|
|
6759
6784
|
"amis": {
|
|
6760
6785
|
"hidden": true,
|
|
6761
6786
|
"required": false
|
|
6762
6787
|
}
|
|
6763
6788
|
},
|
|
6764
6789
|
"mobile_columns":{
|
|
6790
|
+
"group": "",
|
|
6765
6791
|
"amis": {
|
|
6766
6792
|
"hidden": true,
|
|
6767
6793
|
"required": false
|
|
6768
6794
|
}
|
|
6769
6795
|
},
|
|
6770
6796
|
"searchable_fields":{
|
|
6797
|
+
"group": "",
|
|
6771
6798
|
"amis": {
|
|
6772
6799
|
"hidden": true,
|
|
6773
6800
|
"required": false
|
|
6774
6801
|
}
|
|
6775
6802
|
},
|
|
6776
6803
|
"filter_fields": {
|
|
6804
|
+
"group": "",
|
|
6777
6805
|
"amis": {
|
|
6778
6806
|
"hidden": true,
|
|
6779
6807
|
"required": false
|
|
6780
6808
|
}
|
|
6781
6809
|
},
|
|
6782
6810
|
"scrolling_mode": {
|
|
6811
|
+
"group": "",
|
|
6783
6812
|
"amis": {
|
|
6784
6813
|
"hidden": true,
|
|
6785
6814
|
"required": false
|
|
6786
6815
|
}
|
|
6787
6816
|
},
|
|
6788
6817
|
"sort": {
|
|
6818
|
+
"group": "",
|
|
6789
6819
|
"amis": {
|
|
6790
6820
|
"hidden": true,
|
|
6791
6821
|
"required": false
|
|
6792
6822
|
}
|
|
6793
6823
|
},
|
|
6794
6824
|
"show_count": {
|
|
6825
|
+
"group": "",
|
|
6795
6826
|
"amis": {
|
|
6796
6827
|
"hidden": true,
|
|
6797
6828
|
"required": false
|
|
6798
6829
|
}
|
|
6799
6830
|
},
|
|
6800
6831
|
"type": {
|
|
6832
|
+
"group": "",
|
|
6801
6833
|
"amis": {
|
|
6802
6834
|
"hidden": true,
|
|
6803
6835
|
"required": false
|
|
6804
6836
|
}
|
|
6805
6837
|
},
|
|
6806
6838
|
"shared": {
|
|
6839
|
+
"group": "",
|
|
6807
6840
|
"amis": {
|
|
6808
6841
|
"visibleOn": "${global.user.is_space_admin}"
|
|
6809
6842
|
}
|
|
6843
|
+
},
|
|
6844
|
+
"filters": {
|
|
6845
|
+
"group": "",
|
|
6846
|
+
"amis": {
|
|
6847
|
+
"hidden": true
|
|
6848
|
+
}
|
|
6810
6849
|
}
|
|
6811
6850
|
}
|
|
6812
6851
|
}
|
|
@@ -6953,6 +6992,12 @@ function fieldsExtend$3(){
|
|
|
6953
6992
|
"amis": {
|
|
6954
6993
|
"visibleOn": "${global.user.is_space_admin}"
|
|
6955
6994
|
}
|
|
6995
|
+
},
|
|
6996
|
+
"filters": {
|
|
6997
|
+
"group": "",
|
|
6998
|
+
"amis": {
|
|
6999
|
+
"hidden": true
|
|
7000
|
+
}
|
|
6956
7001
|
}
|
|
6957
7002
|
}
|
|
6958
7003
|
}
|
|
@@ -7291,7 +7336,6 @@ function fieldsExtend$1(){
|
|
|
7291
7336
|
}
|
|
7292
7337
|
},
|
|
7293
7338
|
"mobile_columns": {
|
|
7294
|
-
"group": i18next__default["default"].t('frontend_listview_control_columns_mobile_group'),
|
|
7295
7339
|
"amis": {
|
|
7296
7340
|
"type": "transfer",
|
|
7297
7341
|
"sortable": true,
|
|
@@ -8243,7 +8287,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8243
8287
|
hiddenOn: options.tableHiddenOn,
|
|
8244
8288
|
autoFillHeight,
|
|
8245
8289
|
className: `flex-auto ${crudClassName || ""}`,
|
|
8246
|
-
|
|
8290
|
+
// 这里不可以用动态className,因为它会把样式类加到.antd-Crud和.antd-Table.antd-Crud-body这两层div中,而子表列表中crudClassName中有hidden样式类会造成所有子表都不显示的bug
|
|
8291
|
+
// className: {
|
|
8292
|
+
// [`flex-auto ${crudClassName || ""}`]: "true",
|
|
8293
|
+
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
8294
|
+
// },
|
|
8295
|
+
bodyClassName: "bg-white",//上面className写成动态的class变量对象的话,bodyClassName不会生效,会被上面的className值覆盖
|
|
8247
8296
|
crudClassName: crudClassName,
|
|
8248
8297
|
quickSaveApi: {
|
|
8249
8298
|
url: `\${context.rootUrl}/graphql`,
|
|
@@ -10134,8 +10183,6 @@ async function lookupToAmisTreeSelect(field, readonly, ctx) {
|
|
|
10134
10183
|
return amisSchema;
|
|
10135
10184
|
}
|
|
10136
10185
|
|
|
10137
|
-
const keywordsSearchBoxName = `__keywords_lookup`;
|
|
10138
|
-
|
|
10139
10186
|
const getReferenceToFieldSchema = (field, refObjectConfig)=>{
|
|
10140
10187
|
let referenceTo = field.reference_to;
|
|
10141
10188
|
if(!referenceTo){
|
|
@@ -10394,7 +10441,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10394
10441
|
|
|
10395
10442
|
source.data.$term = "$term";
|
|
10396
10443
|
source.data.$self = "$$";
|
|
10397
|
-
|
|
10444
|
+
|
|
10445
|
+
// field.name可能是带点的名称,比如审批王中子表字段'instances.instances_submitter',如果不替换掉点,会造成审批王表单中新建子表行时报错
|
|
10446
|
+
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
10447
|
+
|
|
10398
10448
|
source.requestAdaptor = `
|
|
10399
10449
|
let __changedFilterFormValues = api.data.$self.__changedFilterFormValues || {};
|
|
10400
10450
|
let __changedSearchBoxValues = api.data.$self.__changedSearchBoxValues || {};
|
|
@@ -10537,6 +10587,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10537
10587
|
}
|
|
10538
10588
|
});
|
|
10539
10589
|
payload.data.rows = treeRecords;
|
|
10590
|
+
try{
|
|
10591
|
+
setTimeout(() => {
|
|
10592
|
+
$('.amis-dialog-widget.antd-Modal .antd-Table-content .antd-Table-table thead .antd-Table-expandBtn')[0]?.click();
|
|
10593
|
+
}, 600);
|
|
10594
|
+
}
|
|
10595
|
+
catch(ex){
|
|
10596
|
+
console.error("tree数据格式展开异常:", ex);
|
|
10597
|
+
}
|
|
10540
10598
|
}
|
|
10541
10599
|
return payload;
|
|
10542
10600
|
`;
|
|
@@ -10709,6 +10767,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10709
10767
|
|
|
10710
10768
|
async function lookupToAmisSelect(field, readonly, ctx){
|
|
10711
10769
|
let referenceTo = await getReferenceTo(field);
|
|
10770
|
+
const isMobile = window.innerWidth <= 768;
|
|
10712
10771
|
const valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;
|
|
10713
10772
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
10714
10773
|
|
|
@@ -10889,7 +10948,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
10889
10948
|
</span>
|
|
10890
10949
|
<span class='pl-1.5'>\${label}</span>
|
|
10891
10950
|
</span>`;
|
|
10892
|
-
|
|
10951
|
+
const menuTpl = "${icon ? `"+select_menuTpl+"` : label}";
|
|
10952
|
+
// TODO: 待amis修复了此bug, 就可以撤销添加menuTpl的判断。
|
|
10953
|
+
if(!(isMobile && field.multiple)){
|
|
10954
|
+
data.menuTpl = menuTpl;
|
|
10955
|
+
}
|
|
10893
10956
|
if(field.multiple){
|
|
10894
10957
|
data.multiple = true;
|
|
10895
10958
|
data.extractValue = true;
|
|
@@ -11397,6 +11460,8 @@ function getSelectFieldOptions(field){
|
|
|
11397
11460
|
}
|
|
11398
11461
|
|
|
11399
11462
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
11463
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
11464
|
+
const isMobile = window.innerWidth <= 768;
|
|
11400
11465
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
11401
11466
|
if(___namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
11402
11467
|
return;
|
|
@@ -11459,7 +11524,11 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
11459
11524
|
</span>
|
|
11460
11525
|
<span class='pl-1.5'>\${label}</span>
|
|
11461
11526
|
</span>`;
|
|
11462
|
-
|
|
11527
|
+
const menuTpl = "${icon ? `"+select_menuTpl+"` : label}";
|
|
11528
|
+
// TODO: 待amis修复了此bug, 就可以撤销添加menuTpl的判断。
|
|
11529
|
+
if(!(isMobile && field.multiple)){
|
|
11530
|
+
convertData.menuTpl = menuTpl;
|
|
11531
|
+
}
|
|
11463
11532
|
if(field.multiple){
|
|
11464
11533
|
convertData.multiple = true;
|
|
11465
11534
|
convertData.extractValue = true;
|
|
@@ -12320,7 +12389,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12320
12389
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12321
12390
|
* @Date: 2023-11-15 09:50:22
|
|
12322
12391
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12323
|
-
* @LastEditTime: 2023-
|
|
12392
|
+
* @LastEditTime: 2023-12-04 17:36:50
|
|
12324
12393
|
*/
|
|
12325
12394
|
|
|
12326
12395
|
/**
|
|
@@ -12650,11 +12719,20 @@ const getAmisInputTableSchema = async (props, readonly) => {
|
|
|
12650
12719
|
],
|
|
12651
12720
|
"className": props.className
|
|
12652
12721
|
};
|
|
12722
|
+
let footerToolbar = _$1.clone(props.footerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
|
|
12653
12723
|
if (props.addable) {
|
|
12654
12724
|
let buttonNewSchema = await getButtonNew(props);
|
|
12655
|
-
|
|
12725
|
+
footerToolbar.unshift(buttonNewSchema);
|
|
12726
|
+
}
|
|
12727
|
+
if (footerToolbar.length) {
|
|
12728
|
+
schema.body.push({
|
|
12729
|
+
"type": "wrapper",
|
|
12730
|
+
"size": "none",
|
|
12731
|
+
"body": footerToolbar
|
|
12732
|
+
});
|
|
12656
12733
|
}
|
|
12657
12734
|
if (props.amis) {
|
|
12735
|
+
delete props.amis.id;
|
|
12658
12736
|
Object.assign(schema.body[0], props.amis);
|
|
12659
12737
|
}
|
|
12660
12738
|
return schema;
|