@steedos-widgets/amis-lib 3.6.4-beta.2 → 3.6.4-beta.4
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 +157 -76
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +157 -76
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +132 -126
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/table.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1653,7 +1653,8 @@ i18next
|
|
|
1653
1653
|
}
|
|
1654
1654
|
});
|
|
1655
1655
|
|
|
1656
|
-
async function getQuickEditSchema(
|
|
1656
|
+
async function getQuickEditSchema(object, columnField, options){
|
|
1657
|
+
let field = object.fields[columnField.name];
|
|
1657
1658
|
//判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
|
|
1658
1659
|
let isAmisVersionforBatchEdit = false;
|
|
1659
1660
|
if(window.amisRequire && window.amisRequire('amis')){
|
|
@@ -2121,7 +2122,7 @@ function getFieldWidth(width){
|
|
|
2121
2122
|
}
|
|
2122
2123
|
}
|
|
2123
2124
|
|
|
2124
|
-
async function getTableColumns(fields, options){
|
|
2125
|
+
async function getTableColumns(object, fields, options){
|
|
2125
2126
|
const columns = [];
|
|
2126
2127
|
if(!options.isLookup && !options.isInputTable){
|
|
2127
2128
|
if(!options.enable_tree){
|
|
@@ -2135,7 +2136,7 @@ async function getTableColumns(fields, options){
|
|
|
2135
2136
|
continue;
|
|
2136
2137
|
}
|
|
2137
2138
|
//增加quickEdit属性,实现快速编辑
|
|
2138
|
-
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2139
|
+
const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
|
|
2139
2140
|
let className = "";
|
|
2140
2141
|
const bowserType = getBowserType();
|
|
2141
2142
|
if(bowserType === "Safari"){
|
|
@@ -2707,7 +2708,7 @@ async function getDefaultCrudCard(columns, options) {
|
|
|
2707
2708
|
return card;
|
|
2708
2709
|
}
|
|
2709
2710
|
|
|
2710
|
-
async function getTableSchema$1(fields, options){
|
|
2711
|
+
async function getTableSchema$1(object, fields, options){
|
|
2711
2712
|
if(!options){
|
|
2712
2713
|
options = {};
|
|
2713
2714
|
}
|
|
@@ -2729,7 +2730,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2729
2730
|
columns = await getMobileTableColumns(fields, options);
|
|
2730
2731
|
}
|
|
2731
2732
|
else {
|
|
2732
|
-
columns = await getTableColumns(fields, options);
|
|
2733
|
+
columns = await getTableColumns(object, fields, options);
|
|
2733
2734
|
|
|
2734
2735
|
if(listSchema.mode === "cards"){
|
|
2735
2736
|
let card = listSchema.card;
|
|
@@ -8817,7 +8818,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8817
8818
|
crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
|
|
8818
8819
|
}, options);
|
|
8819
8820
|
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
8820
|
-
const table = await getTableSchema$1(fields, tableOptions);
|
|
8821
|
+
const table = await getTableSchema$1(objectSchema, fields, tableOptions);
|
|
8821
8822
|
// delete table.mode;
|
|
8822
8823
|
//image与avatar需要在提交修改时特别处理
|
|
8823
8824
|
const imageNames = ___default.compact(___default.map(___default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
@@ -9084,7 +9085,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9084
9085
|
body: {
|
|
9085
9086
|
type: 'wrapper',
|
|
9086
9087
|
className: 'p-0 m-0',
|
|
9087
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
9088
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
9088
9089
|
hiddenOn: "${editFormInited != true}",
|
|
9089
9090
|
},
|
|
9090
9091
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -9692,8 +9693,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9692
9693
|
/*
|
|
9693
9694
|
* @Author: baozhoutao@steedos.com
|
|
9694
9695
|
* @Date: 2022-07-05 15:55:39
|
|
9695
|
-
* @LastEditors:
|
|
9696
|
-
* @LastEditTime: 2024-02-
|
|
9696
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9697
|
+
* @LastEditTime: 2024-02-23 16:37:06
|
|
9697
9698
|
* @Description:
|
|
9698
9699
|
*/
|
|
9699
9700
|
|
|
@@ -10041,6 +10042,7 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10041
10042
|
let fields = [];
|
|
10042
10043
|
for (const column of columns) {
|
|
10043
10044
|
if (isString(column)) {
|
|
10045
|
+
let columnField;
|
|
10044
10046
|
if (column.indexOf('.') > 0) {
|
|
10045
10047
|
const fieldName = column.split('.')[0];
|
|
10046
10048
|
const displayName = column.split('.')[1];
|
|
@@ -10048,23 +10050,30 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10048
10050
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10049
10051
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10050
10052
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10051
|
-
|
|
10053
|
+
columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
|
|
10052
10054
|
}else if(filedInfo && filedInfo.type === 'object'){
|
|
10053
|
-
|
|
10055
|
+
columnField = uiSchema.fields[column];
|
|
10054
10056
|
}
|
|
10055
10057
|
} else {
|
|
10056
10058
|
if (uiSchema.fields[column]) {
|
|
10057
|
-
|
|
10059
|
+
columnField = Object.assign({}, uiSchema.fields[column], ctx);
|
|
10058
10060
|
}
|
|
10059
10061
|
else if(ctx.extra){
|
|
10060
10062
|
// 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
|
|
10061
|
-
|
|
10063
|
+
columnField = {
|
|
10062
10064
|
extra: true,
|
|
10063
10065
|
name: column
|
|
10064
|
-
}
|
|
10066
|
+
};
|
|
10065
10067
|
}
|
|
10066
10068
|
}
|
|
10069
|
+
if(columnField){
|
|
10070
|
+
// 列上的字段不认uiSchema.fields中定义的amis属性
|
|
10071
|
+
columnField = Object.assign({}, columnField, {amis: undefined});
|
|
10072
|
+
fields.push(columnField);
|
|
10073
|
+
}
|
|
10074
|
+
|
|
10067
10075
|
} else if (isObject$1(column)) {
|
|
10076
|
+
let columnField;
|
|
10068
10077
|
if (column.field.indexOf('.') > 0) {
|
|
10069
10078
|
const fieldName = column.field.split('.')[0];
|
|
10070
10079
|
const displayName = column.field.split('.')[1];
|
|
@@ -10072,33 +10081,34 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10072
10081
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10073
10082
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10074
10083
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10075
|
-
|
|
10084
|
+
columnField = Object.assign({}, rfFieldInfo, ctx,
|
|
10076
10085
|
{ name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
|
|
10077
10086
|
{
|
|
10078
10087
|
width: column.width,
|
|
10079
|
-
wrap: column.wrap
|
|
10080
|
-
amis: column.amis
|
|
10088
|
+
wrap: column.wrap // wrap = true 是没效果的
|
|
10081
10089
|
}
|
|
10082
|
-
)
|
|
10090
|
+
);
|
|
10083
10091
|
}
|
|
10084
10092
|
} else {
|
|
10085
10093
|
if (uiSchema.fields[column.field]) {
|
|
10086
|
-
fields.
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
amis: column.amis
|
|
10091
|
-
})
|
|
10092
|
-
);
|
|
10094
|
+
columnField = Object.assign({}, uiSchema.fields[column.field], ctx, {
|
|
10095
|
+
width: column.width,
|
|
10096
|
+
wrap: column.wrap // wrap = true 是没效果的
|
|
10097
|
+
});
|
|
10093
10098
|
}
|
|
10094
10099
|
else if(ctx.extra){
|
|
10095
10100
|
// 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
|
|
10096
|
-
|
|
10101
|
+
columnField = {
|
|
10097
10102
|
extra: true,
|
|
10098
10103
|
name: column.field
|
|
10099
|
-
}
|
|
10104
|
+
};
|
|
10100
10105
|
}
|
|
10101
10106
|
}
|
|
10107
|
+
if(columnField){
|
|
10108
|
+
// 列上的字段不认uiSchema.fields中定义的amis属性,用列上配置的amis覆盖
|
|
10109
|
+
columnField = Object.assign({}, columnField, {amis: column.amis});
|
|
10110
|
+
fields.push(columnField);
|
|
10111
|
+
}
|
|
10102
10112
|
}
|
|
10103
10113
|
}
|
|
10104
10114
|
return fields;
|
|
@@ -10672,7 +10682,22 @@ async function getSelectUserSchema(field, readonly, ctx) {
|
|
|
10672
10682
|
async function getSource(field, ctx) {
|
|
10673
10683
|
// data.query 最终格式 "{ \tleftOptions:organizations(filters: {__filters}){value:_id,label:name,children}, children:organizations(filters: {__filters}){ref:_id,children}, defaultValueOptions:space_users(filters: {__options_filters}){user,name} }"
|
|
10674
10684
|
const refObjectName = ctx.objectName;
|
|
10675
|
-
|
|
10685
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10686
|
+
let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
|
|
10687
|
+
|
|
10688
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10689
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10690
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10691
|
+
autoFillMapping.forEach(function (item) {
|
|
10692
|
+
if(item.from !== "children"){
|
|
10693
|
+
optionQueryFields.push({ name: item.from });
|
|
10694
|
+
}
|
|
10695
|
+
defaultOptionQueryFields.push({ name: item.from });
|
|
10696
|
+
});
|
|
10697
|
+
}
|
|
10698
|
+
|
|
10699
|
+
const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
|
|
10700
|
+
expand: false,
|
|
10676
10701
|
alias: "options",
|
|
10677
10702
|
filters: "{__filters}"
|
|
10678
10703
|
});
|
|
@@ -10683,7 +10708,8 @@ async function getSource(field, ctx) {
|
|
|
10683
10708
|
// });
|
|
10684
10709
|
// childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
|
|
10685
10710
|
// data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
|
|
10686
|
-
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null,
|
|
10711
|
+
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
|
|
10712
|
+
expand: false,
|
|
10687
10713
|
alias: "defaultValueOptions",
|
|
10688
10714
|
filters: "{__options_filters}"
|
|
10689
10715
|
});
|
|
@@ -10750,7 +10776,20 @@ async function getSource(field, ctx) {
|
|
|
10750
10776
|
async function getDeferApi(field, ctx) {
|
|
10751
10777
|
// data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
|
|
10752
10778
|
const refObjectName = ctx.objectName;
|
|
10753
|
-
|
|
10779
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10780
|
+
|
|
10781
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10782
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10783
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10784
|
+
autoFillMapping.forEach(function (item) {
|
|
10785
|
+
if(item.from !== "children"){
|
|
10786
|
+
optionQueryFields.push({ name: item.from });
|
|
10787
|
+
}
|
|
10788
|
+
});
|
|
10789
|
+
}
|
|
10790
|
+
|
|
10791
|
+
const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
|
|
10792
|
+
expand: false,
|
|
10754
10793
|
alias: "options",
|
|
10755
10794
|
// filters: "{__filters}",
|
|
10756
10795
|
queryOptions: `filters: {__filters}, sort: "{__sort}"`
|
|
@@ -10765,8 +10804,6 @@ async function getDeferApi(field, ctx) {
|
|
|
10765
10804
|
filters = filters(field);
|
|
10766
10805
|
}
|
|
10767
10806
|
data.query = data.query.replace(/,count\:.+/, "}");
|
|
10768
|
-
// 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
|
|
10769
|
-
data.query = data.query.replace("{_id}", "{{__fields}}");
|
|
10770
10807
|
const requestAdaptor = `
|
|
10771
10808
|
var dep = api.query.dep;
|
|
10772
10809
|
var term = api.query.term;
|
|
@@ -10776,11 +10813,10 @@ async function getDeferApi(field, ctx) {
|
|
|
10776
10813
|
var sort = "";
|
|
10777
10814
|
if (dep) {
|
|
10778
10815
|
objectName = "${refObjectName}";
|
|
10779
|
-
fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
|
|
10780
10816
|
filters = [['parent', '=', dep]];
|
|
10781
10817
|
sort = "${ctx.sort}";
|
|
10782
10818
|
}
|
|
10783
|
-
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{
|
|
10819
|
+
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
|
|
10784
10820
|
return api;
|
|
10785
10821
|
`;
|
|
10786
10822
|
const adaptor = `
|
|
@@ -11134,6 +11170,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11134
11170
|
}
|
|
11135
11171
|
});
|
|
11136
11172
|
|
|
11173
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11174
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11175
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11176
|
+
autoFillMapping.forEach(function (item) {
|
|
11177
|
+
if(!_$1.find(tableFields, function(f){
|
|
11178
|
+
return f.name === item.from
|
|
11179
|
+
})){
|
|
11180
|
+
tableFields.push(refObjectConfig.fields[item.from]);
|
|
11181
|
+
}
|
|
11182
|
+
});
|
|
11183
|
+
}
|
|
11184
|
+
|
|
11137
11185
|
_$1.each(refObjectConfig.fields, function (field) {
|
|
11138
11186
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
11139
11187
|
searchableFields.push(field.name);
|
|
@@ -11390,7 +11438,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11390
11438
|
if(refObjectConfig.name === 'organizations'){
|
|
11391
11439
|
labelFieldName = 'name';
|
|
11392
11440
|
}
|
|
11393
|
-
pickerSchema = await getTableSchema$1(tableFields, {
|
|
11441
|
+
pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
|
|
11394
11442
|
labelFieldName,
|
|
11395
11443
|
top: top,
|
|
11396
11444
|
isLookup: true,
|
|
@@ -11565,22 +11613,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11565
11613
|
|
|
11566
11614
|
let apiInfo;
|
|
11567
11615
|
let defaultValueOptionsQueryData;
|
|
11616
|
+
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11568
11617
|
if(referenceTo){
|
|
11569
|
-
|
|
11570
|
-
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
11618
|
+
let queryFields = [
|
|
11571
11619
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11572
11620
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11573
|
-
]
|
|
11621
|
+
];
|
|
11622
|
+
|
|
11623
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11624
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11625
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11626
|
+
autoFillMapping.forEach(function (item) {
|
|
11627
|
+
queryFields.push(refObjectConfig.fields[item.from]);
|
|
11628
|
+
});
|
|
11629
|
+
}
|
|
11630
|
+
|
|
11631
|
+
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
11632
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
|
|
11633
|
+
expand: false,
|
|
11574
11634
|
alias: "defaultValueOptions",
|
|
11575
11635
|
filters: "{__options_filters}",
|
|
11576
11636
|
count: false
|
|
11577
11637
|
});
|
|
11578
11638
|
apiInfo = await getApi({
|
|
11579
11639
|
name: referenceTo.objectName
|
|
11580
|
-
}, null,
|
|
11581
|
-
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11582
|
-
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11583
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11640
|
+
}, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11584
11641
|
|
|
11585
11642
|
apiInfo.adaptor = `
|
|
11586
11643
|
const data = payload.data;
|
|
@@ -11604,7 +11661,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11604
11661
|
};
|
|
11605
11662
|
}
|
|
11606
11663
|
|
|
11607
|
-
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11608
11664
|
let listView = getLookupListView(refObjectConfig);
|
|
11609
11665
|
|
|
11610
11666
|
let listviewFilter = getListViewFilter(listView);
|
|
@@ -11790,13 +11846,13 @@ async function getApi(object, recordId, fields, options){
|
|
|
11790
11846
|
}
|
|
11791
11847
|
|
|
11792
11848
|
async function getAutoFill(field, refObject) {
|
|
11793
|
-
let autoFillMapping = field.auto_fill_mapping;
|
|
11849
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11794
11850
|
if (autoFillMapping && autoFillMapping.length) {
|
|
11795
11851
|
let fillMapping = {};
|
|
11796
|
-
let fieldsForApi = [];
|
|
11852
|
+
// let fieldsForApi = [];
|
|
11797
11853
|
autoFillMapping.forEach(function (item) {
|
|
11798
11854
|
fillMapping[item.to] = `\${${item.from}}`;
|
|
11799
|
-
fieldsForApi.push(item.from);
|
|
11855
|
+
// fieldsForApi.push(item.from);
|
|
11800
11856
|
});
|
|
11801
11857
|
// let api = {
|
|
11802
11858
|
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
@@ -11990,7 +12046,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
11990
12046
|
actions: false
|
|
11991
12047
|
});
|
|
11992
12048
|
}else {
|
|
11993
|
-
pickerSchema = await getTableSchema$1(tableFields, {
|
|
12049
|
+
pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
|
|
11994
12050
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
11995
12051
|
top: top,
|
|
11996
12052
|
isLookup: true,
|
|
@@ -13137,15 +13193,15 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
13137
13193
|
/*
|
|
13138
13194
|
* @Author: baozhoutao@steedos.com
|
|
13139
13195
|
* @Date: 2022-05-26 16:02:08
|
|
13140
|
-
* @LastEditors:
|
|
13141
|
-
* @LastEditTime:
|
|
13196
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
13197
|
+
* @LastEditTime: 2024-02-25 14:13:10
|
|
13142
13198
|
* @Description:
|
|
13143
13199
|
*/
|
|
13144
13200
|
|
|
13145
13201
|
const getFieldSchemaArray = (formFields, ctx) => {
|
|
13146
13202
|
let fieldSchemaArray = [];
|
|
13147
13203
|
fieldSchemaArray.length = 0;
|
|
13148
|
-
|
|
13204
|
+
ctx && ctx.recordId;
|
|
13149
13205
|
|
|
13150
13206
|
_$1.forEach(formFields, (field) => {
|
|
13151
13207
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
@@ -13158,9 +13214,7 @@ const getFieldSchemaArray = (formFields, ctx) => {
|
|
|
13158
13214
|
}
|
|
13159
13215
|
|
|
13160
13216
|
let forceHidden = false;
|
|
13161
|
-
if(
|
|
13162
|
-
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
13163
|
-
// 表单只读时所有字段都是readonly,设计器中如果forceHidden会造成整个表单在只读的时候显示为空白了,所以要排除掉
|
|
13217
|
+
if(ctx.omitReadonlyFields && field.readonly){
|
|
13164
13218
|
forceHidden = true;
|
|
13165
13219
|
}
|
|
13166
13220
|
|
|
@@ -14131,6 +14185,7 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
14131
14185
|
async function getButtonActions(props, mode) {
|
|
14132
14186
|
let actions = [];
|
|
14133
14187
|
let primaryKey = getTablePrimaryKey(props);
|
|
14188
|
+
let tableServiceId = getComponentId("table_service", props.id);
|
|
14134
14189
|
let formId = getComponentId("form", props.id);
|
|
14135
14190
|
let dialogId = getComponentId("dialog", props.id);
|
|
14136
14191
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
@@ -14447,7 +14502,30 @@ async function getButtonActions(props, mode) {
|
|
|
14447
14502
|
// };
|
|
14448
14503
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
14449
14504
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
14450
|
-
|
|
14505
|
+
if (props.enableDialog === false) {
|
|
14506
|
+
actions = [
|
|
14507
|
+
{
|
|
14508
|
+
"actionType": "custom",
|
|
14509
|
+
"script": `
|
|
14510
|
+
let scope = event.context.scoped;
|
|
14511
|
+
let __wrapperServiceId = "${tableServiceId}";
|
|
14512
|
+
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
14513
|
+
let wrapperServiceData = wrapperService.getData();
|
|
14514
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
14515
|
+
lastestFieldValue.push({})
|
|
14516
|
+
doAction({
|
|
14517
|
+
"componentId": "${props.id}",
|
|
14518
|
+
"actionType": "setValue",
|
|
14519
|
+
"args": {
|
|
14520
|
+
"value": lastestFieldValue
|
|
14521
|
+
}
|
|
14522
|
+
});
|
|
14523
|
+
`
|
|
14524
|
+
}
|
|
14525
|
+
];
|
|
14526
|
+
}else {
|
|
14527
|
+
actions = [actionShowEditDialog];
|
|
14528
|
+
}
|
|
14451
14529
|
}
|
|
14452
14530
|
else if (mode == "edit") {
|
|
14453
14531
|
actions = [actionShowEditDialog];
|
|
@@ -14679,31 +14757,34 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14679
14757
|
let inlineEditMode = props.inlineEditMode;
|
|
14680
14758
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
14681
14759
|
if (showOperation) {
|
|
14682
|
-
if (props.
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14760
|
+
if (props.enableDialog !== false) {
|
|
14761
|
+
if (props.editable) {
|
|
14762
|
+
let showEditButton = true;
|
|
14763
|
+
if (showAsInlineEditMode) {
|
|
14764
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
14765
|
+
showEditButton = true;
|
|
14766
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
14767
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
14768
|
+
// showEditButton = true;
|
|
14769
|
+
// }
|
|
14770
|
+
// else {
|
|
14771
|
+
// showEditButton = false;
|
|
14772
|
+
// }
|
|
14773
|
+
}
|
|
14774
|
+
// 编辑时显示编辑按钮
|
|
14775
|
+
if (showEditButton) {
|
|
14776
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
14777
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
14778
|
+
}
|
|
14694
14779
|
}
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14780
|
+
else {
|
|
14781
|
+
// 只读时显示查看按钮
|
|
14782
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14783
|
+
let buttonViewSchema = await getButtonView(props);
|
|
14784
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14699
14785
|
}
|
|
14700
14786
|
}
|
|
14701
|
-
|
|
14702
|
-
// 只读时显示查看按钮
|
|
14703
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14704
|
-
let buttonViewSchema = await getButtonView(props);
|
|
14705
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14706
|
-
}
|
|
14787
|
+
|
|
14707
14788
|
if (props.removable) {
|
|
14708
14789
|
let buttonDeleteSchema = await getButtonDelete(props);
|
|
14709
14790
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|