@steedos-widgets/amis-lib 3.6.14 → 6.3.0-beta.10
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +139 -65
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +139 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +48 -39
- package/dist/index.umd.js.map +1 -1
- package/dist/types/schema/standard_delete.amis.d.ts +1 -0
- package/dist/types/schema/standard_edit.amis.d.ts +13 -0
- package/dist/types/schema/standard_new.amis.d.ts +1 -1
- package/dist/types/standard/button.d.ts +15 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -570,10 +570,23 @@ function getNameTpl(field, ctx){
|
|
|
570
570
|
if(ctx && ctx.isLookup){
|
|
571
571
|
linkTarget = "target='_blank'";
|
|
572
572
|
}
|
|
573
|
+
let nameLabel = field.name;
|
|
574
|
+
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
575
|
+
if (field.type == "lookup") {
|
|
576
|
+
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
577
|
+
if(!field.isTableField){
|
|
578
|
+
nameLabel = `\${${field.name}__label}`;
|
|
579
|
+
}
|
|
580
|
+
} else {
|
|
581
|
+
nameLabel = `\${_display.${field.name}.label}`;
|
|
582
|
+
}
|
|
583
|
+
} else {
|
|
584
|
+
nameLabel = `\${_display.${field.name} || ${field.name}}`;
|
|
585
|
+
}
|
|
573
586
|
if(ctx.isRelated && window.innerWidth >= 768){
|
|
574
|
-
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${
|
|
587
|
+
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
|
|
575
588
|
}else {
|
|
576
|
-
return `<a href="${href}" ${linkTarget}>\${${
|
|
589
|
+
return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
|
|
577
590
|
}
|
|
578
591
|
}
|
|
579
592
|
|
|
@@ -698,7 +711,7 @@ function getLocationTpl(field){
|
|
|
698
711
|
}
|
|
699
712
|
|
|
700
713
|
async function getFieldTpl (field, options){
|
|
701
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
714
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
|
|
702
715
|
return getNameTpl(field, options)
|
|
703
716
|
}
|
|
704
717
|
switch (field.type) {
|
|
@@ -2319,7 +2332,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2319
2332
|
"title": " ",
|
|
2320
2333
|
"headerClassName": "hidden",
|
|
2321
2334
|
"size": "lg",
|
|
2322
|
-
"bodyClassName": "p-0 m-0",
|
|
2335
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2323
2336
|
"closeOnEsc": true,
|
|
2324
2337
|
"closeOnOutside": true,
|
|
2325
2338
|
"resizable": true,
|
|
@@ -3255,6 +3268,19 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3255
3268
|
// })
|
|
3256
3269
|
|
|
3257
3270
|
var fieldNames = _$1.map(fields, function(n){return n.name});
|
|
3271
|
+
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
3272
|
+
let nameLabel = nameField && nameField.name;
|
|
3273
|
+
if (nameField && nameField.type == "lookup") {
|
|
3274
|
+
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
3275
|
+
if(!nameField.isTableField){
|
|
3276
|
+
nameLabel = `record.${nameField.name}__label`;
|
|
3277
|
+
}
|
|
3278
|
+
} else {
|
|
3279
|
+
nameLabel = `record._display.${nameField.name}.label`;
|
|
3280
|
+
}
|
|
3281
|
+
} else if (nameField){
|
|
3282
|
+
nameLabel = `record._display.${nameField.name} || record.${nameField.name}`;
|
|
3283
|
+
}
|
|
3258
3284
|
return `
|
|
3259
3285
|
if(payload.data.data.length === 0){
|
|
3260
3286
|
var isEditor = !!${options && options.isEditor};
|
|
@@ -3296,8 +3322,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3296
3322
|
payload.data = data;
|
|
3297
3323
|
payload.data.__objectName = "${object.name}";
|
|
3298
3324
|
payload.data.record = record;
|
|
3299
|
-
|
|
3300
|
-
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
3325
|
+
payload.data.NAME_FIELD_VALUE = ${nameLabel} || record.name;
|
|
3301
3326
|
payload.data._master = {
|
|
3302
3327
|
record: record,
|
|
3303
3328
|
objectName: "${object.name}",
|
|
@@ -4764,7 +4789,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4764
4789
|
type: 'button',
|
|
4765
4790
|
actionType: 'confirm',
|
|
4766
4791
|
label: i18next.t('frontend_form_save'),
|
|
4767
|
-
primary: true
|
|
4792
|
+
primary: true,
|
|
4793
|
+
close: `object_actions_drawer_${uiSchema.name}`
|
|
4768
4794
|
},
|
|
4769
4795
|
]
|
|
4770
4796
|
}
|
|
@@ -4883,6 +4909,20 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4883
4909
|
]
|
|
4884
4910
|
}
|
|
4885
4911
|
},
|
|
4912
|
+
"actions": [
|
|
4913
|
+
{
|
|
4914
|
+
type: 'button',
|
|
4915
|
+
actionType: 'cancel',
|
|
4916
|
+
label: i18next.t('frontend_form_cancel')
|
|
4917
|
+
},
|
|
4918
|
+
{
|
|
4919
|
+
type: 'button',
|
|
4920
|
+
actionType: 'confirm',
|
|
4921
|
+
label: i18next.t('frontend_form_save'),
|
|
4922
|
+
primary: true,
|
|
4923
|
+
close: `object_actions_drawer_${uiSchema.name}`
|
|
4924
|
+
},
|
|
4925
|
+
]
|
|
4886
4926
|
},
|
|
4887
4927
|
},
|
|
4888
4928
|
],
|
|
@@ -4964,7 +5004,8 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
4964
5004
|
}
|
|
4965
5005
|
]
|
|
4966
5006
|
}
|
|
4967
|
-
}
|
|
5007
|
+
},
|
|
5008
|
+
"close": `object_actions_drawer_${uiSchema.name}`
|
|
4968
5009
|
}
|
|
4969
5010
|
],
|
|
4970
5011
|
"regions": [
|
|
@@ -8899,10 +8940,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8899
8940
|
}
|
|
8900
8941
|
}
|
|
8901
8942
|
`;
|
|
8902
|
-
let autoFillHeight = true;
|
|
8903
|
-
if(options.isRelated || window.innerWidth < 768){
|
|
8904
|
-
autoFillHeight = false;
|
|
8905
|
-
}
|
|
8906
8943
|
|
|
8907
8944
|
body = Object.assign({}, table, {
|
|
8908
8945
|
type: 'crud',
|
|
@@ -8913,7 +8950,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8913
8950
|
keepItemSelectionOnPageChange: true,
|
|
8914
8951
|
api: await getTableApi(objectSchema, fields, options),
|
|
8915
8952
|
hiddenOn: options.tableHiddenOn,
|
|
8916
|
-
autoFillHeight
|
|
8953
|
+
// autoFillHeight,//autoFillHeight按amis规范默认为false,需要配置此属性时在各个组件层配置,比如列表视图组件那边传入此属性为true
|
|
8917
8954
|
className: `flex-auto ${crudClassName || ""}`,
|
|
8918
8955
|
// 这里不可以用动态className,因为它会把样式类加到.antd-Crud和.antd-Table.antd-Crud-body这两层div中,而子表列表中crudClassName中有hidden样式类会造成所有子表都不显示的bug
|
|
8919
8956
|
// className: {
|
|
@@ -9086,6 +9123,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
9086
9123
|
async function getObjectForm(objectSchema, ctx){
|
|
9087
9124
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
9088
9125
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
9126
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
9127
|
+
if (typeof ctx.enableTabs !== 'boolean') {
|
|
9128
|
+
ctx.enableTabs = objectSchema.enable_form_tabs;
|
|
9129
|
+
}
|
|
9089
9130
|
const fields = ___default.values(objectSchema.fields);
|
|
9090
9131
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
9091
9132
|
const formSchema = defaults && defaults.formSchema || {};
|
|
@@ -9179,7 +9220,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9179
9220
|
|
|
9180
9221
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
9181
9222
|
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
9182
|
-
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
9223
|
+
formDataFilter, onFormDataFilter, amisData, env, enableInitApi } = ctx;
|
|
9183
9224
|
const fields = ___default.values(objectSchema.fields);
|
|
9184
9225
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
9185
9226
|
const serviceId = `service_detail_page`;
|
|
@@ -9246,6 +9287,16 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
9246
9287
|
// }
|
|
9247
9288
|
};
|
|
9248
9289
|
|
|
9290
|
+
if(enableInitApi){
|
|
9291
|
+
amisSchema.api = await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx);
|
|
9292
|
+
// 开启初始化api请求时,如果不把recordLoaded默认设置为false,recordLoaded值会取RecordServic组件中的recordLoaded值
|
|
9293
|
+
// 这会造成表单内steedos field组件lookup字段中props.data取到的是RecordServic组件
|
|
9294
|
+
amisSchema.data = {
|
|
9295
|
+
...amisSchema.data,
|
|
9296
|
+
recordLoaded: false
|
|
9297
|
+
};
|
|
9298
|
+
}
|
|
9299
|
+
|
|
9249
9300
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
9250
9301
|
// console.log('getObjectDetail=====>', amisSchema);
|
|
9251
9302
|
return amisSchema;
|
|
@@ -9737,7 +9788,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9737
9788
|
* @Author: baozhoutao@steedos.com
|
|
9738
9789
|
* @Date: 2022-07-05 15:55:39
|
|
9739
9790
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9740
|
-
* @LastEditTime: 2024-
|
|
9791
|
+
* @LastEditTime: 2024-04-26 16:46:44
|
|
9741
9792
|
* @Description:
|
|
9742
9793
|
*/
|
|
9743
9794
|
|
|
@@ -10002,37 +10053,44 @@ async function getListSchema(
|
|
|
10002
10053
|
* 本次存储代码段
|
|
10003
10054
|
*/
|
|
10004
10055
|
try {
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10056
|
+
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
10057
|
+
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
10058
|
+
/**
|
|
10059
|
+
* localListViewProps规范来自crud请求api中api.data.$self参数值的。
|
|
10060
|
+
* 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
|
|
10061
|
+
* __searchable__...:顶部放大镜搜索条件
|
|
10062
|
+
* filter:右侧过滤器
|
|
10063
|
+
* perPage:每页条数
|
|
10064
|
+
* page:当前页码
|
|
10065
|
+
* orderBy:排序字段
|
|
10066
|
+
* orderDir:排序方向
|
|
10067
|
+
*/
|
|
10068
|
+
if (localListViewProps) {
|
|
10069
|
+
localListViewProps = JSON.parse(localListViewProps);
|
|
10070
|
+
// localListViewProps.perPage = 3;
|
|
10071
|
+
let listSchema = {};
|
|
10072
|
+
if (localListViewProps.orderBy) {
|
|
10073
|
+
listSchema.orderBy = localListViewProps.orderBy;
|
|
10074
|
+
}
|
|
10075
|
+
if (localListViewProps.orderDir) {
|
|
10076
|
+
listSchema.orderDir = localListViewProps.orderDir;
|
|
10077
|
+
}
|
|
10027
10078
|
|
|
10028
|
-
|
|
10029
|
-
|
|
10079
|
+
if (localListViewProps.perPage) {
|
|
10080
|
+
listSchema.perPage = localListViewProps.perPage;
|
|
10081
|
+
}
|
|
10082
|
+
defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
|
|
10030
10083
|
}
|
|
10031
|
-
defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
|
|
10032
|
-
}
|
|
10033
10084
|
}
|
|
10034
10085
|
catch (ex) {
|
|
10035
|
-
|
|
10086
|
+
console.error("本地存储中crud参数解析异常:", ex);
|
|
10087
|
+
}
|
|
10088
|
+
|
|
10089
|
+
if (window.innerWidth > 768) {
|
|
10090
|
+
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
|
|
10091
|
+
defaults.listSchema = defaultsDeep$1({}, defaults.listSchema || {}, {
|
|
10092
|
+
autoFillHeight: true
|
|
10093
|
+
});
|
|
10036
10094
|
}
|
|
10037
10095
|
|
|
10038
10096
|
ctx.defaults = defaults;
|
|
@@ -10082,15 +10140,15 @@ async function getListSchema(
|
|
|
10082
10140
|
async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
10083
10141
|
let fields = [];
|
|
10084
10142
|
for (const column of columns) {
|
|
10143
|
+
let columnField, fieldName, displayName, filedInfo, rfUiSchema, rfFieldInfo;
|
|
10085
10144
|
if (isString(column)) {
|
|
10086
|
-
let columnField;
|
|
10087
10145
|
if (column.indexOf('.') > 0) {
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10146
|
+
fieldName = column.split('.')[0];
|
|
10147
|
+
displayName = column.split('.')[1];
|
|
10148
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
10091
10149
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10092
|
-
|
|
10093
|
-
|
|
10150
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10151
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10094
10152
|
columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
|
|
10095
10153
|
}else if(filedInfo && filedInfo.type === 'object'){
|
|
10096
10154
|
columnField = uiSchema.fields[column];
|
|
@@ -10114,14 +10172,13 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10114
10172
|
}
|
|
10115
10173
|
|
|
10116
10174
|
} else if (isObject$1(column)) {
|
|
10117
|
-
let columnField;
|
|
10118
10175
|
if (column.field.indexOf('.') > 0) {
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10176
|
+
fieldName = column.field.split('.')[0];
|
|
10177
|
+
displayName = column.field.split('.')[1];
|
|
10178
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
10122
10179
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10123
|
-
|
|
10124
|
-
|
|
10180
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10181
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10125
10182
|
columnField = Object.assign({}, rfFieldInfo, ctx,
|
|
10126
10183
|
{ name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
|
|
10127
10184
|
{
|
|
@@ -10129,6 +10186,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10129
10186
|
wrap: column.wrap // wrap = true 是没效果的
|
|
10130
10187
|
}
|
|
10131
10188
|
);
|
|
10189
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
10190
|
+
columnField = uiSchema.fields[column.field];
|
|
10132
10191
|
}
|
|
10133
10192
|
} else {
|
|
10134
10193
|
if (uiSchema.fields[column.field]) {
|
|
@@ -10263,7 +10322,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10263
10322
|
};
|
|
10264
10323
|
const content = {
|
|
10265
10324
|
"type": "tabs",
|
|
10266
|
-
"className": "steedos-record-tabs bg-white p-4
|
|
10325
|
+
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
10267
10326
|
"contentClassName": "bg-none",
|
|
10268
10327
|
"tabs": [
|
|
10269
10328
|
detailed
|
|
@@ -10339,6 +10398,10 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
10339
10398
|
data: {
|
|
10340
10399
|
"_master.objectName": "${objectName}",
|
|
10341
10400
|
"_master.recordId": "${recordId}",
|
|
10401
|
+
// 微页面设计器中用RecordServic组件包裹一个ObjectForm只读组件时,如果这里不把recordLoaded默认设置为false
|
|
10402
|
+
// recordLoaded值会取父作用域中已经被设置为true的值(比如父级有RecordServic组件,在加载完数据后,父作用域中recordLoaded值为true)
|
|
10403
|
+
// 这会造成表单内steedos field组件lookup字段中props.data取到的是父作用域中的数据
|
|
10404
|
+
"recordLoaded": false,
|
|
10342
10405
|
...(props.data || {})
|
|
10343
10406
|
},
|
|
10344
10407
|
"style": {
|
|
@@ -11227,7 +11290,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11227
11290
|
});
|
|
11228
11291
|
|
|
11229
11292
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11230
|
-
let autoFillMapping =
|
|
11293
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11231
11294
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11232
11295
|
autoFillMapping.forEach(function (item) {
|
|
11233
11296
|
if(!_$1.find(tableFields, function(f){
|
|
@@ -11377,7 +11440,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11377
11440
|
// 如果当前元素不是数组,则处理该元素
|
|
11378
11441
|
// 下面正则用于匹配amis公式\${}
|
|
11379
11442
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11380
|
-
arr[i] = currentAmis.evaluate(arr[i], api.data.$);
|
|
11443
|
+
arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
|
|
11381
11444
|
}
|
|
11382
11445
|
}
|
|
11383
11446
|
}
|
|
@@ -11699,7 +11762,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11699
11762
|
];
|
|
11700
11763
|
|
|
11701
11764
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11702
|
-
let autoFillMapping =
|
|
11765
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11703
11766
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11704
11767
|
autoFillMapping.forEach(function (item) {
|
|
11705
11768
|
queryFields.push(refObjectConfig.fields[item.from]);
|
|
@@ -11794,7 +11857,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11794
11857
|
// 如果当前元素不是数组,则处理该元素
|
|
11795
11858
|
// 下面正则用于匹配amis公式\${}
|
|
11796
11859
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11797
|
-
arr[i] = currentAmis.evaluate(arr[i], api.data.$);
|
|
11860
|
+
arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
|
|
11798
11861
|
}
|
|
11799
11862
|
}
|
|
11800
11863
|
}
|
|
@@ -11941,14 +12004,25 @@ async function getApi(object, recordId, fields, options){
|
|
|
11941
12004
|
}
|
|
11942
12005
|
|
|
11943
12006
|
async function getAutoFill(field, refObject) {
|
|
11944
|
-
let autoFillMapping =
|
|
12007
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11945
12008
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11946
12009
|
let fillMapping = {};
|
|
12010
|
+
if (field.multiple) {
|
|
12011
|
+
autoFillMapping.forEach(function (item) {
|
|
12012
|
+
//from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
|
|
12013
|
+
if (_$1.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
|
|
12014
|
+
fillMapping[item.to] = `\${items | pick:${item.from}}`;
|
|
12015
|
+
} else {
|
|
12016
|
+
fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
|
|
12017
|
+
}
|
|
12018
|
+
});
|
|
12019
|
+
}else {
|
|
12020
|
+
autoFillMapping.forEach(function (item) {
|
|
12021
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
12022
|
+
});
|
|
12023
|
+
}
|
|
11947
12024
|
// let fieldsForApi = [];
|
|
11948
|
-
|
|
11949
|
-
fillMapping[item.to] = `\${${item.from}}`;
|
|
11950
|
-
// fieldsForApi.push(item.from);
|
|
11951
|
-
});
|
|
12025
|
+
// fieldsForApi.push(item.from);
|
|
11952
12026
|
// let api = {
|
|
11953
12027
|
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11954
12028
|
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
@@ -12050,7 +12124,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12050
12124
|
amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
12051
12125
|
}
|
|
12052
12126
|
}
|
|
12053
|
-
const autoFill = await getAutoFill(field);
|
|
12127
|
+
const autoFill = await getAutoFill(field, refObject);
|
|
12054
12128
|
if(autoFill){
|
|
12055
12129
|
amisSchema.autoFill = autoFill;
|
|
12056
12130
|
// 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本
|