@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.cjs.js
CHANGED
|
@@ -3847,7 +3847,7 @@ async function getFieldsTemplate(fields, display){
|
|
|
3847
3847
|
let expandFieldsQuery = "";
|
|
3848
3848
|
if(expandFields.length > 0){
|
|
3849
3849
|
___default__namespace.each(expandFields, function(field){
|
|
3850
|
-
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}
|
|
3850
|
+
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
3851
3851
|
});
|
|
3852
3852
|
}
|
|
3853
3853
|
|
|
@@ -6454,6 +6454,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6454
6454
|
}
|
|
6455
6455
|
const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
|
|
6456
6456
|
const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
|
|
6457
|
+
const keywordsSearchBoxName = ctx.keywordsSearchBoxName || "__keywords";
|
|
6457
6458
|
const onSearchScript = `
|
|
6458
6459
|
const scope = event.context.scoped;
|
|
6459
6460
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
@@ -6539,6 +6540,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6539
6540
|
}
|
|
6540
6541
|
}
|
|
6541
6542
|
}
|
|
6543
|
+
else{
|
|
6544
|
+
const keywordsSearchBoxName = "${keywordsSearchBoxName}";
|
|
6545
|
+
//lookup字段保留快速搜索条件
|
|
6546
|
+
removedValues[keywordsSearchBoxName] = filterFormValues[keywordsSearchBoxName];
|
|
6547
|
+
}
|
|
6542
6548
|
filterForm.reset();
|
|
6543
6549
|
listView.handleFilterSubmit(removedValues);
|
|
6544
6550
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
@@ -6603,7 +6609,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6603
6609
|
});
|
|
6604
6610
|
// 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
|
|
6605
6611
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
6606
|
-
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
6612
|
+
let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
|
|
6607
6613
|
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
6608
6614
|
// setData({ showFieldsFilter: true });//自动展开搜索栏
|
|
6609
6615
|
}
|
|
@@ -8406,16 +8412,14 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8406
8412
|
// }
|
|
8407
8413
|
`;
|
|
8408
8414
|
|
|
8409
|
-
|
|
8410
|
-
function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true, isLookup = false } = {}){
|
|
8411
|
-
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
8412
|
-
// console.log(`getObjectHeaderToolbar`, mainObject)
|
|
8415
|
+
function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup = false, keywordsSearchBoxName = "__keywords" } = {}){
|
|
8413
8416
|
const searchableFieldsLabel = [];
|
|
8414
8417
|
_.each(fields, function (field) {
|
|
8415
|
-
if (field
|
|
8418
|
+
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
8416
8419
|
searchableFieldsLabel.push(field.label);
|
|
8417
8420
|
}
|
|
8418
8421
|
});
|
|
8422
|
+
|
|
8419
8423
|
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
8420
8424
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
8421
8425
|
let crudKeywords = "";
|
|
@@ -8424,6 +8428,35 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8424
8428
|
crudKeywords = (localListViewProps && localListViewProps.__keywords) || "";
|
|
8425
8429
|
}
|
|
8426
8430
|
|
|
8431
|
+
return {
|
|
8432
|
+
"type": "tooltip-wrapper",
|
|
8433
|
+
"align": "right",
|
|
8434
|
+
"title": "",
|
|
8435
|
+
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8436
|
+
"placement": "bottom",
|
|
8437
|
+
"tooltipTheme": "dark",
|
|
8438
|
+
"trigger": "click",
|
|
8439
|
+
"className": formFactor !== 'SMALL' ? "mr-1" : '',
|
|
8440
|
+
"visible": !!searchableFieldsLabel.length,
|
|
8441
|
+
"body": [
|
|
8442
|
+
{
|
|
8443
|
+
"type": "search-box",
|
|
8444
|
+
"name": keywordsSearchBoxName,
|
|
8445
|
+
"placeholder": "快速搜索",
|
|
8446
|
+
"value": crudKeywords,
|
|
8447
|
+
"clearable": true,
|
|
8448
|
+
"clearAndSubmit": true
|
|
8449
|
+
}
|
|
8450
|
+
]
|
|
8451
|
+
}
|
|
8452
|
+
}
|
|
8453
|
+
|
|
8454
|
+
function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
8455
|
+
showDisplayAs = false, hiddenCount = false, headerToolbarItems,
|
|
8456
|
+
filterVisible = true, isLookup = false, keywordsSearchBoxName } = {}){
|
|
8457
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
8458
|
+
// console.log(`getObjectHeaderToolbar`, mainObject)
|
|
8459
|
+
|
|
8427
8460
|
const isMobile = window.innerWidth < 768;
|
|
8428
8461
|
if(isMobile){
|
|
8429
8462
|
showDisplayAs = false;
|
|
@@ -8495,26 +8528,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8495
8528
|
}
|
|
8496
8529
|
} : {},
|
|
8497
8530
|
getDisplayAsButton(mainObject?.name),
|
|
8498
|
-
{
|
|
8499
|
-
"type": "tooltip-wrapper",
|
|
8500
|
-
"align": "right",
|
|
8501
|
-
"title": "",
|
|
8502
|
-
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8503
|
-
"placement": "bottom",
|
|
8504
|
-
"tooltipTheme": "dark",
|
|
8505
|
-
"trigger": "click",
|
|
8506
|
-
// "className": "mr-1",
|
|
8507
|
-
"body": [
|
|
8508
|
-
{
|
|
8509
|
-
"type": "search-box",
|
|
8510
|
-
"name": "__keywords",
|
|
8511
|
-
"placeholder": "请输入关键字",
|
|
8512
|
-
"value": crudKeywords,
|
|
8513
|
-
"clearable": true,
|
|
8514
|
-
"clearAndSubmit": true
|
|
8515
|
-
}
|
|
8516
|
-
]
|
|
8517
|
-
},
|
|
8531
|
+
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
8518
8532
|
]
|
|
8519
8533
|
}else {
|
|
8520
8534
|
return [
|
|
@@ -8574,26 +8588,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs
|
|
|
8574
8588
|
// getExportExcelToolbarButtonSchema(),
|
|
8575
8589
|
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
8576
8590
|
getDisplayAsButton(mainObject?.name),
|
|
8577
|
-
{
|
|
8578
|
-
"type": "tooltip-wrapper",
|
|
8579
|
-
"align": "right",
|
|
8580
|
-
"title": "",
|
|
8581
|
-
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
8582
|
-
"placement": "bottom",
|
|
8583
|
-
"tooltipTheme": "dark",
|
|
8584
|
-
"trigger": "click",
|
|
8585
|
-
"className": "mr-1",
|
|
8586
|
-
"body": [
|
|
8587
|
-
{
|
|
8588
|
-
"type": "search-box",
|
|
8589
|
-
"name": "__keywords",
|
|
8590
|
-
"placeholder": "请输入关键字",
|
|
8591
|
-
"value": crudKeywords,
|
|
8592
|
-
"clearable": true,
|
|
8593
|
-
"clearAndSubmit": true
|
|
8594
|
-
}
|
|
8595
|
-
]
|
|
8596
|
-
},
|
|
8591
|
+
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
8597
8592
|
// {
|
|
8598
8593
|
// "type": "drag-toggler",
|
|
8599
8594
|
// "align": "right"
|
|
@@ -9011,7 +9006,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9011
9006
|
})){
|
|
9012
9007
|
i++;
|
|
9013
9008
|
tableFields.push(field);
|
|
9014
|
-
if(field
|
|
9009
|
+
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
9015
9010
|
searchableFields.push(field.name);
|
|
9016
9011
|
}
|
|
9017
9012
|
}
|
|
@@ -9052,7 +9047,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9052
9047
|
source.data.$term = "$term";
|
|
9053
9048
|
source.data.$self = "$$";
|
|
9054
9049
|
|
|
9055
|
-
|
|
9050
|
+
let keywordsSearchBoxName = `__keywords_lookup__${field.name}__to__${refObjectConfig.name}`;
|
|
9051
|
+
|
|
9056
9052
|
source.requestAdaptor = `
|
|
9057
9053
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
9058
9054
|
var filters = [];
|
|
@@ -9106,19 +9102,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9106
9102
|
})
|
|
9107
9103
|
}
|
|
9108
9104
|
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
allowSearchFields.forEach(function(key, index){
|
|
9112
|
-
const keyValue = selfData.__keywords;
|
|
9113
|
-
if(keyValue){
|
|
9114
|
-
keywordsFilters.push([key, "contains", keyValue]);
|
|
9115
|
-
if(index < allowSearchFields.length - 1){
|
|
9116
|
-
keywordsFilters.push('or');
|
|
9117
|
-
}
|
|
9118
|
-
}
|
|
9119
|
-
})
|
|
9105
|
+
var keywordsFilters = SteedosUI.getKeywordsSearchFilter(selfData.${keywordsSearchBoxName}, allowSearchFields);
|
|
9106
|
+
if(keywordsFilters && keywordsFilters.length > 0){
|
|
9120
9107
|
filters.push(keywordsFilters);
|
|
9121
|
-
}
|
|
9108
|
+
}
|
|
9122
9109
|
|
|
9123
9110
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
9124
9111
|
if(fieldFilters && fieldFilters.length){
|
|
@@ -9236,7 +9223,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9236
9223
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9237
9224
|
}
|
|
9238
9225
|
|
|
9239
|
-
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true });
|
|
9226
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
9240
9227
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
9241
9228
|
if (isAllowCreate) {
|
|
9242
9229
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
@@ -9247,8 +9234,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9247
9234
|
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
9248
9235
|
if (ctx.filterVisible !== false) {
|
|
9249
9236
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
9237
|
+
...ctx,
|
|
9250
9238
|
isLookup: true,
|
|
9251
|
-
|
|
9239
|
+
keywordsSearchBoxName
|
|
9252
9240
|
});
|
|
9253
9241
|
}
|
|
9254
9242
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
@@ -9584,7 +9572,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9584
9572
|
}
|
|
9585
9573
|
|
|
9586
9574
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9587
|
-
if(ctx.idsDependOn
|
|
9575
|
+
if(ctx.idsDependOn){
|
|
9588
9576
|
// ids人员点选模式
|
|
9589
9577
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
9590
9578
|
}
|
|
@@ -9959,7 +9947,7 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
9959
9947
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
9960
9948
|
};
|
|
9961
9949
|
|
|
9962
|
-
const
|
|
9950
|
+
const QUICK_SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
|
|
9963
9951
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
9964
9952
|
// const Lookup = require('./lookup');
|
|
9965
9953
|
|
|
@@ -10732,9 +10720,22 @@ if (typeof window != 'undefined') {
|
|
|
10732
10720
|
window.isFieldTypeSearchable = isFieldTypeSearchable;
|
|
10733
10721
|
}
|
|
10734
10722
|
|
|
10723
|
+
|
|
10724
|
+
function isFieldQuickSearchable(field, nameFieldKey) {
|
|
10725
|
+
let fieldSearchable = field.searchable;
|
|
10726
|
+
if(fieldSearchable !== false && field.name === nameFieldKey){
|
|
10727
|
+
// 对象上名称字段的searchable默认认为是true
|
|
10728
|
+
fieldSearchable = true;
|
|
10729
|
+
}
|
|
10730
|
+
if (fieldSearchable && QUICK_SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1) {
|
|
10731
|
+
return true;
|
|
10732
|
+
}
|
|
10733
|
+
return false;
|
|
10734
|
+
}
|
|
10735
|
+
|
|
10735
10736
|
var index = /*#__PURE__*/Object.freeze({
|
|
10736
10737
|
__proto__: null,
|
|
10737
|
-
|
|
10738
|
+
QUICK_SEARCHABLE_FIELD_TYPES: QUICK_SEARCHABLE_FIELD_TYPES,
|
|
10738
10739
|
OMIT_FIELDS: OMIT_FIELDS,
|
|
10739
10740
|
getBaseFields: getBaseFields,
|
|
10740
10741
|
getAmisFieldType: getAmisFieldType,
|
|
@@ -10745,6 +10746,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
10745
10746
|
convertSFieldToAmisField: convertSFieldToAmisField,
|
|
10746
10747
|
getFieldSearchable: getFieldSearchable,
|
|
10747
10748
|
isFieldTypeSearchable: isFieldTypeSearchable,
|
|
10749
|
+
isFieldQuickSearchable: isFieldQuickSearchable,
|
|
10748
10750
|
getAmisStaticFieldType: getAmisStaticFieldType
|
|
10749
10751
|
});
|
|
10750
10752
|
|
|
@@ -11521,8 +11523,9 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11521
11523
|
if(filter){
|
|
11522
11524
|
baseFilters = filter;
|
|
11523
11525
|
}
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
+
|
|
11527
|
+
___default__namespace.each(fields, function (field) {
|
|
11528
|
+
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
11526
11529
|
searchableFields.push(field.name);
|
|
11527
11530
|
}
|
|
11528
11531
|
});
|
|
@@ -11650,19 +11653,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11650
11653
|
})
|
|
11651
11654
|
}
|
|
11652
11655
|
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
allowSearchFields.forEach(function(key, index){
|
|
11656
|
-
const keyValue = selfData.__keywords;
|
|
11657
|
-
if(keyValue){
|
|
11658
|
-
keywordsFilters.push([key, "contains", keyValue]);
|
|
11659
|
-
if(index < allowSearchFields.length - 1){
|
|
11660
|
-
keywordsFilters.push('or');
|
|
11661
|
-
}
|
|
11662
|
-
}
|
|
11663
|
-
})
|
|
11656
|
+
var keywordsFilters = SteedosUI.getKeywordsSearchFilter(selfData.__keywords, allowSearchFields);
|
|
11657
|
+
if(keywordsFilters && keywordsFilters.length > 0){
|
|
11664
11658
|
userFilters.push(keywordsFilters);
|
|
11665
|
-
}
|
|
11659
|
+
}
|
|
11666
11660
|
|
|
11667
11661
|
let filters = [];
|
|
11668
11662
|
|
|
@@ -12524,6 +12518,39 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12524
12518
|
});
|
|
12525
12519
|
`;
|
|
12526
12520
|
|
|
12521
|
+
const onEventClickScript = `
|
|
12522
|
+
const data = event.data;
|
|
12523
|
+
const eventData = data.event;
|
|
12524
|
+
const appId = data.appId;
|
|
12525
|
+
const objectName = data.objectName;
|
|
12526
|
+
const eventId = data.event && data.event.id;
|
|
12527
|
+
doAction({
|
|
12528
|
+
"actionType": "link",
|
|
12529
|
+
"args": {
|
|
12530
|
+
"link": "/app/" + appId + "/" + objectName + "/view/" + eventId
|
|
12531
|
+
}
|
|
12532
|
+
});
|
|
12533
|
+
// doAction({
|
|
12534
|
+
// "actionType": "dialog",
|
|
12535
|
+
// "dialog": {
|
|
12536
|
+
// "type": "dialog",
|
|
12537
|
+
// "title": "",
|
|
12538
|
+
// "body": [
|
|
12539
|
+
// {
|
|
12540
|
+
// "type": "steedos-record-detail",
|
|
12541
|
+
// "objectApiName": "\${objectName}",
|
|
12542
|
+
// "recordId": data.event && data.event.id
|
|
12543
|
+
// }
|
|
12544
|
+
// ],
|
|
12545
|
+
// "closeOnEsc": false,
|
|
12546
|
+
// "closeOnOutside": false,
|
|
12547
|
+
// "showCloseButton": true,
|
|
12548
|
+
// "size": "lg",
|
|
12549
|
+
// "actions": []
|
|
12550
|
+
// }
|
|
12551
|
+
// });
|
|
12552
|
+
`;
|
|
12553
|
+
|
|
12527
12554
|
const recordId = "${event.id}";
|
|
12528
12555
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
12529
12556
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
@@ -12569,11 +12596,16 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12569
12596
|
"weight": 0,
|
|
12570
12597
|
"actions": [
|
|
12571
12598
|
{
|
|
12572
|
-
"actionType": "
|
|
12573
|
-
"
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12599
|
+
"actionType": "custom",
|
|
12600
|
+
"script": onEventClickScript
|
|
12601
|
+
},
|
|
12602
|
+
// amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
|
|
12603
|
+
// {
|
|
12604
|
+
// "actionType": "link",
|
|
12605
|
+
// "args": {
|
|
12606
|
+
// "link": "/app/${appId}/${objectName}/view/${event.id}"
|
|
12607
|
+
// }
|
|
12608
|
+
// }
|
|
12577
12609
|
]
|
|
12578
12610
|
},
|
|
12579
12611
|
"eventAdd": {
|
|
@@ -13740,8 +13772,8 @@ async function getRelatedListSchema(
|
|
|
13740
13772
|
/*
|
|
13741
13773
|
* @Author: baozhoutao@steedos.com
|
|
13742
13774
|
* @Date: 2022-07-05 15:55:39
|
|
13743
|
-
* @LastEditors:
|
|
13744
|
-
* @LastEditTime: 2023-08-
|
|
13775
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
13776
|
+
* @LastEditTime: 2023-08-17 18:03:51
|
|
13745
13777
|
* @Description:
|
|
13746
13778
|
*/
|
|
13747
13779
|
|
|
@@ -14112,7 +14144,7 @@ async function getTableSchema(
|
|
|
14112
14144
|
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && ___default.isString(filedInfo.reference_to) ){
|
|
14113
14145
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14114
14146
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14115
|
-
fields.push(Object.assign({}, rfFieldInfo, {name:
|
|
14147
|
+
fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
|
|
14116
14148
|
}
|
|
14117
14149
|
}else {
|
|
14118
14150
|
if(uiSchema.fields[column]){
|
|
@@ -14128,7 +14160,7 @@ async function getTableSchema(
|
|
|
14128
14160
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
14129
14161
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
14130
14162
|
fields.push(Object.assign({}, rfFieldInfo,
|
|
14131
|
-
{name:
|
|
14163
|
+
{name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}},
|
|
14132
14164
|
{
|
|
14133
14165
|
width: column.width,
|
|
14134
14166
|
wrap: column.wrap, // wrap = true 是没效果的
|
|
@@ -18686,7 +18718,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18686
18718
|
schemaApi: {
|
|
18687
18719
|
"method": "get",
|
|
18688
18720
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18689
|
-
"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 "),
|
|
18721
|
+
"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 "),
|
|
18690
18722
|
"headers": {
|
|
18691
18723
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18692
18724
|
}
|
|
@@ -19842,7 +19874,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19842
19874
|
});
|
|
19843
19875
|
}); };
|
|
19844
19876
|
|
|
19845
|
-
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]=React.useState(!0);var n=()=>{r(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].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__default["default"].createElement(newFunctionComponent(n),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,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):___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: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 React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].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 ___default.isNil(r)||(e=___default.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})`)),___default.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),___default.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||___default.isString(r)?"number"!==t||___default.isNumber(r)?"boolean"!==t||___default.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:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.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);
|
|
19877
|
+
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]=React.useState(!0);var n=()=>{r(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].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__default["default"].createElement(newFunctionComponent(n),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,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):___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: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 React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].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 ___default.isNil(r)||(e=___default.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})`)),___default.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),___default.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||___default.isString(r)?"number"!==t||___default.isNumber(r)?"boolean"!==t||___default.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:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.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=___default.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);
|
|
19846
19878
|
|
|
19847
19879
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19848
19880
|
__proto__: null,
|