@steedos-widgets/amis-object 1.2.31 → 1.2.32
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/AmisObjectCalendar.d.ts +9 -0
- package/dist/amis-object.cjs.css +3 -0
- package/dist/amis-object.cjs.js +100 -38
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +100 -38
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +100 -38
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export declare const AmisObjectCalendar: (props: any) => Promise<{
|
|
2
2
|
type: string;
|
|
3
3
|
body: any;
|
|
4
|
+
id: string;
|
|
4
5
|
className: string;
|
|
5
6
|
data: {
|
|
6
7
|
objectName: any;
|
|
7
8
|
uiSchema: any;
|
|
8
9
|
};
|
|
10
|
+
onEvent: {
|
|
11
|
+
[x: string]: {
|
|
12
|
+
actions: {
|
|
13
|
+
actionType: string;
|
|
14
|
+
script: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
9
18
|
}>;
|
package/dist/amis-object.cjs.css
CHANGED
|
@@ -1551,6 +1551,9 @@ body.sidebar #sidebar {
|
|
|
1551
1551
|
.steedos-select-flow-service .antd-TreeControl > .antd-Tree {
|
|
1552
1552
|
max-height: unset;
|
|
1553
1553
|
}
|
|
1554
|
+
.steedos-select-flow-service .antd-TreeControl {
|
|
1555
|
+
max-height: calc(100vh - 248px) !important;
|
|
1556
|
+
}
|
|
1554
1557
|
|
|
1555
1558
|
.steedos-amis-instance-view {
|
|
1556
1559
|
font-size: 0.8125rem;
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -4120,6 +4120,7 @@ var frontend_form_cancel$1 = "Cancel";
|
|
|
4120
4120
|
var frontend_form_new$1 = "New";
|
|
4121
4121
|
var frontend_form_edit$1 = "Edit";
|
|
4122
4122
|
var frontend_form_select$1 = "Select";
|
|
4123
|
+
var frontend_form_please_select$1 = "Please select";
|
|
4123
4124
|
var frontend_form_confirm$1 = "Confirm";
|
|
4124
4125
|
var frontend_form_delete$1 = "Delete";
|
|
4125
4126
|
var frontend_form_view$1 = "view";
|
|
@@ -4201,6 +4202,7 @@ var en_us = {
|
|
|
4201
4202
|
frontend_form_new: frontend_form_new$1,
|
|
4202
4203
|
frontend_form_edit: frontend_form_edit$1,
|
|
4203
4204
|
frontend_form_select: frontend_form_select$1,
|
|
4205
|
+
frontend_form_please_select: frontend_form_please_select$1,
|
|
4204
4206
|
frontend_form_confirm: frontend_form_confirm$1,
|
|
4205
4207
|
frontend_form_delete: frontend_form_delete$1,
|
|
4206
4208
|
frontend_form_view: frontend_form_view$1,
|
|
@@ -4283,6 +4285,7 @@ var frontend_form_cancel = "取消";
|
|
|
4283
4285
|
var frontend_form_new = "新建";
|
|
4284
4286
|
var frontend_form_edit = "编辑";
|
|
4285
4287
|
var frontend_form_select = "选择";
|
|
4288
|
+
var frontend_form_please_select = "请选择";
|
|
4286
4289
|
var frontend_form_confirm = "确认";
|
|
4287
4290
|
var frontend_form_delete = "删除";
|
|
4288
4291
|
var frontend_form_view = "查看";
|
|
@@ -4365,6 +4368,7 @@ var zh_cn = {
|
|
|
4365
4368
|
frontend_form_new: frontend_form_new,
|
|
4366
4369
|
frontend_form_edit: frontend_form_edit,
|
|
4367
4370
|
frontend_form_select: frontend_form_select,
|
|
4371
|
+
frontend_form_please_select: frontend_form_please_select,
|
|
4368
4372
|
frontend_form_confirm: frontend_form_confirm,
|
|
4369
4373
|
frontend_form_delete: frontend_form_delete,
|
|
4370
4374
|
frontend_form_view: frontend_form_view,
|
|
@@ -5731,7 +5735,8 @@ const StandardButtons = {
|
|
|
5731
5735
|
} = this;
|
|
5732
5736
|
const scopeId = this.scopeId || `amis-${appId}-${objectName}-listview`;
|
|
5733
5737
|
const scope = this.scope || SteedosUI?.getRef(scopeId);
|
|
5734
|
-
|
|
5738
|
+
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
5739
|
+
const listViewRef = scope.parent?.getComponentById(`listview_${uiSchema.name}`);
|
|
5735
5740
|
if(_.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5736
5741
|
listViewRef.handleAction({}, {
|
|
5737
5742
|
"actionType": "toast",
|
|
@@ -9207,6 +9212,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9207
9212
|
|
|
9208
9213
|
const data = {
|
|
9209
9214
|
type: getAmisStaticFieldType('picker', readonly),
|
|
9215
|
+
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
9210
9216
|
labelField: referenceTo.labelField.name,
|
|
9211
9217
|
valueField: referenceTo.valueField.name,
|
|
9212
9218
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
@@ -9680,8 +9686,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
9680
9686
|
/*
|
|
9681
9687
|
* @Author: baozhoutao@steedos.com
|
|
9682
9688
|
* @Date: 2022-10-28 14:52:55
|
|
9683
|
-
* @LastEditors:
|
|
9684
|
-
* @LastEditTime: 2023-
|
|
9689
|
+
* @LastEditors: liaodaxue
|
|
9690
|
+
* @LastEditTime: 2023-07-14 17:18:42
|
|
9685
9691
|
* @Description:
|
|
9686
9692
|
*/
|
|
9687
9693
|
|
|
@@ -9713,6 +9719,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
9713
9719
|
return `static-images`;
|
|
9714
9720
|
}
|
|
9715
9721
|
return `static-${type}`;
|
|
9722
|
+
}else if(type === 'url'){
|
|
9723
|
+
return "input-url"
|
|
9716
9724
|
}else {
|
|
9717
9725
|
return 'static';
|
|
9718
9726
|
}
|
|
@@ -10240,7 +10248,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10240
10248
|
break;
|
|
10241
10249
|
case 'url':
|
|
10242
10250
|
convertData = {
|
|
10243
|
-
type: getAmisStaticFieldType('url', readonly, field)
|
|
10251
|
+
type: getAmisStaticFieldType('url', readonly, field),
|
|
10252
|
+
static: readonly ? true : false
|
|
10244
10253
|
};
|
|
10245
10254
|
if(readonly && field.show_as_qr){
|
|
10246
10255
|
convertData = {
|
|
@@ -10574,17 +10583,19 @@ async function getQuickEditSchema(field, options){
|
|
|
10574
10583
|
return EventType;
|
|
10575
10584
|
};
|
|
10576
10585
|
switch (field.type) {
|
|
10577
|
-
//TODO:amis的picker组件直接点击选项x时不会触发change事件,待处理
|
|
10586
|
+
//TODO: amis的picker组件直接点击选项x时不会触发change事件,待处理
|
|
10578
10587
|
case "lookup":
|
|
10579
10588
|
case "master_detail":
|
|
10589
|
+
let labelField = quickEditSchema.body[0].labelField || "label";
|
|
10590
|
+
let valueField = quickEditSchema.body[0].valueField || "value";
|
|
10580
10591
|
if (field.multiple) {
|
|
10581
10592
|
TempDisplayField = `
|
|
10582
10593
|
_display["${field.name}"] = [];
|
|
10583
|
-
event.data.
|
|
10594
|
+
event.data.selectedItems.forEach(function(item,index){
|
|
10584
10595
|
_display["${field.name}"].push(
|
|
10585
10596
|
{
|
|
10586
|
-
"label":
|
|
10587
|
-
"value":
|
|
10597
|
+
"label": item.${labelField},
|
|
10598
|
+
"value": item.${valueField},
|
|
10588
10599
|
"objectName": "${field.reference_to}"
|
|
10589
10600
|
}
|
|
10590
10601
|
)
|
|
@@ -10593,8 +10604,8 @@ async function getQuickEditSchema(field, options){
|
|
|
10593
10604
|
} else {
|
|
10594
10605
|
TempDisplayField = `
|
|
10595
10606
|
_display["${field.name}"] = {
|
|
10596
|
-
"label": event.data.
|
|
10597
|
-
"value": event.data.
|
|
10607
|
+
"label": event.data.selectedItems.${labelField},
|
|
10608
|
+
"value": event.data.selectedItems.${valueField},
|
|
10598
10609
|
"objectName": "${field.reference_to}"
|
|
10599
10610
|
}
|
|
10600
10611
|
`;
|
|
@@ -10803,8 +10814,12 @@ async function getTableColumns$1(fields, options){
|
|
|
10803
10814
|
type = 'tpl';
|
|
10804
10815
|
}else if(field.type === 'html'){
|
|
10805
10816
|
type = 'markdown';
|
|
10806
|
-
}else if(field.type === 'url'
|
|
10807
|
-
|
|
10817
|
+
}else if(field.type === 'url'){
|
|
10818
|
+
if(field.show_as_qr){
|
|
10819
|
+
type = 'qr-code';
|
|
10820
|
+
}else {
|
|
10821
|
+
type = 'input-url';
|
|
10822
|
+
}
|
|
10808
10823
|
}
|
|
10809
10824
|
let className = "";
|
|
10810
10825
|
if(field.type === 'textarea'){
|
|
@@ -11488,7 +11503,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11488
11503
|
|
|
11489
11504
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
11490
11505
|
if(setDataToComponentId){
|
|
11491
|
-
|
|
11506
|
+
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
11507
|
+
SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
11492
11508
|
};
|
|
11493
11509
|
${options.adaptor || ''}
|
|
11494
11510
|
return payload;
|
|
@@ -12180,17 +12196,18 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12180
12196
|
"objectApiName": "\${objectName}",
|
|
12181
12197
|
"mode": "edit",
|
|
12182
12198
|
"defaultData": doc,
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
}
|
|
12199
|
+
//改回为通用的提交事件
|
|
12200
|
+
// "onEvent": {
|
|
12201
|
+
// "submitSucc": {
|
|
12202
|
+
// "weight": 0,
|
|
12203
|
+
// "actions": [
|
|
12204
|
+
// {
|
|
12205
|
+
// "actionType": "custom",
|
|
12206
|
+
// "script": "event.data.view?.calendar.refetchEvents();"
|
|
12207
|
+
// }
|
|
12208
|
+
// ]
|
|
12209
|
+
// }
|
|
12210
|
+
// }
|
|
12194
12211
|
}
|
|
12195
12212
|
],
|
|
12196
12213
|
"closeOnEsc": false,
|
|
@@ -12319,6 +12336,20 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12319
12336
|
"script": "console.log('eventsSet'); console.log(event);"
|
|
12320
12337
|
}
|
|
12321
12338
|
]
|
|
12339
|
+
},
|
|
12340
|
+
"getRef": {
|
|
12341
|
+
"weight": 0,
|
|
12342
|
+
"actions": [
|
|
12343
|
+
{
|
|
12344
|
+
"componentId": `service_${options.id}`,
|
|
12345
|
+
"args": {
|
|
12346
|
+
"value":{
|
|
12347
|
+
"calendarRef": "${event.data.calendarRef}"
|
|
12348
|
+
}
|
|
12349
|
+
},
|
|
12350
|
+
"actionType": "setValue",
|
|
12351
|
+
}
|
|
12352
|
+
]
|
|
12322
12353
|
}
|
|
12323
12354
|
};
|
|
12324
12355
|
|
|
@@ -12354,6 +12385,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12354
12385
|
const amisSchema = {
|
|
12355
12386
|
"type": "steedos-fullcalendar",
|
|
12356
12387
|
"label": "",
|
|
12388
|
+
"id": options.id,
|
|
12357
12389
|
"name": "fullcalendar",
|
|
12358
12390
|
"placeholder":"${additionalFilters}",//用于触发reload
|
|
12359
12391
|
"editable": permissions.allowEdit,
|
|
@@ -12376,7 +12408,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12376
12408
|
* @Author: baozhoutao@steedos.com
|
|
12377
12409
|
* @Date: 2022-05-26 16:02:08
|
|
12378
12410
|
* @LastEditors: liaodaxue
|
|
12379
|
-
* @LastEditTime: 2023-
|
|
12411
|
+
* @LastEditTime: 2023-07-12 15:45:55
|
|
12380
12412
|
* @Description:
|
|
12381
12413
|
*/
|
|
12382
12414
|
|
|
@@ -12435,7 +12467,11 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12435
12467
|
|
|
12436
12468
|
// fieldSet 已支持显隐控制
|
|
12437
12469
|
const sectionFieldsVisibleOn = ___default__namespace.map(___default__namespace.compact(___default__namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12438
|
-
|
|
12470
|
+
let visible = visibleOn;
|
|
12471
|
+
if(visible.indexOf('${')>-1){
|
|
12472
|
+
visible = visible.substring(visible.indexOf('{')+1, visible.indexOf('}'));
|
|
12473
|
+
}
|
|
12474
|
+
return visible ? "("+visible+")" : visible;
|
|
12439
12475
|
});
|
|
12440
12476
|
|
|
12441
12477
|
let section = {
|
|
@@ -17630,32 +17666,45 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
17630
17666
|
}); };
|
|
17631
17667
|
|
|
17632
17668
|
var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
17633
|
-
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
17634
|
-
|
|
17635
|
-
|
|
17669
|
+
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, id, schema, uiSchema, amisSchema, serviceData;
|
|
17670
|
+
var _b;
|
|
17671
|
+
return __generator(this, function (_c) {
|
|
17672
|
+
switch (_c.label) {
|
|
17636
17673
|
case 0:
|
|
17637
17674
|
console.log("AmisObjectCalendar props", props);
|
|
17638
17675
|
props.$schema, top = props.top, sort = props.sort, filters = props.filters, filtersFunction = props.filtersFunction, title = props.title, currentView = props.currentView, startDateExpr = props.startDateExpr, endDateExpr = props.endDateExpr, allDayExpr = props.allDayExpr, textExpr = props.textExpr, data = props.data, defaultData = props.defaultData, _a = props.className, className = _a === void 0 ? "" : _a, onEvent = props.onEvent, config = props.config;
|
|
17639
17676
|
objectApiName = props.objectApiName || "events";
|
|
17640
17677
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
17678
|
+
id = props.id || "steedos_object_calendar_".concat(objectApiName);
|
|
17641
17679
|
return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
|
|
17642
17680
|
title: title,
|
|
17643
17681
|
currentView: currentView,
|
|
17644
17682
|
startDateExpr: startDateExpr,
|
|
17645
17683
|
endDateExpr: endDateExpr,
|
|
17646
17684
|
allDayExpr: allDayExpr,
|
|
17647
|
-
textExpr: textExpr
|
|
17648
|
-
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
|
|
17685
|
+
textExpr: textExpr,
|
|
17686
|
+
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config, id: id })];
|
|
17649
17687
|
case 1:
|
|
17650
|
-
schema = (
|
|
17688
|
+
schema = (_c.sent());
|
|
17651
17689
|
uiSchema = schema.uiSchema;
|
|
17652
17690
|
amisSchema = schema.amisSchema;
|
|
17653
17691
|
serviceData = Object.assign({}, { objectName: objectApiName, uiSchema: uiSchema });
|
|
17654
17692
|
return [2 /*return*/, {
|
|
17655
17693
|
"type": "service",
|
|
17656
17694
|
"body": amisSchema,
|
|
17695
|
+
"id": "service_".concat(id),
|
|
17657
17696
|
"className": "".concat(className),
|
|
17658
|
-
"data": serviceData
|
|
17697
|
+
"data": serviceData,
|
|
17698
|
+
"onEvent": (_b = {},
|
|
17699
|
+
_b["@data.changed.".concat(objectApiName)] = {
|
|
17700
|
+
"actions": [
|
|
17701
|
+
{
|
|
17702
|
+
"actionType": "custom",
|
|
17703
|
+
"script": "context.props.data.calendarRef.current.getApi().refetchEvents()"
|
|
17704
|
+
}
|
|
17705
|
+
]
|
|
17706
|
+
},
|
|
17707
|
+
_b)
|
|
17659
17708
|
}];
|
|
17660
17709
|
}
|
|
17661
17710
|
});
|
|
@@ -18119,8 +18168,6 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18119
18168
|
"items": {
|
|
18120
18169
|
"type": "button",
|
|
18121
18170
|
"level": "link",
|
|
18122
|
-
"actionType": "link",
|
|
18123
|
-
"link": "${path}",
|
|
18124
18171
|
"body": [{
|
|
18125
18172
|
"type": "tpl",
|
|
18126
18173
|
"wrapperComponent": "span",
|
|
@@ -18130,6 +18177,21 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18130
18177
|
"onEvent": {
|
|
18131
18178
|
"click": {
|
|
18132
18179
|
"actions": [
|
|
18180
|
+
{
|
|
18181
|
+
"actionType": "link",
|
|
18182
|
+
"args": {
|
|
18183
|
+
"link": "${path}"
|
|
18184
|
+
}
|
|
18185
|
+
},
|
|
18186
|
+
{
|
|
18187
|
+
"actionType": "broadcast",
|
|
18188
|
+
"args": {
|
|
18189
|
+
"eventName": "@tabId.changed"
|
|
18190
|
+
},
|
|
18191
|
+
"data": {
|
|
18192
|
+
"tabId": "${event.data.id}"
|
|
18193
|
+
}
|
|
18194
|
+
},
|
|
18133
18195
|
{
|
|
18134
18196
|
"actionType": "closeDialog"
|
|
18135
18197
|
}
|
|
@@ -18282,7 +18344,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18282
18344
|
schemaApi: {
|
|
18283
18345
|
"method": "get",
|
|
18284
18346
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18285
|
-
"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 if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n });\n })\n }\n payload.data = {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n
|
|
18347
|
+
"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 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"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 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"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 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"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, "\",\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 "),
|
|
18286
18348
|
"headers": {
|
|
18287
18349
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18288
18350
|
}
|
|
@@ -18334,7 +18396,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18334
18396
|
schemaApi: {
|
|
18335
18397
|
"method": "get",
|
|
18336
18398
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
|
|
18337
|
-
"adaptor": "\n try {\n
|
|
18399
|
+
"adaptor": "\n try {\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">${tab.name}</span></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ 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\": \"footerService\",\n \"body\": {\n \"type\": \"nav\",\n className: payload.children.length ==1 ? '").concat(className1, "' : '").concat(className, "',\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\" flex-shrink-0 h-10 w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">").concat(instance.t('frontend_menu'), "</span></span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\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\": \"footerService\",\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 };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
|
|
18338
18400
|
"headers": {
|
|
18339
18401
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18340
18402
|
}
|
|
@@ -19329,7 +19391,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19329
19391
|
});
|
|
19330
19392
|
}); };
|
|
19331
19393
|
|
|
19332
|
-
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=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},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 a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=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);
|
|
19394
|
+
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);
|
|
19333
19395
|
|
|
19334
19396
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19335
19397
|
__proto__: null,
|