@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.umd.js
CHANGED
|
@@ -1574,8 +1574,8 @@
|
|
|
1574
1574
|
/*
|
|
1575
1575
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1576
1576
|
* @Date: 2023-03-22 09:31:21
|
|
1577
|
-
* @LastEditors:
|
|
1578
|
-
* @LastEditTime: 2023-
|
|
1577
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
1578
|
+
* @LastEditTime: 2023-04-06 16:04:20
|
|
1579
1579
|
*/
|
|
1580
1580
|
const getSchema$2 = (uiSchema)=>{
|
|
1581
1581
|
return {
|
|
@@ -1605,15 +1605,11 @@
|
|
|
1605
1605
|
},
|
|
1606
1606
|
"adaptor": `
|
|
1607
1607
|
if(payload.errors){
|
|
1608
|
-
|
|
1609
|
-
|
|
1608
|
+
payload.status = 2;
|
|
1609
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
1610
1610
|
}
|
|
1611
1611
|
return payload;
|
|
1612
1612
|
`,
|
|
1613
|
-
},
|
|
1614
|
-
"messages": {
|
|
1615
|
-
"success": "删除成功",
|
|
1616
|
-
"failed": "删除失败"
|
|
1617
1613
|
}
|
|
1618
1614
|
},
|
|
1619
1615
|
"actionType": "ajax"
|
|
@@ -3418,7 +3414,7 @@ setTimeout(()=>{
|
|
|
3418
3414
|
`
|
|
3419
3415
|
}
|
|
3420
3416
|
|
|
3421
|
-
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false} = {}){
|
|
3417
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems} = {}){
|
|
3422
3418
|
const isMobile = window.innerWidth < 768;
|
|
3423
3419
|
if(isMobile){
|
|
3424
3420
|
showDisplayAs = false;
|
|
@@ -3477,6 +3473,7 @@ setTimeout(()=>{
|
|
|
3477
3473
|
}else {
|
|
3478
3474
|
return [
|
|
3479
3475
|
// "filter-toggler",
|
|
3476
|
+
...(headerToolbarItems || []),
|
|
3480
3477
|
"bulkActions",
|
|
3481
3478
|
{
|
|
3482
3479
|
"type": "columns-toggler",
|
|
@@ -4144,20 +4141,20 @@ setTimeout(()=>{
|
|
|
4144
4141
|
|
|
4145
4142
|
if(referenceTo){
|
|
4146
4143
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
4147
|
-
const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null,
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4144
|
+
const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
4145
|
+
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
4146
|
+
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
4147
|
+
], {
|
|
4151
4148
|
alias: "defaultValueOptions",
|
|
4152
4149
|
filters: "{__options_filters}",
|
|
4153
4150
|
count: false
|
|
4154
4151
|
});
|
|
4155
4152
|
apiInfo = await getApi$1({
|
|
4156
4153
|
name: referenceTo.objectName
|
|
4157
|
-
}, null,
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4154
|
+
}, null, [
|
|
4155
|
+
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
4156
|
+
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
4157
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`, moreQueries: [defaultValueOptionsQueryData.query]});
|
|
4161
4158
|
|
|
4162
4159
|
apiInfo.adaptor = `
|
|
4163
4160
|
const data = payload.data;
|
|
@@ -4973,13 +4970,19 @@ setTimeout(()=>{
|
|
|
4973
4970
|
};
|
|
4974
4971
|
break;
|
|
4975
4972
|
case 'percent':
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4973
|
+
if(readonly){
|
|
4974
|
+
convertData = {
|
|
4975
|
+
type: 'static-tpl',
|
|
4976
|
+
tpl: getUiFieldTpl(field)
|
|
4977
|
+
};
|
|
4978
|
+
}else {
|
|
4979
|
+
convertData = {
|
|
4980
|
+
type: getAmisStaticFieldType('number', readonly),
|
|
4981
|
+
min: field.min,
|
|
4982
|
+
max: field.max,
|
|
4983
|
+
precision: field.scale
|
|
4984
|
+
};
|
|
4985
|
+
}
|
|
4983
4986
|
break;
|
|
4984
4987
|
case 'password':
|
|
4985
4988
|
convertData = {
|
|
@@ -5021,12 +5024,18 @@ setTimeout(()=>{
|
|
|
5021
5024
|
break;
|
|
5022
5025
|
case 'formula':
|
|
5023
5026
|
if(readonly){
|
|
5024
|
-
convertData
|
|
5027
|
+
convertData = {
|
|
5028
|
+
type: 'static-tpl',
|
|
5029
|
+
tpl: getUiFieldTpl(field)
|
|
5030
|
+
};
|
|
5025
5031
|
}
|
|
5026
5032
|
break;
|
|
5027
5033
|
case 'summary':
|
|
5028
5034
|
if(readonly){
|
|
5029
|
-
convertData
|
|
5035
|
+
convertData = {
|
|
5036
|
+
type: 'static-tpl',
|
|
5037
|
+
tpl: getUiFieldTpl(field)
|
|
5038
|
+
};
|
|
5030
5039
|
}
|
|
5031
5040
|
break;
|
|
5032
5041
|
case 'code':
|
|
@@ -5739,7 +5748,11 @@ setTimeout(()=>{
|
|
|
5739
5748
|
}
|
|
5740
5749
|
}
|
|
5741
5750
|
|
|
5742
|
-
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
|
|
5751
|
+
bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
|
|
5752
|
+
showDisplayAs,
|
|
5753
|
+
hiddenCount: options.queryCount === false,
|
|
5754
|
+
headerToolbarItems: options.headerToolbarItems
|
|
5755
|
+
});
|
|
5743
5756
|
|
|
5744
5757
|
|
|
5745
5758
|
let body = null;
|
|
@@ -7973,7 +7986,8 @@ setTimeout(()=>{
|
|
|
7973
7986
|
"sort": sort,
|
|
7974
7987
|
"ctx": ctx,
|
|
7975
7988
|
"requestAdaptor": listView.requestAdaptor,
|
|
7976
|
-
"adaptor": listView.adaptor
|
|
7989
|
+
"adaptor": listView.adaptor,
|
|
7990
|
+
"headerToolbarItems": ctx.headerToolbarItems
|
|
7977
7991
|
};
|
|
7978
7992
|
return {
|
|
7979
7993
|
uiSchema,
|
|
@@ -8034,6 +8048,7 @@ setTimeout(()=>{
|
|
|
8034
8048
|
...ctx,
|
|
8035
8049
|
filter: ctx.filters,
|
|
8036
8050
|
sort,
|
|
8051
|
+
headerToolbarItems: ctx.headerToolbarItems,
|
|
8037
8052
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
8038
8053
|
});
|
|
8039
8054
|
return {
|