@steedos-widgets/amis-lib 1.2.35-beta.1 → 1.2.35-beta.2
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 +80 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -35
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +80 -35
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/graphql.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -649,9 +649,10 @@
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
-
async function getFieldsTemplate(fields,
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
async function getFieldsTemplate(fields, display){
|
|
653
|
+
let expandFields = [];
|
|
654
|
+
if(display != false){
|
|
655
|
+
display = true;
|
|
655
656
|
}
|
|
656
657
|
let fieldsName = ['_id'];
|
|
657
658
|
let displayFields = [];
|
|
@@ -663,33 +664,43 @@
|
|
|
663
664
|
}
|
|
664
665
|
for (const field of fieldsArr) {
|
|
665
666
|
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
666
|
-
if(field.
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
667
|
+
if(field.expand){
|
|
668
|
+
expandFields.push(field);
|
|
669
|
+
}else {
|
|
670
|
+
if(field.name.indexOf('.') < 0){
|
|
671
|
+
if(display && (field.type == 'lookup' || field.type == 'master_detail')){
|
|
672
|
+
fieldsName.push(`${field.name}`);
|
|
673
|
+
displayFields.push(`${field.name}`);
|
|
674
|
+
}else {
|
|
675
|
+
fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
|
|
676
|
+
}
|
|
677
|
+
if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
678
|
+
fieldsName.push(`${field.name}`);
|
|
679
|
+
}
|
|
680
|
+
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
681
|
+
displayFields.push(`${field.name}`);
|
|
682
|
+
}
|
|
670
683
|
}else {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
fieldsName.push(`${field.name}`);
|
|
675
|
-
}
|
|
676
|
-
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
677
|
-
displayFields.push(`${field.name}`);
|
|
684
|
+
objectFieldName = field.name.split('.')[0];
|
|
685
|
+
fieldsName.push(objectFieldName);
|
|
686
|
+
displayFields.push(objectFieldName);
|
|
678
687
|
}
|
|
679
|
-
}else {
|
|
680
|
-
objectFieldName = field.name.split('.')[0];
|
|
681
|
-
fieldsName.push(objectFieldName);
|
|
682
|
-
displayFields.push(objectFieldName);
|
|
683
688
|
}
|
|
684
689
|
}
|
|
685
690
|
|
|
686
691
|
displayFields = ___namespace.uniq(displayFields);
|
|
687
692
|
fieldsName = ___namespace.uniq(fieldsName);
|
|
693
|
+
let expandFieldsQuery = "";
|
|
694
|
+
if(expandFields.length > 0){
|
|
695
|
+
___namespace.each(expandFields, function(field){
|
|
696
|
+
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
697
|
+
});
|
|
698
|
+
}
|
|
688
699
|
|
|
689
700
|
if(displayFields.length > 0){
|
|
690
|
-
return `${fieldsName.join(',')},_display:_ui{${displayFields.join(',')}}`;
|
|
701
|
+
return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
|
|
691
702
|
}
|
|
692
|
-
return `${fieldsName.join(' ')}`
|
|
703
|
+
return `${fieldsName.join(' ')},${expandFieldsQuery}`
|
|
693
704
|
}
|
|
694
705
|
|
|
695
706
|
function getRecordPermissionsTemplate(){
|
|
@@ -10385,8 +10396,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10385
10396
|
/*
|
|
10386
10397
|
* @Author: baozhoutao@steedos.com
|
|
10387
10398
|
* @Date: 2022-07-05 15:55:39
|
|
10388
|
-
* @LastEditors:
|
|
10389
|
-
* @LastEditTime: 2023-
|
|
10399
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
10400
|
+
* @LastEditTime: 2023-07-29 13:58:07
|
|
10390
10401
|
* @Description:
|
|
10391
10402
|
*/
|
|
10392
10403
|
|
|
@@ -10720,6 +10731,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10720
10731
|
"filterVisible": ctx.filterVisible,
|
|
10721
10732
|
"rowClassNameExpr": ctx.rowClassNameExpr
|
|
10722
10733
|
};
|
|
10734
|
+
// console.log(`getListSchema===>`,amisSchema)
|
|
10723
10735
|
return {
|
|
10724
10736
|
uiSchema,
|
|
10725
10737
|
amisSchema,
|
|
@@ -10733,7 +10745,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10733
10745
|
columns,
|
|
10734
10746
|
ctx = {}
|
|
10735
10747
|
) {
|
|
10736
|
-
// console.time('getTableSchema');
|
|
10748
|
+
// console.time('getTableSchema', columns);
|
|
10737
10749
|
const uiSchema = await getUISchema(objectName);
|
|
10738
10750
|
|
|
10739
10751
|
let sort = ctx.sort;
|
|
@@ -10747,19 +10759,52 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10747
10759
|
}
|
|
10748
10760
|
|
|
10749
10761
|
let fields = [];
|
|
10750
|
-
|
|
10751
|
-
if (_$1.isString(column)
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10762
|
+
for(const column of columns){
|
|
10763
|
+
if (_$1.isString(column)) {
|
|
10764
|
+
if(column.indexOf('.') > 0){
|
|
10765
|
+
const fieldName = column.split('.')[0];
|
|
10766
|
+
const displayName = column.split('.')[1];
|
|
10767
|
+
const filedInfo = uiSchema.fields[fieldName];
|
|
10768
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
10769
|
+
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10770
|
+
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10771
|
+
fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
|
|
10772
|
+
}
|
|
10773
|
+
}else {
|
|
10774
|
+
if(uiSchema.fields[column]){
|
|
10775
|
+
fields.push(uiSchema.fields[column]);
|
|
10776
|
+
}
|
|
10777
|
+
}
|
|
10778
|
+
} else if (_$1.isObject(column)) {
|
|
10779
|
+
if(column.field.indexOf('.') > 0){
|
|
10780
|
+
const fieldName = column.field.split('.')[0];
|
|
10781
|
+
const displayName = column.field.split('.')[1];
|
|
10782
|
+
const filedInfo = uiSchema.fields[fieldName];
|
|
10783
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
10784
|
+
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10785
|
+
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10786
|
+
fields.push(Object.assign({}, rfFieldInfo,
|
|
10787
|
+
{name: column.field, expand: true, expandInfo: {fieldName, displayName}},
|
|
10788
|
+
{
|
|
10789
|
+
width: column.width,
|
|
10790
|
+
wrap: column.wrap, // wrap = true 是没效果的
|
|
10791
|
+
amis: column.amis
|
|
10792
|
+
}
|
|
10793
|
+
));
|
|
10794
|
+
}
|
|
10795
|
+
}else {
|
|
10796
|
+
if(uiSchema.fields[column.field]){
|
|
10797
|
+
fields.push(
|
|
10798
|
+
Object.assign({}, uiSchema.fields[column.field], {
|
|
10799
|
+
width: column.width,
|
|
10800
|
+
wrap: column.wrap, // wrap = true 是没效果的
|
|
10801
|
+
amis: column.amis
|
|
10802
|
+
})
|
|
10803
|
+
);
|
|
10804
|
+
}
|
|
10805
|
+
}
|
|
10761
10806
|
}
|
|
10762
|
-
}
|
|
10807
|
+
}
|
|
10763
10808
|
|
|
10764
10809
|
const extraColumns = ctx.extraColumns;
|
|
10765
10810
|
|