@steedos-widgets/amis-object 1.3.0-beta.9 → 1.3.1
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 +128 -17
- package/dist/amis-object.cjs.js +678 -699
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +128 -17
- package/dist/amis-object.esm.js +560 -581
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +128 -17
- package/dist/amis-object.umd.js +188 -156
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +16 -16
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useState, useEffect, createElement } from 'react';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as _$1 from 'lodash';
|
|
3
|
+
import _$1__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get as get$1, isBoolean, omitBy, isNil, forEach, trimEnd, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign } from 'lodash';
|
|
4
4
|
import { Dropdown, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
|
|
5
5
|
import ReactDOM, { createRoot } from 'react-dom';
|
|
6
6
|
|
|
@@ -3523,8 +3523,8 @@ const Router$1 = {
|
|
|
3523
3523
|
/*
|
|
3524
3524
|
* @Author: baozhoutao@steedos.com
|
|
3525
3525
|
* @Date: 2022-07-20 16:29:22
|
|
3526
|
-
* @LastEditors:
|
|
3527
|
-
* @LastEditTime: 2023-
|
|
3526
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
3527
|
+
* @LastEditTime: 2023-09-08 14:09:48
|
|
3528
3528
|
* @Description:
|
|
3529
3529
|
*/
|
|
3530
3530
|
|
|
@@ -3537,11 +3537,40 @@ function getContrastColor(bgColor) {
|
|
|
3537
3537
|
return brightness < 128 ? "#ffffff" : "#000000";
|
|
3538
3538
|
}
|
|
3539
3539
|
|
|
3540
|
+
function getLookupListView(refObjectConfig) {
|
|
3541
|
+
if(!refObjectConfig){
|
|
3542
|
+
return null;
|
|
3543
|
+
}
|
|
3544
|
+
const listNameAll = "all";
|
|
3545
|
+
const listNameLookup = "lookup";
|
|
3546
|
+
let listViewAll, listViewLookup;
|
|
3547
|
+
|
|
3548
|
+
_.each(
|
|
3549
|
+
refObjectConfig.list_views,
|
|
3550
|
+
(view, name) => {
|
|
3551
|
+
if (name === listNameAll) {
|
|
3552
|
+
listViewAll = view;
|
|
3553
|
+
if(!listViewAll.name){
|
|
3554
|
+
listViewAll.name = name;
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
else if (name === listNameLookup) {
|
|
3558
|
+
listViewLookup = view;
|
|
3559
|
+
if(!listViewLookup.name){
|
|
3560
|
+
listViewLookup.name = name;
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
);
|
|
3565
|
+
let listView = listViewLookup || listViewAll;
|
|
3566
|
+
return listView;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3540
3569
|
/*
|
|
3541
3570
|
* @Author: baozhoutao@steedos.com
|
|
3542
3571
|
* @Date: 2022-05-23 09:53:08
|
|
3543
3572
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
3544
|
-
* @LastEditTime: 2023-08-
|
|
3573
|
+
* @LastEditTime: 2023-08-29 15:04:39
|
|
3545
3574
|
* @Description:
|
|
3546
3575
|
*/
|
|
3547
3576
|
|
|
@@ -3645,7 +3674,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3645
3674
|
linkTarget = "target='_blank'";
|
|
3646
3675
|
}
|
|
3647
3676
|
|
|
3648
|
-
const
|
|
3677
|
+
const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
|
|
3649
3678
|
|
|
3650
3679
|
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
3651
3680
|
|
|
@@ -3656,7 +3685,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3656
3685
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
3657
3686
|
if(field.multiple){
|
|
3658
3687
|
let labelTpl = `<%=item.label%>`;
|
|
3659
|
-
if(!
|
|
3688
|
+
if(!onlyDisplayLookLabel){
|
|
3660
3689
|
const href = Router$1.getObjectDetailPath({
|
|
3661
3690
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
3662
3691
|
});
|
|
@@ -3674,7 +3703,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3674
3703
|
objectNameTpl = `\${${field.name}.objectName}`;
|
|
3675
3704
|
recordIdTpl = `\${${field.name}.value}`;
|
|
3676
3705
|
}
|
|
3677
|
-
if(!
|
|
3706
|
+
if(!onlyDisplayLookLabel){
|
|
3678
3707
|
const href = Router$1.getObjectDetailPath({
|
|
3679
3708
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
3680
3709
|
});
|
|
@@ -3686,7 +3715,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
3686
3715
|
|
|
3687
3716
|
}else {
|
|
3688
3717
|
let labelTpl = `<%=item.label%>`;
|
|
3689
|
-
if(!
|
|
3718
|
+
if(!onlyDisplayLookLabel){
|
|
3690
3719
|
const href = Router$1.getObjectDetailPath({
|
|
3691
3720
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
3692
3721
|
});
|
|
@@ -3739,7 +3768,7 @@ function getLocationTpl(field){
|
|
|
3739
3768
|
}
|
|
3740
3769
|
|
|
3741
3770
|
async function getFieldTpl (field, options){
|
|
3742
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.
|
|
3771
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
3743
3772
|
return getNameTpl(field, options)
|
|
3744
3773
|
}
|
|
3745
3774
|
switch (field.type) {
|
|
@@ -3783,10 +3812,10 @@ async function getFieldsTemplate(fields, display){
|
|
|
3783
3812
|
let fieldsName = ['_id'];
|
|
3784
3813
|
let displayFields = [];
|
|
3785
3814
|
let fieldsArr = [];
|
|
3786
|
-
if(
|
|
3815
|
+
if(_$1.isArray(fields)){
|
|
3787
3816
|
fieldsArr = fields;
|
|
3788
3817
|
}else {
|
|
3789
|
-
fieldsArr =
|
|
3818
|
+
fieldsArr = _$1.values(fields);
|
|
3790
3819
|
}
|
|
3791
3820
|
for (const field of fieldsArr) {
|
|
3792
3821
|
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
@@ -3814,11 +3843,11 @@ async function getFieldsTemplate(fields, display){
|
|
|
3814
3843
|
}
|
|
3815
3844
|
}
|
|
3816
3845
|
|
|
3817
|
-
displayFields =
|
|
3818
|
-
fieldsName =
|
|
3846
|
+
displayFields = _$1.uniq(displayFields);
|
|
3847
|
+
fieldsName = _$1.uniq(fieldsName);
|
|
3819
3848
|
let expandFieldsQuery = "";
|
|
3820
3849
|
if(expandFields.length > 0){
|
|
3821
|
-
|
|
3850
|
+
_$1.each(expandFields, function(field){
|
|
3822
3851
|
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
3823
3852
|
});
|
|
3824
3853
|
}
|
|
@@ -4045,7 +4074,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
4045
4074
|
}
|
|
4046
4075
|
}
|
|
4047
4076
|
var treeFields = '';
|
|
4048
|
-
if(object.enable_tree &&
|
|
4077
|
+
if(object.enable_tree && _$1.includes(_$1.keys(object.fields), 'parent') && _$1.includes(_$1.keys(object.fields), 'children')){
|
|
4049
4078
|
treeFields = ',parent,children';
|
|
4050
4079
|
}
|
|
4051
4080
|
|
|
@@ -4109,7 +4138,7 @@ function getApi$2 (isMobile){
|
|
|
4109
4138
|
}
|
|
4110
4139
|
}
|
|
4111
4140
|
|
|
4112
|
-
var frontend_field_group_generalization$1 = "
|
|
4141
|
+
var frontend_field_group_generalization$1 = "General";
|
|
4113
4142
|
var frontend_download$1 = "Download";
|
|
4114
4143
|
var frontend_form_save$1 = "Save";
|
|
4115
4144
|
var frontend_form_save_and_new$1 = "Save and New";
|
|
@@ -4794,10 +4823,7 @@ async function getSearchApi(field, ctx) {
|
|
|
4794
4823
|
}
|
|
4795
4824
|
|
|
4796
4825
|
function getRefListViewSort$1(refObject){
|
|
4797
|
-
|
|
4798
|
-
refObject.list_views,
|
|
4799
|
-
(view, name) => name === "all"
|
|
4800
|
-
);
|
|
4826
|
+
let listView = getLookupListView(refObject);
|
|
4801
4827
|
let sort = "";
|
|
4802
4828
|
if(listView){
|
|
4803
4829
|
sort = getListViewSort(listView);
|
|
@@ -5306,257 +5332,92 @@ const getSchema$2 = (uiSchema) => {
|
|
|
5306
5332
|
title: instance.t('frontend_import_data'),
|
|
5307
5333
|
body: [
|
|
5308
5334
|
{
|
|
5309
|
-
type: "form",
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
api: {
|
|
5318
|
-
method: "post",
|
|
5319
|
-
url: "${context.rootUrl}/graphql",
|
|
5320
|
-
data: {
|
|
5321
|
-
objectName: "queue_import_history",
|
|
5322
|
-
$: "$$",
|
|
5323
|
-
},
|
|
5324
|
-
requestAdaptor:
|
|
5325
|
-
"\n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.success_count;\ndelete formData.failure_count;\ndelete formData.total_count;\ndelete formData.start_time;\ndelete formData.end_time;\ndelete formData.state;\ndelete formData.error;\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\n \n \n let fileFieldsKeys = [\"file\"];\n let fileFields = {\"file\":{\"name\":\"file\"}};\n fileFieldsKeys.forEach((item)=>{\n let fileFieldValue = formData[item];\n if(fileFieldValue){\n // 因为表单初始化接口的接收适配器中为file字段值重写了值及格式(为了字段编辑时正常显示附件名、点击附件名正常下载),所以保存时还原(为了字段值保存时正常保存id)。\n if(fileFields[item].multiple){\n if(fileFieldValue instanceof Array && fileFieldValue.length){\n formData[item] = fileFieldValue.map((value)=>{ \n if(typeof value === 'object'){\n return value.value;\n }else{\n return value;\n }\n });\n }\n }else{\n formData[item] = typeof fileFieldValue === 'object' ? fileFieldValue.value : fileFieldValue;\n }\n }\n })\n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId && formData.recordId !='new'){\n query = `mutation{record: ${objectName}__update(id: \"${formData._id}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
|
|
5326
|
-
responseData: {
|
|
5327
|
-
recordId: "${record._id}",
|
|
5328
|
-
},
|
|
5329
|
-
adaptor:
|
|
5330
|
-
"console.log('payload', payload)\n return payload;\n ",
|
|
5331
|
-
headers: {
|
|
5332
|
-
Authorization:
|
|
5333
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5334
|
-
},
|
|
5335
|
-
dataType: "json",
|
|
5335
|
+
"type": "steedos-object-form",
|
|
5336
|
+
"label": "对象表单",
|
|
5337
|
+
"objectApiName": "queue_import_history",
|
|
5338
|
+
"recordId": "",
|
|
5339
|
+
"mode": "edit",
|
|
5340
|
+
"layout": "normal",
|
|
5341
|
+
"defaultData":{
|
|
5342
|
+
"object_name": "${objectName}"
|
|
5336
5343
|
},
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
},
|
|
5366
|
-
headers: {
|
|
5367
|
-
Authorization:
|
|
5368
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5369
|
-
},
|
|
5370
|
-
requestAdaptor:
|
|
5371
|
-
"\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
5372
|
-
},
|
|
5373
|
-
className: "m-1",
|
|
5374
|
-
labelClassName: "text-left",
|
|
5375
|
-
clearValueOnHidden: false,
|
|
5376
|
-
id: "u:04295fee3896",
|
|
5377
|
-
multiple: false,
|
|
5378
|
-
hidden: true,
|
|
5379
|
-
},
|
|
5380
|
-
{
|
|
5381
|
-
name: "queue_import",
|
|
5382
|
-
label: instance.t('frontend_import_data_queue_import'),
|
|
5383
|
-
required: true,
|
|
5384
|
-
type: "picker",
|
|
5385
|
-
labelField: "description",
|
|
5386
|
-
valueField: "_id",
|
|
5387
|
-
modalMode: "dialog",
|
|
5388
|
-
source: {
|
|
5389
|
-
method: "post",
|
|
5390
|
-
url: "${context.rootUrl}/graphql",
|
|
5391
|
-
data: {
|
|
5392
|
-
orderBy: "${orderBy}",
|
|
5393
|
-
orderDir: "${orderDir}",
|
|
5394
|
-
pageNo: "${page}",
|
|
5395
|
-
pageSize: "${perPage}",
|
|
5396
|
-
query:
|
|
5397
|
-
'{rows:queue_import(filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"){_id,description,object_name,encoding,template_url,_display:_ui{object_name,encoding}},count:queue_import__count(filters:{__filters})}',
|
|
5398
|
-
$term: "$term",
|
|
5399
|
-
$self: "$$",
|
|
5344
|
+
"fieldsExtend":{
|
|
5345
|
+
"object_name": {
|
|
5346
|
+
"amis": {
|
|
5347
|
+
"hidden": true
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
},
|
|
5351
|
+
"form": {
|
|
5352
|
+
debug: false,
|
|
5353
|
+
resetAfterSubmit: false,
|
|
5354
|
+
initApi: {
|
|
5355
|
+
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
5356
|
+
sendOn: 'this.recordId',
|
|
5357
|
+
responseData: {
|
|
5358
|
+
importState: "${state}"
|
|
5359
|
+
}
|
|
5360
|
+
},
|
|
5361
|
+
interval: 3000,
|
|
5362
|
+
stopAutoRefreshWhen: "this.importState === 'finished'",
|
|
5363
|
+
initFetch: false,
|
|
5364
|
+
onEvent: {
|
|
5365
|
+
inited: {
|
|
5366
|
+
weight: 0,
|
|
5367
|
+
actions: [
|
|
5368
|
+
{
|
|
5369
|
+
"actionType": "broadcast",
|
|
5370
|
+
"args": {
|
|
5371
|
+
"eventName": `@data.changed.${uiSchema.name}`
|
|
5400
5372
|
},
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5373
|
+
"data": {
|
|
5374
|
+
"objectName": `${uiSchema.name}`,
|
|
5375
|
+
"displayAs": "${displayAs}",
|
|
5376
|
+
"recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
|
|
5404
5377
|
},
|
|
5405
|
-
|
|
5406
|
-
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
|
|
5407
|
-
adaptor:
|
|
5408
|
-
"\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
|
|
5378
|
+
"expression": "this.importState === 'finished'"
|
|
5409
5379
|
},
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
name: "object_name",
|
|
5436
|
-
label: instance.t('frontend_import_data_object_name'),
|
|
5437
|
-
type: "tpl",
|
|
5438
|
-
tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
|
|
5439
|
-
className: "whitespace-nowrap",
|
|
5440
|
-
html: null,
|
|
5441
|
-
},
|
|
5442
|
-
{
|
|
5443
|
-
name: "encoding",
|
|
5444
|
-
label: instance.t('frontend_import_data_queue_import_encoding'),
|
|
5445
|
-
type: "tpl",
|
|
5446
|
-
tpl: "<div>${_display.encoding}</div>",
|
|
5447
|
-
className: "whitespace-nowrap",
|
|
5448
|
-
html: null,
|
|
5449
|
-
},
|
|
5450
|
-
{
|
|
5451
|
-
name: "template_url",
|
|
5452
|
-
label: instance.t('frontend_import_data_queue_import_template_url'),
|
|
5453
|
-
type: "button-group",
|
|
5454
|
-
buttons: [
|
|
5455
|
-
{
|
|
5456
|
-
type: "button",
|
|
5457
|
-
label: instance.t('frontend_download'),
|
|
5458
|
-
visibleOn: "${template_url}",
|
|
5459
|
-
level: "link",
|
|
5460
|
-
actionType: "download",
|
|
5461
|
-
api:{
|
|
5462
|
-
url: "${template_url}",
|
|
5463
|
-
method: "get",
|
|
5464
|
-
headers: {
|
|
5465
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
5466
|
-
}
|
|
5467
|
-
}
|
|
5468
|
-
}
|
|
5469
|
-
],
|
|
5470
|
-
options: {
|
|
5471
|
-
html: true
|
|
5380
|
+
{
|
|
5381
|
+
"actionType": "closeDialog",
|
|
5382
|
+
"expression": "this.importState === 'finished'"
|
|
5383
|
+
}
|
|
5384
|
+
]
|
|
5385
|
+
},
|
|
5386
|
+
submitSucc: {
|
|
5387
|
+
weight: 0,
|
|
5388
|
+
actions: [
|
|
5389
|
+
{
|
|
5390
|
+
args: {
|
|
5391
|
+
api: {
|
|
5392
|
+
url: "${context.rootUrl}/api/data/initiateImport",
|
|
5393
|
+
method: "post",
|
|
5394
|
+
data: {
|
|
5395
|
+
eventData: "${event.data}",
|
|
5396
|
+
},
|
|
5397
|
+
dataType: "json",
|
|
5398
|
+
requestAdaptor:
|
|
5399
|
+
"\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
|
|
5400
|
+
adaptor:
|
|
5401
|
+
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
5402
|
+
headers: {
|
|
5403
|
+
Authorization:
|
|
5404
|
+
"Bearer ${context.tenantId},${context.authToken}",
|
|
5472
5405
|
},
|
|
5473
|
-
className: "whitespace-nowrap",
|
|
5474
|
-
},
|
|
5475
|
-
null,
|
|
5476
|
-
],
|
|
5477
|
-
syncLocation: false,
|
|
5478
|
-
keepItemSelectionOnPageChange: true,
|
|
5479
|
-
checkOnItemClick: false,
|
|
5480
|
-
autoFillHeight: false,
|
|
5481
|
-
},
|
|
5482
|
-
joinValues: false,
|
|
5483
|
-
extractValue: true,
|
|
5484
|
-
className: "m-1",
|
|
5485
|
-
labelClassName: "text-left",
|
|
5486
|
-
clearValueOnHidden: true,
|
|
5487
|
-
id: "u:401df27113e0",
|
|
5488
|
-
},
|
|
5489
|
-
{
|
|
5490
|
-
name: "file",
|
|
5491
|
-
label: instance.t('frontend_import_data_file'),
|
|
5492
|
-
required: true,
|
|
5493
|
-
type: "input-file",
|
|
5494
|
-
accept: ".xlsx,.xls",
|
|
5495
|
-
className: "m-1",
|
|
5496
|
-
labelClassName: "text-left",
|
|
5497
|
-
clearValueOnHidden: true,
|
|
5498
|
-
useChunk: false,
|
|
5499
|
-
receiver: {
|
|
5500
|
-
method: "post",
|
|
5501
|
-
url: "${context.rootUrl}/s3/files",
|
|
5502
|
-
data: {
|
|
5503
|
-
$: "$$",
|
|
5504
|
-
context: "${context}",
|
|
5505
|
-
},
|
|
5506
|
-
adaptor:
|
|
5507
|
-
'\n const { context } = api.body; \n var rootUrl = context.rootUrl + "/api/files/files/";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: payload._id,\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ',
|
|
5508
|
-
headers: {
|
|
5509
|
-
Authorization:
|
|
5510
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5511
|
-
},
|
|
5512
|
-
},
|
|
5513
|
-
id: "u:0213f2cc365b",
|
|
5514
|
-
},
|
|
5515
|
-
],
|
|
5516
|
-
id: "u:4899c260d667",
|
|
5517
|
-
},
|
|
5518
|
-
],
|
|
5519
|
-
panelClassName: "m-0 sm:rounded-lg shadow-none",
|
|
5520
|
-
bodyClassName: "p-0",
|
|
5521
|
-
className: "p-4 sm:p-0 steedos-amis-form",
|
|
5522
|
-
label: "对象表单",
|
|
5523
|
-
objectApiName: "queue_import_history",
|
|
5524
|
-
id: "u:e4ef598eed61",
|
|
5525
|
-
onEvent: {
|
|
5526
|
-
submitSucc: {
|
|
5527
|
-
weight: 0,
|
|
5528
|
-
actions: [
|
|
5529
|
-
{
|
|
5530
|
-
args: {
|
|
5531
|
-
api: {
|
|
5532
|
-
url: "${context.rootUrl}/api/data/initiateImport",
|
|
5533
|
-
method: "post",
|
|
5534
|
-
data: {
|
|
5535
|
-
eventData: "${event.data}",
|
|
5536
5406
|
},
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
adaptor:
|
|
5541
|
-
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
5542
|
-
headers: {
|
|
5543
|
-
Authorization:
|
|
5544
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
5407
|
+
messages: {
|
|
5408
|
+
success: instance.t('frontend_import_data_message_success'),
|
|
5409
|
+
failed: instance.t('frontend_import_data_message_failed'),
|
|
5545
5410
|
},
|
|
5546
5411
|
},
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
failed: instance.t('frontend_import_data_message_failed'),
|
|
5550
|
-
},
|
|
5412
|
+
actionType: "ajax",
|
|
5413
|
+
expression: "event.data.result",
|
|
5551
5414
|
},
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
},
|
|
5555
|
-
],
|
|
5415
|
+
],
|
|
5416
|
+
},
|
|
5556
5417
|
},
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
}
|
|
5418
|
+
closeDialogOnSubmit: false,
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5560
5421
|
],
|
|
5561
5422
|
id: "u:dc05498d3bd4",
|
|
5562
5423
|
closeOnEsc: false,
|
|
@@ -5746,7 +5607,7 @@ const StandardButtons = {
|
|
|
5746
5607
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
5747
5608
|
return {
|
|
5748
5609
|
type: 'amis_button',
|
|
5749
|
-
amis_schema: await getSchema$2()
|
|
5610
|
+
amis_schema: await getSchema$2(uiSchema)
|
|
5750
5611
|
}
|
|
5751
5612
|
},
|
|
5752
5613
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
@@ -5776,7 +5637,7 @@ function getButtonVisibleOn$1(button){
|
|
|
5776
5637
|
visible = button._visible;
|
|
5777
5638
|
}
|
|
5778
5639
|
|
|
5779
|
-
if(
|
|
5640
|
+
if(_$1.isBoolean(visible)){
|
|
5780
5641
|
visible = visible.toString();
|
|
5781
5642
|
}
|
|
5782
5643
|
|
|
@@ -5804,7 +5665,7 @@ function getButtonVisibleOn$1(button){
|
|
|
5804
5665
|
|
|
5805
5666
|
const getButtonVisible = (button, ctx) => {
|
|
5806
5667
|
if (button._visible) {
|
|
5807
|
-
if (
|
|
5668
|
+
if (_$1.startsWith(_$1.trim(button._visible), "function")) {
|
|
5808
5669
|
window.eval("var fun = " + button._visible);
|
|
5809
5670
|
button.visible = fun;
|
|
5810
5671
|
} else if (isExpression$1(button._visible)) {
|
|
@@ -5819,7 +5680,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
5819
5680
|
};
|
|
5820
5681
|
}
|
|
5821
5682
|
}
|
|
5822
|
-
if (
|
|
5683
|
+
if (_$1.isFunction(button.visible)) {
|
|
5823
5684
|
try {
|
|
5824
5685
|
return button.visible(ctx);
|
|
5825
5686
|
} catch (error) {
|
|
@@ -5841,7 +5702,7 @@ const standardButtonsTodo = {
|
|
|
5841
5702
|
} = this;
|
|
5842
5703
|
const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
|
|
5843
5704
|
|
|
5844
|
-
if(
|
|
5705
|
+
if(_$1.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
5845
5706
|
listViewRef.handleAction({}, {
|
|
5846
5707
|
"actionType": "toast",
|
|
5847
5708
|
"toast": {
|
|
@@ -5868,19 +5729,19 @@ const standardButtonsTodo = {
|
|
|
5868
5729
|
*/
|
|
5869
5730
|
const getButtons = (uiSchema, ctx) => {
|
|
5870
5731
|
const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
|
|
5871
|
-
let buttons =
|
|
5872
|
-
if (
|
|
5873
|
-
buttons =
|
|
5874
|
-
return
|
|
5732
|
+
let buttons = _$1.sortBy(_$1.values(uiSchema.actions), "sort");
|
|
5733
|
+
if (_$1.has(uiSchema, "allow_customActions")) {
|
|
5734
|
+
buttons = _$1.filter(buttons, (button) => {
|
|
5735
|
+
return _$1.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
|
|
5875
5736
|
});
|
|
5876
5737
|
}
|
|
5877
|
-
if (
|
|
5878
|
-
buttons =
|
|
5879
|
-
return !
|
|
5738
|
+
if (_$1.has(uiSchema, "exclude_actions")) {
|
|
5739
|
+
buttons = _$1.filter(buttons, (button) => {
|
|
5740
|
+
return !_$1.include(uiSchema.exclude_actions, button.name);
|
|
5880
5741
|
});
|
|
5881
5742
|
}
|
|
5882
5743
|
|
|
5883
|
-
|
|
5744
|
+
_$1.each(buttons, (button) => {
|
|
5884
5745
|
button.objectName = uiSchema.name;
|
|
5885
5746
|
if (
|
|
5886
5747
|
ctx.isMobile &&
|
|
@@ -5899,7 +5760,7 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
5899
5760
|
ctx.isMobile &&
|
|
5900
5761
|
["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
|
|
5901
5762
|
) {
|
|
5902
|
-
|
|
5763
|
+
_$1.map(buttons, (button) => {
|
|
5903
5764
|
if (button.name === "standard_edit") {
|
|
5904
5765
|
button.on = "record_more";
|
|
5905
5766
|
}
|
|
@@ -5909,14 +5770,14 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
5909
5770
|
});
|
|
5910
5771
|
}
|
|
5911
5772
|
|
|
5912
|
-
return
|
|
5913
|
-
return
|
|
5773
|
+
return _$1.filter(buttons, (button) => {
|
|
5774
|
+
return _$1.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
|
|
5914
5775
|
});
|
|
5915
5776
|
};
|
|
5916
5777
|
|
|
5917
5778
|
const getListViewButtons = (uiSchema, ctx) => {
|
|
5918
5779
|
const buttons = getButtons(uiSchema, ctx);
|
|
5919
|
-
const listButtons =
|
|
5780
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
5920
5781
|
return button.on == "list";
|
|
5921
5782
|
});
|
|
5922
5783
|
return listButtons;
|
|
@@ -5924,23 +5785,23 @@ const getListViewButtons = (uiSchema, ctx) => {
|
|
|
5924
5785
|
|
|
5925
5786
|
const getObjectDetailButtons = (uiSchema, ctx) => {
|
|
5926
5787
|
const buttons = getButtons(uiSchema, ctx);
|
|
5927
|
-
const detailButtons =
|
|
5788
|
+
const detailButtons = _$1.filter(buttons, (button) => {
|
|
5928
5789
|
return button.on == "record" || button.on == "record_only";
|
|
5929
5790
|
});
|
|
5930
|
-
return
|
|
5791
|
+
return _$1.sortBy(detailButtons, "sort");
|
|
5931
5792
|
};
|
|
5932
5793
|
|
|
5933
5794
|
const getObjectDetailMoreButtons = (uiSchema, ctx) => {
|
|
5934
5795
|
const buttons = getButtons(uiSchema, ctx);
|
|
5935
|
-
const moreButtons =
|
|
5796
|
+
const moreButtons = _$1.filter(buttons, (button) => {
|
|
5936
5797
|
return button.on == "record_more" || button.on == "record_only_more";
|
|
5937
5798
|
});
|
|
5938
|
-
return
|
|
5799
|
+
return _$1.sortBy(moreButtons, "sort");
|
|
5939
5800
|
};
|
|
5940
5801
|
|
|
5941
5802
|
const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
5942
5803
|
const buttons = getButtons(uiSchema, ctx);
|
|
5943
|
-
const listButtons =
|
|
5804
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
5944
5805
|
return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
|
|
5945
5806
|
});
|
|
5946
5807
|
return listButtons;
|
|
@@ -5957,7 +5818,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
|
5957
5818
|
// });
|
|
5958
5819
|
// return relatedListButtons;
|
|
5959
5820
|
const buttons = getButtons(uiSchema, ctx);
|
|
5960
|
-
const listButtons =
|
|
5821
|
+
const listButtons = _$1.filter(buttons, (button) => {
|
|
5961
5822
|
return button.on == "list";
|
|
5962
5823
|
});
|
|
5963
5824
|
return listButtons;
|
|
@@ -5974,7 +5835,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
5974
5835
|
const uiSchema = await getUISchema(objectName);
|
|
5975
5836
|
if(uiSchema){
|
|
5976
5837
|
const buttons = await getButtons(uiSchema, ctx);
|
|
5977
|
-
const button =
|
|
5838
|
+
const button = _$1.find(buttons, (button)=>{
|
|
5978
5839
|
return button.name === buttonName
|
|
5979
5840
|
});
|
|
5980
5841
|
|
|
@@ -6060,13 +5921,13 @@ const execute = (button, props) => {
|
|
|
6060
5921
|
return; //TODO 弹出提示未配置todo
|
|
6061
5922
|
}
|
|
6062
5923
|
|
|
6063
|
-
if (
|
|
6064
|
-
if (
|
|
5924
|
+
if (_$1.isString(button.todo)) {
|
|
5925
|
+
if (_$1.startsWith(_$1.trim(button.todo), "function")) {
|
|
6065
5926
|
window.eval("var fun = " + button.todo);
|
|
6066
5927
|
button.todo = fun;
|
|
6067
5928
|
}
|
|
6068
5929
|
}
|
|
6069
|
-
if (
|
|
5930
|
+
if (_$1.isFunction(button.todo)) {
|
|
6070
5931
|
const todoThis = {
|
|
6071
5932
|
objectName: props.objectName,
|
|
6072
5933
|
object_name: props.objectName,
|
|
@@ -6091,7 +5952,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
6091
5952
|
recordId: recordId,
|
|
6092
5953
|
objectName: name
|
|
6093
5954
|
});
|
|
6094
|
-
let amisButtonsSchema =
|
|
5955
|
+
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
6095
5956
|
return {
|
|
6096
5957
|
type: 'steedos-object-button',
|
|
6097
5958
|
name: button.name,
|
|
@@ -6101,7 +5962,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
6101
5962
|
}
|
|
6102
5963
|
});
|
|
6103
5964
|
let moreButtonsVisibleOn = '';
|
|
6104
|
-
let dropdownButtons =
|
|
5965
|
+
let dropdownButtons = _$1.map(moreButtons, (button, index) => {
|
|
6105
5966
|
if(index === 0){
|
|
6106
5967
|
moreButtonsVisibleOn = getButtonVisibleOn$1(button);
|
|
6107
5968
|
}else {
|
|
@@ -6144,11 +6005,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
6144
6005
|
"vertical": true,
|
|
6145
6006
|
"tiled": true,
|
|
6146
6007
|
"buttons": [
|
|
6147
|
-
...
|
|
6008
|
+
..._$1.map(buttons, (button)=>{
|
|
6148
6009
|
button.className += ' w-full';
|
|
6149
6010
|
return button;
|
|
6150
6011
|
}),
|
|
6151
|
-
...
|
|
6012
|
+
..._$1.map(moreButtons, (button)=>{
|
|
6152
6013
|
button.className += ' w-full';
|
|
6153
6014
|
return button;
|
|
6154
6015
|
})
|
|
@@ -6193,6 +6054,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6193
6054
|
return {
|
|
6194
6055
|
"type": "button",
|
|
6195
6056
|
"icon": "fa fa-angle-down",
|
|
6057
|
+
"className": "mr-0",
|
|
6196
6058
|
"onEvent": {
|
|
6197
6059
|
"click": {
|
|
6198
6060
|
"actions": [
|
|
@@ -6209,7 +6071,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6209
6071
|
"vertical": true,
|
|
6210
6072
|
"tiled": true,
|
|
6211
6073
|
"buttons": [
|
|
6212
|
-
...
|
|
6074
|
+
..._$1.map(buttons, (button)=>{
|
|
6213
6075
|
return {
|
|
6214
6076
|
type: 'steedos-object-button',
|
|
6215
6077
|
name: button.name,
|
|
@@ -6238,7 +6100,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6238
6100
|
}
|
|
6239
6101
|
}
|
|
6240
6102
|
}else {
|
|
6241
|
-
return
|
|
6103
|
+
return _$1.map(buttons, (button) => {
|
|
6242
6104
|
return {
|
|
6243
6105
|
type: 'steedos-object-button',
|
|
6244
6106
|
name: button.name,
|
|
@@ -6271,7 +6133,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6271
6133
|
"vertical": true,
|
|
6272
6134
|
"tiled": true,
|
|
6273
6135
|
"buttons": [
|
|
6274
|
-
...
|
|
6136
|
+
..._$1.map(buttons, (button)=>{
|
|
6275
6137
|
return {
|
|
6276
6138
|
type: 'steedos-object-button',
|
|
6277
6139
|
name: button.name,
|
|
@@ -6300,7 +6162,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
6300
6162
|
}
|
|
6301
6163
|
}
|
|
6302
6164
|
}else {
|
|
6303
|
-
return
|
|
6165
|
+
return _$1.map(buttons, (button) => {
|
|
6304
6166
|
return {
|
|
6305
6167
|
type: 'steedos-object-button',
|
|
6306
6168
|
name: button.name,
|
|
@@ -6896,6 +6758,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
6896
6758
|
each(
|
|
6897
6759
|
objectSchema.list_views,
|
|
6898
6760
|
(listView, name) => {
|
|
6761
|
+
if(name === "lookup"){
|
|
6762
|
+
// 内置lookup为弹出选择专用视图,不显示在列表切换区域
|
|
6763
|
+
return;
|
|
6764
|
+
}
|
|
6899
6765
|
listViewButtonOptions.push({
|
|
6900
6766
|
type: "button",
|
|
6901
6767
|
label: listView.label,
|
|
@@ -8385,6 +8251,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8385
8251
|
|
|
8386
8252
|
return {
|
|
8387
8253
|
"type": "tooltip-wrapper",
|
|
8254
|
+
"id": "steedos_crud_toolbar_quick_search",
|
|
8388
8255
|
"align": "right",
|
|
8389
8256
|
"title": "",
|
|
8390
8257
|
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
@@ -8416,76 +8283,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8416
8283
|
if(isMobile){
|
|
8417
8284
|
showDisplayAs = false;
|
|
8418
8285
|
}
|
|
8286
|
+
let toolbarCount;
|
|
8287
|
+
if(!hiddenCount){
|
|
8288
|
+
toolbarCount = {
|
|
8289
|
+
"type": "tpl",
|
|
8290
|
+
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8291
|
+
};
|
|
8292
|
+
}
|
|
8293
|
+
let toolbarReloadButton;
|
|
8419
8294
|
if(formFactor === 'SMALL'){
|
|
8420
|
-
const onReloadScript = `
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
`;
|
|
8295
|
+
// const onReloadScript = `
|
|
8296
|
+
// const scope = event.context.scoped;
|
|
8297
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
8298
|
+
// return n.props.type === "crud";
|
|
8299
|
+
// });
|
|
8300
|
+
// listView.handleChangePage(1);
|
|
8301
|
+
// `;
|
|
8302
|
+
// toolbarReloadButton = {
|
|
8303
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
8304
|
+
// "type": "button",
|
|
8305
|
+
// "align": "right",
|
|
8306
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8307
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8308
|
+
// "tooltipPlacement": "top",
|
|
8309
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8310
|
+
// "label": "",
|
|
8311
|
+
// "icon": "fa fa-sync",
|
|
8312
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
8313
|
+
// "onEvent": {
|
|
8314
|
+
// "click": {
|
|
8315
|
+
// "actions": [
|
|
8316
|
+
// {
|
|
8317
|
+
// "actionType": "custom",
|
|
8318
|
+
// "script": onReloadScript
|
|
8319
|
+
// }
|
|
8320
|
+
// ]
|
|
8321
|
+
// }
|
|
8322
|
+
// },
|
|
8323
|
+
// };
|
|
8324
|
+
|
|
8325
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
8326
|
+
toolbarReloadButton = {
|
|
8327
|
+
"type": "reload",
|
|
8328
|
+
"align": "right",
|
|
8329
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8330
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8331
|
+
"tooltip":"",
|
|
8332
|
+
"tooltipPlacement": "top",
|
|
8333
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8334
|
+
};
|
|
8335
|
+
}
|
|
8336
|
+
else {
|
|
8337
|
+
toolbarReloadButton = {
|
|
8338
|
+
"type": "reload",
|
|
8339
|
+
"align": "right",
|
|
8340
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8341
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8342
|
+
"tooltip":"",
|
|
8343
|
+
"tooltipPlacement": "top",
|
|
8344
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8345
|
+
};
|
|
8346
|
+
}
|
|
8347
|
+
let toolbarFilter;
|
|
8348
|
+
if(filterVisible){
|
|
8349
|
+
toolbarFilter ={
|
|
8350
|
+
"label": instance.t('frontend_button_search_tooltip'),
|
|
8351
|
+
"icon": "fa fa-filter",
|
|
8352
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8353
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8354
|
+
// "tooltipPlacement": "top",
|
|
8355
|
+
"type": "button",
|
|
8356
|
+
"badge": {
|
|
8357
|
+
"offset": [
|
|
8358
|
+
-5,
|
|
8359
|
+
1
|
|
8360
|
+
],
|
|
8361
|
+
"size":8,
|
|
8362
|
+
"animation": true,
|
|
8363
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8364
|
+
},
|
|
8365
|
+
"align": "right",
|
|
8366
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8367
|
+
"onEvent": {
|
|
8368
|
+
"click": {
|
|
8369
|
+
"actions": [
|
|
8370
|
+
{
|
|
8371
|
+
"actionType": "custom",
|
|
8372
|
+
"script": onFieldsFilterToggleScript
|
|
8373
|
+
}
|
|
8374
|
+
]
|
|
8375
|
+
}
|
|
8376
|
+
},
|
|
8377
|
+
"id": "steedos_crud_toolbar_filter"
|
|
8378
|
+
};
|
|
8379
|
+
}
|
|
8380
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
8381
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
8382
|
+
|
|
8383
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
8384
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
8385
|
+
let toolbars = [];
|
|
8386
|
+
if(formFactor === 'SMALL'){
|
|
8387
|
+
if(toolbarCount){
|
|
8388
|
+
toolbars.push(toolbarCount);
|
|
8389
|
+
}
|
|
8390
|
+
toolbars.push(toolbarReloadButton);
|
|
8391
|
+
if(toolbarFilter){
|
|
8392
|
+
toolbars.push(toolbarFilter);
|
|
8393
|
+
}
|
|
8394
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
8395
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
8427
8396
|
return [
|
|
8428
8397
|
// "bulkActions",
|
|
8429
8398
|
...(headerToolbarItems || []),
|
|
8430
|
-
|
|
8431
|
-
"type": "tpl",
|
|
8432
|
-
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8433
|
-
},
|
|
8434
|
-
{
|
|
8435
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
8436
|
-
"type": "button",
|
|
8437
|
-
"align": "right",
|
|
8438
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8439
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8440
|
-
"tooltipPlacement": "top",
|
|
8441
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8442
|
-
"label": "",
|
|
8443
|
-
"icon": "fa fa-sync",
|
|
8444
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
8445
|
-
"onEvent": {
|
|
8446
|
-
"click": {
|
|
8447
|
-
"actions": [
|
|
8448
|
-
{
|
|
8449
|
-
"actionType": "custom",
|
|
8450
|
-
"script": onReloadScript
|
|
8451
|
-
}
|
|
8452
|
-
]
|
|
8453
|
-
}
|
|
8454
|
-
},
|
|
8455
|
-
},
|
|
8456
|
-
filterVisible ? {
|
|
8457
|
-
"label": instance.t('frontend_button_search_tooltip'),
|
|
8458
|
-
"icon": "fa fa-search",
|
|
8459
|
-
"type": "button",
|
|
8460
|
-
"tooltipPlacement": "top",
|
|
8461
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8462
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8463
|
-
"badge": {
|
|
8464
|
-
"offset": [
|
|
8465
|
-
-5,
|
|
8466
|
-
1
|
|
8467
|
-
],
|
|
8468
|
-
"size":8,
|
|
8469
|
-
"animation": true,
|
|
8470
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8471
|
-
},
|
|
8472
|
-
"align": "right",
|
|
8473
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8474
|
-
"onEvent": {
|
|
8475
|
-
"click": {
|
|
8476
|
-
"actions": [
|
|
8477
|
-
{
|
|
8478
|
-
"actionType": "custom",
|
|
8479
|
-
"script": onFieldsFilterToggleScript
|
|
8480
|
-
}
|
|
8481
|
-
]
|
|
8482
|
-
}
|
|
8483
|
-
}
|
|
8484
|
-
} : {},
|
|
8485
|
-
getDisplayAsButton(mainObject?.name),
|
|
8486
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
8399
|
+
...toolbars,
|
|
8487
8400
|
]
|
|
8488
8401
|
}else {
|
|
8402
|
+
if(toolbarCount){
|
|
8403
|
+
toolbars.push(toolbarCount);
|
|
8404
|
+
}
|
|
8405
|
+
if(toolbarFilter){
|
|
8406
|
+
toolbars.push(toolbarFilter);
|
|
8407
|
+
}
|
|
8408
|
+
toolbars.push(toolbarReloadButton);
|
|
8409
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
8410
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
8411
|
+
}
|
|
8412
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
8413
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
8489
8414
|
return [
|
|
8490
8415
|
// "filter-toggler",
|
|
8491
8416
|
...(headerToolbarItems || []),
|
|
@@ -8494,56 +8419,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8494
8419
|
"type": "columns-toggler",
|
|
8495
8420
|
"className": "hidden"
|
|
8496
8421
|
},
|
|
8422
|
+
...toolbars,
|
|
8497
8423
|
// {
|
|
8498
8424
|
// "type": "columns-toggler",
|
|
8499
8425
|
// "className": "mr-2"
|
|
8500
8426
|
// },
|
|
8501
|
-
hiddenCount ? {} : {
|
|
8502
|
-
"type": "tpl",
|
|
8503
|
-
"tpl": "${count} " + instance.t('frontend_record_sum')
|
|
8504
|
-
},
|
|
8505
|
-
filterVisible ? {
|
|
8506
|
-
"label": instance.t('frontend_button_search_tooltip'),
|
|
8507
|
-
"icon": "fa fa-filter",
|
|
8508
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8509
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
8510
|
-
// "tooltipPlacement": "top",
|
|
8511
|
-
"type": "button",
|
|
8512
|
-
"badge": {
|
|
8513
|
-
"offset": [
|
|
8514
|
-
-5,
|
|
8515
|
-
1
|
|
8516
|
-
],
|
|
8517
|
-
"size":8,
|
|
8518
|
-
"animation": true,
|
|
8519
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8520
|
-
},
|
|
8521
|
-
"align": "right",
|
|
8522
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8523
|
-
"onEvent": {
|
|
8524
|
-
"click": {
|
|
8525
|
-
"actions": [
|
|
8526
|
-
{
|
|
8527
|
-
"actionType": "custom",
|
|
8528
|
-
"script": onFieldsFilterToggleScript
|
|
8529
|
-
}
|
|
8530
|
-
]
|
|
8531
|
-
}
|
|
8532
|
-
}
|
|
8533
|
-
} : {},
|
|
8534
|
-
{
|
|
8535
|
-
"type": "reload",
|
|
8536
|
-
"align": "right",
|
|
8537
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8538
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8539
|
-
"tooltip":"",
|
|
8540
|
-
"tooltipPlacement": "top",
|
|
8541
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
8542
|
-
},
|
|
8543
8427
|
// getExportExcelToolbarButtonSchema(),
|
|
8544
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
8545
|
-
getDisplayAsButton(mainObject?.name),
|
|
8546
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
8547
8428
|
// {
|
|
8548
8429
|
// "type": "drag-toggler",
|
|
8549
8430
|
// "align": "right"
|
|
@@ -8744,10 +8625,8 @@ async function getDeferApi(field, ctx) {
|
|
|
8744
8625
|
}
|
|
8745
8626
|
|
|
8746
8627
|
function getRefListViewSort(refObject){
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
(view, name) => name === "all"
|
|
8750
|
-
);
|
|
8628
|
+
let listView = getLookupListView(refObject);
|
|
8629
|
+
|
|
8751
8630
|
let sort = "";
|
|
8752
8631
|
if(listView){
|
|
8753
8632
|
sort = getListViewSort(listView);
|
|
@@ -8837,12 +8716,11 @@ const getReferenceTo = async (field)=>{
|
|
|
8837
8716
|
}
|
|
8838
8717
|
};
|
|
8839
8718
|
|
|
8840
|
-
function getLookupSapceUserTreeSchema(){
|
|
8841
|
-
const
|
|
8719
|
+
function getLookupSapceUserTreeSchema(isMobile){
|
|
8720
|
+
const treeSchema = {
|
|
8842
8721
|
"type": "input-tree",
|
|
8843
|
-
"className":
|
|
8722
|
+
"className":"steedos-select-user-tree",
|
|
8844
8723
|
"inputClassName": "p-0",
|
|
8845
|
-
"id": "u:7fd77b7915b0",
|
|
8846
8724
|
"source": {
|
|
8847
8725
|
"method": "post",
|
|
8848
8726
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -8873,6 +8751,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
8873
8751
|
});
|
|
8874
8752
|
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
8875
8753
|
`
|
|
8754
|
+
},
|
|
8755
|
+
{
|
|
8756
|
+
"actionType": "custom",
|
|
8757
|
+
"script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
|
|
8876
8758
|
}
|
|
8877
8759
|
]
|
|
8878
8760
|
}
|
|
@@ -8897,18 +8779,56 @@ function getLookupSapceUserTreeSchema(){
|
|
|
8897
8779
|
"placeholder": "查找部门"
|
|
8898
8780
|
},
|
|
8899
8781
|
"unfoldedLevel": 2,
|
|
8900
|
-
"style": {
|
|
8901
|
-
"max-height": "100%",
|
|
8902
|
-
"position": "absolute",
|
|
8903
|
-
"left": "-330px",
|
|
8904
|
-
"width": "320px",
|
|
8905
|
-
"bottom": 0,
|
|
8906
|
-
"top": "0",
|
|
8907
|
-
"overflow": "auto",
|
|
8908
|
-
"min-height":"300px"
|
|
8909
|
-
},
|
|
8910
8782
|
"originPosition": "left-top"
|
|
8911
|
-
}
|
|
8783
|
+
};
|
|
8784
|
+
const tree = [];
|
|
8785
|
+
if(isMobile){
|
|
8786
|
+
tree.push({
|
|
8787
|
+
type: "action",
|
|
8788
|
+
body:[
|
|
8789
|
+
{
|
|
8790
|
+
type: "action",
|
|
8791
|
+
body:[
|
|
8792
|
+
treeSchema
|
|
8793
|
+
],
|
|
8794
|
+
className:"h-full w-[240px]"
|
|
8795
|
+
}
|
|
8796
|
+
],
|
|
8797
|
+
className: "absolute inset-0 steedos-select-user-sidebar",
|
|
8798
|
+
"onEvent": {
|
|
8799
|
+
"click": {
|
|
8800
|
+
"actions": [
|
|
8801
|
+
{
|
|
8802
|
+
"actionType": "custom",
|
|
8803
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
|
|
8804
|
+
}
|
|
8805
|
+
]
|
|
8806
|
+
}
|
|
8807
|
+
},
|
|
8808
|
+
id: "steedos_crud_toolbar_select_user_tree"
|
|
8809
|
+
});
|
|
8810
|
+
tree.push({
|
|
8811
|
+
"type": "button",
|
|
8812
|
+
"label": "组织",
|
|
8813
|
+
"icon": "fa fa-sitemap",
|
|
8814
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8815
|
+
"align": "left",
|
|
8816
|
+
"onEvent": {
|
|
8817
|
+
"click": {
|
|
8818
|
+
"actions": [
|
|
8819
|
+
{
|
|
8820
|
+
"actionType": "custom",
|
|
8821
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
|
|
8822
|
+
}
|
|
8823
|
+
]
|
|
8824
|
+
}
|
|
8825
|
+
},
|
|
8826
|
+
"id": "steedos_crud_toolbar_organization_button"
|
|
8827
|
+
});
|
|
8828
|
+
}else {
|
|
8829
|
+
tree.push(treeSchema);
|
|
8830
|
+
}
|
|
8831
|
+
|
|
8912
8832
|
return tree;
|
|
8913
8833
|
}
|
|
8914
8834
|
|
|
@@ -8923,24 +8843,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8923
8843
|
ctx.objectName = refObjectConfig.name;
|
|
8924
8844
|
|
|
8925
8845
|
let tableFields = [];
|
|
8926
|
-
let i = 0;
|
|
8927
8846
|
const searchableFields = [];
|
|
8928
8847
|
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
const listName = "all";
|
|
8848
|
+
let fieldsArr = [];
|
|
8932
8849
|
|
|
8933
8850
|
const isMobile = window.innerWidth < 768;
|
|
8934
8851
|
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
(listView, name) => name === listName
|
|
8938
|
-
);
|
|
8852
|
+
let listView = getLookupListView(refObjectConfig);
|
|
8853
|
+
let listName = listView && listView.name;
|
|
8939
8854
|
if (listView && listView.columns) {
|
|
8940
|
-
|
|
8941
|
-
if (
|
|
8855
|
+
_$1.each(listView.columns, function (column) {
|
|
8856
|
+
if (_$1.isString(column) && refObjectConfig.fields[column]) {
|
|
8942
8857
|
fieldsArr.push(refObjectConfig.fields[column]);
|
|
8943
|
-
} else if (
|
|
8858
|
+
} else if (_$1.isObject(column) && refObjectConfig.fields[column.field]) {
|
|
8944
8859
|
fieldsArr.push(
|
|
8945
8860
|
Object.assign({}, refObjectConfig.fields[column.field], {
|
|
8946
8861
|
width: column.width,
|
|
@@ -8950,28 +8865,27 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8950
8865
|
}
|
|
8951
8866
|
});
|
|
8952
8867
|
}else {
|
|
8953
|
-
|
|
8868
|
+
_$1.each(refObjectConfig.fields, (field, field_name)=>{
|
|
8954
8869
|
if(field_name != '_id' && !field.hidden){
|
|
8955
|
-
if(!
|
|
8870
|
+
if(!_$1.has(field, "name")){
|
|
8956
8871
|
field.name = field_name;
|
|
8957
8872
|
}
|
|
8958
8873
|
fieldsArr.push(field);
|
|
8959
8874
|
}
|
|
8960
8875
|
});
|
|
8876
|
+
// 没有视图权限时,取对象上前5个字段,按sort_no排序
|
|
8877
|
+
fieldsArr = _$1.sortBy(fieldsArr, "sort_no").slice(0,5);
|
|
8961
8878
|
}
|
|
8962
8879
|
|
|
8963
|
-
|
|
8964
|
-
if(
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
i++;
|
|
8969
|
-
tableFields.push(field);
|
|
8970
|
-
}
|
|
8880
|
+
_$1.each(fieldsArr,function(field){
|
|
8881
|
+
if(!_$1.find(tableFields, function(f){
|
|
8882
|
+
return f.name === field.name
|
|
8883
|
+
})){
|
|
8884
|
+
tableFields.push(field);
|
|
8971
8885
|
}
|
|
8972
8886
|
});
|
|
8973
8887
|
|
|
8974
|
-
|
|
8888
|
+
_$1.each(refObjectConfig.fields, function (field) {
|
|
8975
8889
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
8976
8890
|
searchableFields.push(field.name);
|
|
8977
8891
|
}
|
|
@@ -8982,7 +8896,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8982
8896
|
[referenceTo.valueField.name]: referenceTo.valueField
|
|
8983
8897
|
};
|
|
8984
8898
|
|
|
8985
|
-
|
|
8899
|
+
_$1.each(tableFields, (tableField)=>{
|
|
8986
8900
|
if(!tableField.hidden){
|
|
8987
8901
|
fields[tableField.name] = tableField;
|
|
8988
8902
|
}
|
|
@@ -8998,7 +8912,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8998
8912
|
if(source.url && !ctx.inFilterForm){
|
|
8999
8913
|
const depend_on = [];
|
|
9000
8914
|
const sendOn = [];
|
|
9001
|
-
|
|
8915
|
+
_$1.each(field.depend_on, (fName)=>{
|
|
9002
8916
|
depend_on.push(`depend_on_${fName}=\${${fName}}`);
|
|
9003
8917
|
sendOn.push(`this.${fName}`);
|
|
9004
8918
|
});
|
|
@@ -9161,13 +9075,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9161
9075
|
}
|
|
9162
9076
|
|
|
9163
9077
|
let pickerSchema = null;
|
|
9164
|
-
|
|
9165
|
-
pickerSchema = await getListSchema$1(tableFields, {
|
|
9166
|
-
top: top,
|
|
9167
|
-
...ctx,
|
|
9168
|
-
actions: false
|
|
9169
|
-
});
|
|
9170
|
-
}else {
|
|
9078
|
+
{
|
|
9171
9079
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
9172
9080
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
9173
9081
|
top: top,
|
|
@@ -9178,13 +9086,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9178
9086
|
pickerSchema.affixHeader = false;
|
|
9179
9087
|
|
|
9180
9088
|
var headerToolbarItems = [];
|
|
9181
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
"margin-left":"330px",
|
|
9185
|
-
"min-height": "300px"
|
|
9186
|
-
};
|
|
9187
|
-
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9089
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9090
|
+
headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
|
|
9091
|
+
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
9188
9092
|
}
|
|
9189
9093
|
|
|
9190
9094
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
@@ -9280,13 +9184,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
9280
9184
|
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
9281
9185
|
}
|
|
9282
9186
|
|
|
9187
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
|
|
9188
|
+
//手机端选人控件只保留部分toolbar
|
|
9189
|
+
pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
|
|
9190
|
+
if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id) > -1){
|
|
9191
|
+
return true;
|
|
9192
|
+
}else {
|
|
9193
|
+
return false;
|
|
9194
|
+
}
|
|
9195
|
+
});
|
|
9196
|
+
pickerSchema.footerToolbar = ["pagination"];
|
|
9197
|
+
}
|
|
9198
|
+
|
|
9283
9199
|
const data = {
|
|
9284
9200
|
type: getAmisStaticFieldType('picker', readonly),
|
|
9285
9201
|
modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
9286
9202
|
labelField: referenceTo.labelField.name,
|
|
9287
9203
|
valueField: referenceTo.valueField.name,
|
|
9288
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9289
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9204
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9205
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9290
9206
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
9291
9207
|
source: source,
|
|
9292
9208
|
size: "lg",
|
|
@@ -9352,10 +9268,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9352
9268
|
}
|
|
9353
9269
|
|
|
9354
9270
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
9355
|
-
|
|
9356
|
-
refObjectConfig.list_views,
|
|
9357
|
-
(listView, name) => name === "all"
|
|
9358
|
-
);
|
|
9271
|
+
let listView = getLookupListView(refObjectConfig);
|
|
9359
9272
|
|
|
9360
9273
|
let sort = "";
|
|
9361
9274
|
if(listView){
|
|
@@ -9366,7 +9279,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9366
9279
|
if(apiInfo.url && !ctx.inFilterForm){
|
|
9367
9280
|
const depend_on = [];
|
|
9368
9281
|
const sendOn = [];
|
|
9369
|
-
|
|
9282
|
+
_$1.each(field.depend_on, (fName)=>{
|
|
9370
9283
|
depend_on.push(`depend_on_${fName}=\${${fName}}`);
|
|
9371
9284
|
sendOn.push(`this.${fName}`);
|
|
9372
9285
|
});
|
|
@@ -9379,7 +9292,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9379
9292
|
apiInfo.data.$term = "$term";
|
|
9380
9293
|
// apiInfo.data.$value = `$${field.name}.${referenceTo ? referenceTo.valueField.name : '_id'}`;
|
|
9381
9294
|
apiInfo.data.$value = ctx.isRefToMutiple ? `$${field.name}.ids` : `$${field.name}`;
|
|
9382
|
-
|
|
9295
|
+
_$1.each(field.depend_on, function(fName){
|
|
9383
9296
|
apiInfo.data[fName] = `$${fName}`;
|
|
9384
9297
|
});
|
|
9385
9298
|
apiInfo.data['$'] = `$$`;
|
|
@@ -9466,8 +9379,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9466
9379
|
joinValues: false,
|
|
9467
9380
|
extractValue: true,
|
|
9468
9381
|
clearable: true,
|
|
9469
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9470
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9382
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9383
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9471
9384
|
// labelField: labelField,
|
|
9472
9385
|
// valueField: valueField,
|
|
9473
9386
|
source: apiInfo,
|
|
@@ -9520,7 +9433,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9520
9433
|
tpl: getRelatedFieldTpl(field, ctx)
|
|
9521
9434
|
}
|
|
9522
9435
|
}
|
|
9523
|
-
if(field.reference_to && !
|
|
9436
|
+
if(field.reference_to && !_$1.isString(field.reference_to) && !readonly){
|
|
9524
9437
|
return {
|
|
9525
9438
|
type: 'steedos-field-lookup',
|
|
9526
9439
|
field,
|
|
@@ -9536,6 +9449,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9536
9449
|
}
|
|
9537
9450
|
|
|
9538
9451
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
9452
|
+
ctx.onlyDisplayLookLabel = true;
|
|
9539
9453
|
if(ctx.idsDependOn){
|
|
9540
9454
|
// ids人员点选模式
|
|
9541
9455
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
@@ -9549,7 +9463,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9549
9463
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
9550
9464
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
9551
9465
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
9552
|
-
if(refObject.enable_enhanced_lookup == true &&
|
|
9466
|
+
if(refObject.enable_enhanced_lookup == true && _$1.isEmpty(field.depend_on)){
|
|
9553
9467
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
9554
9468
|
}else if(refObject.enable_tree) {
|
|
9555
9469
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -9589,7 +9503,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9589
9503
|
|
|
9590
9504
|
const tableFields = [referenceTo.labelField];
|
|
9591
9505
|
|
|
9592
|
-
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
|
|
9506
|
+
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
9593
9507
|
|
|
9594
9508
|
source.data.$term = "$term";
|
|
9595
9509
|
source.data.$self = "$$";
|
|
@@ -9598,6 +9512,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9598
9512
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
9599
9513
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
9600
9514
|
}
|
|
9515
|
+
|
|
9516
|
+
let listView = getLookupListView(refObjectConfig);
|
|
9517
|
+
let sort = "";
|
|
9518
|
+
if(listView){
|
|
9519
|
+
sort = getListViewSort(listView);
|
|
9520
|
+
}
|
|
9601
9521
|
|
|
9602
9522
|
source.requestAdaptor = `
|
|
9603
9523
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -9605,6 +9525,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9605
9525
|
var pageSize = api.data.pageSize || 1000;
|
|
9606
9526
|
var pageNo = api.data.pageNo || 1;
|
|
9607
9527
|
var skip = (pageNo - 1) * pageSize;
|
|
9528
|
+
var orderBy = api.data.orderBy || '';
|
|
9529
|
+
var orderDir = api.data.orderDir || '';
|
|
9530
|
+
var sort = orderBy + ' ' + orderDir;
|
|
9531
|
+
sort = orderBy ? sort : "${sort}";
|
|
9608
9532
|
if(selfData.op === 'loadOptions' && selfData.value){
|
|
9609
9533
|
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
9610
9534
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
|
|
@@ -9622,7 +9546,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9622
9546
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
9623
9547
|
}
|
|
9624
9548
|
|
|
9625
|
-
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
|
|
9549
|
+
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
|
|
9626
9550
|
return api;
|
|
9627
9551
|
`;
|
|
9628
9552
|
|
|
@@ -9639,6 +9563,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9639
9563
|
pickerSchema = await getTableSchema$1(tableFields, {
|
|
9640
9564
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
9641
9565
|
top: top,
|
|
9566
|
+
isLookup: true,
|
|
9642
9567
|
...ctx
|
|
9643
9568
|
});
|
|
9644
9569
|
|
|
@@ -9652,8 +9577,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9652
9577
|
valueField: referenceTo.valueField.name,
|
|
9653
9578
|
modalMode: 'dialog',
|
|
9654
9579
|
source: source,
|
|
9655
|
-
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey
|
|
9656
|
-
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
9580
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
9581
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
9657
9582
|
size: "lg",
|
|
9658
9583
|
pickerSchema: pickerSchema,
|
|
9659
9584
|
joinValues: false,
|
|
@@ -9681,8 +9606,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
9681
9606
|
/*
|
|
9682
9607
|
* @Author: baozhoutao@steedos.com
|
|
9683
9608
|
* @Date: 2023-01-13 17:27:54
|
|
9684
|
-
* @LastEditors:
|
|
9685
|
-
* @LastEditTime: 2023-
|
|
9609
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9610
|
+
* @LastEditTime: 2023-08-28 17:45:38
|
|
9686
9611
|
* @Description:
|
|
9687
9612
|
*/
|
|
9688
9613
|
|
|
@@ -9744,18 +9669,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
9744
9669
|
|
|
9745
9670
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
9746
9671
|
if(readonly){
|
|
9672
|
+
// return {
|
|
9673
|
+
// "type": "control",
|
|
9674
|
+
// "label": field.label,
|
|
9675
|
+
// "body": {
|
|
9676
|
+
// "type": "html",
|
|
9677
|
+
// "name": field.name
|
|
9678
|
+
// }
|
|
9679
|
+
// }
|
|
9747
9680
|
return {
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9681
|
+
"type": "input-rich-text",
|
|
9682
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
9683
|
+
"name": field.name,
|
|
9684
|
+
"options": {
|
|
9685
|
+
"menu": {
|
|
9686
|
+
"insert": {
|
|
9687
|
+
"title": "Insert",
|
|
9688
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
9689
|
+
}
|
|
9690
|
+
},
|
|
9691
|
+
"plugins": [
|
|
9692
|
+
"autoresize"
|
|
9693
|
+
],
|
|
9694
|
+
// "max_height": 2000,
|
|
9695
|
+
"statusbar": false,
|
|
9696
|
+
"readonly": true,
|
|
9697
|
+
"toolbar": false,
|
|
9698
|
+
"menubar": false
|
|
9754
9699
|
}
|
|
9700
|
+
}
|
|
9755
9701
|
}else {
|
|
9756
9702
|
return {
|
|
9757
9703
|
"type": "input-rich-text",
|
|
9758
9704
|
"receiver": "${context.rootUrl}/s3/images",
|
|
9705
|
+
"options":{
|
|
9706
|
+
"menu": {
|
|
9707
|
+
"insert": {
|
|
9708
|
+
"title": "Insert",
|
|
9709
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
9710
|
+
}
|
|
9711
|
+
}
|
|
9712
|
+
},
|
|
9759
9713
|
"name": field.name
|
|
9760
9714
|
}
|
|
9761
9715
|
// return {
|
|
@@ -9801,14 +9755,17 @@ const AmisFormInputs = [
|
|
|
9801
9755
|
|
|
9802
9756
|
function getAmisStaticFieldType(type, readonly, options){
|
|
9803
9757
|
if(!readonly){
|
|
9804
|
-
if(
|
|
9758
|
+
if(_$1.includes(AmisFormInputs, type)){
|
|
9805
9759
|
return `input-${type}`;
|
|
9806
9760
|
}else if(type === 'location'){
|
|
9807
9761
|
return "location-picker"
|
|
9808
9762
|
}
|
|
9809
9763
|
return type;
|
|
9810
9764
|
}
|
|
9811
|
-
if(
|
|
9765
|
+
if(_$1.includes(['text','image'], type)){
|
|
9766
|
+
if('text' === type && options && options.amis && options.amis.tpl){
|
|
9767
|
+
return 'static';
|
|
9768
|
+
}
|
|
9812
9769
|
if('image' === type && options && options.multiple){
|
|
9813
9770
|
return `static-images`;
|
|
9814
9771
|
}
|
|
@@ -9998,8 +9955,8 @@ function getAmisFieldType(sField){
|
|
|
9998
9955
|
}
|
|
9999
9956
|
function getObjectFieldSubFields(mainField, fields){
|
|
10000
9957
|
const newMainField = Object.assign({subFields: []}, mainField);
|
|
10001
|
-
const subFields =
|
|
10002
|
-
let result = field.name.startsWith(`${mainField.name}.`) &&
|
|
9958
|
+
const subFields = _$1.filter(fields, function(field){
|
|
9959
|
+
let result = field.name.startsWith(`${mainField.name}.`) && _$1.split(field.name, ".").length < 3;
|
|
10003
9960
|
if(result){
|
|
10004
9961
|
field._prefix = `${mainField.name}.`;
|
|
10005
9962
|
}
|
|
@@ -10011,7 +9968,7 @@ function getObjectFieldSubFields(mainField, fields){
|
|
|
10011
9968
|
|
|
10012
9969
|
function getGridFieldSubFields(mainField, fields){
|
|
10013
9970
|
const newMainField = Object.assign({subFields: []}, mainField);
|
|
10014
|
-
const subFields =
|
|
9971
|
+
const subFields = _$1.filter(fields, function(field){
|
|
10015
9972
|
let result = field.name.startsWith(`${mainField.name}.`);
|
|
10016
9973
|
if(result){
|
|
10017
9974
|
field._prefix = `${mainField.name}.`;
|
|
@@ -10030,13 +9987,13 @@ function getGridFieldSubFields(mainField, fields){
|
|
|
10030
9987
|
function getPermissionFields(object, userSession){
|
|
10031
9988
|
const permissionFields = [];
|
|
10032
9989
|
const fieldsArr = [];
|
|
10033
|
-
|
|
10034
|
-
if(!
|
|
9990
|
+
_$1.each(object.fields , (field, field_name)=>{
|
|
9991
|
+
if(!_$1.has(field, "name")){
|
|
10035
9992
|
field.name = field_name;
|
|
10036
9993
|
}
|
|
10037
9994
|
fieldsArr.push(field);
|
|
10038
9995
|
});
|
|
10039
|
-
|
|
9996
|
+
_$1.each(_$1.sortBy(fieldsArr, "sort_no"), function(field){
|
|
10040
9997
|
if(!field.hidden){
|
|
10041
9998
|
permissionFields.push( Object.assign({}, field, {permission: {allowEdit: true}}));
|
|
10042
9999
|
}
|
|
@@ -10048,7 +10005,7 @@ function getGridFieldSubFields(mainField, fields){
|
|
|
10048
10005
|
function getSelectFieldOptions(field){
|
|
10049
10006
|
const dataType = field.data_type || 'text';
|
|
10050
10007
|
const options = [];
|
|
10051
|
-
|
|
10008
|
+
_$1.each(field.options, (item)=>{
|
|
10052
10009
|
switch (dataType) {
|
|
10053
10010
|
case 'number':
|
|
10054
10011
|
options.push({label: item.label, value: Number(item.value), icon: item.icon});
|
|
@@ -10068,10 +10025,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10068
10025
|
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
10069
10026
|
const isMobile = window.innerWidth <= 768;
|
|
10070
10027
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
10071
|
-
if(
|
|
10028
|
+
if(_$1.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
10072
10029
|
return;
|
|
10073
10030
|
}
|
|
10074
|
-
const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required:
|
|
10031
|
+
const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: _$1.has(ctx, 'required') ? ctx.required : field.required};
|
|
10075
10032
|
let convertData = {
|
|
10076
10033
|
};
|
|
10077
10034
|
// if(_.includes(OMIT_FIELDS, field.name)){
|
|
@@ -10079,7 +10036,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10079
10036
|
// }
|
|
10080
10037
|
switch (field.type) {
|
|
10081
10038
|
case 'text':
|
|
10082
|
-
convertData.type = getAmisStaticFieldType('text', readonly);
|
|
10039
|
+
convertData.type = getAmisStaticFieldType('text', readonly, field);
|
|
10083
10040
|
break;
|
|
10084
10041
|
case 'textarea':
|
|
10085
10042
|
convertData.type = getAmisStaticFieldType('textarea', readonly);
|
|
@@ -10519,14 +10476,14 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10519
10476
|
}
|
|
10520
10477
|
break;
|
|
10521
10478
|
}
|
|
10522
|
-
if(!
|
|
10479
|
+
if(!_$1.isEmpty(convertData)){
|
|
10523
10480
|
if(field.is_wide || convertData.type === 'group'){
|
|
10524
10481
|
convertData.className = 'col-span-2 m-1';
|
|
10525
10482
|
}else {
|
|
10526
10483
|
convertData.className = 'm-1';
|
|
10527
10484
|
}
|
|
10528
10485
|
if(readonly){
|
|
10529
|
-
convertData.className = `${convertData.className}
|
|
10486
|
+
convertData.className = `${convertData.className} border-b`;
|
|
10530
10487
|
}
|
|
10531
10488
|
if(readonly){
|
|
10532
10489
|
convertData.quickEdit = false;
|
|
@@ -10548,7 +10505,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
10548
10505
|
}
|
|
10549
10506
|
}
|
|
10550
10507
|
|
|
10551
|
-
if(
|
|
10508
|
+
if(_$1.isString(baseData.required)){
|
|
10552
10509
|
if(baseData.required.startsWith("{{")){
|
|
10553
10510
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
10554
10511
|
delete baseData.required;
|
|
@@ -10663,7 +10620,7 @@ if(typeof window != 'undefined'){
|
|
|
10663
10620
|
|
|
10664
10621
|
|
|
10665
10622
|
function isFieldTypeSearchable(fieldType) {
|
|
10666
|
-
return !
|
|
10623
|
+
return !_$1.includes(
|
|
10667
10624
|
[
|
|
10668
10625
|
"grid",
|
|
10669
10626
|
"avatar",
|
|
@@ -10735,7 +10692,7 @@ async function getQuickEditSchema(field, options){
|
|
|
10735
10692
|
if (field.disabled) {
|
|
10736
10693
|
quickEditSchema = false;
|
|
10737
10694
|
} else {
|
|
10738
|
-
var fieldSchema = await convertSFieldToAmisField(field, false,
|
|
10695
|
+
var fieldSchema = await convertSFieldToAmisField(field, false, _$1.omit(options, 'buttons'));
|
|
10739
10696
|
//存在属性上可编辑,实际不可编辑的字段,convertSFieldToAmisField函数可能会返回undefined,如summary
|
|
10740
10697
|
if (!!fieldSchema) {
|
|
10741
10698
|
quickEditSchema.body.push(fieldSchema);
|
|
@@ -10996,7 +10953,10 @@ function getFieldWidth(width){
|
|
|
10996
10953
|
}
|
|
10997
10954
|
|
|
10998
10955
|
async function getTableColumns$1(fields, options){
|
|
10999
|
-
const columns = [
|
|
10956
|
+
const columns = [];
|
|
10957
|
+
if(!options.isLookup){
|
|
10958
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
10959
|
+
}
|
|
11000
10960
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
11001
10961
|
|
|
11002
10962
|
for (const field of fields) {
|
|
@@ -11132,7 +11092,7 @@ async function getTableColumns$1(fields, options){
|
|
|
11132
11092
|
}
|
|
11133
11093
|
}
|
|
11134
11094
|
// columns.push(getOperation(fields));
|
|
11135
|
-
if(!
|
|
11095
|
+
if(!_$1.some(columns, { name: options.labelFieldName })){
|
|
11136
11096
|
const href = Router$1.getObjectDetailPath({
|
|
11137
11097
|
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
11138
11098
|
});
|
|
@@ -11231,7 +11191,7 @@ async function getMobileTableColumns(fields, options){
|
|
|
11231
11191
|
let tpl = "";
|
|
11232
11192
|
if(field.is_name || field.name === options.labelFieldName){
|
|
11233
11193
|
nameField = field;
|
|
11234
|
-
options.
|
|
11194
|
+
options.onlyDisplayLookLabel = true;
|
|
11235
11195
|
tpl = await getFieldTpl(field, options);
|
|
11236
11196
|
}
|
|
11237
11197
|
else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
@@ -11240,12 +11200,13 @@ async function getMobileTableColumns(fields, options){
|
|
|
11240
11200
|
}
|
|
11241
11201
|
else {
|
|
11242
11202
|
if(field.type === 'lookup' || field.type === 'master_detail'){
|
|
11243
|
-
options.
|
|
11203
|
+
options.onlyDisplayLookLabel = true;
|
|
11244
11204
|
}
|
|
11245
11205
|
tpl = await getFieldTpl(field, options);
|
|
11246
11206
|
}
|
|
11247
11207
|
if(!tpl){
|
|
11248
|
-
|
|
11208
|
+
//qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
|
|
11209
|
+
tpl = `\${${field.name} | raw}`;
|
|
11249
11210
|
}
|
|
11250
11211
|
if(!field.hidden && !field.extra){
|
|
11251
11212
|
tpls.push({ field, tpl });
|
|
@@ -11441,7 +11402,12 @@ async function getTableSchema$1(fields, options){
|
|
|
11441
11402
|
options = {};
|
|
11442
11403
|
}
|
|
11443
11404
|
let columns = [];
|
|
11444
|
-
|
|
11405
|
+
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
11406
|
+
if(isLookup){
|
|
11407
|
+
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
11408
|
+
useMobileColumns = false;
|
|
11409
|
+
}
|
|
11410
|
+
if(useMobileColumns){
|
|
11445
11411
|
columns = await getMobileTableColumns(fields, options);
|
|
11446
11412
|
}
|
|
11447
11413
|
else {
|
|
@@ -11461,7 +11427,7 @@ async function getTableSchema$1(fields, options){
|
|
|
11461
11427
|
columns: columns,
|
|
11462
11428
|
syncLocation: false,
|
|
11463
11429
|
keepItemSelectionOnPageChange: true,
|
|
11464
|
-
checkOnItemClick: false,
|
|
11430
|
+
checkOnItemClick: isLookup ? true : false,
|
|
11465
11431
|
labelTpl: `\${${options.labelFieldName}}`,
|
|
11466
11432
|
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
11467
11433
|
columnsTogglable: false,
|
|
@@ -11481,8 +11447,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11481
11447
|
const searchableFields = [];
|
|
11482
11448
|
let { filter, filtersFunction, sort, top, setDataToComponentId = '' } = options;
|
|
11483
11449
|
|
|
11484
|
-
if(
|
|
11485
|
-
filter =
|
|
11450
|
+
if(_$1.isArray(filter)){
|
|
11451
|
+
filter = _$1.map(filter, function(item){
|
|
11486
11452
|
if(item.operation){
|
|
11487
11453
|
return [item.field, item.operation, item.value];
|
|
11488
11454
|
}else {
|
|
@@ -11498,7 +11464,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11498
11464
|
baseFilters = filter;
|
|
11499
11465
|
}
|
|
11500
11466
|
|
|
11501
|
-
|
|
11467
|
+
_$1.each(mainObject.fields, function (field) {
|
|
11502
11468
|
if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
|
|
11503
11469
|
searchableFields.push(field.name);
|
|
11504
11470
|
}
|
|
@@ -11509,7 +11475,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11509
11475
|
// 含有optionsFunction属性, 无reference_to属性的lookup字段
|
|
11510
11476
|
const lookupFields = {};
|
|
11511
11477
|
fields.forEach((item)=>{
|
|
11512
|
-
if(
|
|
11478
|
+
if(_$1.includes(['image','avatar','file'], item.type)){
|
|
11513
11479
|
fileFieldsKeys.push(item.name);
|
|
11514
11480
|
fileFields[item.name] = {
|
|
11515
11481
|
name: item.name,
|
|
@@ -11517,7 +11483,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11517
11483
|
multiple: item.multiple
|
|
11518
11484
|
};
|
|
11519
11485
|
}
|
|
11520
|
-
if(
|
|
11486
|
+
if(_$1.includes(['lookup'], item.type) && !item.reference_to ){
|
|
11521
11487
|
lookupFields[item.name] = item;
|
|
11522
11488
|
}
|
|
11523
11489
|
});
|
|
@@ -11692,7 +11658,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11692
11658
|
sort: sort.trim(),
|
|
11693
11659
|
pageSize: pageSize,
|
|
11694
11660
|
skip: skip,
|
|
11695
|
-
fields: ${JSON.stringify(
|
|
11661
|
+
fields: ${JSON.stringify(_$1.map(fields, 'name'))}
|
|
11696
11662
|
}));
|
|
11697
11663
|
return api;
|
|
11698
11664
|
`;
|
|
@@ -11833,10 +11799,10 @@ const API_CACHE = 100;
|
|
|
11833
11799
|
|
|
11834
11800
|
function getReadonlyFormAdaptor(object, fields, options){
|
|
11835
11801
|
let scriptStr = '';
|
|
11836
|
-
const selectFields =
|
|
11837
|
-
const gridAndObjectFieldsName =
|
|
11838
|
-
|
|
11839
|
-
if(!
|
|
11802
|
+
const selectFields = _$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
|
|
11803
|
+
const gridAndObjectFieldsName = _$1.map(_$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
|
|
11804
|
+
_$1.each(selectFields, function(field){
|
|
11805
|
+
if(!_$1.includes(OMIT_FIELDS, field.name)){
|
|
11840
11806
|
field.name;
|
|
11841
11807
|
if(field.options){
|
|
11842
11808
|
const options = JSON.stringify({options: field.options});
|
|
@@ -11869,7 +11835,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
11869
11835
|
// }
|
|
11870
11836
|
// })
|
|
11871
11837
|
|
|
11872
|
-
var fieldNames =
|
|
11838
|
+
var fieldNames = _$1.map(fields, function(n){return n.name});
|
|
11873
11839
|
return `
|
|
11874
11840
|
if(payload.data.data.length === 0){
|
|
11875
11841
|
var isEditor = !!${options && options.isEditor};
|
|
@@ -11942,7 +11908,7 @@ function getScriptForAddUrlPrefixForImgFields(fields){
|
|
|
11942
11908
|
let imgFieldsKeys = [];
|
|
11943
11909
|
let imgFields = {};
|
|
11944
11910
|
fields.forEach((item)=>{
|
|
11945
|
-
if(
|
|
11911
|
+
if(_$1.includes(['image','avatar'], item.type)){
|
|
11946
11912
|
imgFieldsKeys.push(item.name);
|
|
11947
11913
|
imgFields[item.name] = {
|
|
11948
11914
|
name: item.name,
|
|
@@ -12085,7 +12051,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
12085
12051
|
var defaultValues = {};
|
|
12086
12052
|
_.each(uiSchema && uiSchema.fields, function(field){
|
|
12087
12053
|
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
12088
|
-
if(value){
|
|
12054
|
+
if(!_.isNil(value)){
|
|
12089
12055
|
defaultValues[field.name] = value;
|
|
12090
12056
|
}
|
|
12091
12057
|
});
|
|
@@ -12199,8 +12165,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
12199
12165
|
top = 200;
|
|
12200
12166
|
}
|
|
12201
12167
|
|
|
12202
|
-
if (
|
|
12203
|
-
filter =
|
|
12168
|
+
if (_$1__default.isArray(filter)) {
|
|
12169
|
+
filter = _$1__default.map(filter, function (item) {
|
|
12204
12170
|
if (item.operation) {
|
|
12205
12171
|
return [item.field, item.operation, item.value];
|
|
12206
12172
|
} else {
|
|
@@ -12212,7 +12178,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
12212
12178
|
filter = [];
|
|
12213
12179
|
}
|
|
12214
12180
|
|
|
12215
|
-
|
|
12181
|
+
_$1__default.each(fields, function (field) {
|
|
12216
12182
|
if (field.searchable) {
|
|
12217
12183
|
searchableFields.push(field.name);
|
|
12218
12184
|
}
|
|
@@ -12743,16 +12709,17 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
12743
12709
|
/*
|
|
12744
12710
|
* @Author: baozhoutao@steedos.com
|
|
12745
12711
|
* @Date: 2022-05-26 16:02:08
|
|
12746
|
-
* @LastEditors:
|
|
12747
|
-
* @LastEditTime: 2023-
|
|
12712
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12713
|
+
* @LastEditTime: 2023-09-05 15:42:26
|
|
12748
12714
|
* @Description:
|
|
12749
12715
|
*/
|
|
12750
12716
|
|
|
12751
|
-
const getFieldSchemaArray = (formFields) => {
|
|
12717
|
+
const getFieldSchemaArray = (formFields, ctx) => {
|
|
12752
12718
|
let fieldSchemaArray = [];
|
|
12753
12719
|
fieldSchemaArray.length = 0;
|
|
12720
|
+
const recordId = ctx && ctx.recordId;
|
|
12754
12721
|
|
|
12755
|
-
|
|
12722
|
+
_$1.forEach(formFields, (field) => {
|
|
12756
12723
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
12757
12724
|
field.group = instance.t('frontend_field_group_generalization');
|
|
12758
12725
|
const fieldName = field.name;
|
|
@@ -12762,8 +12729,14 @@ const getFieldSchemaArray = (formFields) => {
|
|
|
12762
12729
|
field.is_wide = true;
|
|
12763
12730
|
}
|
|
12764
12731
|
|
|
12732
|
+
let forceHidden = false;
|
|
12733
|
+
if(!recordId && field.readonly){
|
|
12734
|
+
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
12735
|
+
forceHidden = true;
|
|
12736
|
+
}
|
|
12737
|
+
|
|
12765
12738
|
if (!isObjectField) {
|
|
12766
|
-
if (!field.hidden) {
|
|
12739
|
+
if (!field.hidden && !forceHidden) {
|
|
12767
12740
|
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
12768
12741
|
}
|
|
12769
12742
|
}
|
|
@@ -12775,8 +12748,8 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12775
12748
|
if (!ctx) {
|
|
12776
12749
|
ctx = {};
|
|
12777
12750
|
}
|
|
12778
|
-
const sectionFields =
|
|
12779
|
-
if (sectionFields.length ==
|
|
12751
|
+
const sectionFields = _$1.filter(fieldSchemaArray, { 'group': sectionName });
|
|
12752
|
+
if (sectionFields.length == _$1.filter(sectionFields, ['hidden', true]).length) {
|
|
12780
12753
|
return;
|
|
12781
12754
|
}
|
|
12782
12755
|
|
|
@@ -12802,7 +12775,7 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12802
12775
|
}
|
|
12803
12776
|
|
|
12804
12777
|
// fieldSet 已支持显隐控制
|
|
12805
|
-
const sectionFieldsVisibleOn =
|
|
12778
|
+
const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12806
12779
|
let visible = visibleOn;
|
|
12807
12780
|
if(visible.indexOf('${')>-1){
|
|
12808
12781
|
visible = visible.substring(visible.indexOf('{')+1, visible.indexOf('}'));
|
|
@@ -12834,8 +12807,8 @@ const getSections = async (permissionFields, formFields, ctx) => {
|
|
|
12834
12807
|
if (!ctx) {
|
|
12835
12808
|
ctx = {};
|
|
12836
12809
|
}
|
|
12837
|
-
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
12838
|
-
const _sections =
|
|
12810
|
+
const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
|
|
12811
|
+
const _sections = _$1.groupBy(fieldSchemaArray, 'group');
|
|
12839
12812
|
const sections = [];
|
|
12840
12813
|
var sectionVisibleOns = [];
|
|
12841
12814
|
for (const key in _sections) {
|
|
@@ -13025,7 +12998,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13025
12998
|
const table = await getTableSchema$1(fields, Object.assign({idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName, permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit}, options));
|
|
13026
12999
|
delete table.mode;
|
|
13027
13000
|
//image与avatar需要在提交修改时特别处理
|
|
13028
|
-
const imageNames =
|
|
13001
|
+
const imageNames = _$1__default.compact(_$1__default.map(_$1__default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
13029
13002
|
const quickSaveApiRequestAdaptor = `
|
|
13030
13003
|
var graphqlOrder = "";
|
|
13031
13004
|
var imageNames = ${JSON.stringify(imageNames)};
|
|
@@ -13055,7 +13028,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13055
13028
|
}
|
|
13056
13029
|
`;
|
|
13057
13030
|
let autoFillHeight = true;
|
|
13058
|
-
if(options.isRelated ||
|
|
13031
|
+
if(options.isRelated || window.innerWidth < 768){
|
|
13059
13032
|
autoFillHeight = false;
|
|
13060
13033
|
}
|
|
13061
13034
|
|
|
@@ -13096,16 +13069,16 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
13096
13069
|
if (headerSchema || footerSchema) {
|
|
13097
13070
|
let wrappedBody = [body];
|
|
13098
13071
|
if (headerSchema) {
|
|
13099
|
-
if(
|
|
13100
|
-
wrappedBody =
|
|
13072
|
+
if(_$1__default.isArray(headerSchema)){
|
|
13073
|
+
wrappedBody = _$1__default.union(headerSchema,wrappedBody);
|
|
13101
13074
|
}
|
|
13102
13075
|
else {
|
|
13103
13076
|
wrappedBody.unshift(headerSchema);
|
|
13104
13077
|
}
|
|
13105
13078
|
}
|
|
13106
13079
|
if (footerSchema) {
|
|
13107
|
-
if(
|
|
13108
|
-
wrappedBody =
|
|
13080
|
+
if(_$1__default.isArray(footerSchema)){
|
|
13081
|
+
wrappedBody = _$1__default.union(wrappedBody,footerSchema);
|
|
13109
13082
|
}
|
|
13110
13083
|
else {
|
|
13111
13084
|
wrappedBody.push(footerSchema);
|
|
@@ -13148,7 +13121,7 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13148
13121
|
|
|
13149
13122
|
let fields = {};
|
|
13150
13123
|
// 以uiSchema fields 为基础, 遍历字段, 并更新字段定义
|
|
13151
|
-
|
|
13124
|
+
_$1__default.forEach(objectSchema.fields, (field, fieldName)=>{
|
|
13152
13125
|
if(!lodash.has(field, "name")){
|
|
13153
13126
|
field.name = fieldName;
|
|
13154
13127
|
}
|
|
@@ -13159,9 +13132,9 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13159
13132
|
}
|
|
13160
13133
|
});
|
|
13161
13134
|
|
|
13162
|
-
if(!
|
|
13135
|
+
if(!_$1__default.isEmpty(includedFields) && _$1__default.isArray(includedFields)){
|
|
13163
13136
|
const includedFieldsMap = {};
|
|
13164
|
-
|
|
13137
|
+
_$1__default.each(includedFields, (fName, index)=>{
|
|
13165
13138
|
if(fields[fName]){
|
|
13166
13139
|
includedFieldsMap[fName] = Object.assign({}, fields[fName], {sort_no: index});
|
|
13167
13140
|
}
|
|
@@ -13169,21 +13142,21 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
13169
13142
|
fields = includedFieldsMap;
|
|
13170
13143
|
}
|
|
13171
13144
|
|
|
13172
|
-
if(!
|
|
13173
|
-
|
|
13145
|
+
if(!_$1__default.isEmpty(excludedFields) && _$1__default.isArray(excludedFields)){
|
|
13146
|
+
_$1__default.each(excludedFields, (fName)=>{
|
|
13174
13147
|
delete fields[fName];
|
|
13175
13148
|
});
|
|
13176
13149
|
}
|
|
13177
13150
|
|
|
13178
|
-
return lodash.sortBy(
|
|
13151
|
+
return lodash.sortBy(_$1__default.values(fields), "sort_no");
|
|
13179
13152
|
};
|
|
13180
13153
|
|
|
13181
13154
|
async function getObjectForm(objectSchema, ctx){
|
|
13182
13155
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults } = ctx;
|
|
13183
|
-
const fields =
|
|
13156
|
+
const fields = _$1__default.values(objectSchema.fields);
|
|
13184
13157
|
const formFields = getFormFields(objectSchema, ctx);
|
|
13185
13158
|
const formSchema = defaults && defaults.formSchema || {};
|
|
13186
|
-
if(
|
|
13159
|
+
if(_$1__default.has(formSchema, 'className')){
|
|
13187
13160
|
formSchema.className = 'steedos-amis-form';
|
|
13188
13161
|
}
|
|
13189
13162
|
if(!formSchema.id){
|
|
@@ -13267,7 +13240,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
13267
13240
|
|
|
13268
13241
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
13269
13242
|
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, formInitProps } = ctx;
|
|
13270
|
-
const fields =
|
|
13243
|
+
const fields = _$1__default.values(objectSchema.fields);
|
|
13271
13244
|
const formFields = getFormFields(objectSchema, ctx);
|
|
13272
13245
|
const serviceId = `service_detail_page`;
|
|
13273
13246
|
return {
|
|
@@ -13428,7 +13401,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
13428
13401
|
* @Author: baozhoutao@steedos.com
|
|
13429
13402
|
* @Date: 2022-07-05 15:55:39
|
|
13430
13403
|
* @LastEditors: liaodaxue
|
|
13431
|
-
* @LastEditTime: 2023-08-
|
|
13404
|
+
* @LastEditTime: 2023-08-28 14:55:23
|
|
13432
13405
|
* @Description:
|
|
13433
13406
|
*/
|
|
13434
13407
|
|
|
@@ -13574,11 +13547,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
13574
13547
|
// }
|
|
13575
13548
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
13576
13549
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
13550
|
+
const isMobile = window.innerWidth < 768;
|
|
13551
|
+
let headerToolbar = [];
|
|
13552
|
+
if(!isMobile){
|
|
13553
|
+
headerToolbar.push("bulkActions");
|
|
13554
|
+
}
|
|
13577
13555
|
const options = {
|
|
13578
13556
|
globalFilter,
|
|
13579
13557
|
defaults: {
|
|
13580
13558
|
listSchema: {
|
|
13581
|
-
headerToolbar
|
|
13559
|
+
headerToolbar,
|
|
13582
13560
|
columnsTogglable: false,
|
|
13583
13561
|
onEvent: {
|
|
13584
13562
|
[`@data.changed.${relatedObjectName}`]: {
|
|
@@ -13843,14 +13821,14 @@ function getListViewFilter(listView){
|
|
|
13843
13821
|
const userId = getUserId();
|
|
13844
13822
|
let filters = listView.filters;
|
|
13845
13823
|
if(listView.filter_scope === 'mine'){
|
|
13846
|
-
if(
|
|
13824
|
+
if(_$1__default.isEmpty(filters)){
|
|
13847
13825
|
filters = [["owner", "=", userId]];
|
|
13848
13826
|
}else {
|
|
13849
|
-
if(
|
|
13827
|
+
if(_$1__default.isString(filters) && _$1__default.startsWith(_$1__default.trim(filters), "function")){
|
|
13850
13828
|
filters = new Function(`return ${filters}`);
|
|
13851
13829
|
filters = filters();
|
|
13852
13830
|
}
|
|
13853
|
-
if(
|
|
13831
|
+
if(_$1__default.isArray(filters)){
|
|
13854
13832
|
filters.push(["owner", "=", userId]);
|
|
13855
13833
|
}else {
|
|
13856
13834
|
console.debug(`listView filters is not array`, listView);
|
|
@@ -13868,7 +13846,7 @@ function formatUISchemaCache(objectName, uiSchema){
|
|
|
13868
13846
|
setUISchemaCache(objectName, uiSchema);
|
|
13869
13847
|
each(uiSchema.fields, (field)=>{
|
|
13870
13848
|
try {
|
|
13871
|
-
if(field.type === "lookup" && field._reference_to &&
|
|
13849
|
+
if(field.type === "lookup" && field._reference_to && _$1__default.isString(field._reference_to)){
|
|
13872
13850
|
field.reference_to = eval(`(${field._reference_to})`)();
|
|
13873
13851
|
}
|
|
13874
13852
|
} catch (exception) {
|
|
@@ -14894,12 +14872,12 @@ const conditionItemToFilters = (item) => {
|
|
|
14894
14872
|
// }
|
|
14895
14873
|
const filterToConditionItem = (filter) => {
|
|
14896
14874
|
if (filter.length === 3) {
|
|
14897
|
-
const op =
|
|
14875
|
+
const op = _$1__default.findKey(opMaps, (value) => {
|
|
14898
14876
|
return value === filter[1];
|
|
14899
14877
|
});
|
|
14900
14878
|
if (
|
|
14901
14879
|
op === "between" &&
|
|
14902
|
-
|
|
14880
|
+
_$1__default.includes(DATE_DATETIME_BETWEEN_VALUES, filter[2])
|
|
14903
14881
|
) {
|
|
14904
14882
|
return {
|
|
14905
14883
|
left: {
|
|
@@ -14924,7 +14902,7 @@ const filterToConditionItem = (filter) => {
|
|
|
14924
14902
|
};
|
|
14925
14903
|
|
|
14926
14904
|
const filterObjectToArray = (filter) => {
|
|
14927
|
-
if (!
|
|
14905
|
+
if (!_$1__default.isArray(filter) && _$1__default.isObject(filter)) {
|
|
14928
14906
|
return [filter.field, filter.operation, filter.value];
|
|
14929
14907
|
}
|
|
14930
14908
|
return filter;
|
|
@@ -16912,8 +16890,8 @@ const getUserApprove = ({ instance, userId }) => {
|
|
|
16912
16890
|
//传阅的approve返回最新一条
|
|
16913
16891
|
if (!currentApprove || currentApprove.type == "cc") {
|
|
16914
16892
|
// 当前是传阅
|
|
16915
|
-
|
|
16916
|
-
|
|
16893
|
+
_$1__default.each(instance.traces, function (t) {
|
|
16894
|
+
_$1__default.each(t.approves, function (a) {
|
|
16917
16895
|
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
16918
16896
|
currentApprove = a;
|
|
16919
16897
|
}
|
|
@@ -17003,7 +16981,7 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
17003
16981
|
|
|
17004
16982
|
while (i >= 0) {
|
|
17005
16983
|
if (!trace_id && traces[i].is_finished) {
|
|
17006
|
-
|
|
16984
|
+
_$1__default.each(traces[i].approves, function (ap) {
|
|
17007
16985
|
if (!trace_id) {
|
|
17008
16986
|
if (
|
|
17009
16987
|
ap.is_finished &&
|
|
@@ -17026,7 +17004,7 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
17026
17004
|
};
|
|
17027
17005
|
|
|
17028
17006
|
const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
17029
|
-
return
|
|
17007
|
+
return _$1__default.includes(_$1__default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
17030
17008
|
};
|
|
17031
17009
|
|
|
17032
17010
|
const getInstanceInfo = async ({ instanceId, box }) => {
|
|
@@ -17095,7 +17073,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17095
17073
|
step = getStep({ flowVersion, stepId: trace.step });
|
|
17096
17074
|
}
|
|
17097
17075
|
|
|
17098
|
-
let currentStep = getStep({ flowVersion, stepId:
|
|
17076
|
+
let currentStep = getStep({ flowVersion, stepId: _$1__default.last(instance.traces).step });
|
|
17099
17077
|
|
|
17100
17078
|
const lastCCStep = getLastCCStep(instance, userId);
|
|
17101
17079
|
|
|
@@ -17127,7 +17105,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17127
17105
|
approveValues: values,
|
|
17128
17106
|
title: instance.name || instance.form.name,
|
|
17129
17107
|
name: instance.name || instance.form.name,
|
|
17130
|
-
fields:
|
|
17108
|
+
fields: _$1__default.map(formVersion.fields, (field) => {
|
|
17131
17109
|
return Object.assign({}, field, {
|
|
17132
17110
|
permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
17133
17111
|
}) ;
|
|
@@ -17145,10 +17123,10 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17145
17123
|
forward_from_instance: instance.forward_from_instance,
|
|
17146
17124
|
cc_users: instance.cc_users,
|
|
17147
17125
|
traces: instance.traces,
|
|
17148
|
-
historyApproves:
|
|
17126
|
+
historyApproves: _$1__default.map(instance.traces, (trace) => {
|
|
17149
17127
|
return Object.assign(
|
|
17150
17128
|
{
|
|
17151
|
-
children:
|
|
17129
|
+
children: _$1__default.map(trace.approves, (approve) => {
|
|
17152
17130
|
let finishDate = approve.finish_date;
|
|
17153
17131
|
let judge = approve.judge;
|
|
17154
17132
|
let userName = approve.user_name;
|
|
@@ -17519,7 +17497,7 @@ var AmisObjectButton = function (props) {
|
|
|
17519
17497
|
delete schema.body[0]['visibleOn'];
|
|
17520
17498
|
}
|
|
17521
17499
|
if (schema && className) {
|
|
17522
|
-
schema.className = schema.className + ' ' + className;
|
|
17500
|
+
schema.className = schema.className + ' steedos-object-button ' + className;
|
|
17523
17501
|
}
|
|
17524
17502
|
var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
|
|
17525
17503
|
if (data._id) {
|
|
@@ -17540,7 +17518,7 @@ var AmisObjectButton = function (props) {
|
|
|
17540
17518
|
}))) : null));
|
|
17541
17519
|
}
|
|
17542
17520
|
else {
|
|
17543
|
-
return (React.createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default ".concat(className ? className : '') }, button.label));
|
|
17521
|
+
return (React.createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default steedos-object-button ".concat(className ? className : '') }, button.label));
|
|
17544
17522
|
}
|
|
17545
17523
|
};
|
|
17546
17524
|
|
|
@@ -17916,7 +17894,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
17916
17894
|
body: [{
|
|
17917
17895
|
"type": "wrapper",
|
|
17918
17896
|
"size": "none",
|
|
17919
|
-
"className": "flex flex-1
|
|
17897
|
+
"className": "flex flex-1 h-full",
|
|
17920
17898
|
body: [
|
|
17921
17899
|
sideSchema ? {
|
|
17922
17900
|
"type": "wrapper",
|
|
@@ -18351,6 +18329,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18351
18329
|
if (isMobile) {
|
|
18352
18330
|
dialogSchema = {
|
|
18353
18331
|
"type": "service",
|
|
18332
|
+
"className": "steedos-apps-service",
|
|
18354
18333
|
"affixFooter": false,
|
|
18355
18334
|
"body": [
|
|
18356
18335
|
{
|
|
@@ -18587,7 +18566,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
18587
18566
|
],
|
|
18588
18567
|
}
|
|
18589
18568
|
],
|
|
18590
|
-
"className": "",
|
|
18569
|
+
"className": "steedos-apps-service",
|
|
18591
18570
|
"visibleOn": "",
|
|
18592
18571
|
"clearValueOnHidden": false,
|
|
18593
18572
|
"visible": true,
|
|
@@ -18721,7 +18700,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
18721
18700
|
schemaApi: {
|
|
18722
18701
|
"method": "get",
|
|
18723
18702
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
18724
|
-
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18703
|
+
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n return groupLength + tab.index;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
18725
18704
|
"headers": {
|
|
18726
18705
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18727
18706
|
}
|
|
@@ -18772,7 +18751,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18772
18751
|
schemaApi: {
|
|
18773
18752
|
"method": "get",
|
|
18774
18753
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
|
|
18775
|
-
"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
|
|
18754
|
+
"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 payload.children = _.sortBy(payload.children, function(tab){\n return tab.index;\n })\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 \"index\": tab.index\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 \"index\": tab.index\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: \"").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=' 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=\"!fill-slate-500 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 "),
|
|
18776
18755
|
"headers": {
|
|
18777
18756
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
18778
18757
|
}
|
|
@@ -18787,7 +18766,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18787
18766
|
* @Author: baozhoutao@steedos.com
|
|
18788
18767
|
* @Date: 2022-09-01 14:44:57
|
|
18789
18768
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
18790
|
-
* @LastEditTime: 2023-08-
|
|
18769
|
+
* @LastEditTime: 2023-08-28 15:04:28
|
|
18791
18770
|
* @Description:
|
|
18792
18771
|
*/
|
|
18793
18772
|
var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -18932,7 +18911,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
18932
18911
|
"name": "notifications",
|
|
18933
18912
|
"items": {
|
|
18934
18913
|
"type": "tpl",
|
|
18935
|
-
"tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=moment(data.created).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
|
|
18914
|
+
"tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=moment(data.created).locale(data.global.user.language).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
|
|
18936
18915
|
"id": "u:07ece657c7b7",
|
|
18937
18916
|
"onEvent": {
|
|
18938
18917
|
"click": {
|
|
@@ -19482,8 +19461,8 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
19482
19461
|
/*
|
|
19483
19462
|
* @Author: baozhoutao@steedos.com
|
|
19484
19463
|
* @Date: 2023-01-14 16:41:24
|
|
19485
|
-
* @LastEditors:
|
|
19486
|
-
* @LastEditTime: 2023-
|
|
19464
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
19465
|
+
* @LastEditTime: 2023-09-05 17:06:44
|
|
19487
19466
|
* @Description:
|
|
19488
19467
|
*/
|
|
19489
19468
|
var getSelectFlowSchema = function (id, props) {
|
|
@@ -19631,7 +19610,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
19631
19610
|
method: "post",
|
|
19632
19611
|
url: "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
19633
19612
|
requestAdaptor: "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || "", "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
|
|
19634
|
-
adaptor: "\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n return payload;\n ",
|
|
19613
|
+
adaptor: "\n var options = payload.data.options;\n if(options){\n options.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n }\n if(payload.data.options.length === 1 && payload.data.options[0].children.length === 1){\n payload.data.value = payload.data.options[0].children[0].value\n }\n return payload;\n ",
|
|
19635
19614
|
"headers": {
|
|
19636
19615
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
19637
19616
|
}
|
|
@@ -19877,7 +19856,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
19877
19856
|
});
|
|
19878
19857
|
}); };
|
|
19879
19858
|
|
|
19880
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=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 s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return 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,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),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=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message: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},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19859
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=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 s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return 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,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&(r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message: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},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
19881
19860
|
|
|
19882
19861
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
19883
19862
|
__proto__: null,
|