@steedos-widgets/amis-lib 3.6.2-beta.7 → 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 +126 -58
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +127 -59
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +43 -33
- 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 -0
- 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 bg-gray-100 border-b
|
|
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`,
|
|
@@ -9872,7 +9885,8 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9872
9885
|
};
|
|
9873
9886
|
const content = {
|
|
9874
9887
|
"type": "tabs",
|
|
9875
|
-
"className": "steedos-record-tabs p-4 m-0",
|
|
9888
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
|
|
9889
|
+
"contentClassName": "bg-none",
|
|
9876
9890
|
"tabs": [
|
|
9877
9891
|
detailed
|
|
9878
9892
|
],
|
|
@@ -9880,7 +9894,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9880
9894
|
if(relatedLists.length){
|
|
9881
9895
|
content.tabs.push(related);
|
|
9882
9896
|
}
|
|
9883
|
-
content.tabs = reverse(content.tabs)
|
|
9897
|
+
// content.tabs = reverse(content.tabs)
|
|
9884
9898
|
return {
|
|
9885
9899
|
uiSchema,
|
|
9886
9900
|
amisSchema: {
|
|
@@ -11160,8 +11174,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11160
11174
|
labelField: referenceTo.labelField.name,
|
|
11161
11175
|
valueField: referenceTo.valueField.name,
|
|
11162
11176
|
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
11163
|
-
disabledOn: `${readonly}`,
|
|
11164
|
-
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)) )`,
|
|
11165
11178
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
11166
11179
|
source: source,
|
|
11167
11180
|
size: "lg",
|
|
@@ -11404,16 +11417,18 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11404
11417
|
}
|
|
11405
11418
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
11406
11419
|
if(readonly){
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
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
|
+
}
|
|
11411
11431
|
}
|
|
11412
|
-
|
|
11413
|
-
// return {
|
|
11414
|
-
// type: Field.getAmisStaticFieldType('picker', readonly),
|
|
11415
|
-
// tpl: Tpl.getRelatedFieldTpl(field, ctx)
|
|
11416
|
-
// }
|
|
11417
11432
|
}
|
|
11418
11433
|
if(field.reference_to && !_$1.isString(field.reference_to) && !readonly){
|
|
11419
11434
|
return {
|
|
@@ -12460,7 +12475,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12460
12475
|
if(field.is_wide || convertData.type === 'group'){
|
|
12461
12476
|
convertData.className = 'col-span-2 m-0';
|
|
12462
12477
|
}else {
|
|
12463
|
-
convertData.className = 'm-
|
|
12478
|
+
convertData.className = 'm-0';
|
|
12464
12479
|
}
|
|
12465
12480
|
if(readonly){
|
|
12466
12481
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -12485,6 +12500,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12485
12500
|
}
|
|
12486
12501
|
}
|
|
12487
12502
|
|
|
12503
|
+
if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
|
|
12504
|
+
convertData.className = `${convertData.className || ''} hidden`;
|
|
12505
|
+
}
|
|
12506
|
+
|
|
12488
12507
|
if(_$1.isString(baseData.required)){
|
|
12489
12508
|
if(baseData.required.startsWith("{{")){
|
|
12490
12509
|
baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -12866,9 +12885,41 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12866
12885
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12867
12886
|
* @Date: 2023-11-15 09:50:22
|
|
12868
12887
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12869
|
-
* @LastEditTime: 2024-01-
|
|
12888
|
+
* @LastEditTime: 2024-01-17 17:15:57
|
|
12870
12889
|
*/
|
|
12871
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
|
+
|
|
12872
12923
|
/**
|
|
12873
12924
|
* @param {*} props
|
|
12874
12925
|
* @param {*} mode edit/new/readonly
|
|
@@ -13145,7 +13196,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13145
13196
|
{
|
|
13146
13197
|
"type": "wrapper",
|
|
13147
13198
|
"size": "none",
|
|
13148
|
-
"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",
|
|
13149
13200
|
"body": [
|
|
13150
13201
|
getFormPagination(props, mode)
|
|
13151
13202
|
]
|
|
@@ -13161,16 +13212,8 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13161
13212
|
}
|
|
13162
13213
|
];
|
|
13163
13214
|
let onServiceInitedScript = `
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
if(parent){
|
|
13167
|
-
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13168
|
-
var primaryKey = "${props.primaryKey}";
|
|
13169
|
-
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13170
|
-
return item[primaryKey] == parent[primaryKey];
|
|
13171
|
-
});
|
|
13172
|
-
}
|
|
13173
|
-
// 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13215
|
+
|
|
13216
|
+
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13174
13217
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
13175
13218
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
13176
13219
|
// 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
|
|
@@ -13183,6 +13226,11 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13183
13226
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
13184
13227
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
13185
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
|
+
}
|
|
13186
13234
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
13187
13235
|
let mode = "${mode}";
|
|
13188
13236
|
if(mode === "new"){
|
|
@@ -13205,6 +13253,16 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13205
13253
|
event.data.__tableItems.forEach(function(n,i){
|
|
13206
13254
|
event.data.__tableItems[i] = lastestFieldValue[i];
|
|
13207
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
|
+
}
|
|
13208
13266
|
`;
|
|
13209
13267
|
let schema = {
|
|
13210
13268
|
"type": "service",
|
|
@@ -13807,6 +13865,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13807
13865
|
if(showOperation !== false){
|
|
13808
13866
|
showOperation = true;
|
|
13809
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);
|
|
13810
13873
|
let serviceId = getComponentId("table_service", props.id);
|
|
13811
13874
|
let buttonsForColumnOperations = [];
|
|
13812
13875
|
let inlineEditMode = props.inlineEditMode;
|
|
@@ -13867,6 +13930,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13867
13930
|
});
|
|
13868
13931
|
}
|
|
13869
13932
|
};
|
|
13933
|
+
if(props.fieldPrefix){
|
|
13934
|
+
inputTableSchema.pipeIn = (value, data) => {
|
|
13935
|
+
return getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
13936
|
+
};
|
|
13937
|
+
}
|
|
13870
13938
|
if (buttonsForColumnOperations.length) {
|
|
13871
13939
|
inputTableSchema.columns.push({
|
|
13872
13940
|
"name": "__op__",
|