@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.cjs.js
CHANGED
|
@@ -1758,8 +1758,8 @@ i18next__default["default"]
|
|
|
1758
1758
|
/*
|
|
1759
1759
|
* @Author: baozhoutao@steedos.com
|
|
1760
1760
|
* @Date: 2022-11-01 15:51:00
|
|
1761
|
-
* @LastEditors:
|
|
1762
|
-
* @LastEditTime: 2023-06-
|
|
1761
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1762
|
+
* @LastEditTime: 2023-06-28 23:19:41
|
|
1763
1763
|
* @Description:
|
|
1764
1764
|
*/
|
|
1765
1765
|
|
|
@@ -1811,6 +1811,16 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1811
1811
|
data: formSchema
|
|
1812
1812
|
};
|
|
1813
1813
|
`;
|
|
1814
|
+
const onDialogCancelScript = `
|
|
1815
|
+
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
1816
|
+
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
1817
|
+
setTimeout(function(){
|
|
1818
|
+
doAction({
|
|
1819
|
+
"actionType": "cancel",
|
|
1820
|
+
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
1821
|
+
});
|
|
1822
|
+
}, 200);
|
|
1823
|
+
`;
|
|
1814
1824
|
return {
|
|
1815
1825
|
"type": "service",
|
|
1816
1826
|
"body": [
|
|
@@ -1871,6 +1881,17 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1871
1881
|
"closeOnEsc": false,
|
|
1872
1882
|
"closeOnOutside": false,
|
|
1873
1883
|
"size": "lg",
|
|
1884
|
+
"onEvent": {
|
|
1885
|
+
"cancel": {
|
|
1886
|
+
"actions": [
|
|
1887
|
+
{
|
|
1888
|
+
"actionType": "custom",
|
|
1889
|
+
"script": onDialogCancelScript,
|
|
1890
|
+
"expression": "${window:innerWidth < 768}",
|
|
1891
|
+
}
|
|
1892
|
+
]
|
|
1893
|
+
}
|
|
1894
|
+
},
|
|
1874
1895
|
"actions": [
|
|
1875
1896
|
{
|
|
1876
1897
|
type: 'button',
|
|
@@ -1933,7 +1954,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1933
1954
|
* @Author: baozhoutao@steedos.com
|
|
1934
1955
|
* @Date: 2022-11-01 15:49:58
|
|
1935
1956
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1936
|
-
* @LastEditTime: 2023-
|
|
1957
|
+
* @LastEditTime: 2023-06-28 23:22:31
|
|
1937
1958
|
* @Description:
|
|
1938
1959
|
*/
|
|
1939
1960
|
|
|
@@ -1962,6 +1983,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1962
1983
|
? JSON.parse(page.schema)
|
|
1963
1984
|
: page.schema;
|
|
1964
1985
|
}
|
|
1986
|
+
|
|
1987
|
+
const onDialogCancelScript = `
|
|
1988
|
+
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
1989
|
+
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
|
|
1990
|
+
setTimeout(function(){
|
|
1991
|
+
doAction({
|
|
1992
|
+
"actionType": "cancel",
|
|
1993
|
+
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
1994
|
+
});
|
|
1995
|
+
}, 200);
|
|
1996
|
+
`;
|
|
1965
1997
|
|
|
1966
1998
|
return {
|
|
1967
1999
|
type: "service",
|
|
@@ -1985,6 +2017,17 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1985
2017
|
closeOnOutside: false,
|
|
1986
2018
|
showCloseButton: true,
|
|
1987
2019
|
size: "lg",
|
|
2020
|
+
"onEvent": {
|
|
2021
|
+
"cancel": {
|
|
2022
|
+
"actions": [
|
|
2023
|
+
{
|
|
2024
|
+
"actionType": "custom",
|
|
2025
|
+
"script": onDialogCancelScript,
|
|
2026
|
+
"expression": "${window:innerWidth < 768}",
|
|
2027
|
+
}
|
|
2028
|
+
]
|
|
2029
|
+
}
|
|
2030
|
+
},
|
|
1988
2031
|
},
|
|
1989
2032
|
},
|
|
1990
2033
|
],
|
|
@@ -2281,6 +2324,7 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2281
2324
|
label: i18next__default["default"].t('frontend_import_data_file'),
|
|
2282
2325
|
required: true,
|
|
2283
2326
|
type: "input-file",
|
|
2327
|
+
accept: ".xlsx,.xls",
|
|
2284
2328
|
className: "m-1",
|
|
2285
2329
|
labelClassName: "text-left",
|
|
2286
2330
|
clearValueOnHidden: true,
|
|
@@ -2945,6 +2989,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2945
2989
|
"drawer": {
|
|
2946
2990
|
"type": "drawer",
|
|
2947
2991
|
"title": "操作",
|
|
2992
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
2948
2993
|
"body": [
|
|
2949
2994
|
{
|
|
2950
2995
|
"type": "button-group",
|
|
@@ -2967,7 +3012,6 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2967
3012
|
"size": "lg"
|
|
2968
3013
|
}
|
|
2969
3014
|
],
|
|
2970
|
-
"id": "u:9815f7366b9f",
|
|
2971
3015
|
"position": "bottom",
|
|
2972
3016
|
"closeOnOutside": true,
|
|
2973
3017
|
"resizable": false,
|
|
@@ -2978,8 +3022,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2978
3022
|
}
|
|
2979
3023
|
]
|
|
2980
3024
|
}
|
|
2981
|
-
}
|
|
2982
|
-
"id": "u:ee7c7929e6ae"
|
|
3025
|
+
}
|
|
2983
3026
|
}
|
|
2984
3027
|
}else {
|
|
2985
3028
|
if(moreButtons.length > 0){
|
|
@@ -3011,6 +3054,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3011
3054
|
"drawer": {
|
|
3012
3055
|
"type": "drawer",
|
|
3013
3056
|
"title": "操作",
|
|
3057
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
3014
3058
|
"body": [
|
|
3015
3059
|
{
|
|
3016
3060
|
"type": "button-group",
|
|
@@ -3034,7 +3078,6 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3034
3078
|
"size": "lg"
|
|
3035
3079
|
}
|
|
3036
3080
|
],
|
|
3037
|
-
"id": "u:9815f7366b9f",
|
|
3038
3081
|
"position": "bottom",
|
|
3039
3082
|
"closeOnOutside": true,
|
|
3040
3083
|
"resizable": false,
|
|
@@ -3045,8 +3088,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3045
3088
|
}
|
|
3046
3089
|
]
|
|
3047
3090
|
}
|
|
3048
|
-
}
|
|
3049
|
-
"id": "u:ee7c7929e6ae"
|
|
3091
|
+
}
|
|
3050
3092
|
}
|
|
3051
3093
|
}else {
|
|
3052
3094
|
return ___default["default"].map(buttons, (button) => {
|
|
@@ -3075,6 +3117,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3075
3117
|
"drawer": {
|
|
3076
3118
|
"type": "drawer",
|
|
3077
3119
|
"title": "操作",
|
|
3120
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
3078
3121
|
"body": [
|
|
3079
3122
|
{
|
|
3080
3123
|
"type": "button-group",
|
|
@@ -5651,6 +5694,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5651
5694
|
const fieldsArr = [];
|
|
5652
5695
|
|
|
5653
5696
|
const listName = "all";
|
|
5697
|
+
|
|
5698
|
+
const isMobile = window.innerWidth < 768;
|
|
5654
5699
|
|
|
5655
5700
|
const listView = ___namespace.find(
|
|
5656
5701
|
refObjectConfig.list_views,
|
|
@@ -5727,6 +5772,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5727
5772
|
|
|
5728
5773
|
source.data.$term = "$term";
|
|
5729
5774
|
source.data.$self = "$$";
|
|
5775
|
+
|
|
5730
5776
|
|
|
5731
5777
|
source.requestAdaptor = `
|
|
5732
5778
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -5762,6 +5808,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5762
5808
|
}
|
|
5763
5809
|
}
|
|
5764
5810
|
|
|
5811
|
+
|
|
5765
5812
|
if(allowSearchFields){
|
|
5766
5813
|
allowSearchFields.forEach(function(key){
|
|
5767
5814
|
const keyValue = selfData[key];
|
|
@@ -5877,7 +5924,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5877
5924
|
pickerSchema.affixHeader = false;
|
|
5878
5925
|
|
|
5879
5926
|
var headerToolbarItems = [];
|
|
5880
|
-
const isMobile = window.innerWidth < 768;
|
|
5881
5927
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
5882
5928
|
headerToolbarItems = getLookupSapceUserTreeSchema();
|
|
5883
5929
|
pickerSchema["style"] = {
|
|
@@ -5958,7 +6004,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5958
6004
|
}
|
|
5959
6005
|
|
|
5960
6006
|
const ctx = ${JSON.stringify(ctx)};
|
|
5961
|
-
const componentId = ctx.defaults.formSchema.id
|
|
6007
|
+
const componentId = ctx.defaults.formSchema.id;
|
|
5962
6008
|
doAction({
|
|
5963
6009
|
actionType: 'setValue',
|
|
5964
6010
|
componentId: componentId,
|
|
@@ -6212,6 +6258,11 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6212
6258
|
// ids人员点选模式
|
|
6213
6259
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
6214
6260
|
}
|
|
6261
|
+
if(!field.filters || field.filters.length == 0){
|
|
6262
|
+
field.filters = [["user_accepted", "=", true]];
|
|
6263
|
+
}else {
|
|
6264
|
+
field.filters = [ ["user_accepted", "=", true], "and", field.filters ];
|
|
6265
|
+
}
|
|
6215
6266
|
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
6216
6267
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
6217
6268
|
}
|
|
@@ -6352,7 +6403,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6352
6403
|
* @Author: baozhoutao@steedos.com
|
|
6353
6404
|
* @Date: 2023-01-13 17:27:54
|
|
6354
6405
|
* @LastEditors: liaodaxue
|
|
6355
|
-
* @LastEditTime: 2023-06-
|
|
6406
|
+
* @LastEditTime: 2023-06-30 10:29:52
|
|
6356
6407
|
* @Description:
|
|
6357
6408
|
*/
|
|
6358
6409
|
|
|
@@ -6360,12 +6411,16 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6360
6411
|
const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
6361
6412
|
if(readonly){
|
|
6362
6413
|
return {
|
|
6363
|
-
"type": "
|
|
6364
|
-
"
|
|
6365
|
-
"
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6414
|
+
"type": "control",
|
|
6415
|
+
"label": field.label,
|
|
6416
|
+
"body": {
|
|
6417
|
+
"type": "markdown",
|
|
6418
|
+
"name": field.name,
|
|
6419
|
+
"options": {
|
|
6420
|
+
"linkify": true,
|
|
6421
|
+
"html": true,
|
|
6422
|
+
"breaks": true
|
|
6423
|
+
}
|
|
6369
6424
|
}
|
|
6370
6425
|
}
|
|
6371
6426
|
}else {
|
|
@@ -7446,6 +7501,7 @@ async function getQuickEditSchema(field, options){
|
|
|
7446
7501
|
async function getTableColumns(fields, options){
|
|
7447
7502
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7448
7503
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7504
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7449
7505
|
for (const field of fields) {
|
|
7450
7506
|
//增加quickEdit属性,实现快速编辑
|
|
7451
7507
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7502,7 +7558,7 @@ async function getTableColumns(fields, options){
|
|
|
7502
7558
|
type: "switch",
|
|
7503
7559
|
name: field.name,
|
|
7504
7560
|
label: field.label,
|
|
7505
|
-
width: field.width,
|
|
7561
|
+
width: field.width || defaultWidth,
|
|
7506
7562
|
toggled: field.toggled,
|
|
7507
7563
|
quickEdit: quickEditSchema,
|
|
7508
7564
|
className:"whitespace-nowrap",
|
|
@@ -7517,7 +7573,7 @@ async function getTableColumns(fields, options){
|
|
|
7517
7573
|
label: field.label,
|
|
7518
7574
|
map: map,
|
|
7519
7575
|
sortable: field.sortable,
|
|
7520
|
-
width: field.width,
|
|
7576
|
+
width: field.width || defaultWidth,
|
|
7521
7577
|
toggled: field.toggled,
|
|
7522
7578
|
className:"whitespace-nowrap",
|
|
7523
7579
|
quickEdit: quickEditSchema
|
|
@@ -7546,7 +7602,7 @@ async function getTableColumns(fields, options){
|
|
|
7546
7602
|
label: field.label,
|
|
7547
7603
|
sortable: field.sortable,
|
|
7548
7604
|
// searchable: field.searchable,
|
|
7549
|
-
width: field.width,
|
|
7605
|
+
width: field.width || defaultWidth,
|
|
7550
7606
|
type: type,
|
|
7551
7607
|
tpl: tpl,
|
|
7552
7608
|
toggled: field.toggled,
|
|
@@ -9098,8 +9154,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9098
9154
|
/*
|
|
9099
9155
|
* @Author: baozhoutao@steedos.com
|
|
9100
9156
|
* @Date: 2022-05-26 16:02:08
|
|
9101
|
-
* @LastEditors:
|
|
9102
|
-
* @LastEditTime: 2023-06-
|
|
9157
|
+
* @LastEditors: liaodaxue
|
|
9158
|
+
* @LastEditTime: 2023-06-29 17:27:19
|
|
9103
9159
|
* @Description:
|
|
9104
9160
|
*/
|
|
9105
9161
|
|
|
@@ -9193,7 +9249,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
9193
9249
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
9194
9250
|
if (section.body.length > 0) {
|
|
9195
9251
|
if (section.visibleOn) {
|
|
9196
|
-
sectionVisibleOns.push(section.visibleOn);
|
|
9252
|
+
sectionVisibleOns.push("("+section.visibleOn+")");
|
|
9197
9253
|
}
|
|
9198
9254
|
else {
|
|
9199
9255
|
sectionVisibleOns.push("true");
|
|
@@ -9531,8 +9587,12 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9531
9587
|
if(___default["default"].has(formSchema, 'className')){
|
|
9532
9588
|
formSchema.className = 'steedos-amis-form';
|
|
9533
9589
|
}
|
|
9590
|
+
if(!formSchema.id){
|
|
9591
|
+
formSchema.id = 'form_' + objectSchema.name;
|
|
9592
|
+
}
|
|
9534
9593
|
const amisSchema = {
|
|
9535
9594
|
type: 'service',
|
|
9595
|
+
id: `service_${formSchema.id}`,
|
|
9536
9596
|
className: 'p-0',
|
|
9537
9597
|
name: `page_edit_${recordId}`,
|
|
9538
9598
|
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
@@ -9603,11 +9663,6 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9603
9663
|
}
|
|
9604
9664
|
})]
|
|
9605
9665
|
};
|
|
9606
|
-
if(formSchema.id){
|
|
9607
|
-
amisSchema.id = `service-${formSchema.id}`;
|
|
9608
|
-
}else {
|
|
9609
|
-
amisSchema.id = `new-${objectSchema.name}`;
|
|
9610
|
-
}
|
|
9611
9666
|
return amisSchema;
|
|
9612
9667
|
}
|
|
9613
9668
|
|