@steedos-widgets/amis-lib 1.2.27 → 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 +84 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +84 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +84 -29
- 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
|
@@ -1731,8 +1731,8 @@ i18next
|
|
|
1731
1731
|
/*
|
|
1732
1732
|
* @Author: baozhoutao@steedos.com
|
|
1733
1733
|
* @Date: 2022-11-01 15:51:00
|
|
1734
|
-
* @LastEditors:
|
|
1735
|
-
* @LastEditTime: 2023-06-
|
|
1734
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1735
|
+
* @LastEditTime: 2023-06-28 23:19:41
|
|
1736
1736
|
* @Description:
|
|
1737
1737
|
*/
|
|
1738
1738
|
|
|
@@ -1784,6 +1784,16 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1784
1784
|
data: formSchema
|
|
1785
1785
|
};
|
|
1786
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
|
+
`;
|
|
1787
1797
|
return {
|
|
1788
1798
|
"type": "service",
|
|
1789
1799
|
"body": [
|
|
@@ -1844,6 +1854,17 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1844
1854
|
"closeOnEsc": false,
|
|
1845
1855
|
"closeOnOutside": false,
|
|
1846
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
|
+
},
|
|
1847
1868
|
"actions": [
|
|
1848
1869
|
{
|
|
1849
1870
|
type: 'button',
|
|
@@ -1906,7 +1927,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1906
1927
|
* @Author: baozhoutao@steedos.com
|
|
1907
1928
|
* @Date: 2022-11-01 15:49:58
|
|
1908
1929
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1909
|
-
* @LastEditTime: 2023-
|
|
1930
|
+
* @LastEditTime: 2023-06-28 23:22:31
|
|
1910
1931
|
* @Description:
|
|
1911
1932
|
*/
|
|
1912
1933
|
|
|
@@ -1935,6 +1956,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1935
1956
|
? JSON.parse(page.schema)
|
|
1936
1957
|
: page.schema;
|
|
1937
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
|
+
`;
|
|
1938
1970
|
|
|
1939
1971
|
return {
|
|
1940
1972
|
type: "service",
|
|
@@ -1958,6 +1990,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1958
1990
|
closeOnOutside: false,
|
|
1959
1991
|
showCloseButton: true,
|
|
1960
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
|
+
},
|
|
1961
2004
|
},
|
|
1962
2005
|
},
|
|
1963
2006
|
],
|
|
@@ -2254,6 +2297,7 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2254
2297
|
label: i18next.t('frontend_import_data_file'),
|
|
2255
2298
|
required: true,
|
|
2256
2299
|
type: "input-file",
|
|
2300
|
+
accept: ".xlsx,.xls",
|
|
2257
2301
|
className: "m-1",
|
|
2258
2302
|
labelClassName: "text-left",
|
|
2259
2303
|
clearValueOnHidden: true,
|
|
@@ -2918,6 +2962,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2918
2962
|
"drawer": {
|
|
2919
2963
|
"type": "drawer",
|
|
2920
2964
|
"title": "操作",
|
|
2965
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
2921
2966
|
"body": [
|
|
2922
2967
|
{
|
|
2923
2968
|
"type": "button-group",
|
|
@@ -2940,7 +2985,6 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2940
2985
|
"size": "lg"
|
|
2941
2986
|
}
|
|
2942
2987
|
],
|
|
2943
|
-
"id": "u:9815f7366b9f",
|
|
2944
2988
|
"position": "bottom",
|
|
2945
2989
|
"closeOnOutside": true,
|
|
2946
2990
|
"resizable": false,
|
|
@@ -2951,8 +2995,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2951
2995
|
}
|
|
2952
2996
|
]
|
|
2953
2997
|
}
|
|
2954
|
-
}
|
|
2955
|
-
"id": "u:ee7c7929e6ae"
|
|
2998
|
+
}
|
|
2956
2999
|
}
|
|
2957
3000
|
}else {
|
|
2958
3001
|
if(moreButtons.length > 0){
|
|
@@ -2984,6 +3027,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
2984
3027
|
"drawer": {
|
|
2985
3028
|
"type": "drawer",
|
|
2986
3029
|
"title": "操作",
|
|
3030
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
2987
3031
|
"body": [
|
|
2988
3032
|
{
|
|
2989
3033
|
"type": "button-group",
|
|
@@ -3007,7 +3051,6 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3007
3051
|
"size": "lg"
|
|
3008
3052
|
}
|
|
3009
3053
|
],
|
|
3010
|
-
"id": "u:9815f7366b9f",
|
|
3011
3054
|
"position": "bottom",
|
|
3012
3055
|
"closeOnOutside": true,
|
|
3013
3056
|
"resizable": false,
|
|
@@ -3018,8 +3061,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3018
3061
|
}
|
|
3019
3062
|
]
|
|
3020
3063
|
}
|
|
3021
|
-
}
|
|
3022
|
-
"id": "u:ee7c7929e6ae"
|
|
3064
|
+
}
|
|
3023
3065
|
}
|
|
3024
3066
|
}else {
|
|
3025
3067
|
return ___default.map(buttons, (button) => {
|
|
@@ -3048,6 +3090,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3048
3090
|
"drawer": {
|
|
3049
3091
|
"type": "drawer",
|
|
3050
3092
|
"title": "操作",
|
|
3093
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
3051
3094
|
"body": [
|
|
3052
3095
|
{
|
|
3053
3096
|
"type": "button-group",
|
|
@@ -5624,6 +5667,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5624
5667
|
const fieldsArr = [];
|
|
5625
5668
|
|
|
5626
5669
|
const listName = "all";
|
|
5670
|
+
|
|
5671
|
+
const isMobile = window.innerWidth < 768;
|
|
5627
5672
|
|
|
5628
5673
|
const listView = _$1.find(
|
|
5629
5674
|
refObjectConfig.list_views,
|
|
@@ -5700,6 +5745,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5700
5745
|
|
|
5701
5746
|
source.data.$term = "$term";
|
|
5702
5747
|
source.data.$self = "$$";
|
|
5748
|
+
|
|
5703
5749
|
|
|
5704
5750
|
source.requestAdaptor = `
|
|
5705
5751
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -5735,6 +5781,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5735
5781
|
}
|
|
5736
5782
|
}
|
|
5737
5783
|
|
|
5784
|
+
|
|
5738
5785
|
if(allowSearchFields){
|
|
5739
5786
|
allowSearchFields.forEach(function(key){
|
|
5740
5787
|
const keyValue = selfData[key];
|
|
@@ -5850,7 +5897,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5850
5897
|
pickerSchema.affixHeader = false;
|
|
5851
5898
|
|
|
5852
5899
|
var headerToolbarItems = [];
|
|
5853
|
-
const isMobile = window.innerWidth < 768;
|
|
5854
5900
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
5855
5901
|
headerToolbarItems = getLookupSapceUserTreeSchema();
|
|
5856
5902
|
pickerSchema["style"] = {
|
|
@@ -5931,7 +5977,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5931
5977
|
}
|
|
5932
5978
|
|
|
5933
5979
|
const ctx = ${JSON.stringify(ctx)};
|
|
5934
|
-
const componentId = ctx.defaults.formSchema.id
|
|
5980
|
+
const componentId = ctx.defaults.formSchema.id;
|
|
5935
5981
|
doAction({
|
|
5936
5982
|
actionType: 'setValue',
|
|
5937
5983
|
componentId: componentId,
|
|
@@ -6185,6 +6231,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6185
6231
|
// ids人员点选模式
|
|
6186
6232
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
6187
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
|
+
}
|
|
6188
6239
|
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
6189
6240
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
6190
6241
|
}
|
|
@@ -6325,7 +6376,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6325
6376
|
* @Author: baozhoutao@steedos.com
|
|
6326
6377
|
* @Date: 2023-01-13 17:27:54
|
|
6327
6378
|
* @LastEditors: liaodaxue
|
|
6328
|
-
* @LastEditTime: 2023-06-
|
|
6379
|
+
* @LastEditTime: 2023-06-30 10:29:52
|
|
6329
6380
|
* @Description:
|
|
6330
6381
|
*/
|
|
6331
6382
|
|
|
@@ -6333,12 +6384,16 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6333
6384
|
const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
6334
6385
|
if(readonly){
|
|
6335
6386
|
return {
|
|
6336
|
-
"type": "
|
|
6337
|
-
"
|
|
6338
|
-
"
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
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
|
+
}
|
|
6342
6397
|
}
|
|
6343
6398
|
}
|
|
6344
6399
|
}else {
|
|
@@ -7419,6 +7474,7 @@ async function getQuickEditSchema(field, options){
|
|
|
7419
7474
|
async function getTableColumns(fields, options){
|
|
7420
7475
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7421
7476
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7477
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7422
7478
|
for (const field of fields) {
|
|
7423
7479
|
//增加quickEdit属性,实现快速编辑
|
|
7424
7480
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7475,7 +7531,7 @@ async function getTableColumns(fields, options){
|
|
|
7475
7531
|
type: "switch",
|
|
7476
7532
|
name: field.name,
|
|
7477
7533
|
label: field.label,
|
|
7478
|
-
width: field.width,
|
|
7534
|
+
width: field.width || defaultWidth,
|
|
7479
7535
|
toggled: field.toggled,
|
|
7480
7536
|
quickEdit: quickEditSchema,
|
|
7481
7537
|
className:"whitespace-nowrap",
|
|
@@ -7490,7 +7546,7 @@ async function getTableColumns(fields, options){
|
|
|
7490
7546
|
label: field.label,
|
|
7491
7547
|
map: map,
|
|
7492
7548
|
sortable: field.sortable,
|
|
7493
|
-
width: field.width,
|
|
7549
|
+
width: field.width || defaultWidth,
|
|
7494
7550
|
toggled: field.toggled,
|
|
7495
7551
|
className:"whitespace-nowrap",
|
|
7496
7552
|
quickEdit: quickEditSchema
|
|
@@ -7519,7 +7575,7 @@ async function getTableColumns(fields, options){
|
|
|
7519
7575
|
label: field.label,
|
|
7520
7576
|
sortable: field.sortable,
|
|
7521
7577
|
// searchable: field.searchable,
|
|
7522
|
-
width: field.width,
|
|
7578
|
+
width: field.width || defaultWidth,
|
|
7523
7579
|
type: type,
|
|
7524
7580
|
tpl: tpl,
|
|
7525
7581
|
toggled: field.toggled,
|
|
@@ -9071,8 +9127,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9071
9127
|
/*
|
|
9072
9128
|
* @Author: baozhoutao@steedos.com
|
|
9073
9129
|
* @Date: 2022-05-26 16:02:08
|
|
9074
|
-
* @LastEditors:
|
|
9075
|
-
* @LastEditTime: 2023-06-
|
|
9130
|
+
* @LastEditors: liaodaxue
|
|
9131
|
+
* @LastEditTime: 2023-06-29 17:27:19
|
|
9076
9132
|
* @Description:
|
|
9077
9133
|
*/
|
|
9078
9134
|
|
|
@@ -9166,7 +9222,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
9166
9222
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
9167
9223
|
if (section.body.length > 0) {
|
|
9168
9224
|
if (section.visibleOn) {
|
|
9169
|
-
sectionVisibleOns.push(section.visibleOn);
|
|
9225
|
+
sectionVisibleOns.push("("+section.visibleOn+")");
|
|
9170
9226
|
}
|
|
9171
9227
|
else {
|
|
9172
9228
|
sectionVisibleOns.push("true");
|
|
@@ -9504,8 +9560,12 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9504
9560
|
if(___default.has(formSchema, 'className')){
|
|
9505
9561
|
formSchema.className = 'steedos-amis-form';
|
|
9506
9562
|
}
|
|
9563
|
+
if(!formSchema.id){
|
|
9564
|
+
formSchema.id = 'form_' + objectSchema.name;
|
|
9565
|
+
}
|
|
9507
9566
|
const amisSchema = {
|
|
9508
9567
|
type: 'service',
|
|
9568
|
+
id: `service_${formSchema.id}`,
|
|
9509
9569
|
className: 'p-0',
|
|
9510
9570
|
name: `page_edit_${recordId}`,
|
|
9511
9571
|
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
@@ -9576,11 +9636,6 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9576
9636
|
}
|
|
9577
9637
|
})]
|
|
9578
9638
|
};
|
|
9579
|
-
if(formSchema.id){
|
|
9580
|
-
amisSchema.id = `service-${formSchema.id}`;
|
|
9581
|
-
}else {
|
|
9582
|
-
amisSchema.id = `new-${objectSchema.name}`;
|
|
9583
|
-
}
|
|
9584
9639
|
return amisSchema;
|
|
9585
9640
|
}
|
|
9586
9641
|
|