@steedos-widgets/amis-object 1.2.39 → 1.2.41
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-object.cjs.js +123 -91
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +123 -91
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +123 -91
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +16 -16
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -3819,7 +3819,7 @@ async function getFieldsTemplate(fields, display){
|
|
|
3819
3819
|
let expandFieldsQuery = "";
|
|
3820
3820
|
if(expandFields.length > 0){
|
|
3821
3821
|
___default.each(expandFields, function(field){
|
|
3822
|
-
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}
|
|
3822
|
+
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
3823
3823
|
});
|
|
3824
3824
|
}
|
|
3825
3825
|
|
|
@@ -6426,6 +6426,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6426
6426
|
}
|
|
6427
6427
|
const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
|
|
6428
6428
|
const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
|
|
6429
|
+
const keywordsSearchBoxName = ctx.keywordsSearchBoxName || "__keywords";
|
|
6429
6430
|
const onSearchScript = `
|
|
6430
6431
|
const scope = event.context.scoped;
|
|
6431
6432
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
@@ -6511,6 +6512,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6511
6512
|
}
|
|
6512
6513
|
}
|
|
6513
6514
|
}
|
|
6515
|
+
else{
|
|
6516
|
+
const keywordsSearchBoxName = "${keywordsSearchBoxName}";
|
|
6517
|
+
//lookup字段保留快速搜索条件
|
|
6518
|
+
removedValues[keywordsSearchBoxName] = filterFormValues[keywordsSearchBoxName];
|
|
6519
|
+
}
|
|
6514
6520
|
filterForm.reset();
|
|
6515
6521
|
listView.handleFilterSubmit(removedValues);
|
|
6516
6522
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
@@ -6575,7 +6581,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6575
6581
|
});
|
|
6576
6582
|
// 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
|
|
6577
6583
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
6578
|
-
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
6584
|
+
let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
|
|
6579
6585
|
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
6580
6586
|
// setData({ showFieldsFilter: true });//自动展开搜索栏
|
|
6581
6587
|
}
|
|
@@ -8378,16 +8384,14 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8378
8384
|
// }
|
|
8379
8385
|
`;
|
|
8380
8386
|
|
|
8381
|
-
|
|
8382
|
-
function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true, isLookup = false } = {}){
|
|
8383
|
-
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
8384
|
-
// console.log(`getObjectHeaderToolbar`, mainObject)
|
|
8387
|
+
function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup = false, keywordsSearchBoxName = "__keywords" } = {}){
|
|
8385
8388
|
const searchableFieldsLabel = [];
|
|
8386
8389
|
_.each(fields, function (field) {
|
|
8387
|
-
if (field
|
|
8390
|
+
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
8388
8391
|
searchableFieldsLabel.push(field.label);
|
|
8389
8392
|
}
|
|
8390
8393
|
});
|
|
8394
|
+
|
|
8391
8395
|
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
8392
8396
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
8393
8397
|
let crudKeywords = "";
|
|
@@ -8396,6 +8400,35 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8396
8400
|
crudKeywords = (localListViewProps && localListViewProps.__keywords) || "";
|
|
8397
8401
|
}
|
|
8398
8402
|
|
|
8403
|
+
return {
|
|
8404
|
+
"type": "tooltip-wrapper",
|
|
8405
|
+
"align": "right",
|
|
8406
|
+
"title": "",
|
|
8407
|
+
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8408
|
+
"placement": "bottom",
|
|
8409
|
+
"tooltipTheme": "dark",
|
|
8410
|
+
"trigger": "click",
|
|
8411
|
+
"className": formFactor !== 'SMALL' ? "mr-1" : '',
|
|
8412
|
+
"visible": !!searchableFieldsLabel.length,
|
|
8413
|
+
"body": [
|
|
8414
|
+
{
|
|
8415
|
+
"type": "search-box",
|
|
8416
|
+
"name": keywordsSearchBoxName,
|
|
8417
|
+
"placeholder": "快速搜索",
|
|
8418
|
+
"value": crudKeywords,
|
|
8419
|
+
"clearable": true,
|
|
8420
|
+
"clearAndSubmit": true
|
|
8421
|
+
}
|
|
8422
|
+
]
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8425
|
+
|
|
8426
|
+
function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
8427
|
+
showDisplayAs = false, hiddenCount = false, headerToolbarItems,
|
|
8428
|
+
filterVisible = true, isLookup = false, keywordsSearchBoxName } = {}){
|
|
8429
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
8430
|
+
// console.log(`getObjectHeaderToolbar`, mainObject)
|
|
8431
|
+
|
|
8399
8432
|
const isMobile = window.innerWidth < 768;
|
|
8400
8433
|
if(isMobile){
|
|
8401
8434
|
showDisplayAs = false;
|
|
@@ -8467,26 +8500,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8467
8500
|
}
|
|
8468
8501
|
} : {},
|
|
8469
8502
|
getDisplayAsButton(mainObject?.name),
|
|
8470
|
-
{
|
|
8471
|
-
"type": "tooltip-wrapper",
|
|
8472
|
-
"align": "right",
|
|
8473
|
-
"title": "",
|
|
8474
|
-
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8475
|
-
"placement": "bottom",
|
|
8476
|
-
"tooltipTheme": "dark",
|
|
8477
|
-
"trigger": "click",
|
|
8478
|
-
// "className": "mr-1",
|
|
8479
|
-
"body": [
|
|
8480
|
-
{
|
|
8481
|
-
"type": "search-box",
|
|
8482
|
-
"name": "__keywords",
|
|
8483
|
-
"placeholder": "请输入关键字",
|
|
8484
|
-
"value": crudKeywords,
|
|
8485
|
-
"clearable": true,
|
|
8486
|
-
"clearAndSubmit": true
|
|
8487
|
-
}
|
|
8488
|
-
]
|
|
8489
|
-
},
|
|
8503
|
+
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
8490
8504
|
]
|
|
8491
8505
|
}else {
|
|
8492
8506
|
return [
|
|
@@ -8546,26 +8560,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8546
8560
|
// getExportExcelToolbarButtonSchema(),
|
|
8547
8561
|
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
8548
8562
|
getDisplayAsButton(mainObject?.name),
|
|
8549
|
-
{
|
|
8550
|
-
"type": "tooltip-wrapper",
|
|
8551
|
-
"align": "right",
|
|
8552
|
-
"title": "",
|
|
8553
|
-
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8554
|
-
"placement": "bottom",
|
|
8555
|
-
"tooltipTheme": "dark",
|
|
8556
|
-
"trigger": "click",
|
|
8557
|
-
"className": "mr-1",
|
|
8558
|
-
"body": [
|
|
8559
|
-
{
|
|
8560
|
-
"type": "search-box",
|
|
8561
|
-
"name": "__keywords",
|
|
8562
|
-
"placeholder": "请输入关键字",
|
|
8563
|
-
"value": crudKeywords,
|
|
8564
|
-
"clearable": true,
|
|
8565
|
-
"clearAndSubmit": true
|
|
8566
|
-
}
|
|
8567
|
-
]
|
|
8568
|
-
},
|
|
8563
|
+
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
8569
8564
|
// {
|
|
8570
8565
|
// "type": "drag-toggler",
|
|
8571
8566
|
// "align": "right"
|
|
@@ -8983,7 +8978,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8983
8978
|
})){
|
|
8984
8979
|
i++;
|
|
8985
8980
|
tableFields.push(field);
|
|
8986
|
-
if(field
|
|
8981
|
+
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
8987
8982
|
searchableFields.push(field.name);
|
|
8988
8983
|
}
|
|
8989
8984
|
}
|
|
@@ -9024,7 +9019,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9024
9019
|
source.data.$term = "$term";
|
|
9025
9020
|
source.data.$self = "$$";
|
|
9026
9021
|
|
|
9027
|
-
|
|
9022
|
+
let keywordsSearchBoxName = `__keywords_lookup__${field.name}__to__${refObjectConfig.name}`;
|
|
9023
|
+
|
|
9028
9024
|
source.requestAdaptor = `
|
|
9029
9025
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
9030
9026
|
var filters = [];
|
|
@@ -9078,19 +9074,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9078
9074
|
})
|
|
9079
9075
|
}
|
|
9080
9076
|
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
allowSearchFields.forEach(function(key, index){
|
|
9084
|
-
const keyValue = selfData.__keywords;
|
|
9085
|
-
if(keyValue){
|
|
9086
|
-
keywordsFilters.push([key, "contains", keyValue]);
|
|
9087
|
-
if(index < allowSearchFields.length - 1){
|
|
9088
|
-
keywordsFilters.push('or');
|
|
9089
|
-
}
|
|
9090
|
-
}
|
|
9091
|
-
})
|
|
9077
|
+
var keywordsFilters = SteedosUI.getKeywordsSearchFilter(selfData.${keywordsSearchBoxName}, allowSearchFields);
|
|
9078
|
+
if(keywordsFilters && keywordsFilters.length > 0){
|
|
9092
9079
|
filters.push(keywordsFilters);
|
|
9093
|
-
}
|
|
9080
|
+
}
|
|
9094
9081
|
|
|
9095
9082
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
9096
9083
|
if(fieldFilters && fieldFilters.length){
|
|
@@ -9208,7 +9195,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9208
9195
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9209
9196
|
}
|
|
9210
9197
|
|
|
9211
|
-
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true });
|
|
9198
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
9212
9199
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
9213
9200
|
if (isAllowCreate) {
|
|
9214
9201
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
@@ -9219,8 +9206,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9219
9206
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
9220
9207
|
if (ctx.filterVisible !== false) {
|
|
9221
9208
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
9209
|
+
...ctx,
|
|
9222
9210
|
isLookup: true,
|
|
9223
|
-
|
|
9211
|
+
keywordsSearchBoxName
|
|
9224
9212
|
});
|
|
9225
9213
|
}
|
|
9226
9214
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
@@ -9556,7 +9544,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9556
9544
|
}
|
|
9557
9545
|
|
|
9558
9546
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9559
|
-
if(ctx.idsDependOn
|
|
9547
|
+
if(ctx.idsDependOn){
|
|
9560
9548
|
// ids人员点选模式
|
|
9561
9549
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
9562
9550
|
}
|
|
@@ -9931,7 +9919,7 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
9931
9919
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
9932
9920
|
};
|
|
9933
9921
|
|
|
9934
|
-
const
|
|
9922
|
+
const QUICK_SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
|
|
9935
9923
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
9936
9924
|
// const Lookup = require('./lookup');
|
|
9937
9925
|
|
|
@@ -10704,9 +10692,22 @@ if (typeof window != 'undefined') {
|
|
|
10704
10692
|
window.isFieldTypeSearchable = isFieldTypeSearchable;
|
|
10705
10693
|
}
|
|
10706
10694
|
|
|
10695
|
+
|
|
10696
|
+
function isFieldQuickSearchable(field, nameFieldKey) {
|
|
10697
|
+
let fieldSearchable = field.searchable;
|
|
10698
|
+
if(fieldSearchable !== false && field.name === nameFieldKey){
|
|
10699
|
+
// 对象上名称字段的searchable默认认为是true
|
|
10700
|
+
fieldSearchable = true;
|
|
10701
|
+
}
|
|
10702
|
+
if (fieldSearchable && QUICK_SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1) {
|
|
10703
|
+
return true;
|
|
10704
|
+
}
|
|
10705
|
+
return false;
|
|
10706
|
+
}
|
|
10707
|
+
|
|
10707
10708
|
var index = /*#__PURE__*/Object.freeze({
|
|
10708
10709
|
__proto__: null,
|
|
10709
|
-
|
|
10710
|
+
QUICK_SEARCHABLE_FIELD_TYPES: QUICK_SEARCHABLE_FIELD_TYPES,
|
|
10710
10711
|
OMIT_FIELDS: OMIT_FIELDS,
|
|
10711
10712
|
getBaseFields: getBaseFields,
|
|
10712
10713
|
getAmisFieldType: getAmisFieldType,
|
|
@@ -10717,6 +10718,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
10717
10718
|
convertSFieldToAmisField: convertSFieldToAmisField,
|
|
10718
10719
|
getFieldSearchable: getFieldSearchable,
|
|
10719
10720
|
isFieldTypeSearchable: isFieldTypeSearchable,
|
|
10721
|
+
isFieldQuickSearchable: isFieldQuickSearchable,
|
|
10720
10722
|
getAmisStaticFieldType: getAmisStaticFieldType
|
|
10721
10723
|
});
|
|
10722
10724
|
|
|
@@ -11493,8 +11495,9 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11493
11495
|
if(filter){
|
|
11494
11496
|
baseFilters = filter;
|
|
11495
11497
|
}
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
+
|
|
11499
|
+
___default.each(fields, function (field) {
|
|
11500
|
+
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
11498
11501
|
searchableFields.push(field.name);
|
|
11499
11502
|
}
|
|
11500
11503
|
});
|
|
@@ -11622,19 +11625,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11622
11625
|
})
|
|
11623
11626
|
}
|
|
11624
11627
|
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
allowSearchFields.forEach(function(key, index){
|
|
11628
|
-
const keyValue = selfData.__keywords;
|
|
11629
|
-
if(keyValue){
|
|
11630
|
-
keywordsFilters.push([key, "contains", keyValue]);
|
|
11631
|
-
if(index < allowSearchFields.length - 1){
|
|
11632
|
-
keywordsFilters.push('or');
|
|
11633
|
-
}
|
|
11634
|
-
}
|
|
11635
|
-
})
|
|
11628
|
+
var keywordsFilters = SteedosUI.getKeywordsSearchFilter(selfData.__keywords, allowSearchFields);
|
|
11629
|
+
if(keywordsFilters && keywordsFilters.length > 0){
|
|
11636
11630
|
userFilters.push(keywordsFilters);
|
|
11637
|
-
}
|
|
11631
|
+
}
|
|
11638
11632
|
|
|
11639
11633
|
let filters = [];
|
|
11640
11634
|
|
|
@@ -12496,6 +12490,39 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12496
12490
|
});
|
|
12497
12491
|
`;
|
|
12498
12492
|
|
|
12493
|
+
const onEventClickScript = `
|
|
12494
|
+
const data = event.data;
|
|
12495
|
+
const eventData = data.event;
|
|
12496
|
+
const appId = data.appId;
|
|
12497
|
+
const objectName = data.objectName;
|
|
12498
|
+
const eventId = data.event && data.event.id;
|
|
12499
|
+
doAction({
|
|
12500
|
+
"actionType": "link",
|
|
12501
|
+
"args": {
|
|
12502
|
+
"link": "/app/" + appId + "/" + objectName + "/view/" + eventId
|
|
12503
|
+
}
|
|
12504
|
+
});
|
|
12505
|
+
// doAction({
|
|
12506
|
+
// "actionType": "dialog",
|
|
12507
|
+
// "dialog": {
|
|
12508
|
+
// "type": "dialog",
|
|
12509
|
+
// "title": "",
|
|
12510
|
+
// "body": [
|
|
12511
|
+
// {
|
|
12512
|
+
// "type": "steedos-record-detail",
|
|
12513
|
+
// "objectApiName": "\${objectName}",
|
|
12514
|
+
// "recordId": data.event && data.event.id
|
|
12515
|
+
// }
|
|
12516
|
+
// ],
|
|
12517
|
+
// "closeOnEsc": false,
|
|
12518
|
+
// "closeOnOutside": false,
|
|
12519
|
+
// "showCloseButton": true,
|
|
12520
|
+
// "size": "lg",
|
|
12521
|
+
// "actions": []
|
|
12522
|
+
// }
|
|
12523
|
+
// });
|
|
12524
|
+
`;
|
|
12525
|
+
|
|
12499
12526
|
const recordId = "${event.id}";
|
|
12500
12527
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
12501
12528
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
@@ -12541,11 +12568,16 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12541
12568
|
"weight": 0,
|
|
12542
12569
|
"actions": [
|
|
12543
12570
|
{
|
|
12544
|
-
"actionType": "
|
|
12545
|
-
"
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12571
|
+
"actionType": "custom",
|
|
12572
|
+
"script": onEventClickScript
|
|
12573
|
+
},
|
|
12574
|
+
// amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
|
|
12575
|
+
// {
|
|
12576
|
+
// "actionType": "link",
|
|
12577
|
+
// "args": {
|
|
12578
|
+
// "link": "/app/${appId}/${objectName}/view/${event.id}"
|
|
12579
|
+
// }
|
|
12580
|
+
// }
|
|
12549
12581
|
]
|
|
12550
12582
|
},
|
|
12551
12583
|
"eventAdd": {
|
|
@@ -13712,8 +13744,8 @@ async function getRelatedListSchema(
|
|
|
13712
13744
|
/*
|
|
13713
13745
|
* @Author: baozhoutao@steedos.com
|
|
13714
13746
|
* @Date: 2022-07-05 15:55:39
|
|
13715
|
-
* @LastEditors:
|
|
13716
|
-
* @LastEditTime: 2023-08-
|
|
13747
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
13748
|
+
* @LastEditTime: 2023-08-17 18:03:51
|
|
13717
13749
|
* @Description:
|
|
13718
13750
|
*/
|
|
13719
13751
|
|
|
@@ -14084,7 +14116,7 @@ async function getTableSchema(
|
|
|
14084
14116
|
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to) ){
|
|
14085
14117
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14086
14118
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14087
|
-
fields.push(Object.assign({}, rfFieldInfo, {name:
|
|
14119
|
+
fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
|
|
14088
14120
|
}
|
|
14089
14121
|
}else {
|
|
14090
14122
|
if(uiSchema.fields[column]){
|
|
@@ -14100,7 +14132,7 @@ async function getTableSchema(
|
|
|
14100
14132
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14101
14133
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14102
14134
|
fields.push(Object.assign({}, rfFieldInfo,
|
|
14103
|
-
{name:
|
|
14135
|
+
{name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}},
|
|
14104
14136
|
{
|
|
14105
14137
|
width: column.width,
|
|
14106
14138
|
wrap: column.wrap, // wrap = true 是没效果的
|
|
@@ -18658,7 +18690,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18658
18690
|
schemaApi: {
|
|
18659
18691
|
"method": "get",
|
|
18660
18692
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18661
|
-
"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 const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18693
|
+
"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 const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] 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 \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18662
18694
|
"headers": {
|
|
18663
18695
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18664
18696
|
}
|
|
@@ -19814,7 +19846,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19814
19846
|
});
|
|
19815
19847
|
}); };
|
|
19816
19848
|
|
|
19817
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){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,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):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:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,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 isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){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("."))}(r))||{};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(n)).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,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var s=t,a=0;a<s.length;a++)if(s[a].noParent=0,s[a].unfolded=!1,s[a].parent){let e=1;for(var l=0;l<s.length;l++)s[a].parent==s[l][o]&&(e=0);1==e&&(s[a].noParent=1);}else s[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:i(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:i(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===r&&(!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],r,n));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}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 r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o}});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,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):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);
|
|
19849
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){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,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):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:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,s=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("."))}(r))||{};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(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}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 r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});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,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):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);
|
|
19818
19850
|
|
|
19819
19851
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19820
19852
|
__proto__: null,
|