@steedos-widgets/amis-lib 1.2.26 → 1.2.28
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 +96 -30
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +96 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +96 -30
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +3 -4
- package/dist/types/lib/converter/amis/fields/editor.d.ts +10 -8
- package/dist/types/lib/converter/amis/header.d.ts +18 -8
- package/dist/types/lib/converter/amis/index.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +2 -2
- package/dist/types/lib/page_init.d.ts +1 -0
- package/dist/types/schema/standard_edit.amis.d.ts +9 -0
- package/dist/types/schema/standard_import_data.amis.d.ts +3 -0
- package/dist/types/schema/standard_new.amis.d.ts +9 -0
- package/dist/types/standard/button.d.ts +21 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -647,6 +647,10 @@ async function getFieldsTemplate(fields, expand){
|
|
|
647
647
|
if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
648
648
|
displayFields.push(`${field.name}`);
|
|
649
649
|
}
|
|
650
|
+
}else {
|
|
651
|
+
objectFieldName = field.name.split('.')[0];
|
|
652
|
+
fieldsName.push(objectFieldName);
|
|
653
|
+
displayFields.push(objectFieldName);
|
|
650
654
|
}
|
|
651
655
|
}
|
|
652
656
|
|
|
@@ -1727,8 +1731,8 @@ i18next
|
|
|
1727
1731
|
/*
|
|
1728
1732
|
* @Author: baozhoutao@steedos.com
|
|
1729
1733
|
* @Date: 2022-11-01 15:51:00
|
|
1730
|
-
* @LastEditors:
|
|
1731
|
-
* @LastEditTime: 2023-06-
|
|
1734
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1735
|
+
* @LastEditTime: 2023-06-28 23:19:41
|
|
1732
1736
|
* @Description:
|
|
1733
1737
|
*/
|
|
1734
1738
|
|
|
@@ -1780,6 +1784,16 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1780
1784
|
data: formSchema
|
|
1781
1785
|
};
|
|
1782
1786
|
`;
|
|
1787
|
+
const onDialogCancelScript = `
|
|
1788
|
+
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
1789
|
+
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
1790
|
+
setTimeout(function(){
|
|
1791
|
+
doAction({
|
|
1792
|
+
"actionType": "cancel",
|
|
1793
|
+
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
1794
|
+
});
|
|
1795
|
+
}, 200);
|
|
1796
|
+
`;
|
|
1783
1797
|
return {
|
|
1784
1798
|
"type": "service",
|
|
1785
1799
|
"body": [
|
|
@@ -1840,6 +1854,17 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1840
1854
|
"closeOnEsc": false,
|
|
1841
1855
|
"closeOnOutside": false,
|
|
1842
1856
|
"size": "lg",
|
|
1857
|
+
"onEvent": {
|
|
1858
|
+
"cancel": {
|
|
1859
|
+
"actions": [
|
|
1860
|
+
{
|
|
1861
|
+
"actionType": "custom",
|
|
1862
|
+
"script": onDialogCancelScript,
|
|
1863
|
+
"expression": "${window:innerWidth < 768}",
|
|
1864
|
+
}
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1843
1868
|
"actions": [
|
|
1844
1869
|
{
|
|
1845
1870
|
type: 'button',
|
|
@@ -1902,7 +1927,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1902
1927
|
* @Author: baozhoutao@steedos.com
|
|
1903
1928
|
* @Date: 2022-11-01 15:49:58
|
|
1904
1929
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1905
|
-
* @LastEditTime: 2023-
|
|
1930
|
+
* @LastEditTime: 2023-06-28 23:22:31
|
|
1906
1931
|
* @Description:
|
|
1907
1932
|
*/
|
|
1908
1933
|
|
|
@@ -1931,6 +1956,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1931
1956
|
? JSON.parse(page.schema)
|
|
1932
1957
|
: page.schema;
|
|
1933
1958
|
}
|
|
1959
|
+
|
|
1960
|
+
const onDialogCancelScript = `
|
|
1961
|
+
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
1962
|
+
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
|
|
1963
|
+
setTimeout(function(){
|
|
1964
|
+
doAction({
|
|
1965
|
+
"actionType": "cancel",
|
|
1966
|
+
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
1967
|
+
});
|
|
1968
|
+
}, 200);
|
|
1969
|
+
`;
|
|
1934
1970
|
|
|
1935
1971
|
return {
|
|
1936
1972
|
type: "service",
|
|
@@ -1954,6 +1990,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1954
1990
|
closeOnOutside: false,
|
|
1955
1991
|
showCloseButton: true,
|
|
1956
1992
|
size: "lg",
|
|
1993
|
+
"onEvent": {
|
|
1994
|
+
"cancel": {
|
|
1995
|
+
"actions": [
|
|
1996
|
+
{
|
|
1997
|
+
"actionType": "custom",
|
|
1998
|
+
"script": onDialogCancelScript,
|
|
1999
|
+
"expression": "${window:innerWidth < 768}",
|
|
2000
|
+
}
|
|
2001
|
+
]
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
1957
2004
|
},
|
|
1958
2005
|
},
|
|
1959
2006
|
],
|
|
@@ -2250,6 +2297,7 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2250
2297
|
label: i18next.t('frontend_import_data_file'),
|
|
2251
2298
|
required: true,
|
|
2252
2299
|
type: "input-file",
|
|
2300
|
+
accept: ".xlsx,.xls",
|
|
2253
2301
|
className: "m-1",
|
|
2254
2302
|
labelClassName: "text-left",
|
|
2255
2303
|
clearValueOnHidden: true,
|
|
@@ -2914,6 +2962,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2914
2962
|
"drawer": {
|
|
2915
2963
|
"type": "drawer",
|
|
2916
2964
|
"title": "操作",
|
|
2965
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
2917
2966
|
"body": [
|
|
2918
2967
|
{
|
|
2919
2968
|
"type": "button-group",
|
|
@@ -2936,7 +2985,6 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2936
2985
|
"size": "lg"
|
|
2937
2986
|
}
|
|
2938
2987
|
],
|
|
2939
|
-
"id": "u:9815f7366b9f",
|
|
2940
2988
|
"position": "bottom",
|
|
2941
2989
|
"closeOnOutside": true,
|
|
2942
2990
|
"resizable": false,
|
|
@@ -2947,8 +2995,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2947
2995
|
}
|
|
2948
2996
|
]
|
|
2949
2997
|
}
|
|
2950
|
-
}
|
|
2951
|
-
"id": "u:ee7c7929e6ae"
|
|
2998
|
+
}
|
|
2952
2999
|
}
|
|
2953
3000
|
}else {
|
|
2954
3001
|
if(moreButtons.length > 0){
|
|
@@ -2980,6 +3027,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
2980
3027
|
"drawer": {
|
|
2981
3028
|
"type": "drawer",
|
|
2982
3029
|
"title": "操作",
|
|
3030
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
2983
3031
|
"body": [
|
|
2984
3032
|
{
|
|
2985
3033
|
"type": "button-group",
|
|
@@ -3003,7 +3051,6 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3003
3051
|
"size": "lg"
|
|
3004
3052
|
}
|
|
3005
3053
|
],
|
|
3006
|
-
"id": "u:9815f7366b9f",
|
|
3007
3054
|
"position": "bottom",
|
|
3008
3055
|
"closeOnOutside": true,
|
|
3009
3056
|
"resizable": false,
|
|
@@ -3014,8 +3061,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3014
3061
|
}
|
|
3015
3062
|
]
|
|
3016
3063
|
}
|
|
3017
|
-
}
|
|
3018
|
-
"id": "u:ee7c7929e6ae"
|
|
3064
|
+
}
|
|
3019
3065
|
}
|
|
3020
3066
|
}else {
|
|
3021
3067
|
return ___default.map(buttons, (button) => {
|
|
@@ -3044,6 +3090,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3044
3090
|
"drawer": {
|
|
3045
3091
|
"type": "drawer",
|
|
3046
3092
|
"title": "操作",
|
|
3093
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
3047
3094
|
"body": [
|
|
3048
3095
|
{
|
|
3049
3096
|
"type": "button-group",
|
|
@@ -5620,6 +5667,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5620
5667
|
const fieldsArr = [];
|
|
5621
5668
|
|
|
5622
5669
|
const listName = "all";
|
|
5670
|
+
|
|
5671
|
+
const isMobile = window.innerWidth < 768;
|
|
5623
5672
|
|
|
5624
5673
|
const listView = _$1.find(
|
|
5625
5674
|
refObjectConfig.list_views,
|
|
@@ -5696,6 +5745,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5696
5745
|
|
|
5697
5746
|
source.data.$term = "$term";
|
|
5698
5747
|
source.data.$self = "$$";
|
|
5748
|
+
|
|
5699
5749
|
|
|
5700
5750
|
source.requestAdaptor = `
|
|
5701
5751
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -5731,6 +5781,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5731
5781
|
}
|
|
5732
5782
|
}
|
|
5733
5783
|
|
|
5784
|
+
|
|
5734
5785
|
if(allowSearchFields){
|
|
5735
5786
|
allowSearchFields.forEach(function(key){
|
|
5736
5787
|
const keyValue = selfData[key];
|
|
@@ -5846,7 +5897,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5846
5897
|
pickerSchema.affixHeader = false;
|
|
5847
5898
|
|
|
5848
5899
|
var headerToolbarItems = [];
|
|
5849
|
-
const isMobile = window.innerWidth < 768;
|
|
5850
5900
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
5851
5901
|
headerToolbarItems = getLookupSapceUserTreeSchema();
|
|
5852
5902
|
pickerSchema["style"] = {
|
|
@@ -5927,7 +5977,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5927
5977
|
}
|
|
5928
5978
|
|
|
5929
5979
|
const ctx = ${JSON.stringify(ctx)};
|
|
5930
|
-
const componentId = ctx.defaults.formSchema.id
|
|
5980
|
+
const componentId = ctx.defaults.formSchema.id;
|
|
5931
5981
|
doAction({
|
|
5932
5982
|
actionType: 'setValue',
|
|
5933
5983
|
componentId: componentId,
|
|
@@ -6181,6 +6231,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6181
6231
|
// ids人员点选模式
|
|
6182
6232
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
6183
6233
|
}
|
|
6234
|
+
if(!field.filters || field.filters.length == 0){
|
|
6235
|
+
field.filters = [["user_accepted", "=", true]];
|
|
6236
|
+
}else {
|
|
6237
|
+
field.filters = [ ["user_accepted", "=", true], "and", field.filters ];
|
|
6238
|
+
}
|
|
6184
6239
|
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
6185
6240
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
6186
6241
|
}
|
|
@@ -6321,7 +6376,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6321
6376
|
* @Author: baozhoutao@steedos.com
|
|
6322
6377
|
* @Date: 2023-01-13 17:27:54
|
|
6323
6378
|
* @LastEditors: liaodaxue
|
|
6324
|
-
* @LastEditTime: 2023-06-
|
|
6379
|
+
* @LastEditTime: 2023-06-30 10:29:52
|
|
6325
6380
|
* @Description:
|
|
6326
6381
|
*/
|
|
6327
6382
|
|
|
@@ -6329,12 +6384,16 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6329
6384
|
const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
6330
6385
|
if(readonly){
|
|
6331
6386
|
return {
|
|
6332
|
-
"type": "
|
|
6333
|
-
"
|
|
6334
|
-
"
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6387
|
+
"type": "control",
|
|
6388
|
+
"label": field.label,
|
|
6389
|
+
"body": {
|
|
6390
|
+
"type": "markdown",
|
|
6391
|
+
"name": field.name,
|
|
6392
|
+
"options": {
|
|
6393
|
+
"linkify": true,
|
|
6394
|
+
"html": true,
|
|
6395
|
+
"breaks": true
|
|
6396
|
+
}
|
|
6338
6397
|
}
|
|
6339
6398
|
}
|
|
6340
6399
|
}else {
|
|
@@ -7415,6 +7474,7 @@ async function getQuickEditSchema(field, options){
|
|
|
7415
7474
|
async function getTableColumns(fields, options){
|
|
7416
7475
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7417
7476
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7477
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7418
7478
|
for (const field of fields) {
|
|
7419
7479
|
//增加quickEdit属性,实现快速编辑
|
|
7420
7480
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7471,7 +7531,7 @@ async function getTableColumns(fields, options){
|
|
|
7471
7531
|
type: "switch",
|
|
7472
7532
|
name: field.name,
|
|
7473
7533
|
label: field.label,
|
|
7474
|
-
width: field.width,
|
|
7534
|
+
width: field.width || defaultWidth,
|
|
7475
7535
|
toggled: field.toggled,
|
|
7476
7536
|
quickEdit: quickEditSchema,
|
|
7477
7537
|
className:"whitespace-nowrap",
|
|
@@ -7486,7 +7546,7 @@ async function getTableColumns(fields, options){
|
|
|
7486
7546
|
label: field.label,
|
|
7487
7547
|
map: map,
|
|
7488
7548
|
sortable: field.sortable,
|
|
7489
|
-
width: field.width,
|
|
7549
|
+
width: field.width || defaultWidth,
|
|
7490
7550
|
toggled: field.toggled,
|
|
7491
7551
|
className:"whitespace-nowrap",
|
|
7492
7552
|
quickEdit: quickEditSchema
|
|
@@ -7515,7 +7575,7 @@ async function getTableColumns(fields, options){
|
|
|
7515
7575
|
label: field.label,
|
|
7516
7576
|
sortable: field.sortable,
|
|
7517
7577
|
// searchable: field.searchable,
|
|
7518
|
-
width: field.width,
|
|
7578
|
+
width: field.width || defaultWidth,
|
|
7519
7579
|
type: type,
|
|
7520
7580
|
tpl: tpl,
|
|
7521
7581
|
toggled: field.toggled,
|
|
@@ -7922,6 +7982,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7922
7982
|
let valueField = mainObject.key_field || '_id';
|
|
7923
7983
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
7924
7984
|
|
|
7985
|
+
api.url += "&objectName=${objectName}";//设计器上对象表格组件需要切换对象重新请求列表数据
|
|
7925
7986
|
if(options.isRelated){
|
|
7926
7987
|
api.url += "&recordId=${_master.recordId}";
|
|
7927
7988
|
}
|
|
@@ -8251,12 +8312,18 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
8251
8312
|
// }
|
|
8252
8313
|
// })
|
|
8253
8314
|
|
|
8315
|
+
var fieldNames = _$1.map(fields, function(n){return n.name});
|
|
8254
8316
|
return `
|
|
8255
8317
|
if(payload.data.data.length === 0){
|
|
8256
8318
|
var isEditor = !!${options && options.isEditor};
|
|
8257
8319
|
if(isEditor){
|
|
8320
|
+
var fieldNames = ${JSON.stringify(fieldNames)};
|
|
8321
|
+
var emptyDoc = {};//这里如果不把每个字段值设置为空的话,表单上会显示上一次表单上的字段值
|
|
8322
|
+
fieldNames.forEach(function(n){
|
|
8323
|
+
emptyDoc[n] = null;
|
|
8324
|
+
});
|
|
8258
8325
|
// 设计器中始终显示表单,有记录则显示第一条记录,没记录时显示为空表单
|
|
8259
|
-
payload.data.data = [
|
|
8326
|
+
payload.data.data = [emptyDoc];
|
|
8260
8327
|
}
|
|
8261
8328
|
else{
|
|
8262
8329
|
return {
|
|
@@ -9060,8 +9127,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9060
9127
|
/*
|
|
9061
9128
|
* @Author: baozhoutao@steedos.com
|
|
9062
9129
|
* @Date: 2022-05-26 16:02:08
|
|
9063
|
-
* @LastEditors:
|
|
9064
|
-
* @LastEditTime: 2023-06-
|
|
9130
|
+
* @LastEditors: liaodaxue
|
|
9131
|
+
* @LastEditTime: 2023-06-29 17:27:19
|
|
9065
9132
|
* @Description:
|
|
9066
9133
|
*/
|
|
9067
9134
|
|
|
@@ -9155,7 +9222,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
9155
9222
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
9156
9223
|
if (section.body.length > 0) {
|
|
9157
9224
|
if (section.visibleOn) {
|
|
9158
|
-
sectionVisibleOns.push(section.visibleOn);
|
|
9225
|
+
sectionVisibleOns.push("("+section.visibleOn+")");
|
|
9159
9226
|
}
|
|
9160
9227
|
else {
|
|
9161
9228
|
sectionVisibleOns.push("true");
|
|
@@ -9493,8 +9560,12 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9493
9560
|
if(___default.has(formSchema, 'className')){
|
|
9494
9561
|
formSchema.className = 'steedos-amis-form';
|
|
9495
9562
|
}
|
|
9563
|
+
if(!formSchema.id){
|
|
9564
|
+
formSchema.id = 'form_' + objectSchema.name;
|
|
9565
|
+
}
|
|
9496
9566
|
const amisSchema = {
|
|
9497
9567
|
type: 'service',
|
|
9568
|
+
id: `service_${formSchema.id}`,
|
|
9498
9569
|
className: 'p-0',
|
|
9499
9570
|
name: `page_edit_${recordId}`,
|
|
9500
9571
|
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
@@ -9565,11 +9636,6 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9565
9636
|
}
|
|
9566
9637
|
})]
|
|
9567
9638
|
};
|
|
9568
|
-
if(formSchema.id){
|
|
9569
|
-
amisSchema.id = `service-${formSchema.id}`;
|
|
9570
|
-
}else {
|
|
9571
|
-
amisSchema.id = `new-${objectSchema.name}`;
|
|
9572
|
-
}
|
|
9573
9639
|
return amisSchema;
|
|
9574
9640
|
}
|
|
9575
9641
|
|