@steedos-widgets/amis-lib 3.6.13 → 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 +145 -68
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +145 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +50 -41
- 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.cjs.js
CHANGED
|
@@ -597,10 +597,23 @@ function getNameTpl(field, ctx){
|
|
|
597
597
|
if(ctx && ctx.isLookup){
|
|
598
598
|
linkTarget = "target='_blank'";
|
|
599
599
|
}
|
|
600
|
+
let nameLabel = field.name;
|
|
601
|
+
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
602
|
+
if (field.type == "lookup") {
|
|
603
|
+
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
604
|
+
if(!field.isTableField){
|
|
605
|
+
nameLabel = `\${${field.name}__label}`;
|
|
606
|
+
}
|
|
607
|
+
} else {
|
|
608
|
+
nameLabel = `\${_display.${field.name}.label}`;
|
|
609
|
+
}
|
|
610
|
+
} else {
|
|
611
|
+
nameLabel = `\${_display.${field.name} || ${field.name}}`;
|
|
612
|
+
}
|
|
600
613
|
if(ctx.isRelated && window.innerWidth >= 768){
|
|
601
|
-
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${
|
|
614
|
+
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
|
|
602
615
|
}else {
|
|
603
|
-
return `<a href="${href}" ${linkTarget}>\${${
|
|
616
|
+
return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
|
|
604
617
|
}
|
|
605
618
|
}
|
|
606
619
|
|
|
@@ -725,7 +738,7 @@ function getLocationTpl(field){
|
|
|
725
738
|
}
|
|
726
739
|
|
|
727
740
|
async function getFieldTpl (field, options){
|
|
728
|
-
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
|
|
741
|
+
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
|
|
729
742
|
return getNameTpl(field, options)
|
|
730
743
|
}
|
|
731
744
|
switch (field.type) {
|
|
@@ -1099,7 +1112,7 @@ function getRecordPermissionsQuery(object, recordId, options){
|
|
|
1099
1112
|
function getApi$2 (isMobile){
|
|
1100
1113
|
if(isMobile);else {
|
|
1101
1114
|
// return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
|
|
1102
|
-
return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
|
|
1115
|
+
return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
|
|
1103
1116
|
}
|
|
1104
1117
|
}
|
|
1105
1118
|
|
|
@@ -2346,7 +2359,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2346
2359
|
"title": " ",
|
|
2347
2360
|
"headerClassName": "hidden",
|
|
2348
2361
|
"size": "lg",
|
|
2349
|
-
"bodyClassName": "p-0 m-0",
|
|
2362
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2350
2363
|
"closeOnEsc": true,
|
|
2351
2364
|
"closeOnOutside": true,
|
|
2352
2365
|
"resizable": true,
|
|
@@ -3282,6 +3295,19 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3282
3295
|
// })
|
|
3283
3296
|
|
|
3284
3297
|
var fieldNames = ___namespace.map(fields, function(n){return n.name});
|
|
3298
|
+
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
3299
|
+
let nameLabel = nameField && nameField.name;
|
|
3300
|
+
if (nameField && nameField.type == "lookup") {
|
|
3301
|
+
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
3302
|
+
if(!nameField.isTableField){
|
|
3303
|
+
nameLabel = `record.${nameField.name}__label`;
|
|
3304
|
+
}
|
|
3305
|
+
} else {
|
|
3306
|
+
nameLabel = `record._display.${nameField.name}.label`;
|
|
3307
|
+
}
|
|
3308
|
+
} else if (nameField){
|
|
3309
|
+
nameLabel = `record._display.${nameField.name} || record.${nameField.name}`;
|
|
3310
|
+
}
|
|
3285
3311
|
return `
|
|
3286
3312
|
if(payload.data.data.length === 0){
|
|
3287
3313
|
var isEditor = !!${options && options.isEditor};
|
|
@@ -3323,8 +3349,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3323
3349
|
payload.data = data;
|
|
3324
3350
|
payload.data.__objectName = "${object.name}";
|
|
3325
3351
|
payload.data.record = record;
|
|
3326
|
-
|
|
3327
|
-
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
3352
|
+
payload.data.NAME_FIELD_VALUE = ${nameLabel} || record.name;
|
|
3328
3353
|
payload.data._master = {
|
|
3329
3354
|
record: record,
|
|
3330
3355
|
objectName: "${object.name}",
|
|
@@ -4791,7 +4816,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4791
4816
|
type: 'button',
|
|
4792
4817
|
actionType: 'confirm',
|
|
4793
4818
|
label: i18next__default["default"].t('frontend_form_save'),
|
|
4794
|
-
primary: true
|
|
4819
|
+
primary: true,
|
|
4820
|
+
close: `object_actions_drawer_${uiSchema.name}`
|
|
4795
4821
|
},
|
|
4796
4822
|
]
|
|
4797
4823
|
}
|
|
@@ -4910,6 +4936,20 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4910
4936
|
]
|
|
4911
4937
|
}
|
|
4912
4938
|
},
|
|
4939
|
+
"actions": [
|
|
4940
|
+
{
|
|
4941
|
+
type: 'button',
|
|
4942
|
+
actionType: 'cancel',
|
|
4943
|
+
label: i18next__default["default"].t('frontend_form_cancel')
|
|
4944
|
+
},
|
|
4945
|
+
{
|
|
4946
|
+
type: 'button',
|
|
4947
|
+
actionType: 'confirm',
|
|
4948
|
+
label: i18next__default["default"].t('frontend_form_save'),
|
|
4949
|
+
primary: true,
|
|
4950
|
+
close: `object_actions_drawer_${uiSchema.name}`
|
|
4951
|
+
},
|
|
4952
|
+
]
|
|
4913
4953
|
},
|
|
4914
4954
|
},
|
|
4915
4955
|
],
|
|
@@ -4991,7 +5031,8 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
4991
5031
|
}
|
|
4992
5032
|
]
|
|
4993
5033
|
}
|
|
4994
|
-
}
|
|
5034
|
+
},
|
|
5035
|
+
"close": `object_actions_drawer_${uiSchema.name}`
|
|
4995
5036
|
}
|
|
4996
5037
|
],
|
|
4997
5038
|
"regions": [
|
|
@@ -8310,6 +8351,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8310
8351
|
// const scope = event.context.scoped;
|
|
8311
8352
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
8312
8353
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
8354
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8355
|
+
if(!filterForm){
|
|
8356
|
+
return;
|
|
8357
|
+
}
|
|
8313
8358
|
let isLookup = event.data.isLookup;
|
|
8314
8359
|
let __lookupField = event.data.__lookupField;
|
|
8315
8360
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
@@ -8320,9 +8365,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8320
8365
|
}
|
|
8321
8366
|
__changedFilterFormValuesKey += lookupTag;
|
|
8322
8367
|
}
|
|
8323
|
-
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8324
8368
|
setTimeout(function(){
|
|
8325
|
-
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
8369
|
+
filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
8326
8370
|
}, 500);
|
|
8327
8371
|
`;
|
|
8328
8372
|
|
|
@@ -8923,10 +8967,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8923
8967
|
}
|
|
8924
8968
|
}
|
|
8925
8969
|
`;
|
|
8926
|
-
let autoFillHeight = true;
|
|
8927
|
-
if(options.isRelated || window.innerWidth < 768){
|
|
8928
|
-
autoFillHeight = false;
|
|
8929
|
-
}
|
|
8930
8970
|
|
|
8931
8971
|
body = Object.assign({}, table, {
|
|
8932
8972
|
type: 'crud',
|
|
@@ -8937,7 +8977,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8937
8977
|
keepItemSelectionOnPageChange: true,
|
|
8938
8978
|
api: await getTableApi(objectSchema, fields, options),
|
|
8939
8979
|
hiddenOn: options.tableHiddenOn,
|
|
8940
|
-
autoFillHeight
|
|
8980
|
+
// autoFillHeight,//autoFillHeight按amis规范默认为false,需要配置此属性时在各个组件层配置,比如列表视图组件那边传入此属性为true
|
|
8941
8981
|
className: `flex-auto ${crudClassName || ""}`,
|
|
8942
8982
|
// 这里不可以用动态className,因为它会把样式类加到.antd-Crud和.antd-Table.antd-Crud-body这两层div中,而子表列表中crudClassName中有hidden样式类会造成所有子表都不显示的bug
|
|
8943
8983
|
// className: {
|
|
@@ -9110,6 +9150,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
9110
9150
|
async function getObjectForm(objectSchema, ctx){
|
|
9111
9151
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
9112
9152
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
9153
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
9154
|
+
if (typeof ctx.enableTabs !== 'boolean') {
|
|
9155
|
+
ctx.enableTabs = objectSchema.enable_form_tabs;
|
|
9156
|
+
}
|
|
9113
9157
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
9114
9158
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
9115
9159
|
const formSchema = defaults && defaults.formSchema || {};
|
|
@@ -9203,7 +9247,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9203
9247
|
|
|
9204
9248
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
9205
9249
|
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
9206
|
-
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
9250
|
+
formDataFilter, onFormDataFilter, amisData, env, enableInitApi } = ctx;
|
|
9207
9251
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
9208
9252
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
9209
9253
|
const serviceId = `service_detail_page`;
|
|
@@ -9270,6 +9314,16 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
9270
9314
|
// }
|
|
9271
9315
|
};
|
|
9272
9316
|
|
|
9317
|
+
if(enableInitApi){
|
|
9318
|
+
amisSchema.api = await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx);
|
|
9319
|
+
// 开启初始化api请求时,如果不把recordLoaded默认设置为false,recordLoaded值会取RecordServic组件中的recordLoaded值
|
|
9320
|
+
// 这会造成表单内steedos field组件lookup字段中props.data取到的是RecordServic组件
|
|
9321
|
+
amisSchema.data = {
|
|
9322
|
+
...amisSchema.data,
|
|
9323
|
+
recordLoaded: false
|
|
9324
|
+
};
|
|
9325
|
+
}
|
|
9326
|
+
|
|
9273
9327
|
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
9274
9328
|
// console.log('getObjectDetail=====>', amisSchema);
|
|
9275
9329
|
return amisSchema;
|
|
@@ -9761,7 +9815,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9761
9815
|
* @Author: baozhoutao@steedos.com
|
|
9762
9816
|
* @Date: 2022-07-05 15:55:39
|
|
9763
9817
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9764
|
-
* @LastEditTime: 2024-
|
|
9818
|
+
* @LastEditTime: 2024-04-26 16:46:44
|
|
9765
9819
|
* @Description:
|
|
9766
9820
|
*/
|
|
9767
9821
|
|
|
@@ -10026,37 +10080,44 @@ async function getListSchema(
|
|
|
10026
10080
|
* 本次存储代码段
|
|
10027
10081
|
*/
|
|
10028
10082
|
try {
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10083
|
+
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
10084
|
+
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
10085
|
+
/**
|
|
10086
|
+
* localListViewProps规范来自crud请求api中api.data.$self参数值的。
|
|
10087
|
+
* 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
|
|
10088
|
+
* __searchable__...:顶部放大镜搜索条件
|
|
10089
|
+
* filter:右侧过滤器
|
|
10090
|
+
* perPage:每页条数
|
|
10091
|
+
* page:当前页码
|
|
10092
|
+
* orderBy:排序字段
|
|
10093
|
+
* orderDir:排序方向
|
|
10094
|
+
*/
|
|
10095
|
+
if (localListViewProps) {
|
|
10096
|
+
localListViewProps = JSON.parse(localListViewProps);
|
|
10097
|
+
// localListViewProps.perPage = 3;
|
|
10098
|
+
let listSchema = {};
|
|
10099
|
+
if (localListViewProps.orderBy) {
|
|
10100
|
+
listSchema.orderBy = localListViewProps.orderBy;
|
|
10101
|
+
}
|
|
10102
|
+
if (localListViewProps.orderDir) {
|
|
10103
|
+
listSchema.orderDir = localListViewProps.orderDir;
|
|
10104
|
+
}
|
|
10051
10105
|
|
|
10052
|
-
|
|
10053
|
-
|
|
10106
|
+
if (localListViewProps.perPage) {
|
|
10107
|
+
listSchema.perPage = localListViewProps.perPage;
|
|
10108
|
+
}
|
|
10109
|
+
defaults.listSchema = _$1.defaultsDeep({}, listSchema, defaults.listSchema || {});
|
|
10054
10110
|
}
|
|
10055
|
-
defaults.listSchema = _$1.defaultsDeep({}, listSchema, defaults.listSchema || {});
|
|
10056
|
-
}
|
|
10057
10111
|
}
|
|
10058
10112
|
catch (ex) {
|
|
10059
|
-
|
|
10113
|
+
console.error("本地存储中crud参数解析异常:", ex);
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
if (window.innerWidth > 768) {
|
|
10117
|
+
// 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
|
|
10118
|
+
defaults.listSchema = _$1.defaultsDeep({}, defaults.listSchema || {}, {
|
|
10119
|
+
autoFillHeight: true
|
|
10120
|
+
});
|
|
10060
10121
|
}
|
|
10061
10122
|
|
|
10062
10123
|
ctx.defaults = defaults;
|
|
@@ -10106,15 +10167,15 @@ async function getListSchema(
|
|
|
10106
10167
|
async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
10107
10168
|
let fields = [];
|
|
10108
10169
|
for (const column of columns) {
|
|
10170
|
+
let columnField, fieldName, displayName, filedInfo, rfUiSchema, rfFieldInfo;
|
|
10109
10171
|
if (_$1.isString(column)) {
|
|
10110
|
-
let columnField;
|
|
10111
10172
|
if (column.indexOf('.') > 0) {
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10173
|
+
fieldName = column.split('.')[0];
|
|
10174
|
+
displayName = column.split('.')[1];
|
|
10175
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
10115
10176
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
|
|
10116
|
-
|
|
10117
|
-
|
|
10177
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10178
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10118
10179
|
columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
|
|
10119
10180
|
}else if(filedInfo && filedInfo.type === 'object'){
|
|
10120
10181
|
columnField = uiSchema.fields[column];
|
|
@@ -10138,14 +10199,13 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10138
10199
|
}
|
|
10139
10200
|
|
|
10140
10201
|
} else if (_$1.isObject(column)) {
|
|
10141
|
-
let columnField;
|
|
10142
10202
|
if (column.field.indexOf('.') > 0) {
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10203
|
+
fieldName = column.field.split('.')[0];
|
|
10204
|
+
displayName = column.field.split('.')[1];
|
|
10205
|
+
filedInfo = uiSchema.fields[fieldName];
|
|
10146
10206
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
|
|
10147
|
-
|
|
10148
|
-
|
|
10207
|
+
rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10208
|
+
rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10149
10209
|
columnField = Object.assign({}, rfFieldInfo, ctx,
|
|
10150
10210
|
{ name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
|
|
10151
10211
|
{
|
|
@@ -10153,6 +10213,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10153
10213
|
wrap: column.wrap // wrap = true 是没效果的
|
|
10154
10214
|
}
|
|
10155
10215
|
);
|
|
10216
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
10217
|
+
columnField = uiSchema.fields[column.field];
|
|
10156
10218
|
}
|
|
10157
10219
|
} else {
|
|
10158
10220
|
if (uiSchema.fields[column.field]) {
|
|
@@ -10287,7 +10349,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10287
10349
|
};
|
|
10288
10350
|
const content = {
|
|
10289
10351
|
"type": "tabs",
|
|
10290
|
-
"className": "steedos-record-tabs bg-white p-4
|
|
10352
|
+
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
10291
10353
|
"contentClassName": "bg-none",
|
|
10292
10354
|
"tabs": [
|
|
10293
10355
|
detailed
|
|
@@ -10363,6 +10425,10 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
10363
10425
|
data: {
|
|
10364
10426
|
"_master.objectName": "${objectName}",
|
|
10365
10427
|
"_master.recordId": "${recordId}",
|
|
10428
|
+
// 微页面设计器中用RecordServic组件包裹一个ObjectForm只读组件时,如果这里不把recordLoaded默认设置为false
|
|
10429
|
+
// recordLoaded值会取父作用域中已经被设置为true的值(比如父级有RecordServic组件,在加载完数据后,父作用域中recordLoaded值为true)
|
|
10430
|
+
// 这会造成表单内steedos field组件lookup字段中props.data取到的是父作用域中的数据
|
|
10431
|
+
"recordLoaded": false,
|
|
10366
10432
|
...(props.data || {})
|
|
10367
10433
|
},
|
|
10368
10434
|
"style": {
|
|
@@ -11251,7 +11317,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11251
11317
|
});
|
|
11252
11318
|
|
|
11253
11319
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11254
|
-
let autoFillMapping =
|
|
11320
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11255
11321
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11256
11322
|
autoFillMapping.forEach(function (item) {
|
|
11257
11323
|
if(!___namespace.find(tableFields, function(f){
|
|
@@ -11401,7 +11467,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11401
11467
|
// 如果当前元素不是数组,则处理该元素
|
|
11402
11468
|
// 下面正则用于匹配amis公式\${}
|
|
11403
11469
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11404
|
-
arr[i] = currentAmis.evaluate(arr[i], api.data.$);
|
|
11470
|
+
arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
|
|
11405
11471
|
}
|
|
11406
11472
|
}
|
|
11407
11473
|
}
|
|
@@ -11723,7 +11789,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11723
11789
|
];
|
|
11724
11790
|
|
|
11725
11791
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11726
|
-
let autoFillMapping =
|
|
11792
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11727
11793
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11728
11794
|
autoFillMapping.forEach(function (item) {
|
|
11729
11795
|
queryFields.push(refObjectConfig.fields[item.from]);
|
|
@@ -11818,7 +11884,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11818
11884
|
// 如果当前元素不是数组,则处理该元素
|
|
11819
11885
|
// 下面正则用于匹配amis公式\${}
|
|
11820
11886
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11821
|
-
arr[i] = currentAmis.evaluate(arr[i], api.data.$);
|
|
11887
|
+
arr[i] = currentAmis.evaluate(arr[i], api.data.$self);
|
|
11822
11888
|
}
|
|
11823
11889
|
}
|
|
11824
11890
|
}
|
|
@@ -11965,14 +12031,25 @@ async function getApi(object, recordId, fields, options){
|
|
|
11965
12031
|
}
|
|
11966
12032
|
|
|
11967
12033
|
async function getAutoFill(field, refObject) {
|
|
11968
|
-
let autoFillMapping =
|
|
12034
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11969
12035
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11970
12036
|
let fillMapping = {};
|
|
12037
|
+
if (field.multiple) {
|
|
12038
|
+
autoFillMapping.forEach(function (item) {
|
|
12039
|
+
//from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
|
|
12040
|
+
if (___namespace.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
|
|
12041
|
+
fillMapping[item.to] = `\${items | pick:${item.from}}`;
|
|
12042
|
+
} else {
|
|
12043
|
+
fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
|
|
12044
|
+
}
|
|
12045
|
+
});
|
|
12046
|
+
}else {
|
|
12047
|
+
autoFillMapping.forEach(function (item) {
|
|
12048
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
12049
|
+
});
|
|
12050
|
+
}
|
|
11971
12051
|
// let fieldsForApi = [];
|
|
11972
|
-
|
|
11973
|
-
fillMapping[item.to] = `\${${item.from}}`;
|
|
11974
|
-
// fieldsForApi.push(item.from);
|
|
11975
|
-
});
|
|
12052
|
+
// fieldsForApi.push(item.from);
|
|
11976
12053
|
// let api = {
|
|
11977
12054
|
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11978
12055
|
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
@@ -12074,7 +12151,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12074
12151
|
amisSchema = ___namespace.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
12075
12152
|
}
|
|
12076
12153
|
}
|
|
12077
|
-
const autoFill = await getAutoFill(field);
|
|
12154
|
+
const autoFill = await getAutoFill(field, refObject);
|
|
12078
12155
|
if(autoFill){
|
|
12079
12156
|
amisSchema.autoFill = autoFill;
|
|
12080
12157
|
// 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本
|