@steedos-widgets/amis-lib 3.6.2-beta.6 → 3.6.2-beta.8
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 +128 -65
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +129 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +44 -34
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/api.d.ts +4 -0
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +0 -1
- package/dist/types/lib/objects.d.ts +1 -3
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -486,7 +486,7 @@ function getComparableAmisVersion() {
|
|
|
486
486
|
* @Author: baozhoutao@steedos.com
|
|
487
487
|
* @Date: 2022-05-23 09:53:08
|
|
488
488
|
* @LastEditors: liaodaxue
|
|
489
|
-
* @LastEditTime:
|
|
489
|
+
* @LastEditTime: 2024-01-17 16:00:27
|
|
490
490
|
* @Description:
|
|
491
491
|
*/
|
|
492
492
|
|
|
@@ -558,7 +558,7 @@ function getSelectMap(selectOptions){
|
|
|
558
558
|
|
|
559
559
|
function getNameTplUrl(field, ctx){
|
|
560
560
|
if(ctx.objectName === 'cms_files'){
|
|
561
|
-
return
|
|
561
|
+
return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
562
562
|
}
|
|
563
563
|
const href = Router.getObjectDetailPath({
|
|
564
564
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
@@ -2286,7 +2286,7 @@ function getMobileLines(tpls){
|
|
|
2286
2286
|
}
|
|
2287
2287
|
if(isLeft){
|
|
2288
2288
|
// 左侧半行
|
|
2289
|
-
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
2289
|
+
lineChildrenClassName = "steedos-listview-item-left truncate h-5";
|
|
2290
2290
|
if(item.field.is_wide){
|
|
2291
2291
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
2292
2292
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -2298,7 +2298,7 @@ function getMobileLines(tpls){
|
|
|
2298
2298
|
}
|
|
2299
2299
|
else {
|
|
2300
2300
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
2301
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
2301
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
|
|
2302
2302
|
}
|
|
2303
2303
|
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
2304
2304
|
var className;
|
|
@@ -2409,7 +2409,15 @@ async function getMobileTableColumns(fields, options){
|
|
|
2409
2409
|
"actions": [
|
|
2410
2410
|
{
|
|
2411
2411
|
"script": `
|
|
2412
|
-
let cms_url =
|
|
2412
|
+
let cms_url = '';
|
|
2413
|
+
let value = event.data.versions[0];
|
|
2414
|
+
if(value){
|
|
2415
|
+
if(value.url){
|
|
2416
|
+
cms_url = value.url;
|
|
2417
|
+
}else{
|
|
2418
|
+
cms_url = "/api/files/files/"+value+"?download=true"
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2413
2421
|
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
2414
2422
|
`,
|
|
2415
2423
|
"actionType": "custom"
|
|
@@ -3041,12 +3049,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3041
3049
|
}
|
|
3042
3050
|
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
3043
3051
|
};
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3052
|
+
let formFactor = "${options.formFactor}";
|
|
3053
|
+
if(formFactor !== "SMALL"){
|
|
3054
|
+
const listviewComponent = $(".steedos-object-listview .antd-Table-table");
|
|
3055
|
+
const firstListviewComponent = listviewComponent && listviewComponent[0];
|
|
3056
|
+
if(firstListviewComponent){
|
|
3057
|
+
setTimeout(()=>{
|
|
3058
|
+
firstListviewComponent.scrollIntoView();
|
|
3059
|
+
}, 600);
|
|
3060
|
+
}
|
|
3050
3061
|
}
|
|
3051
3062
|
${options.adaptor || ''}
|
|
3052
3063
|
return payload;
|
|
@@ -3391,17 +3402,16 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3391
3402
|
}
|
|
3392
3403
|
// data下的变量需要在保存接口(getSaveApi)中被删除。
|
|
3393
3404
|
payload.data = {
|
|
3394
|
-
...initialValues
|
|
3395
|
-
editFormInited: true
|
|
3405
|
+
...initialValues
|
|
3396
3406
|
}
|
|
3397
3407
|
${options.initApiAdaptor || ''}
|
|
3398
3408
|
// console.log('getEditFormInitApi======>', payload);
|
|
3399
3409
|
return payload;
|
|
3400
3410
|
`,
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3411
|
+
responseData: {
|
|
3412
|
+
"&": "$$",
|
|
3413
|
+
editFormInited: true
|
|
3414
|
+
},
|
|
3405
3415
|
data: data,
|
|
3406
3416
|
headers: {
|
|
3407
3417
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -4244,7 +4254,7 @@ async function getListBody(fields, options){
|
|
|
4244
4254
|
|
|
4245
4255
|
function getDefaultParams(options){
|
|
4246
4256
|
return {
|
|
4247
|
-
perPage: options.top || options.perPage ||
|
|
4257
|
+
perPage: options.top || options.perPage || 20
|
|
4248
4258
|
}
|
|
4249
4259
|
}
|
|
4250
4260
|
|
|
@@ -4447,7 +4457,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4447
4457
|
"objectApiName": "\${objectName}",
|
|
4448
4458
|
"recordId": "",
|
|
4449
4459
|
"mode": "edit",
|
|
4450
|
-
"layout": "normal"
|
|
4451
4460
|
};
|
|
4452
4461
|
|
|
4453
4462
|
if (payload && payload.schema) {
|
|
@@ -6719,7 +6728,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6719
6728
|
let body = [
|
|
6720
6729
|
{
|
|
6721
6730
|
"type": "wrapper",
|
|
6722
|
-
"className": "p-4",
|
|
6731
|
+
"className": "p-4 bg-gray-100 border-b",
|
|
6723
6732
|
"body": [
|
|
6724
6733
|
{
|
|
6725
6734
|
"type": "grid",
|
|
@@ -6765,12 +6774,16 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6765
6774
|
});
|
|
6766
6775
|
|
|
6767
6776
|
body.push({
|
|
6768
|
-
"type": "
|
|
6769
|
-
"
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6777
|
+
"type": "wrapper",
|
|
6778
|
+
"body": {
|
|
6779
|
+
"type": "form",
|
|
6780
|
+
"className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
|
|
6781
|
+
"wrapWithPanel": false,
|
|
6782
|
+
"actions": [],
|
|
6783
|
+
"body": details,
|
|
6784
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
6785
|
+
},
|
|
6786
|
+
"className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
|
|
6774
6787
|
});
|
|
6775
6788
|
}
|
|
6776
6789
|
|
|
@@ -6849,7 +6862,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6849
6862
|
"className": "flex justify-between"
|
|
6850
6863
|
}
|
|
6851
6864
|
],
|
|
6852
|
-
"className": "
|
|
6865
|
+
"className": "steedos-record-related-header py-2 px-0"
|
|
6853
6866
|
};
|
|
6854
6867
|
return recordRelatedListHeader;
|
|
6855
6868
|
}
|
|
@@ -8565,7 +8578,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8565
8578
|
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
8566
8579
|
// },
|
|
8567
8580
|
bodyClassName: {
|
|
8568
|
-
"
|
|
8581
|
+
"mb-0": true,
|
|
8569
8582
|
"is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
8570
8583
|
},
|
|
8571
8584
|
crudClassName: crudClassName,
|
|
@@ -8721,7 +8734,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
8721
8734
|
}
|
|
8722
8735
|
|
|
8723
8736
|
async function getObjectForm(objectSchema, ctx){
|
|
8724
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
8737
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
8725
8738
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
8726
8739
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
8727
8740
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -8815,7 +8828,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
8815
8828
|
}
|
|
8816
8829
|
|
|
8817
8830
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
8818
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
8831
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
8819
8832
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
8820
8833
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
8821
8834
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -9140,7 +9153,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9140
9153
|
setDataToComponentId: componentId,
|
|
9141
9154
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
9142
9155
|
appId: appId,
|
|
9143
|
-
crudClassName: '
|
|
9156
|
+
crudClassName: 'steedos-record-related-crud hidden',
|
|
9144
9157
|
refField,
|
|
9145
9158
|
...ctx
|
|
9146
9159
|
};
|
|
@@ -9153,7 +9166,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9153
9166
|
amisSchema: {
|
|
9154
9167
|
type: "service",
|
|
9155
9168
|
id: componentId,
|
|
9156
|
-
className: `steedos-record-related-list
|
|
9169
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9157
9170
|
data: {
|
|
9158
9171
|
relatedKey: relatedKey,
|
|
9159
9172
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9880,39 +9893,35 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9880
9893
|
"label": "对象表单",
|
|
9881
9894
|
"objectApiName": "${objectName}",
|
|
9882
9895
|
"recordId": "${recordId}",
|
|
9883
|
-
"id": "u:d4a495811d57",
|
|
9884
9896
|
appId: appId
|
|
9885
9897
|
}
|
|
9886
9898
|
],
|
|
9887
|
-
"id": "u:5d4e7e3f6ecc"
|
|
9888
9899
|
};
|
|
9889
9900
|
const related = {
|
|
9890
9901
|
"title": i18next__default["default"].t('frontend_record_detail_tab_related'),
|
|
9891
|
-
"className": "px-0
|
|
9902
|
+
"className": "px-0 py-4",
|
|
9892
9903
|
"body": [
|
|
9893
9904
|
{
|
|
9894
9905
|
"type": "steedos-object-related-lists",
|
|
9895
9906
|
"label": "相关列表",
|
|
9896
9907
|
"objectApiName": "${objectName}",
|
|
9897
9908
|
"recordId": "${recordId}",
|
|
9898
|
-
"id": "u:3b85b7b7a7f6",
|
|
9899
9909
|
appId: appId
|
|
9900
9910
|
}
|
|
9901
9911
|
],
|
|
9902
|
-
"id": "u:1a0326aeec2b"
|
|
9903
9912
|
};
|
|
9904
9913
|
const content = {
|
|
9905
9914
|
"type": "tabs",
|
|
9906
|
-
"className": "
|
|
9915
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
|
|
9916
|
+
"contentClassName": "bg-none",
|
|
9907
9917
|
"tabs": [
|
|
9908
9918
|
detailed
|
|
9909
9919
|
],
|
|
9910
|
-
"id": "u:a649e4094a12"
|
|
9911
9920
|
};
|
|
9912
9921
|
if(relatedLists.length){
|
|
9913
9922
|
content.tabs.push(related);
|
|
9914
9923
|
}
|
|
9915
|
-
content.tabs =
|
|
9924
|
+
// content.tabs = reverse(content.tabs)
|
|
9916
9925
|
return {
|
|
9917
9926
|
uiSchema,
|
|
9918
9927
|
amisSchema: {
|
|
@@ -9964,7 +9973,7 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
9964
9973
|
body: {
|
|
9965
9974
|
"type": "service",
|
|
9966
9975
|
id: serviceId,
|
|
9967
|
-
className: 'steedos-record-service p-0
|
|
9976
|
+
className: 'steedos-record-service p-0',
|
|
9968
9977
|
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
9969
9978
|
body: {
|
|
9970
9979
|
"type": "wrapper",
|
|
@@ -11192,8 +11201,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11192
11201
|
labelField: referenceTo.labelField.name,
|
|
11193
11202
|
valueField: referenceTo.valueField.name,
|
|
11194
11203
|
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
11195
|
-
disabledOn: `${readonly}`,
|
|
11196
|
-
hiddenOn: `( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
11204
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
11197
11205
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
11198
11206
|
source: source,
|
|
11199
11207
|
size: "lg",
|
|
@@ -11436,16 +11444,18 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11436
11444
|
}
|
|
11437
11445
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
11438
11446
|
if(readonly){
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11447
|
+
if(field.reference_to){
|
|
11448
|
+
return {
|
|
11449
|
+
type: 'steedos-field',
|
|
11450
|
+
config: field,
|
|
11451
|
+
static: true
|
|
11452
|
+
}
|
|
11453
|
+
}else {
|
|
11454
|
+
return {
|
|
11455
|
+
type: getAmisStaticFieldType('picker', readonly),
|
|
11456
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
11457
|
+
}
|
|
11443
11458
|
}
|
|
11444
|
-
|
|
11445
|
-
// return {
|
|
11446
|
-
// type: Field.getAmisStaticFieldType('picker', readonly),
|
|
11447
|
-
// tpl: Tpl.getRelatedFieldTpl(field, ctx)
|
|
11448
|
-
// }
|
|
11449
11459
|
}
|
|
11450
11460
|
if(field.reference_to && !___namespace.isString(field.reference_to) && !readonly){
|
|
11451
11461
|
return {
|
|
@@ -12492,7 +12502,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12492
12502
|
if(field.is_wide || convertData.type === 'group'){
|
|
12493
12503
|
convertData.className = 'col-span-2 m-0';
|
|
12494
12504
|
}else {
|
|
12495
|
-
convertData.className = 'm-
|
|
12505
|
+
convertData.className = 'm-0';
|
|
12496
12506
|
}
|
|
12497
12507
|
if(readonly){
|
|
12498
12508
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -12517,6 +12527,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12517
12527
|
}
|
|
12518
12528
|
}
|
|
12519
12529
|
|
|
12530
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
12531
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
12532
|
+
}
|
|
12533
|
+
|
|
12520
12534
|
if(___namespace.isString(baseData.required)){
|
|
12521
12535
|
if(baseData.required.startsWith("{{")){
|
|
12522
12536
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -12898,9 +12912,41 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12898
12912
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12899
12913
|
* @Date: 2023-11-15 09:50:22
|
|
12900
12914
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12901
|
-
* @LastEditTime: 2024-01-
|
|
12915
|
+
* @LastEditTime: 2024-01-17 17:15:57
|
|
12902
12916
|
*/
|
|
12903
12917
|
|
|
12918
|
+
/**
|
|
12919
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
12920
|
+
* @param {*} value 子表组件字段值,数组
|
|
12921
|
+
* @param {*} fieldPrefix 字段前缀
|
|
12922
|
+
* @returns 转换后的子表组件字段值
|
|
12923
|
+
*/
|
|
12924
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
12925
|
+
let convertedValue = [];
|
|
12926
|
+
(value || []).forEach((itemValue)=>{
|
|
12927
|
+
var newItemValue = {};
|
|
12928
|
+
for(let n in itemValue){
|
|
12929
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
12930
|
+
}
|
|
12931
|
+
convertedValue.push(newItemValue);
|
|
12932
|
+
});
|
|
12933
|
+
return convertedValue;
|
|
12934
|
+
}
|
|
12935
|
+
|
|
12936
|
+
/**
|
|
12937
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
12938
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
12939
|
+
* @param {*} fieldPrefix 字段前缀
|
|
12940
|
+
* @returns 转换后的子表组件字段值
|
|
12941
|
+
*/
|
|
12942
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
12943
|
+
return (fields || []).map((item) => {
|
|
12944
|
+
const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
12945
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
12946
|
+
return newItem;
|
|
12947
|
+
});
|
|
12948
|
+
}
|
|
12949
|
+
|
|
12904
12950
|
/**
|
|
12905
12951
|
* @param {*} props
|
|
12906
12952
|
* @param {*} mode edit/new/readonly
|
|
@@ -13177,7 +13223,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13177
13223
|
{
|
|
13178
13224
|
"type": "wrapper",
|
|
13179
13225
|
"size": "none",
|
|
13180
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
13226
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
13181
13227
|
"body": [
|
|
13182
13228
|
getFormPagination(props, mode)
|
|
13183
13229
|
]
|
|
@@ -13193,16 +13239,8 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13193
13239
|
}
|
|
13194
13240
|
];
|
|
13195
13241
|
let onServiceInitedScript = `
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
if(parent){
|
|
13199
|
-
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13200
|
-
var primaryKey = "${props.primaryKey}";
|
|
13201
|
-
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13202
|
-
return item[primaryKey] == parent[primaryKey];
|
|
13203
|
-
});
|
|
13204
|
-
}
|
|
13205
|
-
// 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13242
|
+
|
|
13243
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13206
13244
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
13207
13245
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
13208
13246
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -13215,6 +13253,11 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13215
13253
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
13216
13254
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
13217
13255
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
13256
|
+
let fieldPrefix = "${props.fieldPrefix}";
|
|
13257
|
+
if(fieldPrefix){
|
|
13258
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
13259
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
13260
|
+
}
|
|
13218
13261
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
13219
13262
|
let mode = "${mode}";
|
|
13220
13263
|
if(mode === "new"){
|
|
@@ -13237,6 +13280,16 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13237
13280
|
event.data.__tableItems.forEach(function(n,i){
|
|
13238
13281
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
13239
13282
|
});
|
|
13283
|
+
|
|
13284
|
+
var parent = event.data.parent;
|
|
13285
|
+
var fieldValue = event.data.__tableItems;
|
|
13286
|
+
if(parent){
|
|
13287
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13288
|
+
var primaryKey = "${props.primaryKey}";
|
|
13289
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13290
|
+
return item[primaryKey] == parent[primaryKey];
|
|
13291
|
+
});
|
|
13292
|
+
}
|
|
13240
13293
|
`;
|
|
13241
13294
|
let schema = {
|
|
13242
13295
|
"type": "service",
|
|
@@ -13839,6 +13892,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13839
13892
|
if(showOperation !== false){
|
|
13840
13893
|
showOperation = true;
|
|
13841
13894
|
}
|
|
13895
|
+
// props.fieldPrefix = "project_milestone_";
|
|
13896
|
+
if (props.fieldPrefix) {
|
|
13897
|
+
props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
|
|
13898
|
+
}
|
|
13899
|
+
console.log("=getAmisInputTableSchema==props.fields, props.fieldPrefix===", props.fields, props.fieldPrefix);
|
|
13842
13900
|
let serviceId = getComponentId("table_service", props.id);
|
|
13843
13901
|
let buttonsForColumnOperations = [];
|
|
13844
13902
|
let inlineEditMode = props.inlineEditMode;
|
|
@@ -13899,6 +13957,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13899
13957
|
});
|
|
13900
13958
|
}
|
|
13901
13959
|
};
|
|
13960
|
+
if(props.fieldPrefix){
|
|
13961
|
+
inputTableSchema.pipeIn = (value, data) => {
|
|
13962
|
+
return getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
13963
|
+
};
|
|
13964
|
+
}
|
|
13902
13965
|
if (buttonsForColumnOperations.length) {
|
|
13903
13966
|
inputTableSchema.columns.push({
|
|
13904
13967
|
"name": "__op__",
|