@steedos-widgets/amis-lib 6.3.0-beta.5 → 6.3.0-beta.7
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 +24 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +24 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +10 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -9079,6 +9079,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
9079
9079
|
async function getObjectForm(objectSchema, ctx){
|
|
9080
9080
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
9081
9081
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
9082
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
9083
|
+
if (typeof ctx.enableTabs !== 'boolean') {
|
|
9084
|
+
ctx.enableTabs = objectSchema.enable_form_tabs;
|
|
9085
|
+
}
|
|
9082
9086
|
const fields = ___default.values(objectSchema.fields);
|
|
9083
9087
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
9084
9088
|
const formSchema = defaults && defaults.formSchema || {};
|
|
@@ -11241,7 +11245,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11241
11245
|
});
|
|
11242
11246
|
|
|
11243
11247
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11244
|
-
let autoFillMapping =
|
|
11248
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11245
11249
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11246
11250
|
autoFillMapping.forEach(function (item) {
|
|
11247
11251
|
if(!_$1.find(tableFields, function(f){
|
|
@@ -11713,7 +11717,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11713
11717
|
];
|
|
11714
11718
|
|
|
11715
11719
|
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11716
|
-
let autoFillMapping =
|
|
11720
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11717
11721
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11718
11722
|
autoFillMapping.forEach(function (item) {
|
|
11719
11723
|
queryFields.push(refObjectConfig.fields[item.from]);
|
|
@@ -11853,7 +11857,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11853
11857
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
11854
11858
|
if (defaultValue && !api.data.$term) {
|
|
11855
11859
|
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
11856
|
-
const defaultValueOptionsQuery = defaultValueOptionsQueryData
|
|
11860
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData && defaultValueOptionsQueryData.query && defaultValueOptionsQueryData.query.replace(/^{/,"").replace(/}$/,"");
|
|
11857
11861
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
11858
11862
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
11859
11863
|
if(filters.length > 0){
|
|
@@ -11955,14 +11959,25 @@ async function getApi(object, recordId, fields, options){
|
|
|
11955
11959
|
}
|
|
11956
11960
|
|
|
11957
11961
|
async function getAutoFill(field, refObject) {
|
|
11958
|
-
let autoFillMapping =
|
|
11962
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11959
11963
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11960
11964
|
let fillMapping = {};
|
|
11965
|
+
if (field.multiple) {
|
|
11966
|
+
autoFillMapping.forEach(function (item) {
|
|
11967
|
+
//from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
|
|
11968
|
+
if (_$1.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
|
|
11969
|
+
fillMapping[item.to] = `\${items | pick:${item.from}}`;
|
|
11970
|
+
} else {
|
|
11971
|
+
fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
|
|
11972
|
+
}
|
|
11973
|
+
});
|
|
11974
|
+
}else {
|
|
11975
|
+
autoFillMapping.forEach(function (item) {
|
|
11976
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
11977
|
+
});
|
|
11978
|
+
}
|
|
11961
11979
|
// let fieldsForApi = [];
|
|
11962
|
-
|
|
11963
|
-
fillMapping[item.to] = `\${${item.from}}`;
|
|
11964
|
-
// fieldsForApi.push(item.from);
|
|
11965
|
-
});
|
|
11980
|
+
// fieldsForApi.push(item.from);
|
|
11966
11981
|
// let api = {
|
|
11967
11982
|
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11968
11983
|
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
@@ -12064,7 +12079,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12064
12079
|
amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
12065
12080
|
}
|
|
12066
12081
|
}
|
|
12067
|
-
const autoFill = await getAutoFill(field);
|
|
12082
|
+
const autoFill = await getAutoFill(field, refObject);
|
|
12068
12083
|
if(autoFill){
|
|
12069
12084
|
amisSchema.autoFill = autoFill;
|
|
12070
12085
|
// 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本
|