@steedos-widgets/amis-lib 1.2.6-beta.9 → 1.2.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 +573 -134
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +573 -136
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +573 -134
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +91 -0
- package/dist/types/lib/converter/amis/fields_filter.d.ts +18 -0
- package/dist/types/lib/converter/amis/header.d.ts +137 -8
- package/dist/types/lib/converter/amis/index.d.ts +2 -0
- package/dist/types/lib/converter/amis/toolbar.d.ts +18 -0
- package/dist/types/lib/converter/amis/util.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +51 -1
- package/dist/types/schema/standard_new.amis.d.ts +1 -0
- package/dist/types/standard/button.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1376,26 +1376,11 @@
|
|
|
1376
1376
|
}
|
|
1377
1377
|
};
|
|
1378
1378
|
|
|
1379
|
-
/*
|
|
1380
|
-
* @Author: baozhoutao@steedos.com
|
|
1381
|
-
* @Date: 2022-08-04 10:42:49
|
|
1382
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
1383
|
-
* @LastEditTime: 2022-08-25 10:28:47
|
|
1384
|
-
* @Description:
|
|
1385
|
-
*/
|
|
1386
|
-
var config = {
|
|
1387
|
-
listView: {
|
|
1388
|
-
newRecordMode: 'modal',
|
|
1389
|
-
editRecordMode: 'modal',
|
|
1390
|
-
perPage: 20
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
|
|
1394
1379
|
/*
|
|
1395
1380
|
* @Author: baozhoutao@steedos.com
|
|
1396
1381
|
* @Date: 2022-11-01 15:51:00
|
|
1397
|
-
* @LastEditors:
|
|
1398
|
-
* @LastEditTime: 2023-04-
|
|
1382
|
+
* @LastEditors: Please set LastEditors
|
|
1383
|
+
* @LastEditTime: 2023-04-26 11:52:04
|
|
1399
1384
|
* @Description:
|
|
1400
1385
|
*/
|
|
1401
1386
|
|
|
@@ -1487,7 +1472,8 @@
|
|
|
1487
1472
|
"schemaApi": {
|
|
1488
1473
|
"data": {
|
|
1489
1474
|
"isLookup": "${isLookup}",
|
|
1490
|
-
"_master": "${_master}"
|
|
1475
|
+
"_master": "${_master}",
|
|
1476
|
+
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
|
|
1491
1477
|
},
|
|
1492
1478
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1493
1479
|
"method": "get",
|
|
@@ -1496,7 +1482,7 @@
|
|
|
1496
1482
|
"headers": {
|
|
1497
1483
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
1498
1484
|
},
|
|
1499
|
-
"requestAdaptor": "",
|
|
1485
|
+
"requestAdaptor": "return { ...api, url: api.body.url }",
|
|
1500
1486
|
"adaptor": schemaApiAdaptor
|
|
1501
1487
|
}
|
|
1502
1488
|
}
|
|
@@ -2405,6 +2391,166 @@
|
|
|
2405
2391
|
|
|
2406
2392
|
const executeButton = execute;
|
|
2407
2393
|
|
|
2394
|
+
|
|
2395
|
+
const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
2396
|
+
const { name } = objectSchema;
|
|
2397
|
+
const buttons = getObjectDetailButtons(objectSchema, {});
|
|
2398
|
+
const moreButtons = getObjectDetailMoreButtons(objectSchema, {
|
|
2399
|
+
recordId: recordId,
|
|
2400
|
+
objectName: name
|
|
2401
|
+
});
|
|
2402
|
+
let amisButtonsSchema = ___default["default"].map(buttons, (button) => {
|
|
2403
|
+
return {
|
|
2404
|
+
type: 'steedos-object-button',
|
|
2405
|
+
name: button.name,
|
|
2406
|
+
objectName: button.objectName,
|
|
2407
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2408
|
+
className: `button_${button.name}`
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
let dropdownButtons = ___default["default"].map(moreButtons, (button) => {
|
|
2412
|
+
return {
|
|
2413
|
+
type: 'steedos-object-button',
|
|
2414
|
+
name: button.name,
|
|
2415
|
+
objectName: button.objectName,
|
|
2416
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
return {
|
|
2420
|
+
buttons: amisButtonsSchema,
|
|
2421
|
+
moreButtons: dropdownButtons
|
|
2422
|
+
};
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2425
|
+
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2426
|
+
const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2427
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2428
|
+
return {
|
|
2429
|
+
"type": "button",
|
|
2430
|
+
"icon": "fa fa-angle-down",
|
|
2431
|
+
"onEvent": {
|
|
2432
|
+
"click": {
|
|
2433
|
+
"actions": [
|
|
2434
|
+
{
|
|
2435
|
+
"actionType": "drawer",
|
|
2436
|
+
"drawer": {
|
|
2437
|
+
"type": "drawer",
|
|
2438
|
+
"title": "操作",
|
|
2439
|
+
"body": [
|
|
2440
|
+
{
|
|
2441
|
+
"type": "button-group",
|
|
2442
|
+
"id": "u:fd837823be5b",
|
|
2443
|
+
"vertical": true,
|
|
2444
|
+
"tiled": true,
|
|
2445
|
+
"buttons": [
|
|
2446
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2447
|
+
button.className += ' w-full';
|
|
2448
|
+
return button;
|
|
2449
|
+
}),
|
|
2450
|
+
...___default["default"].map(moreButtons, (button)=>{
|
|
2451
|
+
button.className += ' w-full';
|
|
2452
|
+
return button;
|
|
2453
|
+
})
|
|
2454
|
+
],
|
|
2455
|
+
"btnLevel": "enhance",
|
|
2456
|
+
"className": "w-full",
|
|
2457
|
+
"btnClassName": "w-full",
|
|
2458
|
+
"size": "lg"
|
|
2459
|
+
}
|
|
2460
|
+
],
|
|
2461
|
+
"id": "u:9815f7366b9f",
|
|
2462
|
+
"position": "bottom",
|
|
2463
|
+
"closeOnOutside": true,
|
|
2464
|
+
"resizable": false,
|
|
2465
|
+
"className": "buttons-drawer",
|
|
2466
|
+
"bodyClassName": "m-none p-none",
|
|
2467
|
+
"actions": []
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
]
|
|
2471
|
+
}
|
|
2472
|
+
},
|
|
2473
|
+
"id": "u:ee7c7929e6ae"
|
|
2474
|
+
}
|
|
2475
|
+
}else {
|
|
2476
|
+
if(moreButtons.length > 0){
|
|
2477
|
+
const dropdownButtonsSchema = {
|
|
2478
|
+
type: "steedos-dropdown-button",
|
|
2479
|
+
label: "",
|
|
2480
|
+
buttons: moreButtons,
|
|
2481
|
+
className: 'slds-icon'
|
|
2482
|
+
};
|
|
2483
|
+
buttons.push(dropdownButtonsSchema);
|
|
2484
|
+
}
|
|
2485
|
+
return buttons;
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
2491
|
+
const buttons = getListViewButtons(objectSchema, ctx);
|
|
2492
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2493
|
+
return {
|
|
2494
|
+
"type": "button",
|
|
2495
|
+
"icon": "fa fa-angle-down",
|
|
2496
|
+
"onEvent": {
|
|
2497
|
+
"click": {
|
|
2498
|
+
"actions": [
|
|
2499
|
+
{
|
|
2500
|
+
"actionType": "drawer",
|
|
2501
|
+
"drawer": {
|
|
2502
|
+
"type": "drawer",
|
|
2503
|
+
"title": "操作",
|
|
2504
|
+
"body": [
|
|
2505
|
+
{
|
|
2506
|
+
"type": "button-group",
|
|
2507
|
+
"id": "u:fd837823be5b",
|
|
2508
|
+
"vertical": true,
|
|
2509
|
+
"tiled": true,
|
|
2510
|
+
"buttons": [
|
|
2511
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2512
|
+
return {
|
|
2513
|
+
type: 'steedos-object-button',
|
|
2514
|
+
name: button.name,
|
|
2515
|
+
objectName: button.objectName,
|
|
2516
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2517
|
+
className: `button_${button.name} w-full`
|
|
2518
|
+
}
|
|
2519
|
+
})
|
|
2520
|
+
],
|
|
2521
|
+
"btnLevel": "enhance",
|
|
2522
|
+
"className": "w-full",
|
|
2523
|
+
"btnClassName": "w-full",
|
|
2524
|
+
"size": "lg"
|
|
2525
|
+
}
|
|
2526
|
+
],
|
|
2527
|
+
"id": "u:9815f7366b9f",
|
|
2528
|
+
"position": "bottom",
|
|
2529
|
+
"closeOnOutside": true,
|
|
2530
|
+
"resizable": false,
|
|
2531
|
+
"className": "buttons-drawer",
|
|
2532
|
+
"bodyClassName": "m-none p-none",
|
|
2533
|
+
"actions": []
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
]
|
|
2537
|
+
}
|
|
2538
|
+
},
|
|
2539
|
+
"id": "u:ee7c7929e6ae"
|
|
2540
|
+
}
|
|
2541
|
+
}else {
|
|
2542
|
+
return ___default["default"].map(buttons, (button) => {
|
|
2543
|
+
return {
|
|
2544
|
+
type: 'steedos-object-button',
|
|
2545
|
+
name: button.name,
|
|
2546
|
+
objectName: button.objectName,
|
|
2547
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2548
|
+
className: `button_${button.name}`
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2408
2554
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2409
2555
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2410
2556
|
return {
|
|
@@ -2537,6 +2683,43 @@
|
|
|
2537
2683
|
// }
|
|
2538
2684
|
// }
|
|
2539
2685
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
2686
|
+
`;
|
|
2687
|
+
const onCancelScript = `
|
|
2688
|
+
const scope = event.context.scoped;
|
|
2689
|
+
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
2690
|
+
return n.props.type === "form";
|
|
2691
|
+
});
|
|
2692
|
+
var filterFormValues = filterForm.getValues();
|
|
2693
|
+
var listView = scope.parent.parent.parent.getComponents().find(function(n){
|
|
2694
|
+
return n.props.type === "crud";
|
|
2695
|
+
});
|
|
2696
|
+
const removedValues = {};
|
|
2697
|
+
for(var k in filterFormValues){
|
|
2698
|
+
if(/^__searchable__/.test(k)){
|
|
2699
|
+
removedValues[k] = "";
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
if(!event.data.isLookup){
|
|
2703
|
+
// 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
|
|
2704
|
+
const listViewId = event.data.listViewId;
|
|
2705
|
+
const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
|
|
2706
|
+
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
2707
|
+
if(localListViewProps){
|
|
2708
|
+
localListViewProps = JSON.parse(localListViewProps);
|
|
2709
|
+
for(var k in localListViewProps){
|
|
2710
|
+
removedValues[k] = "";
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
listView.handleFilterSubmit(removedValues);
|
|
2715
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2716
|
+
return n.props.type === "service";
|
|
2717
|
+
});
|
|
2718
|
+
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
2719
|
+
//触发amis crud 高度重算
|
|
2720
|
+
setTimeout(()=>{
|
|
2721
|
+
window.dispatchEvent(new Event("resize"))
|
|
2722
|
+
}, 100);
|
|
2540
2723
|
`;
|
|
2541
2724
|
const dataProviderInited = `
|
|
2542
2725
|
const objectName = data.objectName;
|
|
@@ -2731,6 +2914,22 @@
|
|
|
2731
2914
|
}
|
|
2732
2915
|
}
|
|
2733
2916
|
},
|
|
2917
|
+
{
|
|
2918
|
+
"type": "button",
|
|
2919
|
+
"label": "取消",
|
|
2920
|
+
"name": "btn_filter_form_cancel",
|
|
2921
|
+
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
2922
|
+
"onEvent": {
|
|
2923
|
+
"click": {
|
|
2924
|
+
"actions": [
|
|
2925
|
+
{
|
|
2926
|
+
"actionType": "custom",
|
|
2927
|
+
"script": onCancelScript
|
|
2928
|
+
}
|
|
2929
|
+
]
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
},
|
|
2734
2933
|
{
|
|
2735
2934
|
"type": "button",
|
|
2736
2935
|
"label": "设置搜索项",
|
|
@@ -2887,17 +3086,7 @@
|
|
|
2887
3086
|
}
|
|
2888
3087
|
);
|
|
2889
3088
|
|
|
2890
|
-
|
|
2891
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
2892
|
-
return {
|
|
2893
|
-
type: 'steedos-object-button',
|
|
2894
|
-
name: button.name,
|
|
2895
|
-
objectName: button.objectName,
|
|
2896
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
2897
|
-
className: `button_${button.name}`
|
|
2898
|
-
}
|
|
2899
|
-
});
|
|
2900
|
-
|
|
3089
|
+
let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
|
|
2901
3090
|
const reg = new RegExp('_', 'g');
|
|
2902
3091
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
2903
3092
|
return {
|
|
@@ -2930,8 +3119,8 @@
|
|
|
2930
3119
|
},
|
|
2931
3120
|
{
|
|
2932
3121
|
"type": "dropdown-button",
|
|
2933
|
-
"className": "",
|
|
2934
|
-
"label": "\${uiSchema.list_views[listName].label}",
|
|
3122
|
+
"className": "",
|
|
3123
|
+
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
2935
3124
|
"rightIcon": "fa fa-caret-down",
|
|
2936
3125
|
"size": "sm",
|
|
2937
3126
|
"hideCaret": true,
|
|
@@ -3079,7 +3268,10 @@
|
|
|
3079
3268
|
* @returns amisSchema
|
|
3080
3269
|
*/
|
|
3081
3270
|
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3082
|
-
|
|
3271
|
+
if (!ctx) {
|
|
3272
|
+
ctx = {};
|
|
3273
|
+
}
|
|
3274
|
+
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
|
|
3083
3275
|
let body = [firstLineSchema];
|
|
3084
3276
|
let headerSchema = [{
|
|
3085
3277
|
"type": "wrapper",
|
|
@@ -3100,35 +3292,11 @@
|
|
|
3100
3292
|
const { showRecordTitle = true } = options || {};
|
|
3101
3293
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
3102
3294
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
3109
|
-
return {
|
|
3110
|
-
type: 'steedos-object-button',
|
|
3111
|
-
name: button.name,
|
|
3112
|
-
objectName: button.objectName,
|
|
3113
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3114
|
-
className: `button_${button.name}`
|
|
3115
|
-
}
|
|
3116
|
-
});
|
|
3117
|
-
let dropdownButtons = _$1.map(moreButtons, (button) => {
|
|
3118
|
-
return {
|
|
3119
|
-
type: 'steedos-object-button',
|
|
3120
|
-
name: button.name,
|
|
3121
|
-
objectName: button.objectName,
|
|
3122
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3123
|
-
}
|
|
3124
|
-
});
|
|
3125
|
-
const dropdownButtonsSchema = {
|
|
3126
|
-
type: "steedos-dropdown-button",
|
|
3127
|
-
label: "",
|
|
3128
|
-
buttons: dropdownButtons,
|
|
3129
|
-
className: 'slds-icon'
|
|
3130
|
-
};
|
|
3131
|
-
amisButtonsSchema.push(dropdownButtonsSchema);
|
|
3295
|
+
|
|
3296
|
+
let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
3297
|
+
|
|
3298
|
+
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
3299
|
+
|
|
3132
3300
|
const reg = new RegExp('_', 'g');
|
|
3133
3301
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3134
3302
|
|
|
@@ -3339,8 +3507,8 @@
|
|
|
3339
3507
|
"icon": "fa fa-table-columns",
|
|
3340
3508
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3341
3509
|
"align": "right",
|
|
3342
|
-
"visibleOn": "${
|
|
3343
|
-
"buttons": [
|
|
3510
|
+
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
3511
|
+
"buttons": [
|
|
3344
3512
|
{
|
|
3345
3513
|
"label": "显示为",
|
|
3346
3514
|
"children": buttons
|
|
@@ -3360,11 +3528,26 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
3360
3528
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3361
3529
|
return n.props.type === "service";
|
|
3362
3530
|
});
|
|
3363
|
-
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3531
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3532
|
+
let resizeWindow = function(){
|
|
3533
|
+
//触发amis crud 高度重算
|
|
3534
|
+
setTimeout(()=>{
|
|
3535
|
+
window.dispatchEvent(new Event("resize"))
|
|
3536
|
+
}, 500);
|
|
3537
|
+
}
|
|
3538
|
+
if(filterService.props.data.showFieldsFilter){
|
|
3539
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3540
|
+
direction: "down",
|
|
3541
|
+
name: "btn_filter_form_cancel"
|
|
3542
|
+
});
|
|
3543
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3544
|
+
resizeWindow();
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3547
|
+
else{
|
|
3548
|
+
filterService.setData({showFieldsFilter: true});
|
|
3549
|
+
resizeWindow();
|
|
3550
|
+
}
|
|
3368
3551
|
`;
|
|
3369
3552
|
|
|
3370
3553
|
function getExportApiRequestAdaptorScript(){
|
|
@@ -3437,6 +3620,7 @@ setTimeout(()=>{
|
|
|
3437
3620
|
`;
|
|
3438
3621
|
return [
|
|
3439
3622
|
// "bulkActions",
|
|
3623
|
+
...(headerToolbarItems || []),
|
|
3440
3624
|
hiddenCount ? {} :{
|
|
3441
3625
|
"type": "tpl",
|
|
3442
3626
|
"tpl": "${count} 个项目"
|
|
@@ -3581,7 +3765,7 @@ setTimeout(()=>{
|
|
|
3581
3765
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
3582
3766
|
"appId": "${appId}",
|
|
3583
3767
|
"global": "${global}",
|
|
3584
|
-
"
|
|
3768
|
+
"targetObjectName": "${objectName}",
|
|
3585
3769
|
},
|
|
3586
3770
|
"body": [
|
|
3587
3771
|
{
|
|
@@ -3621,7 +3805,7 @@ setTimeout(()=>{
|
|
|
3621
3805
|
{
|
|
3622
3806
|
"args": {
|
|
3623
3807
|
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3624
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
3808
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3625
3809
|
"blank": false
|
|
3626
3810
|
},
|
|
3627
3811
|
"actionType": "url",
|
|
@@ -3662,7 +3846,7 @@ setTimeout(()=>{
|
|
|
3662
3846
|
"data": {
|
|
3663
3847
|
"&": "$$",
|
|
3664
3848
|
"listName": "${listName}",
|
|
3665
|
-
"
|
|
3849
|
+
"targetObjectName": "${objectName}",
|
|
3666
3850
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
3667
3851
|
"appId": "${appId}",
|
|
3668
3852
|
"global": "${global}"
|
|
@@ -3705,7 +3889,7 @@ setTimeout(()=>{
|
|
|
3705
3889
|
"actions": [
|
|
3706
3890
|
{
|
|
3707
3891
|
"args": {
|
|
3708
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
3892
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3709
3893
|
"blank": false
|
|
3710
3894
|
},
|
|
3711
3895
|
"actionType": "url",
|
|
@@ -3741,7 +3925,7 @@ setTimeout(()=>{
|
|
|
3741
3925
|
"type": "dialog",
|
|
3742
3926
|
"title": "重命名 列表视图",
|
|
3743
3927
|
"data": {
|
|
3744
|
-
"
|
|
3928
|
+
"targetObjectName": "${objectName}",
|
|
3745
3929
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3746
3930
|
"appId": "${appId}"
|
|
3747
3931
|
},
|
|
@@ -3762,7 +3946,7 @@ setTimeout(()=>{
|
|
|
3762
3946
|
"actions": [
|
|
3763
3947
|
{
|
|
3764
3948
|
"args": {
|
|
3765
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
3949
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
3766
3950
|
"blank": false
|
|
3767
3951
|
},
|
|
3768
3952
|
"actionType": "url",
|
|
@@ -3836,6 +4020,7 @@ setTimeout(()=>{
|
|
|
3836
4020
|
"type": "dialog",
|
|
3837
4021
|
"title": "过滤设置",
|
|
3838
4022
|
"data": {
|
|
4023
|
+
"targetObjectName": "${objectName}",
|
|
3839
4024
|
"objectName": "${objectName}",
|
|
3840
4025
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3841
4026
|
"listName": "${listName}",
|
|
@@ -3861,7 +4046,7 @@ setTimeout(()=>{
|
|
|
3861
4046
|
"actions": [
|
|
3862
4047
|
{
|
|
3863
4048
|
"args": {
|
|
3864
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4049
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
3865
4050
|
"blank": false
|
|
3866
4051
|
},
|
|
3867
4052
|
"actionType": "url",
|
|
@@ -3899,6 +4084,7 @@ setTimeout(()=>{
|
|
|
3899
4084
|
"title": "显示的列",
|
|
3900
4085
|
"data": {
|
|
3901
4086
|
"&": "$$",
|
|
4087
|
+
"targetObjectName": "${objectName}",
|
|
3902
4088
|
"objectName": "${objectName}",
|
|
3903
4089
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3904
4090
|
"listName": "${listName}",
|
|
@@ -3924,7 +4110,7 @@ setTimeout(()=>{
|
|
|
3924
4110
|
"actions": [
|
|
3925
4111
|
{
|
|
3926
4112
|
"args": {
|
|
3927
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4113
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
3928
4114
|
"blank": false
|
|
3929
4115
|
},
|
|
3930
4116
|
"actionType": "url"
|
|
@@ -3960,6 +4146,7 @@ setTimeout(()=>{
|
|
|
3960
4146
|
"title": "弹框标题",
|
|
3961
4147
|
"data": {
|
|
3962
4148
|
"&": "$$",
|
|
4149
|
+
"targetObjectName": "${objectName}",
|
|
3963
4150
|
"objectName": "${objectName}",
|
|
3964
4151
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3965
4152
|
"listName": "${listName}",
|
|
@@ -3985,7 +4172,7 @@ setTimeout(()=>{
|
|
|
3985
4172
|
"actions": [
|
|
3986
4173
|
{
|
|
3987
4174
|
"args": {
|
|
3988
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4175
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
3989
4176
|
"blank": false
|
|
3990
4177
|
},
|
|
3991
4178
|
"actionType": "url"
|
|
@@ -4099,8 +4286,8 @@ setTimeout(()=>{
|
|
|
4099
4286
|
}
|
|
4100
4287
|
else {
|
|
4101
4288
|
return [
|
|
4289
|
+
"switch-per-page",
|
|
4102
4290
|
"statistics",
|
|
4103
|
-
// "switch-per-page",
|
|
4104
4291
|
"pagination"
|
|
4105
4292
|
]
|
|
4106
4293
|
}
|
|
@@ -4533,13 +4720,16 @@ setTimeout(()=>{
|
|
|
4533
4720
|
var sort = orderBy + ' ' + orderDir;
|
|
4534
4721
|
sort = orderBy ? sort : "${sort}";
|
|
4535
4722
|
var allowSearchFields = ${JSON.stringify(searchableFields)};
|
|
4723
|
+
let fieldValue;
|
|
4536
4724
|
if(api.data.$term){
|
|
4537
4725
|
filters = [["name", "contains", "'+ api.data.$term +'"]];
|
|
4538
4726
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
4539
4727
|
if(selfData.value?.indexOf(',') > 0){
|
|
4540
|
-
|
|
4728
|
+
fieldValue = selfData.value.split(',');
|
|
4729
|
+
filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
|
|
4541
4730
|
}else{
|
|
4542
|
-
|
|
4731
|
+
fieldValue = selfData.value;
|
|
4732
|
+
filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
|
|
4543
4733
|
}
|
|
4544
4734
|
}
|
|
4545
4735
|
|
|
@@ -4593,6 +4783,9 @@ setTimeout(()=>{
|
|
|
4593
4783
|
if(enable_tree){
|
|
4594
4784
|
pageSize = 10000;
|
|
4595
4785
|
}
|
|
4786
|
+
if(fieldValue && _.isArray(fieldValue) && fieldValue.length > pageSize){
|
|
4787
|
+
pageSize = fieldValue.length;
|
|
4788
|
+
}
|
|
4596
4789
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
4597
4790
|
return api;
|
|
4598
4791
|
`;
|
|
@@ -4673,6 +4866,8 @@ setTimeout(()=>{
|
|
|
4673
4866
|
...ctx
|
|
4674
4867
|
});
|
|
4675
4868
|
|
|
4869
|
+
pickerSchema.affixHeader = false;
|
|
4870
|
+
|
|
4676
4871
|
var headerToolbarItems = [];
|
|
4677
4872
|
const isMobile = window.innerWidth < 768;
|
|
4678
4873
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
@@ -4690,14 +4885,11 @@ setTimeout(()=>{
|
|
|
4690
4885
|
pickerSchema.headerToolbar.push(new_button);
|
|
4691
4886
|
}
|
|
4692
4887
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
...ctx
|
|
4699
|
-
});
|
|
4700
|
-
}
|
|
4888
|
+
if (ctx.filterVisible !== false) {
|
|
4889
|
+
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
4890
|
+
isLookup: true,
|
|
4891
|
+
...ctx
|
|
4892
|
+
});
|
|
4701
4893
|
}
|
|
4702
4894
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
4703
4895
|
"&": "$$",
|
|
@@ -4881,11 +5073,12 @@ setTimeout(()=>{
|
|
|
4881
5073
|
autoComplete: apiInfo,
|
|
4882
5074
|
searchable: true,
|
|
4883
5075
|
};
|
|
5076
|
+
//删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
|
|
4884
5077
|
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
4885
5078
|
<span role='img' aria-label='smile' class='anticon anticon-smile'>
|
|
4886
5079
|
<span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
|
|
4887
5080
|
<svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
|
|
4888
|
-
<use xlink:href='
|
|
5081
|
+
<use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
|
|
4889
5082
|
</svg>
|
|
4890
5083
|
</span>
|
|
4891
5084
|
</span>
|
|
@@ -4943,8 +5136,10 @@ setTimeout(()=>{
|
|
|
4943
5136
|
|
|
4944
5137
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
4945
5138
|
if(ctx.idsDependOn || field.amis){
|
|
5139
|
+
// ids人员点选模式
|
|
4946
5140
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4947
5141
|
}
|
|
5142
|
+
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
4948
5143
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4949
5144
|
}
|
|
4950
5145
|
|
|
@@ -5045,6 +5240,9 @@ setTimeout(()=>{
|
|
|
5045
5240
|
top: top,
|
|
5046
5241
|
...ctx
|
|
5047
5242
|
});
|
|
5243
|
+
|
|
5244
|
+
pickerSchema.affixHeader = false;
|
|
5245
|
+
|
|
5048
5246
|
}
|
|
5049
5247
|
|
|
5050
5248
|
const data = {
|
|
@@ -5074,7 +5272,6 @@ setTimeout(()=>{
|
|
|
5074
5272
|
if(readonly){
|
|
5075
5273
|
data.tpl = await getLookupTpl(field, ctx);
|
|
5076
5274
|
}
|
|
5077
|
-
|
|
5078
5275
|
return data;
|
|
5079
5276
|
}
|
|
5080
5277
|
|
|
@@ -5282,6 +5479,23 @@ setTimeout(()=>{
|
|
|
5282
5479
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5283
5480
|
};
|
|
5284
5481
|
|
|
5482
|
+
/*
|
|
5483
|
+
* @Author: baozhoutao@steedos.com
|
|
5484
|
+
* @Date: 2022-07-20 16:29:22
|
|
5485
|
+
* @LastEditors: Please set LastEditors
|
|
5486
|
+
* @LastEditTime: 2023-05-11 11:19:54
|
|
5487
|
+
* @Description:
|
|
5488
|
+
*/
|
|
5489
|
+
|
|
5490
|
+
function getContrastColor(bgColor) {
|
|
5491
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5492
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5493
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5494
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5495
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5496
|
+
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5285
5499
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5286
5500
|
// const Lookup = require('./lookup');
|
|
5287
5501
|
|
|
@@ -5435,6 +5649,8 @@ setTimeout(()=>{
|
|
|
5435
5649
|
}
|
|
5436
5650
|
|
|
5437
5651
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
5652
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
5653
|
+
const isMobile = window.innerWidth <= 768;
|
|
5438
5654
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
5439
5655
|
if(___namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
5440
5656
|
return;
|
|
@@ -5469,20 +5685,42 @@ setTimeout(()=>{
|
|
|
5469
5685
|
// }
|
|
5470
5686
|
// break;
|
|
5471
5687
|
case 'select':
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5688
|
+
if(readonly){
|
|
5689
|
+
const selectOptions = field.options;
|
|
5690
|
+
let map = {};
|
|
5691
|
+
___namespace.forEach(selectOptions,(option)=>{
|
|
5692
|
+
const optionValue = option.value + '';
|
|
5693
|
+
if(option.color){
|
|
5694
|
+
const background = '#'+option.color;
|
|
5695
|
+
const color = getContrastColor(background);
|
|
5696
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
5697
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
5698
|
+
}else {
|
|
5699
|
+
map[optionValue] = option.label;
|
|
5700
|
+
}
|
|
5701
|
+
});
|
|
5702
|
+
convertData = {
|
|
5703
|
+
type: "static-mapping",
|
|
5704
|
+
name: field.name,
|
|
5705
|
+
label: field.label,
|
|
5706
|
+
map: map
|
|
5707
|
+
};
|
|
5708
|
+
}else {
|
|
5709
|
+
convertData = {
|
|
5710
|
+
type: getAmisStaticFieldType('select', readonly),
|
|
5711
|
+
joinValues: false,
|
|
5712
|
+
options: getSelectFieldOptions(field),
|
|
5713
|
+
extractValue: true,
|
|
5714
|
+
clearable: true,
|
|
5715
|
+
labelField: 'label',
|
|
5716
|
+
valueField: 'value'
|
|
5717
|
+
};
|
|
5718
|
+
if(field.multiple){
|
|
5719
|
+
convertData.multiple = true;
|
|
5720
|
+
convertData.extractValue = true;
|
|
5721
|
+
}
|
|
5485
5722
|
}
|
|
5723
|
+
|
|
5486
5724
|
break;
|
|
5487
5725
|
case 'boolean':
|
|
5488
5726
|
convertData = {
|
|
@@ -5502,7 +5740,26 @@ setTimeout(()=>{
|
|
|
5502
5740
|
};
|
|
5503
5741
|
break;
|
|
5504
5742
|
case 'date':
|
|
5505
|
-
convertData = {
|
|
5743
|
+
convertData = isMobile && !readonly ? {
|
|
5744
|
+
type: "native-date",
|
|
5745
|
+
pipeIn: (value, data) => {
|
|
5746
|
+
if (value) {
|
|
5747
|
+
value = moment(value).utc().format('YYYY-MM-DD');
|
|
5748
|
+
return value;
|
|
5749
|
+
} else {
|
|
5750
|
+
return "";
|
|
5751
|
+
}
|
|
5752
|
+
|
|
5753
|
+
},
|
|
5754
|
+
pipeOut: (value, oldValue, data) => {
|
|
5755
|
+
if (value) {
|
|
5756
|
+
value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
5757
|
+
return value;
|
|
5758
|
+
} else {
|
|
5759
|
+
return "";
|
|
5760
|
+
}
|
|
5761
|
+
}
|
|
5762
|
+
} : {
|
|
5506
5763
|
type: getAmisStaticFieldType('date', readonly),
|
|
5507
5764
|
inputFormat: "YYYY-MM-DD",
|
|
5508
5765
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -5521,12 +5778,48 @@ setTimeout(()=>{
|
|
|
5521
5778
|
};
|
|
5522
5779
|
break;
|
|
5523
5780
|
case 'datetime':
|
|
5524
|
-
convertData = {
|
|
5781
|
+
convertData = isMobile && !readonly ? {
|
|
5782
|
+
type: "combo",
|
|
5783
|
+
pipeIn: (value, data) => {
|
|
5784
|
+
let revalue = {};
|
|
5785
|
+
if (value && value != "Invalid date") {
|
|
5786
|
+
value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
5787
|
+
revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
5788
|
+
revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
5789
|
+
} else {
|
|
5790
|
+
revalue[field.name + "-native-date"] = "";
|
|
5791
|
+
revalue[field.name + "-native-time"] = "";
|
|
5792
|
+
}
|
|
5793
|
+
return revalue;
|
|
5794
|
+
},
|
|
5795
|
+
pipeOut: (value, oldValue, data) => {
|
|
5796
|
+
let revalue = "";
|
|
5797
|
+
if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
5798
|
+
revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
5799
|
+
revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
5800
|
+
}
|
|
5801
|
+
return revalue;
|
|
5802
|
+
},
|
|
5803
|
+
items: [
|
|
5804
|
+
{
|
|
5805
|
+
type: "native-date",
|
|
5806
|
+
name: field.name + "-native-date",
|
|
5807
|
+
className: "steedos-native-date",
|
|
5808
|
+
value: ""
|
|
5809
|
+
},
|
|
5810
|
+
{
|
|
5811
|
+
type: "native-time",
|
|
5812
|
+
name: field.name + "-native-time",
|
|
5813
|
+
className: "steedos-native-time",
|
|
5814
|
+
value: ""
|
|
5815
|
+
}
|
|
5816
|
+
]
|
|
5817
|
+
} : {
|
|
5525
5818
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
5526
5819
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
5527
|
-
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5820
|
+
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5528
5821
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
5529
|
-
utc: true
|
|
5822
|
+
utc: true,
|
|
5530
5823
|
};
|
|
5531
5824
|
break;
|
|
5532
5825
|
case 'input-time-range':
|
|
@@ -5541,7 +5834,26 @@ setTimeout(()=>{
|
|
|
5541
5834
|
};
|
|
5542
5835
|
break;
|
|
5543
5836
|
case 'time':
|
|
5544
|
-
convertData = {
|
|
5837
|
+
convertData = isMobile && !readonly ? {
|
|
5838
|
+
type: "native-time",
|
|
5839
|
+
pipeIn: (value, data) => {
|
|
5840
|
+
if (value) {
|
|
5841
|
+
value = moment(value).utc().format('HH:mm');
|
|
5842
|
+
return value;
|
|
5843
|
+
} else {
|
|
5844
|
+
return "";
|
|
5845
|
+
}
|
|
5846
|
+
|
|
5847
|
+
},
|
|
5848
|
+
pipeOut: (value, oldValue, data) => {
|
|
5849
|
+
if (value) {
|
|
5850
|
+
value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
5851
|
+
return value;
|
|
5852
|
+
} else {
|
|
5853
|
+
return "";
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
} : {
|
|
5545
5857
|
type: getAmisStaticFieldType('time', readonly),
|
|
5546
5858
|
inputFormat: 'HH:mm',
|
|
5547
5859
|
timeFormat:'HH:mm',
|
|
@@ -5653,7 +5965,7 @@ setTimeout(()=>{
|
|
|
5653
5965
|
convertData = {
|
|
5654
5966
|
type: "editor",
|
|
5655
5967
|
language: field.language,
|
|
5656
|
-
|
|
5968
|
+
editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
|
|
5657
5969
|
};
|
|
5658
5970
|
break;
|
|
5659
5971
|
case 'toggle':
|
|
@@ -5674,7 +5986,7 @@ setTimeout(()=>{
|
|
|
5674
5986
|
columnsTogglable: false,
|
|
5675
5987
|
strictMode:false,
|
|
5676
5988
|
affixHeader: false, // 是否固定表头, 不固定表头, 否则form有y轴滚动条时, 表头会跟随滚动条滚动.
|
|
5677
|
-
|
|
5989
|
+
needConfirm: false,
|
|
5678
5990
|
editable: !readonly,
|
|
5679
5991
|
addable: !readonly,
|
|
5680
5992
|
removable: !readonly,
|
|
@@ -5745,6 +6057,13 @@ setTimeout(()=>{
|
|
|
5745
6057
|
convertData.quickEdit = false;
|
|
5746
6058
|
}
|
|
5747
6059
|
|
|
6060
|
+
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
6061
|
+
if (convertData.className) {
|
|
6062
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
6063
|
+
} else {
|
|
6064
|
+
convertData.className = fieldTypeClassName;
|
|
6065
|
+
}
|
|
6066
|
+
|
|
5748
6067
|
if(field.visible_on){
|
|
5749
6068
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
5750
6069
|
if(field.visible_on.startsWith("{{")){
|
|
@@ -5904,6 +6223,12 @@ setTimeout(()=>{
|
|
|
5904
6223
|
// })
|
|
5905
6224
|
|
|
5906
6225
|
return `
|
|
6226
|
+
if(payload.data.data.length === 0){
|
|
6227
|
+
return {
|
|
6228
|
+
status: 2,
|
|
6229
|
+
msg: "无法找到记录"
|
|
6230
|
+
}
|
|
6231
|
+
}
|
|
5907
6232
|
if(payload.data.data){
|
|
5908
6233
|
var data = payload.data.data[0];
|
|
5909
6234
|
var gridAndObjectFieldsName = ${JSON.stringify(gridAndObjectFieldsName)};
|
|
@@ -6028,12 +6353,12 @@ setTimeout(()=>{
|
|
|
6028
6353
|
});
|
|
6029
6354
|
}
|
|
6030
6355
|
}else{
|
|
6031
|
-
data[item] = {
|
|
6356
|
+
data[item] = [{
|
|
6032
6357
|
value: fileFieldValue,
|
|
6033
6358
|
name: fileFieldDisplayValue.name,
|
|
6034
6359
|
url: fileFieldDisplayValue.url + "?download=true",
|
|
6035
6360
|
state: "uploaded"
|
|
6036
|
-
};
|
|
6361
|
+
}];
|
|
6037
6362
|
}
|
|
6038
6363
|
}
|
|
6039
6364
|
})
|
|
@@ -6051,7 +6376,7 @@ setTimeout(()=>{
|
|
|
6051
6376
|
|
|
6052
6377
|
return {
|
|
6053
6378
|
method: "post",
|
|
6054
|
-
url: getApi$2(),
|
|
6379
|
+
url: getApi$2() + '&objectName=${objectName}' ,
|
|
6055
6380
|
// sendOn: "!!this.recordId",
|
|
6056
6381
|
cache: API_CACHE,
|
|
6057
6382
|
requestAdaptor: `
|
|
@@ -6357,7 +6682,7 @@ setTimeout(()=>{
|
|
|
6357
6682
|
}),
|
|
6358
6683
|
filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
|
|
6359
6684
|
};
|
|
6360
|
-
if(options.formFactor !== 'SMALL'){
|
|
6685
|
+
if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
|
|
6361
6686
|
Object.assign(bodyProps, {
|
|
6362
6687
|
bulkActions: options.bulkActions != false ? bulkActions : false
|
|
6363
6688
|
});
|
|
@@ -6422,7 +6747,7 @@ setTimeout(()=>{
|
|
|
6422
6747
|
api: await getTableApi(objectSchema, fields, options),
|
|
6423
6748
|
hiddenOn: options.tableHiddenOn,
|
|
6424
6749
|
autoFillHeight: options.isRelated ? false : true,
|
|
6425
|
-
className: `flex-auto ${crudClassName || ""}`,
|
|
6750
|
+
className: `flex-auto bg-white ${crudClassName || ""}`,
|
|
6426
6751
|
crudClassName: crudClassName,
|
|
6427
6752
|
},
|
|
6428
6753
|
bodyProps,
|
|
@@ -6571,7 +6896,8 @@ setTimeout(()=>{
|
|
|
6571
6896
|
"eventName": `@data.changed.${objectSchema.name}`
|
|
6572
6897
|
},
|
|
6573
6898
|
"data": {
|
|
6574
|
-
"objectName": `${objectSchema.name}
|
|
6899
|
+
"objectName": `${objectSchema.name}`,
|
|
6900
|
+
"displayAs": "${displayAs}"
|
|
6575
6901
|
}
|
|
6576
6902
|
},
|
|
6577
6903
|
{
|
|
@@ -6671,7 +6997,8 @@ setTimeout(()=>{
|
|
|
6671
6997
|
data: {
|
|
6672
6998
|
objectName: "${event.data.__objectName}",
|
|
6673
6999
|
record: "${event.data.__record}"
|
|
6674
|
-
}
|
|
7000
|
+
},
|
|
7001
|
+
expression: "${event.data.__response.error != true}"
|
|
6675
7002
|
},
|
|
6676
7003
|
{
|
|
6677
7004
|
"actionType": "setValue",
|
|
@@ -6679,7 +7006,8 @@ setTimeout(()=>{
|
|
|
6679
7006
|
value: {
|
|
6680
7007
|
"recordLoaded": true,
|
|
6681
7008
|
}
|
|
6682
|
-
}
|
|
7009
|
+
},
|
|
7010
|
+
expression: "${event.data.__response.error != true}"
|
|
6683
7011
|
}
|
|
6684
7012
|
]
|
|
6685
7013
|
}
|
|
@@ -6687,6 +7015,21 @@ setTimeout(()=>{
|
|
|
6687
7015
|
}
|
|
6688
7016
|
}
|
|
6689
7017
|
|
|
7018
|
+
/*
|
|
7019
|
+
* @Author: baozhoutao@steedos.com
|
|
7020
|
+
* @Date: 2022-08-04 10:42:49
|
|
7021
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
7022
|
+
* @LastEditTime: 2022-08-25 10:28:47
|
|
7023
|
+
* @Description:
|
|
7024
|
+
*/
|
|
7025
|
+
var config = {
|
|
7026
|
+
listView: {
|
|
7027
|
+
newRecordMode: 'modal',
|
|
7028
|
+
editRecordMode: 'modal',
|
|
7029
|
+
perPage: 20
|
|
7030
|
+
}
|
|
7031
|
+
};
|
|
7032
|
+
|
|
6690
7033
|
async function getTableColumns(fields, options){
|
|
6691
7034
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
6692
7035
|
for (const field of fields) {
|
|
@@ -6750,7 +7093,31 @@ setTimeout(()=>{
|
|
|
6750
7093
|
...getAmisFileReadonlySchema(field)
|
|
6751
7094
|
}, field.amis, {name: field.name}));
|
|
6752
7095
|
}
|
|
6753
|
-
|
|
7096
|
+
else if(field.type === 'select'){
|
|
7097
|
+
const selectOptions = field.options;
|
|
7098
|
+
let map = {};
|
|
7099
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
7100
|
+
const optionValue = option.value + '';
|
|
7101
|
+
if(option.color){
|
|
7102
|
+
const background = '#'+option.color;
|
|
7103
|
+
const color = getContrastColor(background);
|
|
7104
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7105
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7106
|
+
}else {
|
|
7107
|
+
map[optionValue] = option.label;
|
|
7108
|
+
}
|
|
7109
|
+
});
|
|
7110
|
+
columns.push(Object.assign({}, {
|
|
7111
|
+
type: "mapping",
|
|
7112
|
+
name: field.name,
|
|
7113
|
+
label: field.label,
|
|
7114
|
+
map: map,
|
|
7115
|
+
sortable: field.sortable,
|
|
7116
|
+
width: field.width,
|
|
7117
|
+
toggled: field.toggled,
|
|
7118
|
+
className:"whitespace-nowrap",
|
|
7119
|
+
}, field.amis, {name: field.name}));
|
|
7120
|
+
}
|
|
6754
7121
|
else {
|
|
6755
7122
|
const tpl = await getFieldTpl(field, options);
|
|
6756
7123
|
|
|
@@ -6760,6 +7127,13 @@ setTimeout(()=>{
|
|
|
6760
7127
|
}else if(field.type === 'html'){
|
|
6761
7128
|
type = 'markdown';
|
|
6762
7129
|
}
|
|
7130
|
+
let className = "";
|
|
7131
|
+
if(field.type === 'textarea'){
|
|
7132
|
+
className = 'min-w-56';
|
|
7133
|
+
}
|
|
7134
|
+
if(field.wrap === false){
|
|
7135
|
+
className += " whitespace-nowrap";
|
|
7136
|
+
}
|
|
6763
7137
|
if(!field.hidden && !field.extra){
|
|
6764
7138
|
columns.push(Object.assign({}, {
|
|
6765
7139
|
name: field.name,
|
|
@@ -6770,7 +7144,7 @@ setTimeout(()=>{
|
|
|
6770
7144
|
type: type,
|
|
6771
7145
|
tpl: tpl,
|
|
6772
7146
|
toggled: field.toggled,
|
|
6773
|
-
className
|
|
7147
|
+
className,
|
|
6774
7148
|
html: field.type === 'html' ? true : null
|
|
6775
7149
|
// toggled: true
|
|
6776
7150
|
}, field.amis, {name: field.name}));
|
|
@@ -6895,8 +7269,9 @@ setTimeout(()=>{
|
|
|
6895
7269
|
const url = getNameTplUrl(nameField, options);
|
|
6896
7270
|
|
|
6897
7271
|
const columnLines = getMobileLines(tpls);
|
|
6898
|
-
|
|
6899
|
-
|
|
7272
|
+
|
|
7273
|
+
|
|
7274
|
+
let column = {
|
|
6900
7275
|
name: nameField.name,
|
|
6901
7276
|
label: nameField.label,
|
|
6902
7277
|
sortable: nameField.sortable,
|
|
@@ -6905,13 +7280,66 @@ setTimeout(()=>{
|
|
|
6905
7280
|
actionType: "link",
|
|
6906
7281
|
link: url,
|
|
6907
7282
|
innerClassName: "steedos-listview-item block text-gray-500",
|
|
6908
|
-
body:{
|
|
7283
|
+
body: {
|
|
6909
7284
|
"type": "wrapper",
|
|
6910
7285
|
"body": columnLines,
|
|
6911
7286
|
"size": "none",
|
|
6912
7287
|
"className": "p-1"
|
|
6913
7288
|
}
|
|
6914
|
-
}
|
|
7289
|
+
};
|
|
7290
|
+
|
|
7291
|
+
if(options.objectName === 'cms_files'){
|
|
7292
|
+
if(window.Meteor?.isCordova){
|
|
7293
|
+
column = {
|
|
7294
|
+
...column,
|
|
7295
|
+
actionType: "",
|
|
7296
|
+
link: "",
|
|
7297
|
+
onEvent: {
|
|
7298
|
+
"click": {
|
|
7299
|
+
"actions": [
|
|
7300
|
+
{
|
|
7301
|
+
"script": `
|
|
7302
|
+
let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
|
|
7303
|
+
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
7304
|
+
`,
|
|
7305
|
+
"actionType": "custom"
|
|
7306
|
+
}
|
|
7307
|
+
],
|
|
7308
|
+
"weight": 0
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7311
|
+
};
|
|
7312
|
+
}else {
|
|
7313
|
+
column = {
|
|
7314
|
+
...column,
|
|
7315
|
+
actionType: "",
|
|
7316
|
+
link: "",
|
|
7317
|
+
onEvent: {
|
|
7318
|
+
"click": {
|
|
7319
|
+
"actions": [
|
|
7320
|
+
{
|
|
7321
|
+
"args": {
|
|
7322
|
+
"api": {
|
|
7323
|
+
"url": url,
|
|
7324
|
+
"method": "get",
|
|
7325
|
+
"headers": {
|
|
7326
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
},
|
|
7330
|
+
"actionType": "download"
|
|
7331
|
+
}
|
|
7332
|
+
],
|
|
7333
|
+
"weight": 0
|
|
7334
|
+
}
|
|
7335
|
+
}
|
|
7336
|
+
};
|
|
7337
|
+
}
|
|
7338
|
+
|
|
7339
|
+
}
|
|
7340
|
+
|
|
7341
|
+
columns.push(column);
|
|
7342
|
+
|
|
6915
7343
|
|
|
6916
7344
|
return columns;
|
|
6917
7345
|
}
|
|
@@ -7030,7 +7458,7 @@ setTimeout(()=>{
|
|
|
7030
7458
|
options = {};
|
|
7031
7459
|
}
|
|
7032
7460
|
let columns = [];
|
|
7033
|
-
if(options.formFactor === 'SMALL'){
|
|
7461
|
+
if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
|
|
7034
7462
|
columns = await getMobileTableColumns(fields, options);
|
|
7035
7463
|
}
|
|
7036
7464
|
else {
|
|
@@ -7233,7 +7661,11 @@ setTimeout(()=>{
|
|
|
7233
7661
|
filters = systemFilters;
|
|
7234
7662
|
};
|
|
7235
7663
|
if(api.data.$self.additionalFilters){
|
|
7236
|
-
|
|
7664
|
+
if(_.isString(api.data.$self.additionalFilters)){
|
|
7665
|
+
userFilters.push(eval(api.data.$self.additionalFilters))
|
|
7666
|
+
}else{
|
|
7667
|
+
userFilters.push(api.data.$self.additionalFilters)
|
|
7668
|
+
}
|
|
7237
7669
|
}
|
|
7238
7670
|
|
|
7239
7671
|
if(api.data.$self._isRelated){
|
|
@@ -7266,8 +7698,7 @@ setTimeout(()=>{
|
|
|
7266
7698
|
if(_.isEmpty(filters)){
|
|
7267
7699
|
filters = userFilters;
|
|
7268
7700
|
}else{
|
|
7269
|
-
filters
|
|
7270
|
-
filters.push(userFilters)
|
|
7701
|
+
filters = [filters, 'and', userFilters]
|
|
7271
7702
|
}
|
|
7272
7703
|
}
|
|
7273
7704
|
api.data = {
|
|
@@ -7694,7 +8125,6 @@ setTimeout(()=>{
|
|
|
7694
8125
|
// ObjectForm会认作用域下的变量值
|
|
7695
8126
|
// TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
|
|
7696
8127
|
// TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
|
|
7697
|
-
event.data = doc;
|
|
7698
8128
|
const title = "新建 ${objectSchema.label}";
|
|
7699
8129
|
doAction(
|
|
7700
8130
|
{
|
|
@@ -7707,6 +8137,7 @@ setTimeout(()=>{
|
|
|
7707
8137
|
"type": "steedos-object-form",
|
|
7708
8138
|
"objectApiName": "\${objectName}",
|
|
7709
8139
|
"mode": "edit",
|
|
8140
|
+
"defaultData": doc,
|
|
7710
8141
|
"onEvent": {
|
|
7711
8142
|
"submitSucc": {
|
|
7712
8143
|
"weight": 0,
|
|
@@ -7999,7 +8430,7 @@ setTimeout(()=>{
|
|
|
7999
8430
|
* @Author: baozhoutao@steedos.com
|
|
8000
8431
|
* @Date: 2022-07-05 15:55:39
|
|
8001
8432
|
* @LastEditors: Please set LastEditors
|
|
8002
|
-
* @LastEditTime: 2023-
|
|
8433
|
+
* @LastEditTime: 2023-05-08 16:34:25
|
|
8003
8434
|
* @Description:
|
|
8004
8435
|
*/
|
|
8005
8436
|
|
|
@@ -8253,7 +8684,7 @@ setTimeout(()=>{
|
|
|
8253
8684
|
}
|
|
8254
8685
|
function getRelatedListProps(uiSchema, listViewName, ctx) {
|
|
8255
8686
|
if (ctx.columns) {
|
|
8256
|
-
const sort = getListViewSort(ctx.sort);
|
|
8687
|
+
const sort = getListViewSort({sort: ctx.sort});
|
|
8257
8688
|
let { filters , filtersFunction} = ctx;
|
|
8258
8689
|
if(!filtersFunction && filters){
|
|
8259
8690
|
filtersFunction = str2function(
|
|
@@ -8342,7 +8773,7 @@ setTimeout(()=>{
|
|
|
8342
8773
|
* @Author: baozhoutao@steedos.com
|
|
8343
8774
|
* @Date: 2022-07-05 15:55:39
|
|
8344
8775
|
* @LastEditors: baozhoutao@steedos.com
|
|
8345
|
-
* @LastEditTime: 2023-04-
|
|
8776
|
+
* @LastEditTime: 2023-04-28 11:11:29
|
|
8346
8777
|
* @Description:
|
|
8347
8778
|
*/
|
|
8348
8779
|
|
|
@@ -8540,6 +8971,9 @@ setTimeout(()=>{
|
|
|
8540
8971
|
ctx = {}
|
|
8541
8972
|
) {
|
|
8542
8973
|
const uiSchema = await getUISchema(objectName);
|
|
8974
|
+
if(!uiSchema){
|
|
8975
|
+
return {}
|
|
8976
|
+
}
|
|
8543
8977
|
const listView = _$1.find(
|
|
8544
8978
|
uiSchema.list_views,
|
|
8545
8979
|
(listView, name) => {
|
|
@@ -9093,7 +9527,10 @@ setTimeout(()=>{
|
|
|
9093
9527
|
const defaults = ctx.defaults || {};
|
|
9094
9528
|
if(!defaults.headerSchema){
|
|
9095
9529
|
//传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
|
|
9096
|
-
const headerSchema = await getObjectListHeader$1(uiSchema
|
|
9530
|
+
const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
|
|
9531
|
+
onlySecordLine: true,
|
|
9532
|
+
isListviewInit: true
|
|
9533
|
+
});
|
|
9097
9534
|
defaults.headerSchema = headerSchema;
|
|
9098
9535
|
}
|
|
9099
9536
|
ctx.defaults = defaults;
|
|
@@ -11769,6 +12206,7 @@ setTimeout(()=>{
|
|
|
11769
12206
|
exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
|
|
11770
12207
|
exports.getNotifications = getNotifications;
|
|
11771
12208
|
exports.getObjectDetailButtons = getObjectDetailButtons;
|
|
12209
|
+
exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
|
|
11772
12210
|
exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
|
|
11773
12211
|
exports.getObjectFieldsFilterBarSchema = getObjectFieldsFilterBarSchema;
|
|
11774
12212
|
exports.getObjectFieldsFilterButtonSchema = getObjectFieldsFilterButtonSchema;
|
|
@@ -11777,6 +12215,7 @@ setTimeout(()=>{
|
|
|
11777
12215
|
exports.getObjectListHeaderFieldsFilterBar = getObjectListHeaderFieldsFilterBar;
|
|
11778
12216
|
exports.getObjectListHeaderFirstLine = getObjectListHeaderFirstLine;
|
|
11779
12217
|
exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
|
|
12218
|
+
exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
|
|
11780
12219
|
exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
|
|
11781
12220
|
exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
|
|
11782
12221
|
exports.getObjectRelated = getObjectRelated;
|