@steedos-widgets/amis-object 1.2.17 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/amis-object.cjs.css +5 -2
- package/dist/amis-object.cjs.js +123 -107
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +5 -2
- package/dist/amis-object.esm.js +123 -107
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +5 -2
- package/dist/amis-object.umd.js +123 -107
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/dist/meta.js +15 -9
- package/dist/pages/PageObject.d.ts +2 -2
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
|
@@ -543,6 +543,9 @@ body {
|
|
|
543
543
|
.w-8 {
|
|
544
544
|
width: 2rem
|
|
545
545
|
}
|
|
546
|
+
.w-\[388px\] {
|
|
547
|
+
width: 388px
|
|
548
|
+
}
|
|
546
549
|
.\!min-w-\[160px\] {
|
|
547
550
|
min-width: 160px !important
|
|
548
551
|
}
|
|
@@ -555,8 +558,8 @@ body {
|
|
|
555
558
|
.min-w-\[200px\] {
|
|
556
559
|
min-width: 200px
|
|
557
560
|
}
|
|
558
|
-
.
|
|
559
|
-
|
|
561
|
+
.max-w-\[360px\] {
|
|
562
|
+
max-width: 360px
|
|
560
563
|
}
|
|
561
564
|
.max-w-md {
|
|
562
565
|
max-width: 28rem
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -4767,7 +4767,7 @@ var frontend_listview_control_rename_label = "重命名";
|
|
|
4767
4767
|
var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
4768
4768
|
var frontend_listview_control_share = "共享设置";
|
|
4769
4769
|
var frontend_listview_control_sort = "默认排序规则";
|
|
4770
|
-
var frontend_export_excel = "导出
|
|
4770
|
+
var frontend_export_excel = "导出";
|
|
4771
4771
|
var frontend_ercord_operation = "操作";
|
|
4772
4772
|
var frontend_import_data = "导入数据";
|
|
4773
4773
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -4918,7 +4918,7 @@ instance
|
|
|
4918
4918
|
* @Description:
|
|
4919
4919
|
*/
|
|
4920
4920
|
|
|
4921
|
-
const getSchema$
|
|
4921
|
+
const getSchema$5 = async (uiSchema, ctx) => {
|
|
4922
4922
|
const schemaApiAdaptor = `
|
|
4923
4923
|
let formSchema = {
|
|
4924
4924
|
"type": "steedos-object-form",
|
|
@@ -5092,7 +5092,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
5092
5092
|
* @Description:
|
|
5093
5093
|
*/
|
|
5094
5094
|
|
|
5095
|
-
const getSchema$
|
|
5095
|
+
const getSchema$4 = async (uiSchema, ctx) => {
|
|
5096
5096
|
const title = instance.t('frontend_form_edit') + " " + uiSchema.label;
|
|
5097
5097
|
|
|
5098
5098
|
const defaultFormSchema = {
|
|
@@ -5160,7 +5160,7 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
5160
5160
|
* @LastEditors: Please set LastEditors
|
|
5161
5161
|
* @LastEditTime: 2023-04-12 10:35:36
|
|
5162
5162
|
*/
|
|
5163
|
-
const getSchema$
|
|
5163
|
+
const getSchema$3 = (uiSchema)=>{
|
|
5164
5164
|
return {
|
|
5165
5165
|
"type": "service",
|
|
5166
5166
|
"className": "p-0",
|
|
@@ -5229,7 +5229,7 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
5229
5229
|
}
|
|
5230
5230
|
};
|
|
5231
5231
|
|
|
5232
|
-
const getSchema$
|
|
5232
|
+
const getSchema$2 = (uiSchema) => {
|
|
5233
5233
|
return {
|
|
5234
5234
|
type: "service",
|
|
5235
5235
|
body: [
|
|
@@ -5530,7 +5530,7 @@ const getSchema$1 = (uiSchema) => {
|
|
|
5530
5530
|
* @Description:
|
|
5531
5531
|
*/
|
|
5532
5532
|
|
|
5533
|
-
const getSchema$
|
|
5533
|
+
const getSchema$1 = (uiSchema)=>{
|
|
5534
5534
|
return {
|
|
5535
5535
|
"type": "service",
|
|
5536
5536
|
"className": "p-0",
|
|
@@ -5562,6 +5562,94 @@ const getSchema$5 = (uiSchema)=>{
|
|
|
5562
5562
|
}
|
|
5563
5563
|
};
|
|
5564
5564
|
|
|
5565
|
+
const getSchema$6 = async (uiSchema, ctx) => {
|
|
5566
|
+
const requestAdaptor = `
|
|
5567
|
+
// 获取列表视图的属性
|
|
5568
|
+
let uiSchema = api.body.uiSchema;
|
|
5569
|
+
let list_views = uiSchema.list_views;
|
|
5570
|
+
let list_views_name = api.body.listName;
|
|
5571
|
+
let col = list_views[list_views_name].columns;
|
|
5572
|
+
let sort_test = list_views[list_views_name].sort;
|
|
5573
|
+
|
|
5574
|
+
// 获取下载字段
|
|
5575
|
+
let select = [];
|
|
5576
|
+
_.each(col, (col) => {
|
|
5577
|
+
if (col.field == undefined)
|
|
5578
|
+
select.push(col);
|
|
5579
|
+
else select.push(col.field);
|
|
5580
|
+
});
|
|
5581
|
+
|
|
5582
|
+
// 获取排序字段
|
|
5583
|
+
|
|
5584
|
+
let sort = [];
|
|
5585
|
+
_.forEach(sort_test, (sortField) => {
|
|
5586
|
+
if (sortField.field_name == undefined)
|
|
5587
|
+
sort.push(sortField);
|
|
5588
|
+
else sort.push([sortField.field_name, sortField.order]);
|
|
5589
|
+
})
|
|
5590
|
+
|
|
5591
|
+
let orders = [];
|
|
5592
|
+
_.map(sort, (value) => {
|
|
5593
|
+
let order_tmp = [];
|
|
5594
|
+
if (value[1] == "desc")
|
|
5595
|
+
order_tmp = value[0] + ' desc';
|
|
5596
|
+
else
|
|
5597
|
+
order_tmp = value[0];
|
|
5598
|
+
orders.push(order_tmp);
|
|
5599
|
+
});
|
|
5600
|
+
let order = orders.join(',');
|
|
5601
|
+
|
|
5602
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
5603
|
+
|
|
5604
|
+
url_tmp = api.url.split('?')[0];
|
|
5605
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
5606
|
+
|
|
5607
|
+
// 判断sort 和 filters
|
|
5608
|
+
if (sort.length > 0) {
|
|
5609
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
5610
|
+
}
|
|
5611
|
+
let filters = list_views[list_views_name].filters;
|
|
5612
|
+
if (filters && filters.length > 0) {
|
|
5613
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
5614
|
+
}
|
|
5615
|
+
return api;
|
|
5616
|
+
`;
|
|
5617
|
+
return {
|
|
5618
|
+
"type": "service",
|
|
5619
|
+
"body": [{
|
|
5620
|
+
"type": "button",
|
|
5621
|
+
"label": instance.t('frontend_export_excel'),
|
|
5622
|
+
"id": "u:standard_export_excel",
|
|
5623
|
+
"level": "default",
|
|
5624
|
+
"onEvent": {
|
|
5625
|
+
"click": {
|
|
5626
|
+
"weight": 0,
|
|
5627
|
+
"actions": [
|
|
5628
|
+
{
|
|
5629
|
+
"args": {
|
|
5630
|
+
"api": {
|
|
5631
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
5632
|
+
"method": "get",
|
|
5633
|
+
"messages": {},
|
|
5634
|
+
"requestAdaptor": requestAdaptor,
|
|
5635
|
+
"data": {
|
|
5636
|
+
"uiSchema": "${uiSchema}",
|
|
5637
|
+
"listName": "${listName}"
|
|
5638
|
+
},
|
|
5639
|
+
"headers": {
|
|
5640
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
},
|
|
5644
|
+
"actionType": "download"
|
|
5645
|
+
}
|
|
5646
|
+
]
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5649
|
+
}]
|
|
5650
|
+
}
|
|
5651
|
+
};
|
|
5652
|
+
|
|
5565
5653
|
/*
|
|
5566
5654
|
* @Author: baozhoutao@steedos.com
|
|
5567
5655
|
* @Date: 2022-11-01 15:53:07
|
|
@@ -5574,19 +5662,19 @@ const StandardButtons = {
|
|
|
5574
5662
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
5575
5663
|
return {
|
|
5576
5664
|
type: 'amis_button',
|
|
5577
|
-
amis_schema: await getSchema$
|
|
5665
|
+
amis_schema: await getSchema$5(uiSchema)
|
|
5578
5666
|
}
|
|
5579
5667
|
},
|
|
5580
5668
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
5581
5669
|
return {
|
|
5582
5670
|
type: 'amis_button',
|
|
5583
|
-
amis_schema: await getSchema$
|
|
5671
|
+
amis_schema: await getSchema$4(uiSchema, ctx)
|
|
5584
5672
|
}
|
|
5585
5673
|
},
|
|
5586
5674
|
getStandardDelete: async (uiSchema, ctx)=>{
|
|
5587
5675
|
return {
|
|
5588
5676
|
type: 'amis_button',
|
|
5589
|
-
amis_schema: await getSchema$
|
|
5677
|
+
amis_schema: await getSchema$3(uiSchema)
|
|
5590
5678
|
}
|
|
5591
5679
|
},
|
|
5592
5680
|
getStandardDeleteMany: async (uiSchema, ctx)=>{
|
|
@@ -5622,13 +5710,19 @@ const StandardButtons = {
|
|
|
5622
5710
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
5623
5711
|
return {
|
|
5624
5712
|
type: 'amis_button',
|
|
5625
|
-
amis_schema: await getSchema$
|
|
5713
|
+
amis_schema: await getSchema$2()
|
|
5626
5714
|
}
|
|
5627
5715
|
},
|
|
5628
5716
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
5629
5717
|
return {
|
|
5630
5718
|
type: 'amis_button',
|
|
5631
|
-
amis_schema: await getSchema$
|
|
5719
|
+
amis_schema: await getSchema$1()
|
|
5720
|
+
}
|
|
5721
|
+
},
|
|
5722
|
+
getStandardExportExcel: async (uiSchema, ctx)=>{
|
|
5723
|
+
return {
|
|
5724
|
+
type: 'amis_button',
|
|
5725
|
+
amis_schema: await getSchema$6()
|
|
5632
5726
|
}
|
|
5633
5727
|
}
|
|
5634
5728
|
};
|
|
@@ -5890,6 +5984,16 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
5890
5984
|
}
|
|
5891
5985
|
}
|
|
5892
5986
|
|
|
5987
|
+
if(button.name === 'standard_export_excel'){
|
|
5988
|
+
return {
|
|
5989
|
+
label: button.label,
|
|
5990
|
+
name: button.name,
|
|
5991
|
+
on: button.on,
|
|
5992
|
+
sort: button.sort,
|
|
5993
|
+
...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
|
|
5994
|
+
}
|
|
5995
|
+
}
|
|
5996
|
+
|
|
5893
5997
|
if(button.name === 'standard_open_view'){
|
|
5894
5998
|
return {
|
|
5895
5999
|
label: button.label,
|
|
@@ -7185,97 +7289,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7185
7289
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
7186
7290
|
}
|
|
7187
7291
|
|
|
7188
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
7189
|
-
return {
|
|
7190
|
-
"type": "button",
|
|
7191
|
-
"icon": "fa fa-download",
|
|
7192
|
-
"align": "right",
|
|
7193
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
7194
|
-
"tooltipPlacement": "bottom",
|
|
7195
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
7196
|
-
"tooltip": instance.t('frontend_export_excel'),
|
|
7197
|
-
"onEvent": {
|
|
7198
|
-
"click": {
|
|
7199
|
-
"weight": 0,
|
|
7200
|
-
"actions": [
|
|
7201
|
-
{
|
|
7202
|
-
"args": {
|
|
7203
|
-
"api": {
|
|
7204
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
7205
|
-
"method": "get",
|
|
7206
|
-
"messages": {},
|
|
7207
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
7208
|
-
"data": {
|
|
7209
|
-
"uiSchema": "${uiSchema}",
|
|
7210
|
-
"listName": "${listName}"
|
|
7211
|
-
},
|
|
7212
|
-
"headers": {
|
|
7213
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
},
|
|
7217
|
-
"actionType": "download"
|
|
7218
|
-
}
|
|
7219
|
-
]
|
|
7220
|
-
}
|
|
7221
|
-
}
|
|
7222
|
-
}
|
|
7223
|
-
};
|
|
7224
|
-
|
|
7225
|
-
function requestAdaptor$1(){
|
|
7226
|
-
return `
|
|
7227
|
-
// 获取列表视图的属性
|
|
7228
|
-
let uiSchema = api.body.uiSchema;
|
|
7229
|
-
let list_views = uiSchema.list_views;
|
|
7230
|
-
let list_views_name = api.body.listName;
|
|
7231
|
-
let col = list_views[list_views_name].columns;
|
|
7232
|
-
let sort_test = list_views[list_views_name].sort;
|
|
7233
|
-
|
|
7234
|
-
// 获取下载字段
|
|
7235
|
-
let select = [];
|
|
7236
|
-
_.each(col, (col) => {
|
|
7237
|
-
if (col.field == undefined)
|
|
7238
|
-
select.push(col);
|
|
7239
|
-
else select.push(col.field);
|
|
7240
|
-
});
|
|
7241
|
-
|
|
7242
|
-
// 获取排序字段
|
|
7243
|
-
|
|
7244
|
-
let sort = [];
|
|
7245
|
-
_.forEach(sort_test, (sortField) => {
|
|
7246
|
-
if (sortField.field_name == undefined)
|
|
7247
|
-
sort.push(sortField);
|
|
7248
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
7249
|
-
})
|
|
7250
|
-
|
|
7251
|
-
let orders = [];
|
|
7252
|
-
_.map(sort, (value) => {
|
|
7253
|
-
let order_tmp = [];
|
|
7254
|
-
if (value[1] == "desc")
|
|
7255
|
-
order_tmp = value[0] + ' desc';
|
|
7256
|
-
else
|
|
7257
|
-
order_tmp = value[0];
|
|
7258
|
-
orders.push(order_tmp);
|
|
7259
|
-
});
|
|
7260
|
-
let order = orders.join(',');
|
|
7261
|
-
|
|
7262
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
7263
|
-
|
|
7264
|
-
url_tmp = api.url.split('?')[0];
|
|
7265
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
7266
|
-
|
|
7267
|
-
// 判断sort 和 filters
|
|
7268
|
-
if (sort.length > 0) {
|
|
7269
|
-
api.url += "&$orderby=" + order;
|
|
7270
|
-
}
|
|
7271
|
-
let filters = list_views[list_views_name].filters;
|
|
7272
|
-
if (filters && filters.length > 0) {
|
|
7273
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
7274
|
-
}
|
|
7275
|
-
return api;
|
|
7276
|
-
`
|
|
7277
|
-
}
|
|
7278
|
-
|
|
7279
7292
|
const getNewListviewButtonSchema = ()=>{
|
|
7280
7293
|
return {
|
|
7281
7294
|
"type": "button",
|
|
@@ -8365,7 +8378,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
8365
8378
|
"tooltipPlacement": "bottom",
|
|
8366
8379
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8367
8380
|
},
|
|
8368
|
-
getExportExcelToolbarButtonSchema(),
|
|
8381
|
+
// getExportExcelToolbarButtonSchema(),
|
|
8369
8382
|
filterVisible ? {
|
|
8370
8383
|
"label": "",
|
|
8371
8384
|
"icon": "fa fa-search",
|
|
@@ -8989,7 +9002,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8989
9002
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
8990
9003
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
8991
9004
|
if (isAllowCreate) {
|
|
8992
|
-
const new_button = await getSchema$
|
|
9005
|
+
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
8993
9006
|
new_button.align = "right";
|
|
8994
9007
|
pickerSchema.headerToolbar.push(new_button);
|
|
8995
9008
|
}
|
|
@@ -10739,7 +10752,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
10739
10752
|
level: "link",
|
|
10740
10753
|
actionType: "link",
|
|
10741
10754
|
link: url,
|
|
10742
|
-
innerClassName:
|
|
10755
|
+
innerClassName: {
|
|
10756
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
10757
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
10758
|
+
},
|
|
10743
10759
|
body: {
|
|
10744
10760
|
"type": "wrapper",
|
|
10745
10761
|
"body": columnLines,
|
|
@@ -18983,7 +18999,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
18983
18999
|
"type": "wrapper",
|
|
18984
19000
|
"size": "none",
|
|
18985
19001
|
"className": {
|
|
18986
|
-
"p-0 flex-shrink-0
|
|
19002
|
+
"p-0 flex-shrink-0 w-[388px] border-r border-gray-300 bg-gray-100 shadow lg:order-first lg:flex lg:flex-col": "${display == 'split'}",
|
|
18987
19003
|
'h-full': "${display != 'split'}",
|
|
18988
19004
|
},
|
|
18989
19005
|
"body": {
|
|
@@ -19028,7 +19044,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19028
19044
|
});
|
|
19029
19045
|
}); };
|
|
19030
19046
|
|
|
19031
|
-
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)}}}}},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 r=[];return _.each(e,(e,t)=>{_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?r.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?r.push([""+t.replace("__searchable__",""),"contains",e]):r.push([""+t.replace("__searchable__",""),"=",e])));}),r}});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);
|
|
19047
|
+
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);
|
|
19032
19048
|
|
|
19033
19049
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19034
19050
|
__proto__: null,
|