@steedos-widgets/amis-lib 1.1.4 → 1.1.7
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 +43 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +43 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +43 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/toolbar.d.ts +3 -111
- package/dist/types/lib/objects.d.ts +2 -0
- package/dist/types/schema/standard_delete.amis.d.ts +0 -6
- package/dist/types/standard/button.d.ts +0 -6
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1548,8 +1548,8 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
1548
1548
|
/*
|
|
1549
1549
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1550
1550
|
* @Date: 2023-03-22 09:31:21
|
|
1551
|
-
* @LastEditors:
|
|
1552
|
-
* @LastEditTime: 2023-
|
|
1551
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
1552
|
+
* @LastEditTime: 2023-04-06 16:04:20
|
|
1553
1553
|
*/
|
|
1554
1554
|
const getSchema$2 = (uiSchema)=>{
|
|
1555
1555
|
return {
|
|
@@ -1579,15 +1579,11 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
1579
1579
|
},
|
|
1580
1580
|
"adaptor": `
|
|
1581
1581
|
if(payload.errors){
|
|
1582
|
-
|
|
1583
|
-
|
|
1582
|
+
payload.status = 2;
|
|
1583
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
1584
1584
|
}
|
|
1585
1585
|
return payload;
|
|
1586
1586
|
`,
|
|
1587
|
-
},
|
|
1588
|
-
"messages": {
|
|
1589
|
-
"success": "删除成功",
|
|
1590
|
-
"failed": "删除失败"
|
|
1591
1587
|
}
|
|
1592
1588
|
},
|
|
1593
1589
|
"actionType": "ajax"
|
|
@@ -3392,7 +3388,7 @@ function getExportApiRequestAdaptorScript(){
|
|
|
3392
3388
|
`
|
|
3393
3389
|
}
|
|
3394
3390
|
|
|
3395
|
-
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false} = {}){
|
|
3391
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
|
|
3396
3392
|
const isMobile = window.innerWidth < 768;
|
|
3397
3393
|
if(isMobile){
|
|
3398
3394
|
showDisplayAs = false;
|
|
@@ -3451,6 +3447,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3451
3447
|
}else {
|
|
3452
3448
|
return [
|
|
3453
3449
|
// "filter-toggler",
|
|
3450
|
+
...(headerToolbarItems || []),
|
|
3454
3451
|
"bulkActions",
|
|
3455
3452
|
{
|
|
3456
3453
|
"type": "columns-toggler",
|
|
@@ -4118,20 +4115,20 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
4118
4115
|
|
|
4119
4116
|
if(referenceTo){
|
|
4120
4117
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
4121
|
-
const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null,
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4118
|
+
const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
4119
|
+
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
4120
|
+
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
4121
|
+
], {
|
|
4125
4122
|
alias: "defaultValueOptions",
|
|
4126
4123
|
filters: "{__options_filters}",
|
|
4127
4124
|
count: false
|
|
4128
4125
|
});
|
|
4129
4126
|
apiInfo = await getApi$1({
|
|
4130
4127
|
name: referenceTo.objectName
|
|
4131
|
-
}, null,
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4128
|
+
}, null, [
|
|
4129
|
+
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
4130
|
+
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
4131
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`, moreQueries: [defaultValueOptionsQueryData.query]});
|
|
4135
4132
|
|
|
4136
4133
|
apiInfo.adaptor = `
|
|
4137
4134
|
const data = payload.data;
|
|
@@ -4947,13 +4944,19 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
4947
4944
|
};
|
|
4948
4945
|
break;
|
|
4949
4946
|
case 'percent':
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4947
|
+
if(readonly){
|
|
4948
|
+
convertData = {
|
|
4949
|
+
type: 'static-tpl',
|
|
4950
|
+
tpl: getUiFieldTpl(field)
|
|
4951
|
+
};
|
|
4952
|
+
}else {
|
|
4953
|
+
convertData = {
|
|
4954
|
+
type: getAmisStaticFieldType('number', readonly),
|
|
4955
|
+
min: field.min,
|
|
4956
|
+
max: field.max,
|
|
4957
|
+
precision: field.scale
|
|
4958
|
+
};
|
|
4959
|
+
}
|
|
4957
4960
|
break;
|
|
4958
4961
|
case 'password':
|
|
4959
4962
|
convertData = {
|
|
@@ -4995,12 +4998,18 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
4995
4998
|
break;
|
|
4996
4999
|
case 'formula':
|
|
4997
5000
|
if(readonly){
|
|
4998
|
-
convertData
|
|
5001
|
+
convertData = {
|
|
5002
|
+
type: 'static-tpl',
|
|
5003
|
+
tpl: getUiFieldTpl(field)
|
|
5004
|
+
};
|
|
4999
5005
|
}
|
|
5000
5006
|
break;
|
|
5001
5007
|
case 'summary':
|
|
5002
5008
|
if(readonly){
|
|
5003
|
-
convertData
|
|
5009
|
+
convertData = {
|
|
5010
|
+
type: 'static-tpl',
|
|
5011
|
+
tpl: getUiFieldTpl(field)
|
|
5012
|
+
};
|
|
5004
5013
|
}
|
|
5005
5014
|
break;
|
|
5006
5015
|
case 'code':
|
|
@@ -5713,7 +5722,11 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
5713
5722
|
}
|
|
5714
5723
|
}
|
|
5715
5724
|
|
|
5716
|
-
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
|
|
5725
|
+
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
|
|
5726
|
+
showDisplayAs,
|
|
5727
|
+
hiddenCount: options.queryCount === false,
|
|
5728
|
+
headerToolbarItems: options.headerToolbarItems
|
|
5729
|
+
});
|
|
5717
5730
|
|
|
5718
5731
|
|
|
5719
5732
|
let body = null;
|
|
@@ -7947,7 +7960,8 @@ async function getListSchema(
|
|
|
7947
7960
|
"sort": sort,
|
|
7948
7961
|
"ctx": ctx,
|
|
7949
7962
|
"requestAdaptor": listView.requestAdaptor,
|
|
7950
|
-
"adaptor": listView.adaptor
|
|
7963
|
+
"adaptor": listView.adaptor,
|
|
7964
|
+
"headerToolbarItems": ctx.headerToolbarItems
|
|
7951
7965
|
};
|
|
7952
7966
|
return {
|
|
7953
7967
|
uiSchema,
|
|
@@ -8008,6 +8022,7 @@ async function getTableSchema(
|
|
|
8008
8022
|
...ctx,
|
|
8009
8023
|
filter: ctx.filters,
|
|
8010
8024
|
sort,
|
|
8025
|
+
headerToolbarItems: ctx.headerToolbarItems,
|
|
8011
8026
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
8012
8027
|
});
|
|
8013
8028
|
return {
|