@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.esm.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.esm.js
CHANGED
|
@@ -4739,7 +4739,7 @@ var frontend_listview_control_rename_label = "重命名";
|
|
|
4739
4739
|
var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
4740
4740
|
var frontend_listview_control_share = "共享设置";
|
|
4741
4741
|
var frontend_listview_control_sort = "默认排序规则";
|
|
4742
|
-
var frontend_export_excel = "导出
|
|
4742
|
+
var frontend_export_excel = "导出";
|
|
4743
4743
|
var frontend_ercord_operation = "操作";
|
|
4744
4744
|
var frontend_import_data = "导入数据";
|
|
4745
4745
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -4890,7 +4890,7 @@ instance
|
|
|
4890
4890
|
* @Description:
|
|
4891
4891
|
*/
|
|
4892
4892
|
|
|
4893
|
-
const getSchema$
|
|
4893
|
+
const getSchema$5 = async (uiSchema, ctx) => {
|
|
4894
4894
|
const schemaApiAdaptor = `
|
|
4895
4895
|
let formSchema = {
|
|
4896
4896
|
"type": "steedos-object-form",
|
|
@@ -5064,7 +5064,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
5064
5064
|
* @Description:
|
|
5065
5065
|
*/
|
|
5066
5066
|
|
|
5067
|
-
const getSchema$
|
|
5067
|
+
const getSchema$4 = async (uiSchema, ctx) => {
|
|
5068
5068
|
const title = instance.t('frontend_form_edit') + " " + uiSchema.label;
|
|
5069
5069
|
|
|
5070
5070
|
const defaultFormSchema = {
|
|
@@ -5132,7 +5132,7 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
5132
5132
|
* @LastEditors: Please set LastEditors
|
|
5133
5133
|
* @LastEditTime: 2023-04-12 10:35:36
|
|
5134
5134
|
*/
|
|
5135
|
-
const getSchema$
|
|
5135
|
+
const getSchema$3 = (uiSchema)=>{
|
|
5136
5136
|
return {
|
|
5137
5137
|
"type": "service",
|
|
5138
5138
|
"className": "p-0",
|
|
@@ -5201,7 +5201,7 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
5201
5201
|
}
|
|
5202
5202
|
};
|
|
5203
5203
|
|
|
5204
|
-
const getSchema$
|
|
5204
|
+
const getSchema$2 = (uiSchema) => {
|
|
5205
5205
|
return {
|
|
5206
5206
|
type: "service",
|
|
5207
5207
|
body: [
|
|
@@ -5502,7 +5502,7 @@ const getSchema$1 = (uiSchema) => {
|
|
|
5502
5502
|
* @Description:
|
|
5503
5503
|
*/
|
|
5504
5504
|
|
|
5505
|
-
const getSchema$
|
|
5505
|
+
const getSchema$1 = (uiSchema)=>{
|
|
5506
5506
|
return {
|
|
5507
5507
|
"type": "service",
|
|
5508
5508
|
"className": "p-0",
|
|
@@ -5534,6 +5534,94 @@ const getSchema$5 = (uiSchema)=>{
|
|
|
5534
5534
|
}
|
|
5535
5535
|
};
|
|
5536
5536
|
|
|
5537
|
+
const getSchema$6 = async (uiSchema, ctx) => {
|
|
5538
|
+
const requestAdaptor = `
|
|
5539
|
+
// 获取列表视图的属性
|
|
5540
|
+
let uiSchema = api.body.uiSchema;
|
|
5541
|
+
let list_views = uiSchema.list_views;
|
|
5542
|
+
let list_views_name = api.body.listName;
|
|
5543
|
+
let col = list_views[list_views_name].columns;
|
|
5544
|
+
let sort_test = list_views[list_views_name].sort;
|
|
5545
|
+
|
|
5546
|
+
// 获取下载字段
|
|
5547
|
+
let select = [];
|
|
5548
|
+
_.each(col, (col) => {
|
|
5549
|
+
if (col.field == undefined)
|
|
5550
|
+
select.push(col);
|
|
5551
|
+
else select.push(col.field);
|
|
5552
|
+
});
|
|
5553
|
+
|
|
5554
|
+
// 获取排序字段
|
|
5555
|
+
|
|
5556
|
+
let sort = [];
|
|
5557
|
+
_.forEach(sort_test, (sortField) => {
|
|
5558
|
+
if (sortField.field_name == undefined)
|
|
5559
|
+
sort.push(sortField);
|
|
5560
|
+
else sort.push([sortField.field_name, sortField.order]);
|
|
5561
|
+
})
|
|
5562
|
+
|
|
5563
|
+
let orders = [];
|
|
5564
|
+
_.map(sort, (value) => {
|
|
5565
|
+
let order_tmp = [];
|
|
5566
|
+
if (value[1] == "desc")
|
|
5567
|
+
order_tmp = value[0] + ' desc';
|
|
5568
|
+
else
|
|
5569
|
+
order_tmp = value[0];
|
|
5570
|
+
orders.push(order_tmp);
|
|
5571
|
+
});
|
|
5572
|
+
let order = orders.join(',');
|
|
5573
|
+
|
|
5574
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
5575
|
+
|
|
5576
|
+
url_tmp = api.url.split('?')[0];
|
|
5577
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
5578
|
+
|
|
5579
|
+
// 判断sort 和 filters
|
|
5580
|
+
if (sort.length > 0) {
|
|
5581
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
5582
|
+
}
|
|
5583
|
+
let filters = list_views[list_views_name].filters;
|
|
5584
|
+
if (filters && filters.length > 0) {
|
|
5585
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
5586
|
+
}
|
|
5587
|
+
return api;
|
|
5588
|
+
`;
|
|
5589
|
+
return {
|
|
5590
|
+
"type": "service",
|
|
5591
|
+
"body": [{
|
|
5592
|
+
"type": "button",
|
|
5593
|
+
"label": instance.t('frontend_export_excel'),
|
|
5594
|
+
"id": "u:standard_export_excel",
|
|
5595
|
+
"level": "default",
|
|
5596
|
+
"onEvent": {
|
|
5597
|
+
"click": {
|
|
5598
|
+
"weight": 0,
|
|
5599
|
+
"actions": [
|
|
5600
|
+
{
|
|
5601
|
+
"args": {
|
|
5602
|
+
"api": {
|
|
5603
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
5604
|
+
"method": "get",
|
|
5605
|
+
"messages": {},
|
|
5606
|
+
"requestAdaptor": requestAdaptor,
|
|
5607
|
+
"data": {
|
|
5608
|
+
"uiSchema": "${uiSchema}",
|
|
5609
|
+
"listName": "${listName}"
|
|
5610
|
+
},
|
|
5611
|
+
"headers": {
|
|
5612
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
},
|
|
5616
|
+
"actionType": "download"
|
|
5617
|
+
}
|
|
5618
|
+
]
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
}]
|
|
5622
|
+
}
|
|
5623
|
+
};
|
|
5624
|
+
|
|
5537
5625
|
/*
|
|
5538
5626
|
* @Author: baozhoutao@steedos.com
|
|
5539
5627
|
* @Date: 2022-11-01 15:53:07
|
|
@@ -5546,19 +5634,19 @@ const StandardButtons = {
|
|
|
5546
5634
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
5547
5635
|
return {
|
|
5548
5636
|
type: 'amis_button',
|
|
5549
|
-
amis_schema: await getSchema$
|
|
5637
|
+
amis_schema: await getSchema$5(uiSchema)
|
|
5550
5638
|
}
|
|
5551
5639
|
},
|
|
5552
5640
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
5553
5641
|
return {
|
|
5554
5642
|
type: 'amis_button',
|
|
5555
|
-
amis_schema: await getSchema$
|
|
5643
|
+
amis_schema: await getSchema$4(uiSchema, ctx)
|
|
5556
5644
|
}
|
|
5557
5645
|
},
|
|
5558
5646
|
getStandardDelete: async (uiSchema, ctx)=>{
|
|
5559
5647
|
return {
|
|
5560
5648
|
type: 'amis_button',
|
|
5561
|
-
amis_schema: await getSchema$
|
|
5649
|
+
amis_schema: await getSchema$3(uiSchema)
|
|
5562
5650
|
}
|
|
5563
5651
|
},
|
|
5564
5652
|
getStandardDeleteMany: async (uiSchema, ctx)=>{
|
|
@@ -5594,13 +5682,19 @@ const StandardButtons = {
|
|
|
5594
5682
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
5595
5683
|
return {
|
|
5596
5684
|
type: 'amis_button',
|
|
5597
|
-
amis_schema: await getSchema$
|
|
5685
|
+
amis_schema: await getSchema$2()
|
|
5598
5686
|
}
|
|
5599
5687
|
},
|
|
5600
5688
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
5601
5689
|
return {
|
|
5602
5690
|
type: 'amis_button',
|
|
5603
|
-
amis_schema: await getSchema$
|
|
5691
|
+
amis_schema: await getSchema$1()
|
|
5692
|
+
}
|
|
5693
|
+
},
|
|
5694
|
+
getStandardExportExcel: async (uiSchema, ctx)=>{
|
|
5695
|
+
return {
|
|
5696
|
+
type: 'amis_button',
|
|
5697
|
+
amis_schema: await getSchema$6()
|
|
5604
5698
|
}
|
|
5605
5699
|
}
|
|
5606
5700
|
};
|
|
@@ -5862,6 +5956,16 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
5862
5956
|
}
|
|
5863
5957
|
}
|
|
5864
5958
|
|
|
5959
|
+
if(button.name === 'standard_export_excel'){
|
|
5960
|
+
return {
|
|
5961
|
+
label: button.label,
|
|
5962
|
+
name: button.name,
|
|
5963
|
+
on: button.on,
|
|
5964
|
+
sort: button.sort,
|
|
5965
|
+
...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5865
5969
|
if(button.name === 'standard_open_view'){
|
|
5866
5970
|
return {
|
|
5867
5971
|
label: button.label,
|
|
@@ -7157,97 +7261,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7157
7261
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
7158
7262
|
}
|
|
7159
7263
|
|
|
7160
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
7161
|
-
return {
|
|
7162
|
-
"type": "button",
|
|
7163
|
-
"icon": "fa fa-download",
|
|
7164
|
-
"align": "right",
|
|
7165
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
7166
|
-
"tooltipPlacement": "bottom",
|
|
7167
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
7168
|
-
"tooltip": instance.t('frontend_export_excel'),
|
|
7169
|
-
"onEvent": {
|
|
7170
|
-
"click": {
|
|
7171
|
-
"weight": 0,
|
|
7172
|
-
"actions": [
|
|
7173
|
-
{
|
|
7174
|
-
"args": {
|
|
7175
|
-
"api": {
|
|
7176
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
7177
|
-
"method": "get",
|
|
7178
|
-
"messages": {},
|
|
7179
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
7180
|
-
"data": {
|
|
7181
|
-
"uiSchema": "${uiSchema}",
|
|
7182
|
-
"listName": "${listName}"
|
|
7183
|
-
},
|
|
7184
|
-
"headers": {
|
|
7185
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7186
|
-
}
|
|
7187
|
-
}
|
|
7188
|
-
},
|
|
7189
|
-
"actionType": "download"
|
|
7190
|
-
}
|
|
7191
|
-
]
|
|
7192
|
-
}
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7195
|
-
};
|
|
7196
|
-
|
|
7197
|
-
function requestAdaptor$1(){
|
|
7198
|
-
return `
|
|
7199
|
-
// 获取列表视图的属性
|
|
7200
|
-
let uiSchema = api.body.uiSchema;
|
|
7201
|
-
let list_views = uiSchema.list_views;
|
|
7202
|
-
let list_views_name = api.body.listName;
|
|
7203
|
-
let col = list_views[list_views_name].columns;
|
|
7204
|
-
let sort_test = list_views[list_views_name].sort;
|
|
7205
|
-
|
|
7206
|
-
// 获取下载字段
|
|
7207
|
-
let select = [];
|
|
7208
|
-
_.each(col, (col) => {
|
|
7209
|
-
if (col.field == undefined)
|
|
7210
|
-
select.push(col);
|
|
7211
|
-
else select.push(col.field);
|
|
7212
|
-
});
|
|
7213
|
-
|
|
7214
|
-
// 获取排序字段
|
|
7215
|
-
|
|
7216
|
-
let sort = [];
|
|
7217
|
-
_.forEach(sort_test, (sortField) => {
|
|
7218
|
-
if (sortField.field_name == undefined)
|
|
7219
|
-
sort.push(sortField);
|
|
7220
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
7221
|
-
})
|
|
7222
|
-
|
|
7223
|
-
let orders = [];
|
|
7224
|
-
_.map(sort, (value) => {
|
|
7225
|
-
let order_tmp = [];
|
|
7226
|
-
if (value[1] == "desc")
|
|
7227
|
-
order_tmp = value[0] + ' desc';
|
|
7228
|
-
else
|
|
7229
|
-
order_tmp = value[0];
|
|
7230
|
-
orders.push(order_tmp);
|
|
7231
|
-
});
|
|
7232
|
-
let order = orders.join(',');
|
|
7233
|
-
|
|
7234
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
7235
|
-
|
|
7236
|
-
url_tmp = api.url.split('?')[0];
|
|
7237
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
7238
|
-
|
|
7239
|
-
// 判断sort 和 filters
|
|
7240
|
-
if (sort.length > 0) {
|
|
7241
|
-
api.url += "&$orderby=" + order;
|
|
7242
|
-
}
|
|
7243
|
-
let filters = list_views[list_views_name].filters;
|
|
7244
|
-
if (filters && filters.length > 0) {
|
|
7245
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
7246
|
-
}
|
|
7247
|
-
return api;
|
|
7248
|
-
`
|
|
7249
|
-
}
|
|
7250
|
-
|
|
7251
7264
|
const getNewListviewButtonSchema = ()=>{
|
|
7252
7265
|
return {
|
|
7253
7266
|
"type": "button",
|
|
@@ -8337,7 +8350,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
8337
8350
|
"tooltipPlacement": "bottom",
|
|
8338
8351
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8339
8352
|
},
|
|
8340
|
-
getExportExcelToolbarButtonSchema(),
|
|
8353
|
+
// getExportExcelToolbarButtonSchema(),
|
|
8341
8354
|
filterVisible ? {
|
|
8342
8355
|
"label": "",
|
|
8343
8356
|
"icon": "fa fa-search",
|
|
@@ -8961,7 +8974,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8961
8974
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
8962
8975
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
8963
8976
|
if (isAllowCreate) {
|
|
8964
|
-
const new_button = await getSchema$
|
|
8977
|
+
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
8965
8978
|
new_button.align = "right";
|
|
8966
8979
|
pickerSchema.headerToolbar.push(new_button);
|
|
8967
8980
|
}
|
|
@@ -10711,7 +10724,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
10711
10724
|
level: "link",
|
|
10712
10725
|
actionType: "link",
|
|
10713
10726
|
link: url,
|
|
10714
|
-
innerClassName:
|
|
10727
|
+
innerClassName: {
|
|
10728
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
10729
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
10730
|
+
},
|
|
10715
10731
|
body: {
|
|
10716
10732
|
"type": "wrapper",
|
|
10717
10733
|
"body": columnLines,
|
|
@@ -18955,7 +18971,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
18955
18971
|
"type": "wrapper",
|
|
18956
18972
|
"size": "none",
|
|
18957
18973
|
"className": {
|
|
18958
|
-
"p-0 flex-shrink-0
|
|
18974
|
+
"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'}",
|
|
18959
18975
|
'h-full': "${display != 'split'}",
|
|
18960
18976
|
},
|
|
18961
18977
|
"body": {
|
|
@@ -19000,7 +19016,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19000
19016
|
});
|
|
19001
19017
|
}); };
|
|
19002
19018
|
|
|
19003
|
-
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]=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 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);
|
|
19019
|
+
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);
|
|
19004
19020
|
|
|
19005
19021
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19006
19022
|
__proto__: null,
|