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