@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.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _$1 from 'lodash';
|
|
2
|
-
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, has, slice, defaultsDeep as defaultsDeep$1,
|
|
2
|
+
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, clone, filter, startsWith } from 'lodash';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
export { default as i18next } from 'i18next';
|
|
5
5
|
import { initReactI18next } from 'react-i18next';
|
|
@@ -459,7 +459,7 @@ function getComparableAmisVersion() {
|
|
|
459
459
|
* @Author: baozhoutao@steedos.com
|
|
460
460
|
* @Date: 2022-05-23 09:53:08
|
|
461
461
|
* @LastEditors: liaodaxue
|
|
462
|
-
* @LastEditTime:
|
|
462
|
+
* @LastEditTime: 2024-01-17 16:00:27
|
|
463
463
|
* @Description:
|
|
464
464
|
*/
|
|
465
465
|
|
|
@@ -531,7 +531,7 @@ function getSelectMap(selectOptions){
|
|
|
531
531
|
|
|
532
532
|
function getNameTplUrl(field, ctx){
|
|
533
533
|
if(ctx.objectName === 'cms_files'){
|
|
534
|
-
return
|
|
534
|
+
return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
535
535
|
}
|
|
536
536
|
const href = Router.getObjectDetailPath({
|
|
537
537
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
@@ -2259,7 +2259,7 @@ function getMobileLines(tpls){
|
|
|
2259
2259
|
}
|
|
2260
2260
|
if(isLeft){
|
|
2261
2261
|
// 左侧半行
|
|
2262
|
-
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
2262
|
+
lineChildrenClassName = "steedos-listview-item-left truncate h-5";
|
|
2263
2263
|
if(item.field.is_wide){
|
|
2264
2264
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
2265
2265
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -2271,7 +2271,7 @@ function getMobileLines(tpls){
|
|
|
2271
2271
|
}
|
|
2272
2272
|
else {
|
|
2273
2273
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
2274
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
2274
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
|
|
2275
2275
|
}
|
|
2276
2276
|
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
2277
2277
|
var className;
|
|
@@ -2382,7 +2382,15 @@ async function getMobileTableColumns(fields, options){
|
|
|
2382
2382
|
"actions": [
|
|
2383
2383
|
{
|
|
2384
2384
|
"script": `
|
|
2385
|
-
let cms_url =
|
|
2385
|
+
let cms_url = '';
|
|
2386
|
+
let value = event.data.versions[0];
|
|
2387
|
+
if(value){
|
|
2388
|
+
if(value.url){
|
|
2389
|
+
cms_url = value.url;
|
|
2390
|
+
}else{
|
|
2391
|
+
cms_url = "/api/files/files/"+value+"?download=true"
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2386
2394
|
Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
|
|
2387
2395
|
`,
|
|
2388
2396
|
"actionType": "custom"
|
|
@@ -3014,12 +3022,15 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3014
3022
|
}
|
|
3015
3023
|
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
3016
3024
|
};
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3025
|
+
let formFactor = "${options.formFactor}";
|
|
3026
|
+
if(formFactor !== "SMALL"){
|
|
3027
|
+
const listviewComponent = $(".steedos-object-listview .antd-Table-table");
|
|
3028
|
+
const firstListviewComponent = listviewComponent && listviewComponent[0];
|
|
3029
|
+
if(firstListviewComponent){
|
|
3030
|
+
setTimeout(()=>{
|
|
3031
|
+
firstListviewComponent.scrollIntoView();
|
|
3032
|
+
}, 600);
|
|
3033
|
+
}
|
|
3023
3034
|
}
|
|
3024
3035
|
${options.adaptor || ''}
|
|
3025
3036
|
return payload;
|
|
@@ -3364,17 +3375,16 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3364
3375
|
}
|
|
3365
3376
|
// data下的变量需要在保存接口(getSaveApi)中被删除。
|
|
3366
3377
|
payload.data = {
|
|
3367
|
-
...initialValues
|
|
3368
|
-
editFormInited: true
|
|
3378
|
+
...initialValues
|
|
3369
3379
|
}
|
|
3370
3380
|
${options.initApiAdaptor || ''}
|
|
3371
3381
|
// console.log('getEditFormInitApi======>', payload);
|
|
3372
3382
|
return payload;
|
|
3373
3383
|
`,
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3384
|
+
responseData: {
|
|
3385
|
+
"&": "$$",
|
|
3386
|
+
editFormInited: true
|
|
3387
|
+
},
|
|
3378
3388
|
data: data,
|
|
3379
3389
|
headers: {
|
|
3380
3390
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -4217,7 +4227,7 @@ async function getListBody(fields, options){
|
|
|
4217
4227
|
|
|
4218
4228
|
function getDefaultParams(options){
|
|
4219
4229
|
return {
|
|
4220
|
-
perPage: options.top || options.perPage ||
|
|
4230
|
+
perPage: options.top || options.perPage || 20
|
|
4221
4231
|
}
|
|
4222
4232
|
}
|
|
4223
4233
|
|
|
@@ -4420,7 +4430,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4420
4430
|
"objectApiName": "\${objectName}",
|
|
4421
4431
|
"recordId": "",
|
|
4422
4432
|
"mode": "edit",
|
|
4423
|
-
"layout": "normal"
|
|
4424
4433
|
};
|
|
4425
4434
|
|
|
4426
4435
|
if (payload && payload.schema) {
|
|
@@ -6692,7 +6701,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6692
6701
|
let body = [
|
|
6693
6702
|
{
|
|
6694
6703
|
"type": "wrapper",
|
|
6695
|
-
"className": "p-4",
|
|
6704
|
+
"className": "p-4 bg-gray-100 border-b",
|
|
6696
6705
|
"body": [
|
|
6697
6706
|
{
|
|
6698
6707
|
"type": "grid",
|
|
@@ -6738,12 +6747,16 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6738
6747
|
});
|
|
6739
6748
|
|
|
6740
6749
|
body.push({
|
|
6741
|
-
"type": "
|
|
6742
|
-
"
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6750
|
+
"type": "wrapper",
|
|
6751
|
+
"body": {
|
|
6752
|
+
"type": "form",
|
|
6753
|
+
"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
|
|
6754
|
+
"wrapWithPanel": false,
|
|
6755
|
+
"actions": [],
|
|
6756
|
+
"body": details,
|
|
6757
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
6758
|
+
},
|
|
6759
|
+
"className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
|
|
6747
6760
|
});
|
|
6748
6761
|
}
|
|
6749
6762
|
|
|
@@ -6822,7 +6835,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6822
6835
|
"className": "flex justify-between"
|
|
6823
6836
|
}
|
|
6824
6837
|
],
|
|
6825
|
-
"className": "
|
|
6838
|
+
"className": "steedos-record-related-header py-2 px-0"
|
|
6826
6839
|
};
|
|
6827
6840
|
return recordRelatedListHeader;
|
|
6828
6841
|
}
|
|
@@ -8538,7 +8551,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8538
8551
|
// "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
8539
8552
|
// },
|
|
8540
8553
|
bodyClassName: {
|
|
8541
|
-
"
|
|
8554
|
+
"mb-0": true,
|
|
8542
8555
|
"is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
|
|
8543
8556
|
},
|
|
8544
8557
|
crudClassName: crudClassName,
|
|
@@ -8694,7 +8707,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
8694
8707
|
}
|
|
8695
8708
|
|
|
8696
8709
|
async function getObjectForm(objectSchema, ctx){
|
|
8697
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
8710
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
8698
8711
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
8699
8712
|
const fields = ___default.values(objectSchema.fields);
|
|
8700
8713
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -8788,7 +8801,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
8788
8801
|
}
|
|
8789
8802
|
|
|
8790
8803
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
8791
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "
|
|
8804
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
|
|
8792
8805
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
8793
8806
|
const fields = ___default.values(objectSchema.fields);
|
|
8794
8807
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -9113,7 +9126,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9113
9126
|
setDataToComponentId: componentId,
|
|
9114
9127
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
9115
9128
|
appId: appId,
|
|
9116
|
-
crudClassName: '
|
|
9129
|
+
crudClassName: 'steedos-record-related-crud hidden',
|
|
9117
9130
|
refField,
|
|
9118
9131
|
...ctx
|
|
9119
9132
|
};
|
|
@@ -9126,7 +9139,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9126
9139
|
amisSchema: {
|
|
9127
9140
|
type: "service",
|
|
9128
9141
|
id: componentId,
|
|
9129
|
-
className: `steedos-record-related-list
|
|
9142
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9130
9143
|
data: {
|
|
9131
9144
|
relatedKey: relatedKey,
|
|
9132
9145
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9853,39 +9866,35 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9853
9866
|
"label": "对象表单",
|
|
9854
9867
|
"objectApiName": "${objectName}",
|
|
9855
9868
|
"recordId": "${recordId}",
|
|
9856
|
-
"id": "u:d4a495811d57",
|
|
9857
9869
|
appId: appId
|
|
9858
9870
|
}
|
|
9859
9871
|
],
|
|
9860
|
-
"id": "u:5d4e7e3f6ecc"
|
|
9861
9872
|
};
|
|
9862
9873
|
const related = {
|
|
9863
9874
|
"title": i18next.t('frontend_record_detail_tab_related'),
|
|
9864
|
-
"className": "px-0
|
|
9875
|
+
"className": "px-0 py-4",
|
|
9865
9876
|
"body": [
|
|
9866
9877
|
{
|
|
9867
9878
|
"type": "steedos-object-related-lists",
|
|
9868
9879
|
"label": "相关列表",
|
|
9869
9880
|
"objectApiName": "${objectName}",
|
|
9870
9881
|
"recordId": "${recordId}",
|
|
9871
|
-
"id": "u:3b85b7b7a7f6",
|
|
9872
9882
|
appId: appId
|
|
9873
9883
|
}
|
|
9874
9884
|
],
|
|
9875
|
-
"id": "u:1a0326aeec2b"
|
|
9876
9885
|
};
|
|
9877
9886
|
const content = {
|
|
9878
9887
|
"type": "tabs",
|
|
9879
|
-
"className": "
|
|
9888
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
|
|
9889
|
+
"contentClassName": "bg-none",
|
|
9880
9890
|
"tabs": [
|
|
9881
9891
|
detailed
|
|
9882
9892
|
],
|
|
9883
|
-
"id": "u:a649e4094a12"
|
|
9884
9893
|
};
|
|
9885
9894
|
if(relatedLists.length){
|
|
9886
9895
|
content.tabs.push(related);
|
|
9887
9896
|
}
|
|
9888
|
-
content.tabs = reverse(content.tabs)
|
|
9897
|
+
// content.tabs = reverse(content.tabs)
|
|
9889
9898
|
return {
|
|
9890
9899
|
uiSchema,
|
|
9891
9900
|
amisSchema: {
|
|
@@ -9937,7 +9946,7 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
9937
9946
|
body: {
|
|
9938
9947
|
"type": "service",
|
|
9939
9948
|
id: serviceId,
|
|
9940
|
-
className: 'steedos-record-service p-0
|
|
9949
|
+
className: 'steedos-record-service p-0',
|
|
9941
9950
|
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
9942
9951
|
body: {
|
|
9943
9952
|
"type": "wrapper",
|
|
@@ -11165,8 +11174,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11165
11174
|
labelField: referenceTo.labelField.name,
|
|
11166
11175
|
valueField: referenceTo.valueField.name,
|
|
11167
11176
|
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
11168
|
-
disabledOn: `${readonly}`,
|
|
11169
|
-
hiddenOn: `( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
11177
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
11170
11178
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
11171
11179
|
source: source,
|
|
11172
11180
|
size: "lg",
|
|
@@ -11409,16 +11417,18 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11409
11417
|
}
|
|
11410
11418
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
11411
11419
|
if(readonly){
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11420
|
+
if(field.reference_to){
|
|
11421
|
+
return {
|
|
11422
|
+
type: 'steedos-field',
|
|
11423
|
+
config: field,
|
|
11424
|
+
static: true
|
|
11425
|
+
}
|
|
11426
|
+
}else {
|
|
11427
|
+
return {
|
|
11428
|
+
type: getAmisStaticFieldType('picker', readonly),
|
|
11429
|
+
tpl: getRelatedFieldTpl(field, ctx)
|
|
11430
|
+
}
|
|
11416
11431
|
}
|
|
11417
|
-
|
|
11418
|
-
// return {
|
|
11419
|
-
// type: Field.getAmisStaticFieldType('picker', readonly),
|
|
11420
|
-
// tpl: Tpl.getRelatedFieldTpl(field, ctx)
|
|
11421
|
-
// }
|
|
11422
11432
|
}
|
|
11423
11433
|
if(field.reference_to && !_$1.isString(field.reference_to) && !readonly){
|
|
11424
11434
|
return {
|
|
@@ -12465,7 +12475,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12465
12475
|
if(field.is_wide || convertData.type === 'group'){
|
|
12466
12476
|
convertData.className = 'col-span-2 m-0';
|
|
12467
12477
|
}else {
|
|
12468
|
-
convertData.className = 'm-
|
|
12478
|
+
convertData.className = 'm-0';
|
|
12469
12479
|
}
|
|
12470
12480
|
if(readonly){
|
|
12471
12481
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -12490,6 +12500,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12490
12500
|
}
|
|
12491
12501
|
}
|
|
12492
12502
|
|
|
12503
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
12504
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
12505
|
+
}
|
|
12506
|
+
|
|
12493
12507
|
if(_$1.isString(baseData.required)){
|
|
12494
12508
|
if(baseData.required.startsWith("{{")){
|
|
12495
12509
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -12871,9 +12885,41 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12871
12885
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12872
12886
|
* @Date: 2023-11-15 09:50:22
|
|
12873
12887
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12874
|
-
* @LastEditTime: 2024-01-
|
|
12888
|
+
* @LastEditTime: 2024-01-17 17:15:57
|
|
12875
12889
|
*/
|
|
12876
12890
|
|
|
12891
|
+
/**
|
|
12892
|
+
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
12893
|
+
* @param {*} value 子表组件字段值,数组
|
|
12894
|
+
* @param {*} fieldPrefix 字段前缀
|
|
12895
|
+
* @returns 转换后的子表组件字段值
|
|
12896
|
+
*/
|
|
12897
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
12898
|
+
let convertedValue = [];
|
|
12899
|
+
(value || []).forEach((itemValue)=>{
|
|
12900
|
+
var newItemValue = {};
|
|
12901
|
+
for(let n in itemValue){
|
|
12902
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
12903
|
+
}
|
|
12904
|
+
convertedValue.push(newItemValue);
|
|
12905
|
+
});
|
|
12906
|
+
return convertedValue;
|
|
12907
|
+
}
|
|
12908
|
+
|
|
12909
|
+
/**
|
|
12910
|
+
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
12911
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
12912
|
+
* @param {*} fieldPrefix 字段前缀
|
|
12913
|
+
* @returns 转换后的子表组件字段值
|
|
12914
|
+
*/
|
|
12915
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
12916
|
+
return (fields || []).map((item) => {
|
|
12917
|
+
const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
12918
|
+
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
12919
|
+
return newItem;
|
|
12920
|
+
});
|
|
12921
|
+
}
|
|
12922
|
+
|
|
12877
12923
|
/**
|
|
12878
12924
|
* @param {*} props
|
|
12879
12925
|
* @param {*} mode edit/new/readonly
|
|
@@ -13150,7 +13196,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13150
13196
|
{
|
|
13151
13197
|
"type": "wrapper",
|
|
13152
13198
|
"size": "none",
|
|
13153
|
-
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white
|
|
13199
|
+
"className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
|
|
13154
13200
|
"body": [
|
|
13155
13201
|
getFormPagination(props, mode)
|
|
13156
13202
|
]
|
|
@@ -13166,16 +13212,8 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13166
13212
|
}
|
|
13167
13213
|
];
|
|
13168
13214
|
let onServiceInitedScript = `
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
if(parent){
|
|
13172
|
-
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13173
|
-
var primaryKey = "${props.primaryKey}";
|
|
13174
|
-
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13175
|
-
return item[primaryKey] == parent[primaryKey];
|
|
13176
|
-
});
|
|
13177
|
-
}
|
|
13178
|
-
// 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13215
|
+
|
|
13216
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13179
13217
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
13180
13218
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
13181
13219
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -13188,6 +13226,11 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13188
13226
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
13189
13227
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
13190
13228
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
13229
|
+
let fieldPrefix = "${props.fieldPrefix}";
|
|
13230
|
+
if(fieldPrefix){
|
|
13231
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
13232
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
13233
|
+
}
|
|
13191
13234
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
13192
13235
|
let mode = "${mode}";
|
|
13193
13236
|
if(mode === "new"){
|
|
@@ -13210,6 +13253,16 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13210
13253
|
event.data.__tableItems.forEach(function(n,i){
|
|
13211
13254
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
13212
13255
|
});
|
|
13256
|
+
|
|
13257
|
+
var parent = event.data.parent;
|
|
13258
|
+
var fieldValue = event.data.__tableItems;
|
|
13259
|
+
if(parent){
|
|
13260
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13261
|
+
var primaryKey = "${props.primaryKey}";
|
|
13262
|
+
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13263
|
+
return item[primaryKey] == parent[primaryKey];
|
|
13264
|
+
});
|
|
13265
|
+
}
|
|
13213
13266
|
`;
|
|
13214
13267
|
let schema = {
|
|
13215
13268
|
"type": "service",
|
|
@@ -13812,6 +13865,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13812
13865
|
if(showOperation !== false){
|
|
13813
13866
|
showOperation = true;
|
|
13814
13867
|
}
|
|
13868
|
+
// props.fieldPrefix = "project_milestone_";
|
|
13869
|
+
if (props.fieldPrefix) {
|
|
13870
|
+
props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
|
|
13871
|
+
}
|
|
13872
|
+
console.log("=getAmisInputTableSchema==props.fields, props.fieldPrefix===", props.fields, props.fieldPrefix);
|
|
13815
13873
|
let serviceId = getComponentId("table_service", props.id);
|
|
13816
13874
|
let buttonsForColumnOperations = [];
|
|
13817
13875
|
let inlineEditMode = props.inlineEditMode;
|
|
@@ -13872,6 +13930,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13872
13930
|
});
|
|
13873
13931
|
}
|
|
13874
13932
|
};
|
|
13933
|
+
if(props.fieldPrefix){
|
|
13934
|
+
inputTableSchema.pipeIn = (value, data) => {
|
|
13935
|
+
return getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
13936
|
+
};
|
|
13937
|
+
}
|
|
13875
13938
|
if (buttonsForColumnOperations.length) {
|
|
13876
13939
|
inputTableSchema.columns.push({
|
|
13877
13940
|
"name": "__op__",
|