@steedos-widgets/amis-lib 1.2.6-beta.17 → 1.2.6-beta.18
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 +193 -59
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +192 -60
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +193 -59
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +91 -0
- package/dist/types/lib/converter/amis/header.d.ts +119 -8
- package/dist/types/lib/objects.d.ts +39 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1377,21 +1377,6 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
1377
1377
|
}
|
|
1378
1378
|
};
|
|
1379
1379
|
|
|
1380
|
-
/*
|
|
1381
|
-
* @Author: baozhoutao@steedos.com
|
|
1382
|
-
* @Date: 2022-08-04 10:42:49
|
|
1383
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
1384
|
-
* @LastEditTime: 2022-08-25 10:28:47
|
|
1385
|
-
* @Description:
|
|
1386
|
-
*/
|
|
1387
|
-
var config = {
|
|
1388
|
-
listView: {
|
|
1389
|
-
newRecordMode: 'modal',
|
|
1390
|
-
editRecordMode: 'modal',
|
|
1391
|
-
perPage: 20
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
1380
|
/*
|
|
1396
1381
|
* @Author: baozhoutao@steedos.com
|
|
1397
1382
|
* @Date: 2022-11-01 15:51:00
|
|
@@ -2407,6 +2392,166 @@ const execute = (button, props) => {
|
|
|
2407
2392
|
|
|
2408
2393
|
const executeButton = execute;
|
|
2409
2394
|
|
|
2395
|
+
|
|
2396
|
+
const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
2397
|
+
const { name } = objectSchema;
|
|
2398
|
+
const buttons = getObjectDetailButtons(objectSchema, {});
|
|
2399
|
+
const moreButtons = getObjectDetailMoreButtons(objectSchema, {
|
|
2400
|
+
recordId: recordId,
|
|
2401
|
+
objectName: name
|
|
2402
|
+
});
|
|
2403
|
+
let amisButtonsSchema = ___default["default"].map(buttons, (button) => {
|
|
2404
|
+
return {
|
|
2405
|
+
type: 'steedos-object-button',
|
|
2406
|
+
name: button.name,
|
|
2407
|
+
objectName: button.objectName,
|
|
2408
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2409
|
+
className: `button_${button.name}`
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
let dropdownButtons = ___default["default"].map(moreButtons, (button) => {
|
|
2413
|
+
return {
|
|
2414
|
+
type: 'steedos-object-button',
|
|
2415
|
+
name: button.name,
|
|
2416
|
+
objectName: button.objectName,
|
|
2417
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2420
|
+
return {
|
|
2421
|
+
buttons: amisButtonsSchema,
|
|
2422
|
+
moreButtons: dropdownButtons
|
|
2423
|
+
};
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2427
|
+
const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2428
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2429
|
+
return {
|
|
2430
|
+
"type": "button",
|
|
2431
|
+
"icon": "fa fa-angle-down",
|
|
2432
|
+
"onEvent": {
|
|
2433
|
+
"click": {
|
|
2434
|
+
"actions": [
|
|
2435
|
+
{
|
|
2436
|
+
"actionType": "drawer",
|
|
2437
|
+
"drawer": {
|
|
2438
|
+
"type": "drawer",
|
|
2439
|
+
"title": "操作",
|
|
2440
|
+
"body": [
|
|
2441
|
+
{
|
|
2442
|
+
"type": "button-group",
|
|
2443
|
+
"id": "u:fd837823be5b",
|
|
2444
|
+
"vertical": true,
|
|
2445
|
+
"tiled": true,
|
|
2446
|
+
"buttons": [
|
|
2447
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2448
|
+
button.className += ' w-full';
|
|
2449
|
+
return button;
|
|
2450
|
+
}),
|
|
2451
|
+
...___default["default"].map(moreButtons, (button)=>{
|
|
2452
|
+
button.className += ' w-full';
|
|
2453
|
+
return button;
|
|
2454
|
+
})
|
|
2455
|
+
],
|
|
2456
|
+
"btnLevel": "enhance",
|
|
2457
|
+
"className": "w-full",
|
|
2458
|
+
"btnClassName": "w-full",
|
|
2459
|
+
"size": "lg"
|
|
2460
|
+
}
|
|
2461
|
+
],
|
|
2462
|
+
"id": "u:9815f7366b9f",
|
|
2463
|
+
"position": "bottom",
|
|
2464
|
+
"closeOnOutside": true,
|
|
2465
|
+
"resizable": false,
|
|
2466
|
+
"className": "buttons-drawer",
|
|
2467
|
+
"bodyClassName": "m-none p-none",
|
|
2468
|
+
"actions": []
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
},
|
|
2474
|
+
"id": "u:ee7c7929e6ae"
|
|
2475
|
+
}
|
|
2476
|
+
}else {
|
|
2477
|
+
if(moreButtons.length > 0){
|
|
2478
|
+
const dropdownButtonsSchema = {
|
|
2479
|
+
type: "steedos-dropdown-button",
|
|
2480
|
+
label: "",
|
|
2481
|
+
buttons: moreButtons,
|
|
2482
|
+
className: 'slds-icon'
|
|
2483
|
+
};
|
|
2484
|
+
buttons.push(dropdownButtonsSchema);
|
|
2485
|
+
}
|
|
2486
|
+
return buttons;
|
|
2487
|
+
}
|
|
2488
|
+
};
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
2492
|
+
const buttons = getListViewButtons(objectSchema, ctx);
|
|
2493
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2494
|
+
return {
|
|
2495
|
+
"type": "button",
|
|
2496
|
+
"icon": "fa fa-angle-down",
|
|
2497
|
+
"onEvent": {
|
|
2498
|
+
"click": {
|
|
2499
|
+
"actions": [
|
|
2500
|
+
{
|
|
2501
|
+
"actionType": "drawer",
|
|
2502
|
+
"drawer": {
|
|
2503
|
+
"type": "drawer",
|
|
2504
|
+
"title": "操作",
|
|
2505
|
+
"body": [
|
|
2506
|
+
{
|
|
2507
|
+
"type": "button-group",
|
|
2508
|
+
"id": "u:fd837823be5b",
|
|
2509
|
+
"vertical": true,
|
|
2510
|
+
"tiled": true,
|
|
2511
|
+
"buttons": [
|
|
2512
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2513
|
+
return {
|
|
2514
|
+
type: 'steedos-object-button',
|
|
2515
|
+
name: button.name,
|
|
2516
|
+
objectName: button.objectName,
|
|
2517
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2518
|
+
className: `button_${button.name} w-full`
|
|
2519
|
+
}
|
|
2520
|
+
})
|
|
2521
|
+
],
|
|
2522
|
+
"btnLevel": "enhance",
|
|
2523
|
+
"className": "w-full",
|
|
2524
|
+
"btnClassName": "w-full",
|
|
2525
|
+
"size": "lg"
|
|
2526
|
+
}
|
|
2527
|
+
],
|
|
2528
|
+
"id": "u:9815f7366b9f",
|
|
2529
|
+
"position": "bottom",
|
|
2530
|
+
"closeOnOutside": true,
|
|
2531
|
+
"resizable": false,
|
|
2532
|
+
"className": "buttons-drawer",
|
|
2533
|
+
"bodyClassName": "m-none p-none",
|
|
2534
|
+
"actions": []
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
]
|
|
2538
|
+
}
|
|
2539
|
+
},
|
|
2540
|
+
"id": "u:ee7c7929e6ae"
|
|
2541
|
+
}
|
|
2542
|
+
}else {
|
|
2543
|
+
return ___default["default"].map(buttons, (button) => {
|
|
2544
|
+
return {
|
|
2545
|
+
type: 'steedos-object-button',
|
|
2546
|
+
name: button.name,
|
|
2547
|
+
objectName: button.objectName,
|
|
2548
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2549
|
+
className: `button_${button.name}`
|
|
2550
|
+
}
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
};
|
|
2554
|
+
|
|
2410
2555
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2411
2556
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2412
2557
|
return {
|
|
@@ -2889,17 +3034,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
2889
3034
|
}
|
|
2890
3035
|
);
|
|
2891
3036
|
|
|
2892
|
-
|
|
2893
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
2894
|
-
return {
|
|
2895
|
-
type: 'steedos-object-button',
|
|
2896
|
-
name: button.name,
|
|
2897
|
-
objectName: button.objectName,
|
|
2898
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
2899
|
-
className: `button_${button.name}`
|
|
2900
|
-
}
|
|
2901
|
-
});
|
|
2902
|
-
|
|
3037
|
+
let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
|
|
2903
3038
|
const reg = new RegExp('_', 'g');
|
|
2904
3039
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
2905
3040
|
return {
|
|
@@ -3081,7 +3216,10 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
|
|
|
3081
3216
|
* @returns amisSchema
|
|
3082
3217
|
*/
|
|
3083
3218
|
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3084
|
-
|
|
3219
|
+
if (!ctx) {
|
|
3220
|
+
ctx = {};
|
|
3221
|
+
}
|
|
3222
|
+
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
|
|
3085
3223
|
let body = [firstLineSchema];
|
|
3086
3224
|
let headerSchema = [{
|
|
3087
3225
|
"type": "wrapper",
|
|
@@ -3102,35 +3240,11 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3102
3240
|
const { showRecordTitle = true } = options || {};
|
|
3103
3241
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
3104
3242
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
3111
|
-
return {
|
|
3112
|
-
type: 'steedos-object-button',
|
|
3113
|
-
name: button.name,
|
|
3114
|
-
objectName: button.objectName,
|
|
3115
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3116
|
-
className: `button_${button.name}`
|
|
3117
|
-
}
|
|
3118
|
-
});
|
|
3119
|
-
let dropdownButtons = _$1.map(moreButtons, (button) => {
|
|
3120
|
-
return {
|
|
3121
|
-
type: 'steedos-object-button',
|
|
3122
|
-
name: button.name,
|
|
3123
|
-
objectName: button.objectName,
|
|
3124
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3125
|
-
}
|
|
3126
|
-
});
|
|
3127
|
-
const dropdownButtonsSchema = {
|
|
3128
|
-
type: "steedos-dropdown-button",
|
|
3129
|
-
label: "",
|
|
3130
|
-
buttons: dropdownButtons,
|
|
3131
|
-
className: 'slds-icon'
|
|
3132
|
-
};
|
|
3133
|
-
amisButtonsSchema.push(dropdownButtonsSchema);
|
|
3243
|
+
|
|
3244
|
+
let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
3245
|
+
|
|
3246
|
+
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
3247
|
+
|
|
3134
3248
|
const reg = new RegExp('_', 'g');
|
|
3135
3249
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3136
3250
|
|
|
@@ -6375,7 +6489,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6375
6489
|
}),
|
|
6376
6490
|
filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
|
|
6377
6491
|
};
|
|
6378
|
-
if(options.formFactor !== 'SMALL'){
|
|
6492
|
+
if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
|
|
6379
6493
|
Object.assign(bodyProps, {
|
|
6380
6494
|
bulkActions: options.bulkActions != false ? bulkActions : false
|
|
6381
6495
|
});
|
|
@@ -6708,6 +6822,21 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
6708
6822
|
}
|
|
6709
6823
|
}
|
|
6710
6824
|
|
|
6825
|
+
/*
|
|
6826
|
+
* @Author: baozhoutao@steedos.com
|
|
6827
|
+
* @Date: 2022-08-04 10:42:49
|
|
6828
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
6829
|
+
* @LastEditTime: 2022-08-25 10:28:47
|
|
6830
|
+
* @Description:
|
|
6831
|
+
*/
|
|
6832
|
+
var config = {
|
|
6833
|
+
listView: {
|
|
6834
|
+
newRecordMode: 'modal',
|
|
6835
|
+
editRecordMode: 'modal',
|
|
6836
|
+
perPage: 20
|
|
6837
|
+
}
|
|
6838
|
+
};
|
|
6839
|
+
|
|
6711
6840
|
async function getTableColumns(fields, options){
|
|
6712
6841
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
6713
6842
|
for (const field of fields) {
|
|
@@ -7058,7 +7187,7 @@ async function getTableSchema$1(fields, options){
|
|
|
7058
7187
|
options = {};
|
|
7059
7188
|
}
|
|
7060
7189
|
let columns = [];
|
|
7061
|
-
if(options.formFactor === 'SMALL'){
|
|
7190
|
+
if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
|
|
7062
7191
|
columns = await getMobileTableColumns(fields, options);
|
|
7063
7192
|
}
|
|
7064
7193
|
else {
|
|
@@ -9127,7 +9256,10 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
|
|
|
9127
9256
|
const defaults = ctx.defaults || {};
|
|
9128
9257
|
if(!defaults.headerSchema){
|
|
9129
9258
|
//传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
|
|
9130
|
-
const headerSchema = await getObjectListHeader$1(uiSchema
|
|
9259
|
+
const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
|
|
9260
|
+
onlySecordLine: true,
|
|
9261
|
+
isListviewInit: true
|
|
9262
|
+
});
|
|
9131
9263
|
defaults.headerSchema = headerSchema;
|
|
9132
9264
|
}
|
|
9133
9265
|
ctx.defaults = defaults;
|
|
@@ -11803,6 +11935,7 @@ exports.getListviewInitSchema = getListviewInitSchema;
|
|
|
11803
11935
|
exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
|
|
11804
11936
|
exports.getNotifications = getNotifications;
|
|
11805
11937
|
exports.getObjectDetailButtons = getObjectDetailButtons;
|
|
11938
|
+
exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
|
|
11806
11939
|
exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
|
|
11807
11940
|
exports.getObjectFieldsFilterBarSchema = getObjectFieldsFilterBarSchema;
|
|
11808
11941
|
exports.getObjectFieldsFilterButtonSchema = getObjectFieldsFilterButtonSchema;
|
|
@@ -11811,6 +11944,7 @@ exports.getObjectListHeader = getObjectListHeader$1;
|
|
|
11811
11944
|
exports.getObjectListHeaderFieldsFilterBar = getObjectListHeaderFieldsFilterBar;
|
|
11812
11945
|
exports.getObjectListHeaderFirstLine = getObjectListHeaderFirstLine;
|
|
11813
11946
|
exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
|
|
11947
|
+
exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
|
|
11814
11948
|
exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
|
|
11815
11949
|
exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
|
|
11816
11950
|
exports.getObjectRelated = getObjectRelated;
|