@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
package/dist/amis-object.esm.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.esm.js
CHANGED
|
@@ -4092,6 +4092,7 @@ var frontend_form_cancel$1 = "Cancel";
|
|
|
4092
4092
|
var frontend_form_new$1 = "New";
|
|
4093
4093
|
var frontend_form_edit$1 = "Edit";
|
|
4094
4094
|
var frontend_form_select$1 = "Select";
|
|
4095
|
+
var frontend_form_please_select$1 = "Please select";
|
|
4095
4096
|
var frontend_form_confirm$1 = "Confirm";
|
|
4096
4097
|
var frontend_form_delete$1 = "Delete";
|
|
4097
4098
|
var frontend_form_view$1 = "view";
|
|
@@ -4173,6 +4174,7 @@ var en_us = {
|
|
|
4173
4174
|
frontend_form_new: frontend_form_new$1,
|
|
4174
4175
|
frontend_form_edit: frontend_form_edit$1,
|
|
4175
4176
|
frontend_form_select: frontend_form_select$1,
|
|
4177
|
+
frontend_form_please_select: frontend_form_please_select$1,
|
|
4176
4178
|
frontend_form_confirm: frontend_form_confirm$1,
|
|
4177
4179
|
frontend_form_delete: frontend_form_delete$1,
|
|
4178
4180
|
frontend_form_view: frontend_form_view$1,
|
|
@@ -4255,6 +4257,7 @@ var frontend_form_cancel = "取消";
|
|
|
4255
4257
|
var frontend_form_new = "新建";
|
|
4256
4258
|
var frontend_form_edit = "编辑";
|
|
4257
4259
|
var frontend_form_select = "选择";
|
|
4260
|
+
var frontend_form_please_select = "请选择";
|
|
4258
4261
|
var frontend_form_confirm = "确认";
|
|
4259
4262
|
var frontend_form_delete = "删除";
|
|
4260
4263
|
var frontend_form_view = "查看";
|
|
@@ -4337,6 +4340,7 @@ var zh_cn = {
|
|
|
4337
4340
|
frontend_form_new: frontend_form_new,
|
|
4338
4341
|
frontend_form_edit: frontend_form_edit,
|
|
4339
4342
|
frontend_form_select: frontend_form_select,
|
|
4343
|
+
frontend_form_please_select: frontend_form_please_select,
|
|
4340
4344
|
frontend_form_confirm: frontend_form_confirm,
|
|
4341
4345
|
frontend_form_delete: frontend_form_delete,
|
|
4342
4346
|
frontend_form_view: frontend_form_view,
|
|
@@ -5703,7 +5707,8 @@ const StandardButtons = {
|
|
|
5703
5707
|
} = this;
|
|
5704
5708
|
const scopeId = this.scopeId || `amis-${appId}-${objectName}-listview`;
|
|
5705
5709
|
const scope = this.scope || SteedosUI?.getRef(scopeId);
|
|
5706
|
-
|
|
5710
|
+
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
5711
|
+
const listViewRef = scope.parent?.getComponentById(`listview_${uiSchema.name}`);
|
|
5707
5712
|
if(_.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5708
5713
|
listViewRef.handleAction({}, {
|
|
5709
5714
|
"actionType": "toast",
|
|
@@ -9179,6 +9184,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9179
9184
|
|
|
9180
9185
|
const data = {
|
|
9181
9186
|
type: getAmisStaticFieldType('picker', readonly),
|
|
9187
|
+
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
9182
9188
|
labelField: referenceTo.labelField.name,
|
|
9183
9189
|
valueField: referenceTo.valueField.name,
|
|
9184
9190
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
@@ -9652,8 +9658,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
9652
9658
|
/*
|
|
9653
9659
|
* @Author: baozhoutao@steedos.com
|
|
9654
9660
|
* @Date: 2022-10-28 14:52:55
|
|
9655
|
-
* @LastEditors:
|
|
9656
|
-
* @LastEditTime: 2023-
|
|
9661
|
+
* @LastEditors: liaodaxue
|
|
9662
|
+
* @LastEditTime: 2023-07-14 17:18:42
|
|
9657
9663
|
* @Description:
|
|
9658
9664
|
*/
|
|
9659
9665
|
|
|
@@ -9685,6 +9691,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
9685
9691
|
return `static-images`;
|
|
9686
9692
|
}
|
|
9687
9693
|
return `static-${type}`;
|
|
9694
|
+
}else if(type === 'url'){
|
|
9695
|
+
return "input-url"
|
|
9688
9696
|
}else {
|
|
9689
9697
|
return 'static';
|
|
9690
9698
|
}
|
|
@@ -10212,7 +10220,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10212
10220
|
break;
|
|
10213
10221
|
case 'url':
|
|
10214
10222
|
convertData = {
|
|
10215
|
-
type: getAmisStaticFieldType('url', readonly, field)
|
|
10223
|
+
type: getAmisStaticFieldType('url', readonly, field),
|
|
10224
|
+
static: readonly ? true : false
|
|
10216
10225
|
};
|
|
10217
10226
|
if(readonly && field.show_as_qr){
|
|
10218
10227
|
convertData = {
|
|
@@ -10546,17 +10555,19 @@ async function getQuickEditSchema(field, options){
|
|
|
10546
10555
|
return EventType;
|
|
10547
10556
|
};
|
|
10548
10557
|
switch (field.type) {
|
|
10549
|
-
//TODO:amis的picker组件直接点击选项x时不会触发change事件,待处理
|
|
10558
|
+
//TODO: amis的picker组件直接点击选项x时不会触发change事件,待处理
|
|
10550
10559
|
case "lookup":
|
|
10551
10560
|
case "master_detail":
|
|
10561
|
+
let labelField = quickEditSchema.body[0].labelField || "label";
|
|
10562
|
+
let valueField = quickEditSchema.body[0].valueField || "value";
|
|
10552
10563
|
if (field.multiple) {
|
|
10553
10564
|
TempDisplayField = `
|
|
10554
10565
|
_display["${field.name}"] = [];
|
|
10555
|
-
event.data.
|
|
10566
|
+
event.data.selectedItems.forEach(function(item,index){
|
|
10556
10567
|
_display["${field.name}"].push(
|
|
10557
10568
|
{
|
|
10558
|
-
"label":
|
|
10559
|
-
"value":
|
|
10569
|
+
"label": item.${labelField},
|
|
10570
|
+
"value": item.${valueField},
|
|
10560
10571
|
"objectName": "${field.reference_to}"
|
|
10561
10572
|
}
|
|
10562
10573
|
)
|
|
@@ -10565,8 +10576,8 @@ async function getQuickEditSchema(field, options){
|
|
|
10565
10576
|
} else {
|
|
10566
10577
|
TempDisplayField = `
|
|
10567
10578
|
_display["${field.name}"] = {
|
|
10568
|
-
"label": event.data.
|
|
10569
|
-
"value": event.data.
|
|
10579
|
+
"label": event.data.selectedItems.${labelField},
|
|
10580
|
+
"value": event.data.selectedItems.${valueField},
|
|
10570
10581
|
"objectName": "${field.reference_to}"
|
|
10571
10582
|
}
|
|
10572
10583
|
`;
|
|
@@ -10775,8 +10786,12 @@ async function getTableColumns$1(fields, options){
|
|
|
10775
10786
|
type = 'tpl';
|
|
10776
10787
|
}else if(field.type === 'html'){
|
|
10777
10788
|
type = 'markdown';
|
|
10778
|
-
}else if(field.type === 'url'
|
|
10779
|
-
|
|
10789
|
+
}else if(field.type === 'url'){
|
|
10790
|
+
if(field.show_as_qr){
|
|
10791
|
+
type = 'qr-code';
|
|
10792
|
+
}else {
|
|
10793
|
+
type = 'input-url';
|
|
10794
|
+
}
|
|
10780
10795
|
}
|
|
10781
10796
|
let className = "";
|
|
10782
10797
|
if(field.type === 'textarea'){
|
|
@@ -11460,7 +11475,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11460
11475
|
|
|
11461
11476
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
11462
11477
|
if(setDataToComponentId){
|
|
11463
|
-
|
|
11478
|
+
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
11479
|
+
SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
11464
11480
|
};
|
|
11465
11481
|
${options.adaptor || ''}
|
|
11466
11482
|
return payload;
|
|
@@ -12152,17 +12168,18 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12152
12168
|
"objectApiName": "\${objectName}",
|
|
12153
12169
|
"mode": "edit",
|
|
12154
12170
|
"defaultData": doc,
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
}
|
|
12171
|
+
//改回为通用的提交事件
|
|
12172
|
+
// "onEvent": {
|
|
12173
|
+
// "submitSucc": {
|
|
12174
|
+
// "weight": 0,
|
|
12175
|
+
// "actions": [
|
|
12176
|
+
// {
|
|
12177
|
+
// "actionType": "custom",
|
|
12178
|
+
// "script": "event.data.view?.calendar.refetchEvents();"
|
|
12179
|
+
// }
|
|
12180
|
+
// ]
|
|
12181
|
+
// }
|
|
12182
|
+
// }
|
|
12166
12183
|
}
|
|
12167
12184
|
],
|
|
12168
12185
|
"closeOnEsc": false,
|
|
@@ -12291,6 +12308,20 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12291
12308
|
"script": "console.log('eventsSet'); console.log(event);"
|
|
12292
12309
|
}
|
|
12293
12310
|
]
|
|
12311
|
+
},
|
|
12312
|
+
"getRef": {
|
|
12313
|
+
"weight": 0,
|
|
12314
|
+
"actions": [
|
|
12315
|
+
{
|
|
12316
|
+
"componentId": `service_${options.id}`,
|
|
12317
|
+
"args": {
|
|
12318
|
+
"value":{
|
|
12319
|
+
"calendarRef": "${event.data.calendarRef}"
|
|
12320
|
+
}
|
|
12321
|
+
},
|
|
12322
|
+
"actionType": "setValue",
|
|
12323
|
+
}
|
|
12324
|
+
]
|
|
12294
12325
|
}
|
|
12295
12326
|
};
|
|
12296
12327
|
|
|
@@ -12326,6 +12357,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12326
12357
|
const amisSchema = {
|
|
12327
12358
|
"type": "steedos-fullcalendar",
|
|
12328
12359
|
"label": "",
|
|
12360
|
+
"id": options.id,
|
|
12329
12361
|
"name": "fullcalendar",
|
|
12330
12362
|
"placeholder":"${additionalFilters}",//用于触发reload
|
|
12331
12363
|
"editable": permissions.allowEdit,
|
|
@@ -12348,7 +12380,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12348
12380
|
* @Author: baozhoutao@steedos.com
|
|
12349
12381
|
* @Date: 2022-05-26 16:02:08
|
|
12350
12382
|
* @LastEditors: liaodaxue
|
|
12351
|
-
* @LastEditTime: 2023-
|
|
12383
|
+
* @LastEditTime: 2023-07-12 15:45:55
|
|
12352
12384
|
* @Description:
|
|
12353
12385
|
*/
|
|
12354
12386
|
|
|
@@ -12407,7 +12439,11 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12407
12439
|
|
|
12408
12440
|
// fieldSet 已支持显隐控制
|
|
12409
12441
|
const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12410
|
-
|
|
12442
|
+
let visible = visibleOn;
|
|
12443
|
+
if(visible.indexOf('${')>-1){
|
|
12444
|
+
visible = visible.substring(visible.indexOf('{')+1, visible.indexOf('}'));
|
|
12445
|
+
}
|
|
12446
|
+
return visible ? "("+visible+")" : visible;
|
|
12411
12447
|
});
|
|
12412
12448
|
|
|
12413
12449
|
let section = {
|
|
@@ -17602,32 +17638,45 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
17602
17638
|
}); };
|
|
17603
17639
|
|
|
17604
17640
|
var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
17605
|
-
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
17606
|
-
|
|
17607
|
-
|
|
17641
|
+
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, id, schema, uiSchema, amisSchema, serviceData;
|
|
17642
|
+
var _b;
|
|
17643
|
+
return __generator(this, function (_c) {
|
|
17644
|
+
switch (_c.label) {
|
|
17608
17645
|
case 0:
|
|
17609
17646
|
console.log("AmisObjectCalendar props", props);
|
|
17610
17647
|
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;
|
|
17611
17648
|
objectApiName = props.objectApiName || "events";
|
|
17612
17649
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
17650
|
+
id = props.id || "steedos_object_calendar_".concat(objectApiName);
|
|
17613
17651
|
return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
|
|
17614
17652
|
title: title,
|
|
17615
17653
|
currentView: currentView,
|
|
17616
17654
|
startDateExpr: startDateExpr,
|
|
17617
17655
|
endDateExpr: endDateExpr,
|
|
17618
17656
|
allDayExpr: allDayExpr,
|
|
17619
|
-
textExpr: textExpr
|
|
17620
|
-
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
|
|
17657
|
+
textExpr: textExpr,
|
|
17658
|
+
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config, id: id })];
|
|
17621
17659
|
case 1:
|
|
17622
|
-
schema = (
|
|
17660
|
+
schema = (_c.sent());
|
|
17623
17661
|
uiSchema = schema.uiSchema;
|
|
17624
17662
|
amisSchema = schema.amisSchema;
|
|
17625
17663
|
serviceData = Object.assign({}, { objectName: objectApiName, uiSchema: uiSchema });
|
|
17626
17664
|
return [2 /*return*/, {
|
|
17627
17665
|
"type": "service",
|
|
17628
17666
|
"body": amisSchema,
|
|
17667
|
+
"id": "service_".concat(id),
|
|
17629
17668
|
"className": "".concat(className),
|
|
17630
|
-
"data": serviceData
|
|
17669
|
+
"data": serviceData,
|
|
17670
|
+
"onEvent": (_b = {},
|
|
17671
|
+
_b["@data.changed.".concat(objectApiName)] = {
|
|
17672
|
+
"actions": [
|
|
17673
|
+
{
|
|
17674
|
+
"actionType": "custom",
|
|
17675
|
+
"script": "context.props.data.calendarRef.current.getApi().refetchEvents()"
|
|
17676
|
+
}
|
|
17677
|
+
]
|
|
17678
|
+
},
|
|
17679
|
+
_b)
|
|
17631
17680
|
}];
|
|
17632
17681
|
}
|
|
17633
17682
|
});
|
|
@@ -18091,8 +18140,6 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18091
18140
|
"items": {
|
|
18092
18141
|
"type": "button",
|
|
18093
18142
|
"level": "link",
|
|
18094
|
-
"actionType": "link",
|
|
18095
|
-
"link": "${path}",
|
|
18096
18143
|
"body": [{
|
|
18097
18144
|
"type": "tpl",
|
|
18098
18145
|
"wrapperComponent": "span",
|
|
@@ -18102,6 +18149,21 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18102
18149
|
"onEvent": {
|
|
18103
18150
|
"click": {
|
|
18104
18151
|
"actions": [
|
|
18152
|
+
{
|
|
18153
|
+
"actionType": "link",
|
|
18154
|
+
"args": {
|
|
18155
|
+
"link": "${path}"
|
|
18156
|
+
}
|
|
18157
|
+
},
|
|
18158
|
+
{
|
|
18159
|
+
"actionType": "broadcast",
|
|
18160
|
+
"args": {
|
|
18161
|
+
"eventName": "@tabId.changed"
|
|
18162
|
+
},
|
|
18163
|
+
"data": {
|
|
18164
|
+
"tabId": "${event.data.id}"
|
|
18165
|
+
}
|
|
18166
|
+
},
|
|
18105
18167
|
{
|
|
18106
18168
|
"actionType": "closeDialog"
|
|
18107
18169
|
}
|
|
@@ -18254,7 +18316,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18254
18316
|
schemaApi: {
|
|
18255
18317
|
"method": "get",
|
|
18256
18318
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18257
|
-
"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
|
|
18319
|
+
"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 "),
|
|
18258
18320
|
"headers": {
|
|
18259
18321
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18260
18322
|
}
|
|
@@ -18306,7 +18368,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18306
18368
|
schemaApi: {
|
|
18307
18369
|
"method": "get",
|
|
18308
18370
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
|
|
18309
|
-
"adaptor": "\n try {\n
|
|
18371
|
+
"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 "),
|
|
18310
18372
|
"headers": {
|
|
18311
18373
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18312
18374
|
}
|
|
@@ -19301,7 +19363,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19301
19363
|
});
|
|
19302
19364
|
}); };
|
|
19303
19365
|
|
|
19304
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var 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:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19366
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var s=t,a=0;a<s.length;a++)if(s[a].noParent=0,s[a].unfolded=!1,s[a].parent){let e=1;for(var l=0;l<s.length;l++)s[a].parent==s[l][o]&&(e=0);1==e&&(s[a].noParent=1);}else s[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:i(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:i(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],r,n));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19305
19367
|
|
|
19306
19368
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19307
19369
|
__proto__: null,
|