@steedos-widgets/amis-object 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/amis/AmisAppLauncher.d.ts +0 -5
- package/dist/amis/AmisObjectListview.d.ts +1 -7
- package/dist/amis/AmisRecordDetailHeader.d.ts +39 -1
- package/dist/amis/AmisRecordDetailRelatedLists.d.ts +1 -14
- package/dist/amis/AmisSelectFlow.d.ts +1 -0
- package/dist/amis-object.cjs.css +170 -32
- package/dist/amis-object.cjs.js +705 -193
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +170 -32
- package/dist/amis-object.esm.js +706 -194
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +170 -32
- package/dist/amis-object.umd.js +705 -193
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/dist/meta.js +1 -1
- package/dist/pages/PageListView.d.ts +4 -1
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -1737,26 +1737,11 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
|
|
|
1737
1737
|
}
|
|
1738
1738
|
};
|
|
1739
1739
|
|
|
1740
|
-
/*
|
|
1741
|
-
* @Author: baozhoutao@steedos.com
|
|
1742
|
-
* @Date: 2022-08-04 10:42:49
|
|
1743
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
1744
|
-
* @LastEditTime: 2022-08-25 10:28:47
|
|
1745
|
-
* @Description:
|
|
1746
|
-
*/
|
|
1747
|
-
var config = {
|
|
1748
|
-
listView: {
|
|
1749
|
-
newRecordMode: 'modal',
|
|
1750
|
-
editRecordMode: 'modal',
|
|
1751
|
-
perPage: 20
|
|
1752
|
-
}
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
1740
|
/*
|
|
1756
1741
|
* @Author: baozhoutao@steedos.com
|
|
1757
1742
|
* @Date: 2022-11-01 15:51:00
|
|
1758
|
-
* @LastEditors:
|
|
1759
|
-
* @LastEditTime: 2023-04-
|
|
1743
|
+
* @LastEditors: Please set LastEditors
|
|
1744
|
+
* @LastEditTime: 2023-04-26 11:52:04
|
|
1760
1745
|
* @Description:
|
|
1761
1746
|
*/
|
|
1762
1747
|
|
|
@@ -1848,7 +1833,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1848
1833
|
"schemaApi": {
|
|
1849
1834
|
"data": {
|
|
1850
1835
|
"isLookup": "${isLookup}",
|
|
1851
|
-
"_master": "${_master}"
|
|
1836
|
+
"_master": "${_master}",
|
|
1837
|
+
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
|
|
1852
1838
|
},
|
|
1853
1839
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1854
1840
|
"method": "get",
|
|
@@ -1857,7 +1843,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1857
1843
|
"headers": {
|
|
1858
1844
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
1859
1845
|
},
|
|
1860
|
-
"requestAdaptor": "",
|
|
1846
|
+
"requestAdaptor": "return { ...api, url: api.body.url }",
|
|
1861
1847
|
"adaptor": schemaApiAdaptor
|
|
1862
1848
|
}
|
|
1863
1849
|
}
|
|
@@ -2766,6 +2752,166 @@ const execute = (button, props) => {
|
|
|
2766
2752
|
|
|
2767
2753
|
const executeButton = execute;
|
|
2768
2754
|
|
|
2755
|
+
|
|
2756
|
+
const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
2757
|
+
const { name } = objectSchema;
|
|
2758
|
+
const buttons = getObjectDetailButtons(objectSchema, {});
|
|
2759
|
+
const moreButtons = getObjectDetailMoreButtons(objectSchema, {
|
|
2760
|
+
recordId: recordId,
|
|
2761
|
+
objectName: name
|
|
2762
|
+
});
|
|
2763
|
+
let amisButtonsSchema = ___default__default["default"].map(buttons, (button) => {
|
|
2764
|
+
return {
|
|
2765
|
+
type: 'steedos-object-button',
|
|
2766
|
+
name: button.name,
|
|
2767
|
+
objectName: button.objectName,
|
|
2768
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2769
|
+
className: `button_${button.name}`
|
|
2770
|
+
}
|
|
2771
|
+
});
|
|
2772
|
+
let dropdownButtons = ___default__default["default"].map(moreButtons, (button) => {
|
|
2773
|
+
return {
|
|
2774
|
+
type: 'steedos-object-button',
|
|
2775
|
+
name: button.name,
|
|
2776
|
+
objectName: button.objectName,
|
|
2777
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
return {
|
|
2781
|
+
buttons: amisButtonsSchema,
|
|
2782
|
+
moreButtons: dropdownButtons
|
|
2783
|
+
};
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2786
|
+
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2787
|
+
const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2788
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2789
|
+
return {
|
|
2790
|
+
"type": "button",
|
|
2791
|
+
"icon": "fa fa-angle-down",
|
|
2792
|
+
"onEvent": {
|
|
2793
|
+
"click": {
|
|
2794
|
+
"actions": [
|
|
2795
|
+
{
|
|
2796
|
+
"actionType": "drawer",
|
|
2797
|
+
"drawer": {
|
|
2798
|
+
"type": "drawer",
|
|
2799
|
+
"title": "操作",
|
|
2800
|
+
"body": [
|
|
2801
|
+
{
|
|
2802
|
+
"type": "button-group",
|
|
2803
|
+
"id": "u:fd837823be5b",
|
|
2804
|
+
"vertical": true,
|
|
2805
|
+
"tiled": true,
|
|
2806
|
+
"buttons": [
|
|
2807
|
+
...___default__default["default"].map(buttons, (button)=>{
|
|
2808
|
+
button.className += ' w-full';
|
|
2809
|
+
return button;
|
|
2810
|
+
}),
|
|
2811
|
+
...___default__default["default"].map(moreButtons, (button)=>{
|
|
2812
|
+
button.className += ' w-full';
|
|
2813
|
+
return button;
|
|
2814
|
+
})
|
|
2815
|
+
],
|
|
2816
|
+
"btnLevel": "enhance",
|
|
2817
|
+
"className": "w-full",
|
|
2818
|
+
"btnClassName": "w-full",
|
|
2819
|
+
"size": "lg"
|
|
2820
|
+
}
|
|
2821
|
+
],
|
|
2822
|
+
"id": "u:9815f7366b9f",
|
|
2823
|
+
"position": "bottom",
|
|
2824
|
+
"closeOnOutside": true,
|
|
2825
|
+
"resizable": false,
|
|
2826
|
+
"className": "buttons-drawer",
|
|
2827
|
+
"bodyClassName": "m-none p-none",
|
|
2828
|
+
"actions": []
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
]
|
|
2832
|
+
}
|
|
2833
|
+
},
|
|
2834
|
+
"id": "u:ee7c7929e6ae"
|
|
2835
|
+
}
|
|
2836
|
+
}else {
|
|
2837
|
+
if(moreButtons.length > 0){
|
|
2838
|
+
const dropdownButtonsSchema = {
|
|
2839
|
+
type: "steedos-dropdown-button",
|
|
2840
|
+
label: "",
|
|
2841
|
+
buttons: moreButtons,
|
|
2842
|
+
className: 'slds-icon'
|
|
2843
|
+
};
|
|
2844
|
+
buttons.push(dropdownButtonsSchema);
|
|
2845
|
+
}
|
|
2846
|
+
return buttons;
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
|
|
2851
|
+
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
2852
|
+
const buttons = getListViewButtons(objectSchema, ctx);
|
|
2853
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2854
|
+
return {
|
|
2855
|
+
"type": "button",
|
|
2856
|
+
"icon": "fa fa-angle-down",
|
|
2857
|
+
"onEvent": {
|
|
2858
|
+
"click": {
|
|
2859
|
+
"actions": [
|
|
2860
|
+
{
|
|
2861
|
+
"actionType": "drawer",
|
|
2862
|
+
"drawer": {
|
|
2863
|
+
"type": "drawer",
|
|
2864
|
+
"title": "操作",
|
|
2865
|
+
"body": [
|
|
2866
|
+
{
|
|
2867
|
+
"type": "button-group",
|
|
2868
|
+
"id": "u:fd837823be5b",
|
|
2869
|
+
"vertical": true,
|
|
2870
|
+
"tiled": true,
|
|
2871
|
+
"buttons": [
|
|
2872
|
+
...___default__default["default"].map(buttons, (button)=>{
|
|
2873
|
+
return {
|
|
2874
|
+
type: 'steedos-object-button',
|
|
2875
|
+
name: button.name,
|
|
2876
|
+
objectName: button.objectName,
|
|
2877
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2878
|
+
className: `button_${button.name} w-full`
|
|
2879
|
+
}
|
|
2880
|
+
})
|
|
2881
|
+
],
|
|
2882
|
+
"btnLevel": "enhance",
|
|
2883
|
+
"className": "w-full",
|
|
2884
|
+
"btnClassName": "w-full",
|
|
2885
|
+
"size": "lg"
|
|
2886
|
+
}
|
|
2887
|
+
],
|
|
2888
|
+
"id": "u:9815f7366b9f",
|
|
2889
|
+
"position": "bottom",
|
|
2890
|
+
"closeOnOutside": true,
|
|
2891
|
+
"resizable": false,
|
|
2892
|
+
"className": "buttons-drawer",
|
|
2893
|
+
"bodyClassName": "m-none p-none",
|
|
2894
|
+
"actions": []
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
]
|
|
2898
|
+
}
|
|
2899
|
+
},
|
|
2900
|
+
"id": "u:ee7c7929e6ae"
|
|
2901
|
+
}
|
|
2902
|
+
}else {
|
|
2903
|
+
return ___default__default["default"].map(buttons, (button) => {
|
|
2904
|
+
return {
|
|
2905
|
+
type: 'steedos-object-button',
|
|
2906
|
+
name: button.name,
|
|
2907
|
+
objectName: button.objectName,
|
|
2908
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2909
|
+
className: `button_${button.name}`
|
|
2910
|
+
}
|
|
2911
|
+
});
|
|
2912
|
+
}
|
|
2913
|
+
};
|
|
2914
|
+
|
|
2769
2915
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2770
2916
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2771
2917
|
return {
|
|
@@ -2899,6 +3045,43 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2899
3045
|
// }
|
|
2900
3046
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
2901
3047
|
`;
|
|
3048
|
+
const onCancelScript = `
|
|
3049
|
+
const scope = event.context.scoped;
|
|
3050
|
+
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
3051
|
+
return n.props.type === "form";
|
|
3052
|
+
});
|
|
3053
|
+
var filterFormValues = filterForm.getValues();
|
|
3054
|
+
var listView = scope.parent.parent.parent.getComponents().find(function(n){
|
|
3055
|
+
return n.props.type === "crud";
|
|
3056
|
+
});
|
|
3057
|
+
const removedValues = {};
|
|
3058
|
+
for(var k in filterFormValues){
|
|
3059
|
+
if(/^__searchable__/.test(k)){
|
|
3060
|
+
removedValues[k] = "";
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
if(!event.data.isLookup){
|
|
3064
|
+
// 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
|
|
3065
|
+
const listViewId = event.data.listViewId;
|
|
3066
|
+
const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
|
|
3067
|
+
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
3068
|
+
if(localListViewProps){
|
|
3069
|
+
localListViewProps = JSON.parse(localListViewProps);
|
|
3070
|
+
for(var k in localListViewProps){
|
|
3071
|
+
removedValues[k] = "";
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
listView.handleFilterSubmit(removedValues);
|
|
3076
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3077
|
+
return n.props.type === "service";
|
|
3078
|
+
});
|
|
3079
|
+
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3080
|
+
//触发amis crud 高度重算
|
|
3081
|
+
setTimeout(()=>{
|
|
3082
|
+
window.dispatchEvent(new Event("resize"))
|
|
3083
|
+
}, 100);
|
|
3084
|
+
`;
|
|
2902
3085
|
const dataProviderInited = `
|
|
2903
3086
|
const objectName = data.objectName;
|
|
2904
3087
|
const isLookup = data.isLookup;
|
|
@@ -3092,6 +3275,22 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3092
3275
|
}
|
|
3093
3276
|
}
|
|
3094
3277
|
},
|
|
3278
|
+
{
|
|
3279
|
+
"type": "button",
|
|
3280
|
+
"label": "取消",
|
|
3281
|
+
"name": "btn_filter_form_cancel",
|
|
3282
|
+
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3283
|
+
"onEvent": {
|
|
3284
|
+
"click": {
|
|
3285
|
+
"actions": [
|
|
3286
|
+
{
|
|
3287
|
+
"actionType": "custom",
|
|
3288
|
+
"script": onCancelScript
|
|
3289
|
+
}
|
|
3290
|
+
]
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
},
|
|
3095
3294
|
{
|
|
3096
3295
|
"type": "button",
|
|
3097
3296
|
"label": "设置搜索项",
|
|
@@ -3248,17 +3447,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3248
3447
|
}
|
|
3249
3448
|
);
|
|
3250
3449
|
|
|
3251
|
-
|
|
3252
|
-
let amisButtonsSchema = ___default.map(buttons, (button) => {
|
|
3253
|
-
return {
|
|
3254
|
-
type: 'steedos-object-button',
|
|
3255
|
-
name: button.name,
|
|
3256
|
-
objectName: button.objectName,
|
|
3257
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3258
|
-
className: `button_${button.name}`
|
|
3259
|
-
}
|
|
3260
|
-
});
|
|
3261
|
-
|
|
3450
|
+
let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
|
|
3262
3451
|
const reg = new RegExp('_', 'g');
|
|
3263
3452
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3264
3453
|
return {
|
|
@@ -3291,8 +3480,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3291
3480
|
},
|
|
3292
3481
|
{
|
|
3293
3482
|
"type": "dropdown-button",
|
|
3294
|
-
"className": "",
|
|
3295
|
-
"label": "\${uiSchema.list_views[listName].label}",
|
|
3483
|
+
"className": "",
|
|
3484
|
+
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
3296
3485
|
"rightIcon": "fa fa-caret-down",
|
|
3297
3486
|
"size": "sm",
|
|
3298
3487
|
"hideCaret": true,
|
|
@@ -3440,7 +3629,10 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
|
|
|
3440
3629
|
* @returns amisSchema
|
|
3441
3630
|
*/
|
|
3442
3631
|
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3443
|
-
|
|
3632
|
+
if (!ctx) {
|
|
3633
|
+
ctx = {};
|
|
3634
|
+
}
|
|
3635
|
+
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
|
|
3444
3636
|
let body = [firstLineSchema];
|
|
3445
3637
|
let headerSchema = [{
|
|
3446
3638
|
"type": "wrapper",
|
|
@@ -3461,35 +3653,11 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3461
3653
|
const { showRecordTitle = true } = options || {};
|
|
3462
3654
|
// console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
|
|
3463
3655
|
const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
let amisButtonsSchema = ___default.map(buttons, (button) => {
|
|
3470
|
-
return {
|
|
3471
|
-
type: 'steedos-object-button',
|
|
3472
|
-
name: button.name,
|
|
3473
|
-
objectName: button.objectName,
|
|
3474
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3475
|
-
className: `button_${button.name}`
|
|
3476
|
-
}
|
|
3477
|
-
});
|
|
3478
|
-
let dropdownButtons = ___default.map(moreButtons, (button) => {
|
|
3479
|
-
return {
|
|
3480
|
-
type: 'steedos-object-button',
|
|
3481
|
-
name: button.name,
|
|
3482
|
-
objectName: button.objectName,
|
|
3483
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3484
|
-
}
|
|
3485
|
-
});
|
|
3486
|
-
const dropdownButtonsSchema = {
|
|
3487
|
-
type: "steedos-dropdown-button",
|
|
3488
|
-
label: "",
|
|
3489
|
-
buttons: dropdownButtons,
|
|
3490
|
-
className: 'slds-icon'
|
|
3491
|
-
};
|
|
3492
|
-
amisButtonsSchema.push(dropdownButtonsSchema);
|
|
3656
|
+
|
|
3657
|
+
let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
3658
|
+
|
|
3659
|
+
// console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
|
|
3660
|
+
|
|
3493
3661
|
const reg = new RegExp('_', 'g');
|
|
3494
3662
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3495
3663
|
|
|
@@ -3700,8 +3868,8 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
3700
3868
|
"icon": "fa fa-table-columns",
|
|
3701
3869
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3702
3870
|
"align": "right",
|
|
3703
|
-
"visibleOn": "${
|
|
3704
|
-
"buttons": [
|
|
3871
|
+
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
3872
|
+
"buttons": [
|
|
3705
3873
|
{
|
|
3706
3874
|
"label": "显示为",
|
|
3707
3875
|
"children": buttons
|
|
@@ -3721,11 +3889,26 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
3721
3889
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3722
3890
|
return n.props.type === "service";
|
|
3723
3891
|
});
|
|
3724
|
-
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3892
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3893
|
+
let resizeWindow = function(){
|
|
3894
|
+
//触发amis crud 高度重算
|
|
3895
|
+
setTimeout(()=>{
|
|
3896
|
+
window.dispatchEvent(new Event("resize"))
|
|
3897
|
+
}, 500);
|
|
3898
|
+
}
|
|
3899
|
+
if(filterService.props.data.showFieldsFilter){
|
|
3900
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3901
|
+
direction: "down",
|
|
3902
|
+
name: "btn_filter_form_cancel"
|
|
3903
|
+
});
|
|
3904
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3905
|
+
resizeWindow();
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
3908
|
+
else{
|
|
3909
|
+
filterService.setData({showFieldsFilter: true});
|
|
3910
|
+
resizeWindow();
|
|
3911
|
+
}
|
|
3729
3912
|
`;
|
|
3730
3913
|
|
|
3731
3914
|
function getExportApiRequestAdaptorScript(){
|
|
@@ -3798,6 +3981,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3798
3981
|
`;
|
|
3799
3982
|
return [
|
|
3800
3983
|
// "bulkActions",
|
|
3984
|
+
...(headerToolbarItems || []),
|
|
3801
3985
|
hiddenCount ? {} :{
|
|
3802
3986
|
"type": "tpl",
|
|
3803
3987
|
"tpl": "${count} 个项目"
|
|
@@ -3942,7 +4126,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3942
4126
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
3943
4127
|
"appId": "${appId}",
|
|
3944
4128
|
"global": "${global}",
|
|
3945
|
-
"
|
|
4129
|
+
"targetObjectName": "${objectName}",
|
|
3946
4130
|
},
|
|
3947
4131
|
"body": [
|
|
3948
4132
|
{
|
|
@@ -3982,7 +4166,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3982
4166
|
{
|
|
3983
4167
|
"args": {
|
|
3984
4168
|
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3985
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4169
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3986
4170
|
"blank": false
|
|
3987
4171
|
},
|
|
3988
4172
|
"actionType": "url",
|
|
@@ -4023,7 +4207,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4023
4207
|
"data": {
|
|
4024
4208
|
"&": "$$",
|
|
4025
4209
|
"listName": "${listName}",
|
|
4026
|
-
"
|
|
4210
|
+
"targetObjectName": "${objectName}",
|
|
4027
4211
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
4028
4212
|
"appId": "${appId}",
|
|
4029
4213
|
"global": "${global}"
|
|
@@ -4066,7 +4250,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4066
4250
|
"actions": [
|
|
4067
4251
|
{
|
|
4068
4252
|
"args": {
|
|
4069
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4253
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
4070
4254
|
"blank": false
|
|
4071
4255
|
},
|
|
4072
4256
|
"actionType": "url",
|
|
@@ -4102,7 +4286,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4102
4286
|
"type": "dialog",
|
|
4103
4287
|
"title": "重命名 列表视图",
|
|
4104
4288
|
"data": {
|
|
4105
|
-
"
|
|
4289
|
+
"targetObjectName": "${objectName}",
|
|
4106
4290
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4107
4291
|
"appId": "${appId}"
|
|
4108
4292
|
},
|
|
@@ -4123,7 +4307,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4123
4307
|
"actions": [
|
|
4124
4308
|
{
|
|
4125
4309
|
"args": {
|
|
4126
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4310
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4127
4311
|
"blank": false
|
|
4128
4312
|
},
|
|
4129
4313
|
"actionType": "url",
|
|
@@ -4197,6 +4381,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4197
4381
|
"type": "dialog",
|
|
4198
4382
|
"title": "过滤设置",
|
|
4199
4383
|
"data": {
|
|
4384
|
+
"targetObjectName": "${objectName}",
|
|
4200
4385
|
"objectName": "${objectName}",
|
|
4201
4386
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4202
4387
|
"listName": "${listName}",
|
|
@@ -4222,7 +4407,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4222
4407
|
"actions": [
|
|
4223
4408
|
{
|
|
4224
4409
|
"args": {
|
|
4225
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4410
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4226
4411
|
"blank": false
|
|
4227
4412
|
},
|
|
4228
4413
|
"actionType": "url",
|
|
@@ -4260,6 +4445,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4260
4445
|
"title": "显示的列",
|
|
4261
4446
|
"data": {
|
|
4262
4447
|
"&": "$$",
|
|
4448
|
+
"targetObjectName": "${objectName}",
|
|
4263
4449
|
"objectName": "${objectName}",
|
|
4264
4450
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4265
4451
|
"listName": "${listName}",
|
|
@@ -4285,7 +4471,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4285
4471
|
"actions": [
|
|
4286
4472
|
{
|
|
4287
4473
|
"args": {
|
|
4288
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4474
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4289
4475
|
"blank": false
|
|
4290
4476
|
},
|
|
4291
4477
|
"actionType": "url"
|
|
@@ -4321,6 +4507,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4321
4507
|
"title": "弹框标题",
|
|
4322
4508
|
"data": {
|
|
4323
4509
|
"&": "$$",
|
|
4510
|
+
"targetObjectName": "${objectName}",
|
|
4324
4511
|
"objectName": "${objectName}",
|
|
4325
4512
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4326
4513
|
"listName": "${listName}",
|
|
@@ -4346,7 +4533,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4346
4533
|
"actions": [
|
|
4347
4534
|
{
|
|
4348
4535
|
"args": {
|
|
4349
|
-
"url": "${context.rootUrl}/app/${appId}/${
|
|
4536
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4350
4537
|
"blank": false
|
|
4351
4538
|
},
|
|
4352
4539
|
"actionType": "url"
|
|
@@ -4460,8 +4647,8 @@ function getObjectFooterToolbar(mainObject, formFactor) {
|
|
|
4460
4647
|
}
|
|
4461
4648
|
else {
|
|
4462
4649
|
return [
|
|
4650
|
+
"switch-per-page",
|
|
4463
4651
|
"statistics",
|
|
4464
|
-
// "switch-per-page",
|
|
4465
4652
|
"pagination"
|
|
4466
4653
|
]
|
|
4467
4654
|
}
|
|
@@ -4894,13 +5081,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4894
5081
|
var sort = orderBy + ' ' + orderDir;
|
|
4895
5082
|
sort = orderBy ? sort : "${sort}";
|
|
4896
5083
|
var allowSearchFields = ${JSON.stringify(searchableFields)};
|
|
5084
|
+
let fieldValue;
|
|
4897
5085
|
if(api.data.$term){
|
|
4898
5086
|
filters = [["name", "contains", "'+ api.data.$term +'"]];
|
|
4899
5087
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
4900
5088
|
if(selfData.value?.indexOf(',') > 0){
|
|
4901
|
-
|
|
5089
|
+
fieldValue = selfData.value.split(',');
|
|
5090
|
+
filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
|
|
4902
5091
|
}else{
|
|
4903
|
-
|
|
5092
|
+
fieldValue = selfData.value;
|
|
5093
|
+
filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
|
|
4904
5094
|
}
|
|
4905
5095
|
}
|
|
4906
5096
|
|
|
@@ -4954,6 +5144,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4954
5144
|
if(enable_tree){
|
|
4955
5145
|
pageSize = 10000;
|
|
4956
5146
|
}
|
|
5147
|
+
if(fieldValue && _.isArray(fieldValue) && fieldValue.length > pageSize){
|
|
5148
|
+
pageSize = fieldValue.length;
|
|
5149
|
+
}
|
|
4957
5150
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
4958
5151
|
return api;
|
|
4959
5152
|
`;
|
|
@@ -5034,6 +5227,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5034
5227
|
...ctx
|
|
5035
5228
|
});
|
|
5036
5229
|
|
|
5230
|
+
pickerSchema.affixHeader = false;
|
|
5231
|
+
|
|
5037
5232
|
var headerToolbarItems = [];
|
|
5038
5233
|
const isMobile = window.innerWidth < 768;
|
|
5039
5234
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
|
|
@@ -5051,14 +5246,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5051
5246
|
pickerSchema.headerToolbar.push(new_button);
|
|
5052
5247
|
}
|
|
5053
5248
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
...ctx
|
|
5060
|
-
});
|
|
5061
|
-
}
|
|
5249
|
+
if (ctx.filterVisible !== false) {
|
|
5250
|
+
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
5251
|
+
isLookup: true,
|
|
5252
|
+
...ctx
|
|
5253
|
+
});
|
|
5062
5254
|
}
|
|
5063
5255
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
5064
5256
|
"&": "$$",
|
|
@@ -5242,11 +5434,12 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
5242
5434
|
autoComplete: apiInfo,
|
|
5243
5435
|
searchable: true,
|
|
5244
5436
|
};
|
|
5437
|
+
//删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
|
|
5245
5438
|
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
5246
5439
|
<span role='img' aria-label='smile' class='anticon anticon-smile'>
|
|
5247
5440
|
<span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
|
|
5248
5441
|
<svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
|
|
5249
|
-
<use xlink:href='
|
|
5442
|
+
<use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
|
|
5250
5443
|
</svg>
|
|
5251
5444
|
</span>
|
|
5252
5445
|
</span>
|
|
@@ -5304,8 +5497,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
5304
5497
|
|
|
5305
5498
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
5306
5499
|
if(ctx.idsDependOn || field.amis){
|
|
5500
|
+
// ids人员点选模式
|
|
5307
5501
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
5308
5502
|
}
|
|
5503
|
+
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
5309
5504
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
5310
5505
|
}
|
|
5311
5506
|
|
|
@@ -5406,6 +5601,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
5406
5601
|
top: top,
|
|
5407
5602
|
...ctx
|
|
5408
5603
|
});
|
|
5604
|
+
|
|
5605
|
+
pickerSchema.affixHeader = false;
|
|
5606
|
+
|
|
5409
5607
|
}
|
|
5410
5608
|
|
|
5411
5609
|
const data = {
|
|
@@ -5435,7 +5633,6 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
5435
5633
|
if(readonly){
|
|
5436
5634
|
data.tpl = await getLookupTpl(field, ctx);
|
|
5437
5635
|
}
|
|
5438
|
-
|
|
5439
5636
|
return data;
|
|
5440
5637
|
}
|
|
5441
5638
|
|
|
@@ -5643,6 +5840,23 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
5643
5840
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5644
5841
|
};
|
|
5645
5842
|
|
|
5843
|
+
/*
|
|
5844
|
+
* @Author: baozhoutao@steedos.com
|
|
5845
|
+
* @Date: 2022-07-20 16:29:22
|
|
5846
|
+
* @LastEditors: Please set LastEditors
|
|
5847
|
+
* @LastEditTime: 2023-05-11 11:19:54
|
|
5848
|
+
* @Description:
|
|
5849
|
+
*/
|
|
5850
|
+
|
|
5851
|
+
function getContrastColor(bgColor) {
|
|
5852
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5853
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5854
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5855
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5856
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5857
|
+
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5858
|
+
}
|
|
5859
|
+
|
|
5646
5860
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5647
5861
|
// const Lookup = require('./lookup');
|
|
5648
5862
|
|
|
@@ -5796,6 +6010,8 @@ function getSelectFieldOptions(field){
|
|
|
5796
6010
|
}
|
|
5797
6011
|
|
|
5798
6012
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
6013
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
6014
|
+
const isMobile = window.innerWidth <= 768;
|
|
5799
6015
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
5800
6016
|
if(___default__namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
5801
6017
|
return;
|
|
@@ -5830,20 +6046,42 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5830
6046
|
// }
|
|
5831
6047
|
// break;
|
|
5832
6048
|
case 'select':
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
6049
|
+
if(readonly){
|
|
6050
|
+
const selectOptions = field.options;
|
|
6051
|
+
let map = {};
|
|
6052
|
+
___default__namespace.forEach(selectOptions,(option)=>{
|
|
6053
|
+
const optionValue = option.value + '';
|
|
6054
|
+
if(option.color){
|
|
6055
|
+
const background = '#'+option.color;
|
|
6056
|
+
const color = getContrastColor(background);
|
|
6057
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
6058
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
6059
|
+
}else {
|
|
6060
|
+
map[optionValue] = option.label;
|
|
6061
|
+
}
|
|
6062
|
+
});
|
|
6063
|
+
convertData = {
|
|
6064
|
+
type: "static-mapping",
|
|
6065
|
+
name: field.name,
|
|
6066
|
+
label: field.label,
|
|
6067
|
+
map: map
|
|
6068
|
+
};
|
|
6069
|
+
}else {
|
|
6070
|
+
convertData = {
|
|
6071
|
+
type: getAmisStaticFieldType('select', readonly),
|
|
6072
|
+
joinValues: false,
|
|
6073
|
+
options: getSelectFieldOptions(field),
|
|
6074
|
+
extractValue: true,
|
|
6075
|
+
clearable: true,
|
|
6076
|
+
labelField: 'label',
|
|
6077
|
+
valueField: 'value'
|
|
6078
|
+
};
|
|
6079
|
+
if(field.multiple){
|
|
6080
|
+
convertData.multiple = true;
|
|
6081
|
+
convertData.extractValue = true;
|
|
6082
|
+
}
|
|
5846
6083
|
}
|
|
6084
|
+
|
|
5847
6085
|
break;
|
|
5848
6086
|
case 'boolean':
|
|
5849
6087
|
convertData = {
|
|
@@ -5863,7 +6101,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5863
6101
|
};
|
|
5864
6102
|
break;
|
|
5865
6103
|
case 'date':
|
|
5866
|
-
convertData = {
|
|
6104
|
+
convertData = isMobile && !readonly ? {
|
|
6105
|
+
type: "native-date",
|
|
6106
|
+
pipeIn: (value, data) => {
|
|
6107
|
+
if (value) {
|
|
6108
|
+
value = moment(value).utc().format('YYYY-MM-DD');
|
|
6109
|
+
return value;
|
|
6110
|
+
} else {
|
|
6111
|
+
return "";
|
|
6112
|
+
}
|
|
6113
|
+
|
|
6114
|
+
},
|
|
6115
|
+
pipeOut: (value, oldValue, data) => {
|
|
6116
|
+
if (value) {
|
|
6117
|
+
value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
6118
|
+
return value;
|
|
6119
|
+
} else {
|
|
6120
|
+
return "";
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
} : {
|
|
5867
6124
|
type: getAmisStaticFieldType('date', readonly),
|
|
5868
6125
|
inputFormat: "YYYY-MM-DD",
|
|
5869
6126
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -5882,12 +6139,48 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5882
6139
|
};
|
|
5883
6140
|
break;
|
|
5884
6141
|
case 'datetime':
|
|
5885
|
-
convertData = {
|
|
6142
|
+
convertData = isMobile && !readonly ? {
|
|
6143
|
+
type: "combo",
|
|
6144
|
+
pipeIn: (value, data) => {
|
|
6145
|
+
let revalue = {};
|
|
6146
|
+
if (value && value != "Invalid date") {
|
|
6147
|
+
value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
6148
|
+
revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
6149
|
+
revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
6150
|
+
} else {
|
|
6151
|
+
revalue[field.name + "-native-date"] = "";
|
|
6152
|
+
revalue[field.name + "-native-time"] = "";
|
|
6153
|
+
}
|
|
6154
|
+
return revalue;
|
|
6155
|
+
},
|
|
6156
|
+
pipeOut: (value, oldValue, data) => {
|
|
6157
|
+
let revalue = "";
|
|
6158
|
+
if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
6159
|
+
revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
6160
|
+
revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
6161
|
+
}
|
|
6162
|
+
return revalue;
|
|
6163
|
+
},
|
|
6164
|
+
items: [
|
|
6165
|
+
{
|
|
6166
|
+
type: "native-date",
|
|
6167
|
+
name: field.name + "-native-date",
|
|
6168
|
+
className: "steedos-native-date",
|
|
6169
|
+
value: ""
|
|
6170
|
+
},
|
|
6171
|
+
{
|
|
6172
|
+
type: "native-time",
|
|
6173
|
+
name: field.name + "-native-time",
|
|
6174
|
+
className: "steedos-native-time",
|
|
6175
|
+
value: ""
|
|
6176
|
+
}
|
|
6177
|
+
]
|
|
6178
|
+
} : {
|
|
5886
6179
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
5887
6180
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
5888
|
-
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
6181
|
+
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5889
6182
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
5890
|
-
utc: true
|
|
6183
|
+
utc: true,
|
|
5891
6184
|
};
|
|
5892
6185
|
break;
|
|
5893
6186
|
case 'input-time-range':
|
|
@@ -5902,7 +6195,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5902
6195
|
};
|
|
5903
6196
|
break;
|
|
5904
6197
|
case 'time':
|
|
5905
|
-
convertData = {
|
|
6198
|
+
convertData = isMobile && !readonly ? {
|
|
6199
|
+
type: "native-time",
|
|
6200
|
+
pipeIn: (value, data) => {
|
|
6201
|
+
if (value) {
|
|
6202
|
+
value = moment(value).utc().format('HH:mm');
|
|
6203
|
+
return value;
|
|
6204
|
+
} else {
|
|
6205
|
+
return "";
|
|
6206
|
+
}
|
|
6207
|
+
|
|
6208
|
+
},
|
|
6209
|
+
pipeOut: (value, oldValue, data) => {
|
|
6210
|
+
if (value) {
|
|
6211
|
+
value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
6212
|
+
return value;
|
|
6213
|
+
} else {
|
|
6214
|
+
return "";
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
} : {
|
|
5906
6218
|
type: getAmisStaticFieldType('time', readonly),
|
|
5907
6219
|
inputFormat: 'HH:mm',
|
|
5908
6220
|
timeFormat:'HH:mm',
|
|
@@ -6014,7 +6326,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6014
6326
|
convertData = {
|
|
6015
6327
|
type: "editor",
|
|
6016
6328
|
language: field.language,
|
|
6017
|
-
|
|
6329
|
+
editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
|
|
6018
6330
|
};
|
|
6019
6331
|
break;
|
|
6020
6332
|
case 'toggle':
|
|
@@ -6035,7 +6347,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6035
6347
|
columnsTogglable: false,
|
|
6036
6348
|
strictMode:false,
|
|
6037
6349
|
affixHeader: false, // 是否固定表头, 不固定表头, 否则form有y轴滚动条时, 表头会跟随滚动条滚动.
|
|
6038
|
-
|
|
6350
|
+
needConfirm: false,
|
|
6039
6351
|
editable: !readonly,
|
|
6040
6352
|
addable: !readonly,
|
|
6041
6353
|
removable: !readonly,
|
|
@@ -6106,6 +6418,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6106
6418
|
convertData.quickEdit = false;
|
|
6107
6419
|
}
|
|
6108
6420
|
|
|
6421
|
+
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
6422
|
+
if (convertData.className) {
|
|
6423
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
6424
|
+
} else {
|
|
6425
|
+
convertData.className = fieldTypeClassName;
|
|
6426
|
+
}
|
|
6427
|
+
|
|
6109
6428
|
if(field.visible_on){
|
|
6110
6429
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
6111
6430
|
if(field.visible_on.startsWith("{{")){
|
|
@@ -6265,6 +6584,12 @@ function getReadonlyFormAdaptor(object, fields){
|
|
|
6265
6584
|
// })
|
|
6266
6585
|
|
|
6267
6586
|
return `
|
|
6587
|
+
if(payload.data.data.length === 0){
|
|
6588
|
+
return {
|
|
6589
|
+
status: 2,
|
|
6590
|
+
msg: "无法找到记录"
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6268
6593
|
if(payload.data.data){
|
|
6269
6594
|
var data = payload.data.data[0];
|
|
6270
6595
|
var gridAndObjectFieldsName = ${JSON.stringify(gridAndObjectFieldsName)};
|
|
@@ -6389,12 +6714,12 @@ function getScriptForRewriteValueForFileFields(fields){
|
|
|
6389
6714
|
});
|
|
6390
6715
|
}
|
|
6391
6716
|
}else{
|
|
6392
|
-
data[item] = {
|
|
6717
|
+
data[item] = [{
|
|
6393
6718
|
value: fileFieldValue,
|
|
6394
6719
|
name: fileFieldDisplayValue.name,
|
|
6395
6720
|
url: fileFieldDisplayValue.url + "?download=true",
|
|
6396
6721
|
state: "uploaded"
|
|
6397
|
-
};
|
|
6722
|
+
}];
|
|
6398
6723
|
}
|
|
6399
6724
|
}
|
|
6400
6725
|
})
|
|
@@ -6412,7 +6737,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
6412
6737
|
|
|
6413
6738
|
return {
|
|
6414
6739
|
method: "post",
|
|
6415
|
-
url: getApi$2(),
|
|
6740
|
+
url: getApi$2() + '&objectName=${objectName}' ,
|
|
6416
6741
|
// sendOn: "!!this.recordId",
|
|
6417
6742
|
cache: API_CACHE,
|
|
6418
6743
|
requestAdaptor: `
|
|
@@ -6718,7 +7043,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6718
7043
|
}),
|
|
6719
7044
|
filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
|
|
6720
7045
|
};
|
|
6721
|
-
if(options.formFactor !== 'SMALL'){
|
|
7046
|
+
if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
|
|
6722
7047
|
Object.assign(bodyProps, {
|
|
6723
7048
|
bulkActions: options.bulkActions != false ? bulkActions : false
|
|
6724
7049
|
});
|
|
@@ -6783,7 +7108,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6783
7108
|
api: await getTableApi(objectSchema, fields, options),
|
|
6784
7109
|
hiddenOn: options.tableHiddenOn,
|
|
6785
7110
|
autoFillHeight: options.isRelated ? false : true,
|
|
6786
|
-
className: `flex-auto ${crudClassName || ""}`,
|
|
7111
|
+
className: `flex-auto bg-white ${crudClassName || ""}`,
|
|
6787
7112
|
crudClassName: crudClassName,
|
|
6788
7113
|
},
|
|
6789
7114
|
bodyProps,
|
|
@@ -6932,7 +7257,8 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
6932
7257
|
"eventName": `@data.changed.${objectSchema.name}`
|
|
6933
7258
|
},
|
|
6934
7259
|
"data": {
|
|
6935
|
-
"objectName": `${objectSchema.name}
|
|
7260
|
+
"objectName": `${objectSchema.name}`,
|
|
7261
|
+
"displayAs": "${displayAs}"
|
|
6936
7262
|
}
|
|
6937
7263
|
},
|
|
6938
7264
|
{
|
|
@@ -7032,7 +7358,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
7032
7358
|
data: {
|
|
7033
7359
|
objectName: "${event.data.__objectName}",
|
|
7034
7360
|
record: "${event.data.__record}"
|
|
7035
|
-
}
|
|
7361
|
+
},
|
|
7362
|
+
expression: "${event.data.__response.error != true}"
|
|
7036
7363
|
},
|
|
7037
7364
|
{
|
|
7038
7365
|
"actionType": "setValue",
|
|
@@ -7040,7 +7367,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
7040
7367
|
value: {
|
|
7041
7368
|
"recordLoaded": true,
|
|
7042
7369
|
}
|
|
7043
|
-
}
|
|
7370
|
+
},
|
|
7371
|
+
expression: "${event.data.__response.error != true}"
|
|
7044
7372
|
}
|
|
7045
7373
|
]
|
|
7046
7374
|
}
|
|
@@ -7048,6 +7376,21 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
7048
7376
|
}
|
|
7049
7377
|
}
|
|
7050
7378
|
|
|
7379
|
+
/*
|
|
7380
|
+
* @Author: baozhoutao@steedos.com
|
|
7381
|
+
* @Date: 2022-08-04 10:42:49
|
|
7382
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
7383
|
+
* @LastEditTime: 2022-08-25 10:28:47
|
|
7384
|
+
* @Description:
|
|
7385
|
+
*/
|
|
7386
|
+
var config = {
|
|
7387
|
+
listView: {
|
|
7388
|
+
newRecordMode: 'modal',
|
|
7389
|
+
editRecordMode: 'modal',
|
|
7390
|
+
perPage: 20
|
|
7391
|
+
}
|
|
7392
|
+
};
|
|
7393
|
+
|
|
7051
7394
|
async function getTableColumns$1(fields, options){
|
|
7052
7395
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7053
7396
|
for (const field of fields) {
|
|
@@ -7111,7 +7454,31 @@ async function getTableColumns$1(fields, options){
|
|
|
7111
7454
|
...getAmisFileReadonlySchema(field)
|
|
7112
7455
|
}, field.amis, {name: field.name}));
|
|
7113
7456
|
}
|
|
7114
|
-
|
|
7457
|
+
else if(field.type === 'select'){
|
|
7458
|
+
const selectOptions = field.options;
|
|
7459
|
+
let map = {};
|
|
7460
|
+
___default.forEach(selectOptions,(option)=>{
|
|
7461
|
+
const optionValue = option.value + '';
|
|
7462
|
+
if(option.color){
|
|
7463
|
+
const background = '#'+option.color;
|
|
7464
|
+
const color = getContrastColor(background);
|
|
7465
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7466
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7467
|
+
}else {
|
|
7468
|
+
map[optionValue] = option.label;
|
|
7469
|
+
}
|
|
7470
|
+
});
|
|
7471
|
+
columns.push(Object.assign({}, {
|
|
7472
|
+
type: "mapping",
|
|
7473
|
+
name: field.name,
|
|
7474
|
+
label: field.label,
|
|
7475
|
+
map: map,
|
|
7476
|
+
sortable: field.sortable,
|
|
7477
|
+
width: field.width,
|
|
7478
|
+
toggled: field.toggled,
|
|
7479
|
+
className:"whitespace-nowrap",
|
|
7480
|
+
}, field.amis, {name: field.name}));
|
|
7481
|
+
}
|
|
7115
7482
|
else {
|
|
7116
7483
|
const tpl = await getFieldTpl(field, options);
|
|
7117
7484
|
|
|
@@ -7121,6 +7488,13 @@ async function getTableColumns$1(fields, options){
|
|
|
7121
7488
|
}else if(field.type === 'html'){
|
|
7122
7489
|
type = 'markdown';
|
|
7123
7490
|
}
|
|
7491
|
+
let className = "";
|
|
7492
|
+
if(field.type === 'textarea'){
|
|
7493
|
+
className = 'min-w-56';
|
|
7494
|
+
}
|
|
7495
|
+
if(field.wrap === false){
|
|
7496
|
+
className += " whitespace-nowrap";
|
|
7497
|
+
}
|
|
7124
7498
|
if(!field.hidden && !field.extra){
|
|
7125
7499
|
columns.push(Object.assign({}, {
|
|
7126
7500
|
name: field.name,
|
|
@@ -7131,7 +7505,7 @@ async function getTableColumns$1(fields, options){
|
|
|
7131
7505
|
type: type,
|
|
7132
7506
|
tpl: tpl,
|
|
7133
7507
|
toggled: field.toggled,
|
|
7134
|
-
className
|
|
7508
|
+
className,
|
|
7135
7509
|
html: field.type === 'html' ? true : null
|
|
7136
7510
|
// toggled: true
|
|
7137
7511
|
}, field.amis, {name: field.name}));
|
|
@@ -7256,8 +7630,9 @@ async function getMobileTableColumns(fields, options){
|
|
|
7256
7630
|
const url = getNameTplUrl(nameField, options);
|
|
7257
7631
|
|
|
7258
7632
|
const columnLines = getMobileLines(tpls);
|
|
7259
|
-
|
|
7260
|
-
|
|
7633
|
+
|
|
7634
|
+
|
|
7635
|
+
let column = {
|
|
7261
7636
|
name: nameField.name,
|
|
7262
7637
|
label: nameField.label,
|
|
7263
7638
|
sortable: nameField.sortable,
|
|
@@ -7266,13 +7641,66 @@ async function getMobileTableColumns(fields, options){
|
|
|
7266
7641
|
actionType: "link",
|
|
7267
7642
|
link: url,
|
|
7268
7643
|
innerClassName: "steedos-listview-item block text-gray-500",
|
|
7269
|
-
body:{
|
|
7644
|
+
body: {
|
|
7270
7645
|
"type": "wrapper",
|
|
7271
7646
|
"body": columnLines,
|
|
7272
7647
|
"size": "none",
|
|
7273
7648
|
"className": "p-1"
|
|
7274
7649
|
}
|
|
7275
|
-
}
|
|
7650
|
+
};
|
|
7651
|
+
|
|
7652
|
+
if(options.objectName === 'cms_files'){
|
|
7653
|
+
if(window.Meteor?.isCordova){
|
|
7654
|
+
column = {
|
|
7655
|
+
...column,
|
|
7656
|
+
actionType: "",
|
|
7657
|
+
link: "",
|
|
7658
|
+
onEvent: {
|
|
7659
|
+
"click": {
|
|
7660
|
+
"actions": [
|
|
7661
|
+
{
|
|
7662
|
+
"script": `
|
|
7663
|
+
let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
|
|
7664
|
+
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
7665
|
+
`,
|
|
7666
|
+
"actionType": "custom"
|
|
7667
|
+
}
|
|
7668
|
+
],
|
|
7669
|
+
"weight": 0
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7672
|
+
};
|
|
7673
|
+
}else {
|
|
7674
|
+
column = {
|
|
7675
|
+
...column,
|
|
7676
|
+
actionType: "",
|
|
7677
|
+
link: "",
|
|
7678
|
+
onEvent: {
|
|
7679
|
+
"click": {
|
|
7680
|
+
"actions": [
|
|
7681
|
+
{
|
|
7682
|
+
"args": {
|
|
7683
|
+
"api": {
|
|
7684
|
+
"url": url,
|
|
7685
|
+
"method": "get",
|
|
7686
|
+
"headers": {
|
|
7687
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7688
|
+
}
|
|
7689
|
+
}
|
|
7690
|
+
},
|
|
7691
|
+
"actionType": "download"
|
|
7692
|
+
}
|
|
7693
|
+
],
|
|
7694
|
+
"weight": 0
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
};
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7700
|
+
}
|
|
7701
|
+
|
|
7702
|
+
columns.push(column);
|
|
7703
|
+
|
|
7276
7704
|
|
|
7277
7705
|
return columns;
|
|
7278
7706
|
}
|
|
@@ -7391,7 +7819,7 @@ async function getTableSchema$1(fields, options){
|
|
|
7391
7819
|
options = {};
|
|
7392
7820
|
}
|
|
7393
7821
|
let columns = [];
|
|
7394
|
-
if(options.formFactor === 'SMALL'){
|
|
7822
|
+
if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
|
|
7395
7823
|
columns = await getMobileTableColumns(fields, options);
|
|
7396
7824
|
}
|
|
7397
7825
|
else {
|
|
@@ -7594,7 +8022,11 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7594
8022
|
filters = systemFilters;
|
|
7595
8023
|
};
|
|
7596
8024
|
if(api.data.$self.additionalFilters){
|
|
7597
|
-
|
|
8025
|
+
if(_.isString(api.data.$self.additionalFilters)){
|
|
8026
|
+
userFilters.push(eval(api.data.$self.additionalFilters))
|
|
8027
|
+
}else{
|
|
8028
|
+
userFilters.push(api.data.$self.additionalFilters)
|
|
8029
|
+
}
|
|
7598
8030
|
}
|
|
7599
8031
|
|
|
7600
8032
|
if(api.data.$self._isRelated){
|
|
@@ -7627,8 +8059,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7627
8059
|
if(_.isEmpty(filters)){
|
|
7628
8060
|
filters = userFilters;
|
|
7629
8061
|
}else{
|
|
7630
|
-
filters
|
|
7631
|
-
filters.push(userFilters)
|
|
8062
|
+
filters = [filters, 'and', userFilters]
|
|
7632
8063
|
}
|
|
7633
8064
|
}
|
|
7634
8065
|
api.data = {
|
|
@@ -8055,7 +8486,6 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
8055
8486
|
// ObjectForm会认作用域下的变量值
|
|
8056
8487
|
// TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
|
|
8057
8488
|
// TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
|
|
8058
|
-
event.data = doc;
|
|
8059
8489
|
const title = "新建 ${objectSchema.label}";
|
|
8060
8490
|
doAction(
|
|
8061
8491
|
{
|
|
@@ -8068,6 +8498,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
8068
8498
|
"type": "steedos-object-form",
|
|
8069
8499
|
"objectApiName": "\${objectName}",
|
|
8070
8500
|
"mode": "edit",
|
|
8501
|
+
"defaultData": doc,
|
|
8071
8502
|
"onEvent": {
|
|
8072
8503
|
"submitSucc": {
|
|
8073
8504
|
"weight": 0,
|
|
@@ -8360,7 +8791,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
8360
8791
|
* @Author: baozhoutao@steedos.com
|
|
8361
8792
|
* @Date: 2022-07-05 15:55:39
|
|
8362
8793
|
* @LastEditors: Please set LastEditors
|
|
8363
|
-
* @LastEditTime: 2023-
|
|
8794
|
+
* @LastEditTime: 2023-05-08 16:34:25
|
|
8364
8795
|
* @Description:
|
|
8365
8796
|
*/
|
|
8366
8797
|
|
|
@@ -8614,7 +9045,7 @@ function getDefaultRelatedListProps(uiSchema, listName, ctx) {
|
|
|
8614
9045
|
}
|
|
8615
9046
|
function getRelatedListProps(uiSchema, listViewName, ctx) {
|
|
8616
9047
|
if (ctx.columns) {
|
|
8617
|
-
const sort = getListViewSort(ctx.sort);
|
|
9048
|
+
const sort = getListViewSort({sort: ctx.sort});
|
|
8618
9049
|
let { filters , filtersFunction} = ctx;
|
|
8619
9050
|
if(!filtersFunction && filters){
|
|
8620
9051
|
filtersFunction = str2function(
|
|
@@ -8703,7 +9134,7 @@ async function getRelatedListSchema(
|
|
|
8703
9134
|
* @Author: baozhoutao@steedos.com
|
|
8704
9135
|
* @Date: 2022-07-05 15:55:39
|
|
8705
9136
|
* @LastEditors: baozhoutao@steedos.com
|
|
8706
|
-
* @LastEditTime: 2023-04-
|
|
9137
|
+
* @LastEditTime: 2023-04-28 11:11:29
|
|
8707
9138
|
* @Description:
|
|
8708
9139
|
*/
|
|
8709
9140
|
|
|
@@ -8901,6 +9332,9 @@ async function getListSchema(
|
|
|
8901
9332
|
ctx = {}
|
|
8902
9333
|
) {
|
|
8903
9334
|
const uiSchema = await getUISchema(objectName);
|
|
9335
|
+
if(!uiSchema){
|
|
9336
|
+
return {}
|
|
9337
|
+
}
|
|
8904
9338
|
const listView = ___default.find(
|
|
8905
9339
|
uiSchema.list_views,
|
|
8906
9340
|
(listView, name) => {
|
|
@@ -9454,7 +9888,10 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
|
|
|
9454
9888
|
const defaults = ctx.defaults || {};
|
|
9455
9889
|
if(!defaults.headerSchema){
|
|
9456
9890
|
//传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
|
|
9457
|
-
const headerSchema = await getObjectListHeader$1(uiSchema
|
|
9891
|
+
const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
|
|
9892
|
+
onlySecordLine: true,
|
|
9893
|
+
isListviewInit: true
|
|
9894
|
+
});
|
|
9458
9895
|
defaults.headerSchema = headerSchema;
|
|
9459
9896
|
}
|
|
9460
9897
|
ctx.defaults = defaults;
|
|
@@ -12132,6 +12569,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
12132
12569
|
getLookupSapceUserTreeSchema: getLookupSapceUserTreeSchema,
|
|
12133
12570
|
getNotifications: getNotifications,
|
|
12134
12571
|
getObjectDetailButtons: getObjectDetailButtons,
|
|
12572
|
+
getObjectDetailButtonsSchemas: getObjectDetailButtonsSchemas,
|
|
12135
12573
|
getObjectDetailMoreButtons: getObjectDetailMoreButtons,
|
|
12136
12574
|
getObjectFieldsFilterBarSchema: getObjectFieldsFilterBarSchema,
|
|
12137
12575
|
getObjectFieldsFilterButtonSchema: getObjectFieldsFilterButtonSchema,
|
|
@@ -12140,6 +12578,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
12140
12578
|
getObjectListHeaderFieldsFilterBar: getObjectListHeaderFieldsFilterBar,
|
|
12141
12579
|
getObjectListHeaderFirstLine: getObjectListHeaderFirstLine,
|
|
12142
12580
|
getObjectListHeaderSecordLine: getObjectListHeaderSecordLine,
|
|
12581
|
+
getObjectListViewButtonsSchemas: getObjectListViewButtonsSchemas,
|
|
12143
12582
|
getObjectRecordDetailHeader: getObjectRecordDetailHeader,
|
|
12144
12583
|
getObjectRecordDetailRelatedListHeader: getObjectRecordDetailRelatedListHeader,
|
|
12145
12584
|
getObjectRelated: getObjectRelated,
|
|
@@ -12387,15 +12826,16 @@ var AmisObjectButton = function (props) {
|
|
|
12387
12826
|
React__default["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "animate-spin w-4 h-4" },
|
|
12388
12827
|
React__default["default"].createElement("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99" }))));
|
|
12389
12828
|
}
|
|
12829
|
+
// console.log('AmisObjectButton===>', button, className);
|
|
12390
12830
|
if (button.type === "amis_button") {
|
|
12391
12831
|
var amisSchema = button.amis_schema;
|
|
12392
12832
|
var schema = ___default.isString(amisSchema) ? JSON.parse(amisSchema) : amisSchema;
|
|
12393
12833
|
if (schema && schema.body.length > 0) {
|
|
12394
12834
|
delete schema.body[0]['visibleOn'];
|
|
12395
12835
|
}
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12836
|
+
if (schema && className) {
|
|
12837
|
+
schema.className = schema.className + ' ' + className;
|
|
12838
|
+
}
|
|
12399
12839
|
var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
|
|
12400
12840
|
if (data._id) {
|
|
12401
12841
|
renderData.recordId = data._id;
|
|
@@ -12421,7 +12861,10 @@ var AmisObjectButton = function (props) {
|
|
|
12421
12861
|
|
|
12422
12862
|
var getMenu = function (render, buttons, btnClassName, props) {
|
|
12423
12863
|
return ___default.map(buttons, function (button) {
|
|
12424
|
-
|
|
12864
|
+
if (btnClassName) {
|
|
12865
|
+
button.className = "".concat(button.className, " ").concat(btnClassName);
|
|
12866
|
+
}
|
|
12867
|
+
delete button.className;
|
|
12425
12868
|
return {
|
|
12426
12869
|
key: button.name,
|
|
12427
12870
|
label: (React__default["default"].createElement(React__default["default"].Fragment, null, render('body', button, props)))
|
|
@@ -12656,7 +13099,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12656
13099
|
}
|
|
12657
13100
|
amisSchema.className = "steedos-object-form ".concat(className);
|
|
12658
13101
|
amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
|
|
12659
|
-
|
|
13102
|
+
if (___default.has(props, 'objectApiName')) {
|
|
13103
|
+
amisSchema.data.objectName = objectApiName;
|
|
13104
|
+
}
|
|
12660
13105
|
return [2 /*return*/, amisSchema];
|
|
12661
13106
|
}
|
|
12662
13107
|
});
|
|
@@ -12664,8 +13109,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12664
13109
|
|
|
12665
13110
|
var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12666
13111
|
var $schema, top, perPage, _a, showHeader, data, defaultData, _b, className, crudClassName, _c, showDisplayAs, sideSchema, _e, filterVisible, headerToolbarItems, headerSchema, ctx, listName, defaults, objectApiName, displayAs, formFactor, isMobile, uiSchema, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, listViewSchemaProps, serviceData;
|
|
12667
|
-
|
|
12668
|
-
|
|
13112
|
+
var _f;
|
|
13113
|
+
return __generator(this, function (_g) {
|
|
13114
|
+
switch (_g.label) {
|
|
12669
13115
|
case 0:
|
|
12670
13116
|
// console.time('AmisObjectListView')
|
|
12671
13117
|
console.log("AmisObjectListView props", props);
|
|
@@ -12673,6 +13119,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12673
13119
|
headerSchema = props.headerSchema;
|
|
12674
13120
|
ctx = props.ctx;
|
|
12675
13121
|
listName = (defaultData === null || defaultData === void 0 ? void 0 : defaultData.listName) || (data === null || data === void 0 ? void 0 : data.listName) || (props === null || props === void 0 ? void 0 : props.listName);
|
|
13122
|
+
console.log('AmisObjectListView ==listName=>', listName);
|
|
12676
13123
|
defaults = {};
|
|
12677
13124
|
objectApiName = props.objectApiName || "space_users";
|
|
12678
13125
|
if (!ctx) {
|
|
@@ -12689,15 +13136,16 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12689
13136
|
formFactor = 'LARGE';
|
|
12690
13137
|
}
|
|
12691
13138
|
}
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
13139
|
+
// 分栏模式不应该改变尺寸变量值
|
|
13140
|
+
// if(["split"].indexOf(displayAs) > -1){
|
|
13141
|
+
// formFactor = 'SMALL';
|
|
13142
|
+
// }
|
|
12695
13143
|
if (!ctx.formFactor) {
|
|
12696
13144
|
ctx.formFactor = formFactor;
|
|
12697
13145
|
}
|
|
12698
13146
|
return [4 /*yield*/, getUISchema(objectApiName, false)];
|
|
12699
13147
|
case 1:
|
|
12700
|
-
uiSchema =
|
|
13148
|
+
uiSchema = _g.sent();
|
|
12701
13149
|
listView = ___default.find(uiSchema.list_views, function (listView, name) {
|
|
12702
13150
|
// 传入listViewName空值则取第一个
|
|
12703
13151
|
if (!listName) {
|
|
@@ -12749,14 +13197,26 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12749
13197
|
listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
|
|
12750
13198
|
listViewSchemaProps = __assign$2(__assign$2({ top: top, perPage: perPage, showHeader: showHeader, defaults: defaults }, ctx), { listViewId: listViewId, setDataToComponentId: setDataToComponentId, filterVisible: filterVisible, showDisplayAs: showDisplayAs, displayAs: displayAs, headerToolbarItems: headerToolbarItems });
|
|
12751
13199
|
if (!headerSchema) {
|
|
12752
|
-
headerSchema = getObjectListHeader$1(uiSchema);
|
|
13200
|
+
headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
|
|
12753
13201
|
}
|
|
12754
13202
|
serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
13203
|
+
if (___default.has(props, 'objectApiName')) {
|
|
13204
|
+
serviceData.objectName = objectApiName;
|
|
13205
|
+
}
|
|
13206
|
+
if (___default.has(props, 'listName') && ___default.has(props, '$$editor')) {
|
|
13207
|
+
serviceData.listName = listName;
|
|
13208
|
+
}
|
|
13209
|
+
if (!___default.has(data, 'uiSchema')) {
|
|
13210
|
+
serviceData.uiSchema = uiSchema;
|
|
13211
|
+
}
|
|
13212
|
+
serviceData.defaultListName = listName ? listName : (_f = ___default.first(___default.values(uiSchema.list_views))) === null || _f === void 0 ? void 0 : _f.name;
|
|
12755
13213
|
// console.timeEnd('AmisObjectListView')
|
|
13214
|
+
// console.log('serviceData===>', serviceData)
|
|
13215
|
+
// console.log('headerSchema===>', headerSchema)
|
|
12756
13216
|
return [2 /*return*/, {
|
|
12757
13217
|
type: "service",
|
|
12758
13218
|
data: serviceData,
|
|
12759
|
-
className: "".concat(className, " steedos-object-listview"),
|
|
13219
|
+
className: "".concat(className, " sm:bg-gray-100 h-full sm:shadow sm:rounded-tl sm:rounded-tr steedos-object-listview"),
|
|
12760
13220
|
body: [{
|
|
12761
13221
|
"type": "wrapper",
|
|
12762
13222
|
"size": "none",
|
|
@@ -12785,8 +13245,8 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12785
13245
|
"headers": {
|
|
12786
13246
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12787
13247
|
},
|
|
12788
|
-
"requestAdaptor": "console.log('service listview schemaApi requestAdaptor======>');api.data={query: '{spaces__findOne(id: \"
|
|
12789
|
-
"adaptor": "\n console.log('service listview schemaApi adaptor....', api.body); \n
|
|
13248
|
+
"requestAdaptor": "console.log('service listview schemaApi requestAdaptor======>');api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
|
|
13249
|
+
"adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n // console.log(\"====listViewSchemaProps===>\", listName, listViewSchemaProps)\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n payload.data = schema.amisSchema;\n // console.log(\"payload================>\", payload)\n resolve(payload)\n });\n });\n ")
|
|
12790
13250
|
},
|
|
12791
13251
|
// "body": body,
|
|
12792
13252
|
// "data": serviceData
|
|
@@ -12918,7 +13378,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12918
13378
|
return __generator(this, function (_d) {
|
|
12919
13379
|
switch (_d.label) {
|
|
12920
13380
|
case 0:
|
|
12921
|
-
_a = props.className, className = _a === void 0 ? 'sticky top-0 z-10 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
|
|
13381
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
|
|
12922
13382
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
12923
13383
|
case 1:
|
|
12924
13384
|
objectUiSchema = _d.sent();
|
|
@@ -12941,7 +13401,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12941
13401
|
};
|
|
12942
13402
|
props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
|
|
12943
13403
|
objectApiName = props.objectApiName || "space_users";
|
|
12944
|
-
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle })];
|
|
13404
|
+
return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
|
|
12945
13405
|
case 2:
|
|
12946
13406
|
schema = (_d.sent()).amisSchema;
|
|
12947
13407
|
schema.className = className;
|
|
@@ -12959,12 +13419,11 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12959
13419
|
* @Description:
|
|
12960
13420
|
*/
|
|
12961
13421
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12962
|
-
var className, appId, _a, objectApiName, body, schema;
|
|
13422
|
+
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
12963
13423
|
return __generator(this, function (_b) {
|
|
12964
13424
|
switch (_b.label) {
|
|
12965
13425
|
case 0:
|
|
12966
|
-
|
|
12967
|
-
className = props.className, props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body;
|
|
13426
|
+
className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body;
|
|
12968
13427
|
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
12969
13428
|
case 1:
|
|
12970
13429
|
schema = (_b.sent()).amisSchema;
|
|
@@ -12974,11 +13433,14 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
12974
13433
|
// recordDetailData.recordId = recordId;
|
|
12975
13434
|
// }
|
|
12976
13435
|
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
13436
|
+
if (___default.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
13437
|
+
schema.data.recordId = props.recordId;
|
|
13438
|
+
}
|
|
12977
13439
|
schema.className = className;
|
|
12978
13440
|
if (body) {
|
|
12979
13441
|
schema.body = body;
|
|
12980
13442
|
}
|
|
12981
|
-
console.log(
|
|
13443
|
+
// console.log(`AmisRecordDetail====schema==>`, schema)
|
|
12982
13444
|
return [2 /*return*/, schema];
|
|
12983
13445
|
}
|
|
12984
13446
|
});
|
|
@@ -13015,11 +13477,11 @@ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13015
13477
|
}); };
|
|
13016
13478
|
|
|
13017
13479
|
var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13018
|
-
var objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, schema;
|
|
13480
|
+
var $schema, objectApiName, recordId, relatedObjectApiName, relatedKey, top, perPage, hiddenEmptyTable, appId, relatedLabel, _a, className, columns, sort, filters, visible_on, requestAdaptor, adaptor, formFactor, formData, schema;
|
|
13019
13481
|
return __generator(this, function (_b) {
|
|
13020
13482
|
switch (_b.label) {
|
|
13021
13483
|
case 0:
|
|
13022
|
-
objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage, hiddenEmptyTable = props.hiddenEmptyTable, appId = props.appId, relatedLabel = props.relatedLabel, _a = props.className, className = _a === void 0 ? '' : _a, columns = props.columns, sort = props.sort, filters = props.filters, visible_on = props.visible_on, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor;
|
|
13484
|
+
$schema = props.$schema, objectApiName = props.objectApiName, recordId = props.recordId, relatedObjectApiName = props.relatedObjectApiName, props.data, relatedKey = props.relatedKey, top = props.top, perPage = props.perPage, hiddenEmptyTable = props.hiddenEmptyTable, appId = props.appId, relatedLabel = props.relatedLabel, _a = props.className, className = _a === void 0 ? '' : _a, columns = props.columns, sort = props.sort, filters = props.filters, visible_on = props.visible_on, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor;
|
|
13023
13485
|
formFactor = props.formFactor;
|
|
13024
13486
|
if (!formFactor) {
|
|
13025
13487
|
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
@@ -13034,20 +13496,25 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
|
|
|
13034
13496
|
"className": "mb-3"
|
|
13035
13497
|
}];
|
|
13036
13498
|
}
|
|
13499
|
+
formData = {};
|
|
13500
|
+
if (___default.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
13501
|
+
formData.recordId = recordId;
|
|
13502
|
+
}
|
|
13037
13503
|
return [4 /*yield*/, getRecordDetailRelatedListSchema(objectApiName, recordId, relatedObjectApiName, relatedKey, { top: top, perPage: perPage, appId: appId, relatedLabel: relatedLabel, className: className, formFactor: formFactor, columns: columns, sort: sort, filters: filters, visible_on: visible_on, isRelated: true, hiddenEmptyTable: hiddenEmptyTable, requestAdaptor: requestAdaptor, adaptor: adaptor })];
|
|
13038
13504
|
case 1:
|
|
13039
13505
|
schema = (_b.sent()).amisSchema;
|
|
13506
|
+
schema.data = Object.assign(schema.data, formData);
|
|
13040
13507
|
return [2 /*return*/, schema];
|
|
13041
13508
|
}
|
|
13042
13509
|
});
|
|
13043
13510
|
}); };
|
|
13044
13511
|
|
|
13045
13512
|
var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13046
|
-
var objectApiName, _a, perPage, relatedLists;
|
|
13513
|
+
var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
|
|
13047
13514
|
return __generator(this, function (_b) {
|
|
13048
13515
|
switch (_b.label) {
|
|
13049
13516
|
case 0:
|
|
13050
|
-
objectApiName = props.objectApiName, props.recordId, props.data, _a = props.perPage, perPage = _a === void 0 ? 5 : _a;
|
|
13517
|
+
$schema = props.$schema, objectApiName = props.objectApiName, recordId = props.recordId, props.data, _a = props.perPage, perPage = _a === void 0 ? 5 : _a;
|
|
13051
13518
|
if (!objectApiName) {
|
|
13052
13519
|
// if(!objectApiName || !recordId){
|
|
13053
13520
|
return [2 /*return*/, {
|
|
@@ -13071,11 +13538,15 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
13071
13538
|
"className": "mb-3"
|
|
13072
13539
|
}];
|
|
13073
13540
|
}
|
|
13541
|
+
staticRecordId = '';
|
|
13542
|
+
if (___default.has(props, "recordId") && $schema.recordId !== "${recordId}") {
|
|
13543
|
+
staticRecordId = recordId;
|
|
13544
|
+
}
|
|
13074
13545
|
return [2 /*return*/, {
|
|
13075
13546
|
type: 'service',
|
|
13076
13547
|
className: "steedos-record-detail-related-lists",
|
|
13077
13548
|
body: ___default.map(relatedLists, function (item) {
|
|
13078
|
-
|
|
13549
|
+
var relatedList = {
|
|
13079
13550
|
type: 'steedos-object-related-listview',
|
|
13080
13551
|
objectApiName: objectApiName,
|
|
13081
13552
|
// recordId: recordId,
|
|
@@ -13090,6 +13561,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
13090
13561
|
hiddenEmptyTable: true,
|
|
13091
13562
|
relatedLabel: item.label
|
|
13092
13563
|
};
|
|
13564
|
+
if (staticRecordId) {
|
|
13565
|
+
relatedList.recordId = staticRecordId;
|
|
13566
|
+
}
|
|
13567
|
+
return relatedList;
|
|
13093
13568
|
})
|
|
13094
13569
|
}];
|
|
13095
13570
|
}
|
|
@@ -13140,12 +13615,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
13140
13615
|
/*
|
|
13141
13616
|
* @Author: baozhoutao@steedos.com
|
|
13142
13617
|
* @Date: 2022-09-01 14:44:57
|
|
13143
|
-
* @LastEditors:
|
|
13144
|
-
* @LastEditTime: 2023-
|
|
13618
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
13619
|
+
* @LastEditTime: 2023-05-08 15:05:32
|
|
13145
13620
|
* @Description:
|
|
13146
13621
|
*/
|
|
13147
13622
|
var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13148
|
-
var app, data, className, _a, showAppName, _b, appNameClassName, formFactor, isMobile, dialogSchema;
|
|
13623
|
+
var app, data, className, _a, showAppName, _b, appNameClassName, formFactor, isMobile, on_click_script, mobile_blank_script, dialogSchema;
|
|
13149
13624
|
return __generator(this, function (_c) {
|
|
13150
13625
|
app = props.app, data = props.data, className = props.className, _a = props.showAppName, showAppName = _a === void 0 ? true : _a, _b = props.appNameClassName, appNameClassName = _b === void 0 ? '' : _b;
|
|
13151
13626
|
if (!app) {
|
|
@@ -13153,6 +13628,8 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13153
13628
|
}
|
|
13154
13629
|
formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
|
|
13155
13630
|
isMobile = formFactor === "SMALL" ? true : false;
|
|
13631
|
+
on_click_script = "\n var evalFunString = \"(function(){\" + event.data.on_click + \"})()\";\n try{\n eval(evalFunString);\n }\n catch(e){\n console.error(\"catch some error when eval the on_click script for app link:\");\n console.error(e.message + \"\\r\\n\" + e.stack);\n }\n ";
|
|
13632
|
+
mobile_blank_script = "\n if(event.data.path[0] == \"/\"){\n Steedos.openWindow(event.data.context.rootUrl + event.data.path)\n }else{\n Steedos.openWindow(event.data.path)\n }\n ";
|
|
13156
13633
|
dialogSchema = {};
|
|
13157
13634
|
if (isMobile) {
|
|
13158
13635
|
dialogSchema = {
|
|
@@ -13165,8 +13642,6 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13165
13642
|
"items": {
|
|
13166
13643
|
"type": "button",
|
|
13167
13644
|
"level": "link",
|
|
13168
|
-
"actionType": "link",
|
|
13169
|
-
"link": "${path}",
|
|
13170
13645
|
"body": [
|
|
13171
13646
|
{
|
|
13172
13647
|
"type": "tpl",
|
|
@@ -13192,6 +13667,23 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13192
13667
|
"actions": [
|
|
13193
13668
|
{
|
|
13194
13669
|
"actionType": "closeDialog"
|
|
13670
|
+
},
|
|
13671
|
+
{
|
|
13672
|
+
"actionType": "link",
|
|
13673
|
+
"args": {
|
|
13674
|
+
"link": "${path}"
|
|
13675
|
+
},
|
|
13676
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
13677
|
+
},
|
|
13678
|
+
{
|
|
13679
|
+
"actionType": "custom",
|
|
13680
|
+
"script": mobile_blank_script,
|
|
13681
|
+
"expression": "${AND(blank , !on_click)}"
|
|
13682
|
+
},
|
|
13683
|
+
{
|
|
13684
|
+
"actionType": "custom",
|
|
13685
|
+
"script": on_click_script,
|
|
13686
|
+
"expression": "${on_click}"
|
|
13195
13687
|
}
|
|
13196
13688
|
]
|
|
13197
13689
|
}
|
|
@@ -13215,18 +13707,26 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13215
13707
|
"headers": {
|
|
13216
13708
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
13217
13709
|
},
|
|
13218
|
-
"adaptor": "\nlet app_items = payload;\npayload
|
|
13710
|
+
"adaptor": "\nlet app_items = payload;\npayload = {\n app_items\n}\nreturn payload;",
|
|
13219
13711
|
"messages": {}
|
|
13220
13712
|
},
|
|
13221
13713
|
"onEvent": {
|
|
13222
13714
|
"@data.changed.steedos_keyvalues": {
|
|
13223
13715
|
"actions": [
|
|
13224
13716
|
{
|
|
13225
|
-
"actionType": "
|
|
13717
|
+
"actionType": "reload"
|
|
13718
|
+
}
|
|
13719
|
+
]
|
|
13720
|
+
},
|
|
13721
|
+
"fetchInited": {
|
|
13722
|
+
"actions": [
|
|
13723
|
+
{
|
|
13724
|
+
"actionType": "broadcast",
|
|
13226
13725
|
"args": {
|
|
13227
|
-
"
|
|
13228
|
-
|
|
13229
|
-
|
|
13726
|
+
"eventName": "@appsLoaded"
|
|
13727
|
+
},
|
|
13728
|
+
"data": {
|
|
13729
|
+
"apps": "${event.data.app_items}"
|
|
13230
13730
|
}
|
|
13231
13731
|
}
|
|
13232
13732
|
]
|
|
@@ -13291,7 +13791,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13291
13791
|
"args": {
|
|
13292
13792
|
"link": "${path}"
|
|
13293
13793
|
},
|
|
13294
|
-
"expression": "${!blank}"
|
|
13794
|
+
"expression": "${AND(!blank , !on_click)}"
|
|
13295
13795
|
},
|
|
13296
13796
|
{
|
|
13297
13797
|
"actionType": "url",
|
|
@@ -13299,7 +13799,12 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13299
13799
|
"url": "${path}",
|
|
13300
13800
|
"blank": true
|
|
13301
13801
|
},
|
|
13302
|
-
"expression": "${blank}"
|
|
13802
|
+
"expression": "${AND(blank , !on_click)}"
|
|
13803
|
+
},
|
|
13804
|
+
{
|
|
13805
|
+
"actionType": "custom",
|
|
13806
|
+
"script": on_click_script,
|
|
13807
|
+
"expression": "${!!on_click}"
|
|
13303
13808
|
}
|
|
13304
13809
|
]
|
|
13305
13810
|
}
|
|
@@ -13361,11 +13866,19 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13361
13866
|
"@data.changed.steedos_keyvalues": {
|
|
13362
13867
|
"actions": [
|
|
13363
13868
|
{
|
|
13364
|
-
"actionType": "
|
|
13869
|
+
"actionType": "reload"
|
|
13870
|
+
}
|
|
13871
|
+
]
|
|
13872
|
+
},
|
|
13873
|
+
"fetchInited": {
|
|
13874
|
+
"actions": [
|
|
13875
|
+
{
|
|
13876
|
+
"actionType": "broadcast",
|
|
13365
13877
|
"args": {
|
|
13366
|
-
"
|
|
13367
|
-
|
|
13368
|
-
|
|
13878
|
+
"eventName": "@appsLoaded"
|
|
13879
|
+
},
|
|
13880
|
+
"data": {
|
|
13881
|
+
"apps": "${event.data.app_items}"
|
|
13369
13882
|
}
|
|
13370
13883
|
}
|
|
13371
13884
|
]
|
|
@@ -13378,7 +13891,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13378
13891
|
"headers": {
|
|
13379
13892
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
13380
13893
|
},
|
|
13381
|
-
"adaptor": "\nlet app_items = payload;\nlet object_items = [];\nlet objects = [];\napp_items.forEach((item) => {\n item.children.forEach((i) => {\n if (objects.indexOf(i.id) < 0) {\n objects.push(i.id);\n object_items.push(i)\n }\n })\n})\npayload
|
|
13894
|
+
"adaptor": "\nlet app_items = payload;\nlet object_items = [];\nlet objects = [];\napp_items.forEach((item) => {\n item.children.forEach((i) => {\n if (objects.indexOf(i.id) < 0) {\n objects.push(i.id);\n object_items.push(i)\n }\n })\n})\npayload = {\n app_items,\n object_items\n}\nreturn payload;"
|
|
13382
13895
|
}
|
|
13383
13896
|
};
|
|
13384
13897
|
}
|
|
@@ -13432,12 +13945,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
13432
13945
|
"@data.changed.steedos_keyvalues": {
|
|
13433
13946
|
"actions": [
|
|
13434
13947
|
{
|
|
13435
|
-
"actionType": "
|
|
13436
|
-
"args": {
|
|
13437
|
-
"value": {
|
|
13438
|
-
"keyvalue": "${event.data.keyvalue.value}"
|
|
13439
|
-
}
|
|
13440
|
-
}
|
|
13948
|
+
"actionType": "reload"
|
|
13441
13949
|
}
|
|
13442
13950
|
]
|
|
13443
13951
|
}
|
|
@@ -13482,7 +13990,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
13482
13990
|
type: 'service',
|
|
13483
13991
|
schemaApi: {
|
|
13484
13992
|
"method": "get",
|
|
13485
|
-
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus
|
|
13993
|
+
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
13486
13994
|
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": true,\n \"children\": _.map(tabs, (tab) => {\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n });\n })\n }\n payload.data = {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
13487
13995
|
"headers": {
|
|
13488
13996
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -13498,7 +14006,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
13498
14006
|
* @Author: baozhoutao@steedos.com
|
|
13499
14007
|
* @Date: 2022-09-01 14:44:57
|
|
13500
14008
|
* @LastEditors: baozhoutao@steedos.com
|
|
13501
|
-
* @LastEditTime: 2023-04-
|
|
14009
|
+
* @LastEditTime: 2023-04-27 13:26:12
|
|
13502
14010
|
* @Description:
|
|
13503
14011
|
*/
|
|
13504
14012
|
var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -13509,8 +14017,8 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13509
14017
|
appId = data.context.appId || 'admin';
|
|
13510
14018
|
}
|
|
13511
14019
|
isMobile = window.innerWidth <= 768;
|
|
13512
|
-
className = 'fixed bottom-0 z-20 flex justify-evenly w-full h-16 bg-gray-100
|
|
13513
|
-
className1 = 'fixed bottom-0 z-20 flex justify-center w-full h-16 bg-gray-100
|
|
14020
|
+
className = 'fixed bottom-0 z-20 flex justify-evenly w-full h-16 bg-gray-100 steedos-global-footer';
|
|
14021
|
+
className1 = 'fixed bottom-0 z-20 flex justify-center w-full h-16 bg-gray-100 steedos-global-footer';
|
|
13514
14022
|
schema = {};
|
|
13515
14023
|
if (links) {
|
|
13516
14024
|
schema = {
|
|
@@ -13534,8 +14042,8 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13534
14042
|
type: 'service',
|
|
13535
14043
|
schemaApi: {
|
|
13536
14044
|
"method": "get",
|
|
13537
|
-
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?
|
|
13538
|
-
"adaptor": "\n
|
|
14045
|
+
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
|
|
14046
|
+
"adaptor": "\n try {\n\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }\n \n })\n\n payload.data = {\n \"type\": \"nav\",\n className: payload.children.length ==1 ? '").concat(className1, "' : '").concat(className, "',\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\" flex-shrink-0 h-10 w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg>\u83DC\u5355</span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
|
|
13539
14047
|
"headers": {
|
|
13540
14048
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
13541
14049
|
}
|
|
@@ -14056,7 +14564,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
14056
14564
|
{
|
|
14057
14565
|
"type": "button",
|
|
14058
14566
|
"className": 'p-0 absolute inset-0 mt-[50px] sm:mt-[90px]',
|
|
14059
|
-
hiddenOn: "${app.showSidebar != true}",
|
|
14567
|
+
hiddenOn: "${OR(app.showSidebar != true,isMobile)}",
|
|
14060
14568
|
body: [
|
|
14061
14569
|
{
|
|
14062
14570
|
type: "wrapper",
|
|
@@ -14152,7 +14660,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
14152
14660
|
var getSelectFlowSchema = function (id, props) {
|
|
14153
14661
|
var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? 'query' : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? 'input-tree' : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
|
|
14154
14662
|
console.log("=====onEvent", onEvent);
|
|
14155
|
-
return __assign$2({ "type": mode, "id": id, "label": label, "name": name, "options": [], "multiple": multiple, "delimiter": delimiter, "joinValues": joinValues, "extractValue": extractValue, "searchable": searchable, "showOutline": showOutline, "initiallyOpen": initiallyOpen, "unfoldedLevel": unfoldedLevel, "className": className, "required": required, "treeContainerClassName": treeContainerClassName,
|
|
14663
|
+
return __assign$2({ "type": mode, "id": id, "label": label, "name": name, "options": [], "multiple": multiple, "delimiter": delimiter, "joinValues": joinValues, "extractValue": extractValue, "searchable": searchable, "showOutline": showOutline, "initiallyOpen": initiallyOpen, "unfoldedLevel": unfoldedLevel, "className": className, "required": required, "treeContainerClassName": treeContainerClassName, "heightAuto": true,
|
|
14156
14664
|
// "menuTpl": {
|
|
14157
14665
|
// // type: "button",
|
|
14158
14666
|
// type: "tpl",
|
|
@@ -14209,6 +14717,7 @@ var AmisSelectFlow = function (props) {
|
|
|
14209
14717
|
return {
|
|
14210
14718
|
"type": "service",
|
|
14211
14719
|
"id": "selectFlowService",
|
|
14720
|
+
"className": "steedos-select-flow-service",
|
|
14212
14721
|
"body": [
|
|
14213
14722
|
{
|
|
14214
14723
|
"type": "search-box",
|
|
@@ -14307,7 +14816,10 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
14307
14816
|
// const pageSplitClassName = listSchema.pageSplitClassName || 'p-0 flex flex-1 overflow-hidden h-full'
|
|
14308
14817
|
return [2 /*return*/, {
|
|
14309
14818
|
type: 'service',
|
|
14310
|
-
className:
|
|
14819
|
+
className: {
|
|
14820
|
+
"h-full": "true",
|
|
14821
|
+
"sm:px-3 sm:pt-3": "${display != 'split'}"
|
|
14822
|
+
},
|
|
14311
14823
|
body: listSchema
|
|
14312
14824
|
}];
|
|
14313
14825
|
}
|
|
@@ -14424,7 +14936,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
14424
14936
|
});
|
|
14425
14937
|
}); };
|
|
14426
14938
|
|
|
14427
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,
|
|
14939
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,n){return !1}},standard_new:{visible:function(e,t,n){return "cms_files"!==e&&"instances"!==e&&(n?n.allowCreate:void 0)}},standard_edit:{visible:function(e,t,n){if(n)return n.allowEdit}},standard_delete:{visible:function(e,t,n){if(n)return n.allowDelete}},standard_import_data:{visible:function(e,t,n){var r=this.object;if(n)return n.allowCreate&&r.hasImportTemplates}},standard_approve:{visible:function(e,t,n){return !1}},standard_view_instance:{visible:function(e,t,n){return !1}},standard_submit_for_approval:{visible:function(e,t,n){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,n){return !1}},standard_delete_many:{visible:function(e,t,n){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(n?n.allowDelete:void 0)}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var n=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],r={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(n&&n.length)return n.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,n){var r,o;e.responseJSON&&e.responseJSON.error?(r=e.responseJSON.error,o=void(i={error:r}),o=r.reason||r.message||r,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},r,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,n]=React.useState(!0);var r=()=>{n(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{n(!0);},close:r}),React__default["default"].createElement(o,_extends({visible:t,onCancel:r,onClose:r},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(n,r)=>(e,t)=>{e.name||(e.name=n+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${n}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${n}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(r),e);ReactDOM.createRoot(t).render(e);},Modal=___default.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),___default.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,n)=>{e=e.replace(/\./g,"_");n=getGraphqlFieldsQuery(n);let r="";t=[`id: "${t}"`];return `{record:${e}__findOne${r=0<t.length?`(${t.join(",")})`:r}{${n}}}`},SObject={getRecord:async(e,t,n)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,n)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:n})=>{canSaveFilter(t);n.filters&&(n.filters=filtersToConditions(n.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):___default.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:n}){return `/app/${e}/${t}/grid/`+n},getObjectDetailPath({appId:e,objectName:t,recordId:n}){return `/app/${e}/${t}/view/`+n},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:n,objectName:r,foreignKey:o}){return `/app/${e}/${t}/${n}/${r}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,n,r){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,n)};const safeRunFunction=(t,n,r,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___default.isNil(n)||(e=___default.isArray(n)?n:[n]),t.bind(o||{})(...e)}catch(e){return console.log(e),r}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,n;return "string"==typeof e&&(t=/^{{(function.+)}}$/,n=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(n)))},parseSingleExpression=function(t,e,n,r){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(n))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(r)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,n),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let n=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(n=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(n=n.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),n},getFieldDefaultValue=(e,t)=>{if(!e)return null;let n=e.defaultValue;e._defaultValue&&(n=safeEval(`(${e._defaultValue})`)),___default.isFunction(n)&&(n=safeRunFunction(n,[],null,{name:e.name})),___default.isString(n)&&(n=getCompatibleDefaultValueExpression(n,e.multiple));var r=isExpression(n);return r&&(n=parseSingleExpression(n,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!n||r||e.multiple||("text"!==t||___default.isString(n)?"number"!==t||___default.isNumber(n)?"boolean"!==t||___default.isBoolean(n)||(n="true"===n):n=Number(n):n=String(n))),n};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const n=e?.unfoldedNum||1,r=[],i=(t,n,r)=>{var e;if(n)return e=_.filter(t,e=>_.includes(n,e[o])),_.each(e,e=>{1<=r?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,r-1))):e.children&&(e.children=i(t,e.children,r));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=n?(e.unfolded=!0,r.push(Object.assign({},e,{children:i(t,e.children,n-1)}))):r.push(Object.assign({},e,{children:i(t,e.children,n)})));}),r}function getClosestAmisComponentByType(t,n,r){let o=(r=r||{}).name;var e=r.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===n&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],n,r));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,n,r)}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var n=window.FlowRouter;if(t)return n?n.go(t):window.open(t);n?n.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:n})=>{switch(e){case"listview":return `amis-${t}-${n}-listview`;case"form":return `amis-${t}-${n}-form`;case"detail":return `amis-${t}-${n}-detail`;default:return `amis-${t}-${n}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,n=e.authToken;return t&&n?"Bearer ".concat(t,",").concat(n):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
14428
14940
|
|
|
14429
14941
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
14430
14942
|
__proto__: null,
|