@steedos-widgets/amis-lib 3.6.2-beta.5 → 3.6.2-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 +127 -158
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +127 -158
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +33 -36
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/api.d.ts +0 -4
- package/dist/types/lib/converter/amis/header.d.ts +0 -7
- package/dist/types/lib/converter/amis/index.d.ts +0 -17
- package/dist/types/lib/objects.d.ts +37 -44
- package/dist/types/lib/page_init.d.ts +1 -38
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1430,9 +1430,9 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
1430
1430
|
var frontend_display_as = "显示为";
|
|
1431
1431
|
var frontend_record_sum = "个项目";
|
|
1432
1432
|
var frontend_button_reload_tooltip = "刷新";
|
|
1433
|
-
var frontend_button_search_tooltip = "
|
|
1433
|
+
var frontend_button_search_tooltip = "搜索";
|
|
1434
1434
|
var frontend_fields_filter_button_search = "搜索";
|
|
1435
|
-
var frontend_fields_filter_button_settings = "
|
|
1435
|
+
var frontend_fields_filter_button_settings = "选择搜索项";
|
|
1436
1436
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
1437
1437
|
var frontend_button_listview_control_label = "列表视图控制";
|
|
1438
1438
|
var frontend_listview_control_columns = "显示的列";
|
|
@@ -2086,12 +2086,11 @@ async function getTableColumns(fields, options){
|
|
|
2086
2086
|
//增加quickEdit属性,实现快速编辑
|
|
2087
2087
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2088
2088
|
let className = "";
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
// }
|
|
2089
|
+
if(field.wrap != true){
|
|
2090
|
+
className += " whitespace-nowrap ";
|
|
2091
|
+
}else {
|
|
2092
|
+
className += " break-words ";
|
|
2093
|
+
}
|
|
2095
2094
|
let columnItem;
|
|
2096
2095
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
2097
2096
|
const previewFileScript = `
|
|
@@ -2623,7 +2622,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2623
2622
|
}
|
|
2624
2623
|
return {
|
|
2625
2624
|
mode: "cards",
|
|
2626
|
-
perPageAvailable: [
|
|
2625
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
2627
2626
|
name: "thelist",
|
|
2628
2627
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
2629
2628
|
className: "",
|
|
@@ -2656,7 +2655,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2656
2655
|
|
|
2657
2656
|
return {
|
|
2658
2657
|
mode: "table",
|
|
2659
|
-
perPageAvailable: [
|
|
2658
|
+
perPageAvailable: [20, 50, 100, 500],
|
|
2660
2659
|
name: "thelist",
|
|
2661
2660
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
2662
2661
|
className: "",
|
|
@@ -3162,7 +3161,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3162
3161
|
payload.data.__objectName = "${object.name}";
|
|
3163
3162
|
payload.data.record = record;
|
|
3164
3163
|
|
|
3165
|
-
payload.data.
|
|
3164
|
+
payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
|
|
3166
3165
|
payload.data._master = {
|
|
3167
3166
|
record: record,
|
|
3168
3167
|
objectName: "${object.name}",
|
|
@@ -3317,7 +3316,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3317
3316
|
cache: API_CACHE,
|
|
3318
3317
|
requestAdaptor: `
|
|
3319
3318
|
// 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
|
|
3320
|
-
var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
|
|
3319
|
+
var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
|
|
3321
3320
|
if(!recordId){
|
|
3322
3321
|
// 新建则不请求任何数据
|
|
3323
3322
|
data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
|
|
@@ -3392,15 +3391,17 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
3392
3391
|
}
|
|
3393
3392
|
// data下的变量需要在保存接口(getSaveApi)中被删除。
|
|
3394
3393
|
payload.data = {
|
|
3395
|
-
...initialValues
|
|
3394
|
+
...initialValues,
|
|
3395
|
+
editFormInited: true
|
|
3396
3396
|
}
|
|
3397
3397
|
${options.initApiAdaptor || ''}
|
|
3398
|
+
// console.log('getEditFormInitApi======>', payload);
|
|
3398
3399
|
return payload;
|
|
3399
3400
|
`,
|
|
3400
|
-
responseData: {
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
},
|
|
3401
|
+
// responseData: {
|
|
3402
|
+
// initialValues: "$$",
|
|
3403
|
+
// editFormInited: true
|
|
3404
|
+
// },
|
|
3404
3405
|
data: data,
|
|
3405
3406
|
headers: {
|
|
3406
3407
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -6690,8 +6691,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6690
6691
|
},
|
|
6691
6692
|
{
|
|
6692
6693
|
"type": "tpl",
|
|
6693
|
-
"tpl": "${
|
|
6694
|
-
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
6694
|
+
"tpl": "${NAME_FIELD_VALUE}",
|
|
6695
6695
|
"inline": false,
|
|
6696
6696
|
"wrapperComponent": "",
|
|
6697
6697
|
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
@@ -6719,7 +6719,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6719
6719
|
let body = [
|
|
6720
6720
|
{
|
|
6721
6721
|
"type": "wrapper",
|
|
6722
|
-
"className": "p-4",
|
|
6722
|
+
"className": "p-4 bg-gray-100 border-b sm:sticky top-0 z-10",
|
|
6723
6723
|
"body": [
|
|
6724
6724
|
{
|
|
6725
6725
|
"type": "grid",
|
|
@@ -6766,7 +6766,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6766
6766
|
|
|
6767
6767
|
body.push({
|
|
6768
6768
|
"type": "form",
|
|
6769
|
-
"className": "p-4
|
|
6769
|
+
"className": "p-4 bg-white compact-layouts",
|
|
6770
6770
|
"wrapWithPanel": false,
|
|
6771
6771
|
"actions": [],
|
|
6772
6772
|
"body": details,
|
|
@@ -6778,7 +6778,6 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6778
6778
|
type: 'service',
|
|
6779
6779
|
id: `page_readonly_${name}_header`,
|
|
6780
6780
|
name: `page`,
|
|
6781
|
-
data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
|
|
6782
6781
|
body: body,
|
|
6783
6782
|
className: ''
|
|
6784
6783
|
}
|
|
@@ -6850,7 +6849,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6850
6849
|
"className": "flex justify-between"
|
|
6851
6850
|
}
|
|
6852
6851
|
],
|
|
6853
|
-
"className": "
|
|
6852
|
+
"className": "pt-0 pb-2 px-0"
|
|
6854
6853
|
};
|
|
6855
6854
|
return recordRelatedListHeader;
|
|
6856
6855
|
}
|
|
@@ -7985,7 +7984,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
7985
7984
|
{
|
|
7986
7985
|
"type": "search-box",
|
|
7987
7986
|
"name": keywordsSearchBoxName,
|
|
7988
|
-
"placeholder": "
|
|
7987
|
+
"placeholder": "快捷搜索",
|
|
7989
7988
|
"value": crudKeywords,
|
|
7990
7989
|
// "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
|
|
7991
7990
|
"clearAndSubmit": true,
|
|
@@ -8586,7 +8585,9 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8586
8585
|
return payload;
|
|
8587
8586
|
`
|
|
8588
8587
|
},
|
|
8589
|
-
rowClassNameExpr
|
|
8588
|
+
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
8589
|
+
// 使用表达式给tr添加初始选中状态
|
|
8590
|
+
rowClassNameExpr: options.rowClassNameExpr || "<%= data._id === data.recordId ? 'steedos-record-tr steedos-record-tr-' + data._id + ' steedos-record-selected' : 'steedos-record-tr steedos-record-tr-' + data._id %>"
|
|
8590
8591
|
}, bodyProps);
|
|
8591
8592
|
|
|
8592
8593
|
}
|
|
@@ -8601,7 +8602,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8601
8602
|
|
|
8602
8603
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
8603
8604
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
8604
|
-
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${}"});
|
|
8605
|
+
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
8605
8606
|
}
|
|
8606
8607
|
|
|
8607
8608
|
if (defaults) {
|
|
@@ -8736,9 +8737,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
8736
8737
|
id: `service_${formSchema.id}`,
|
|
8737
8738
|
className: 'p-0',
|
|
8738
8739
|
name: `page_edit_${recordId}`,
|
|
8739
|
-
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
8740
8740
|
data:{
|
|
8741
|
-
editFormInited: false,
|
|
8742
8741
|
...amisData
|
|
8743
8742
|
},
|
|
8744
8743
|
// data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
@@ -8747,8 +8746,9 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
8747
8746
|
body: [defaultsDeep({}, formSchema, {
|
|
8748
8747
|
type: "form",
|
|
8749
8748
|
mode: layout,
|
|
8749
|
+
initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
8750
8750
|
data: {
|
|
8751
|
-
|
|
8751
|
+
editFormInited: false,
|
|
8752
8752
|
},
|
|
8753
8753
|
labelAlign,
|
|
8754
8754
|
persistData: false,
|
|
@@ -8762,11 +8762,15 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
8762
8762
|
submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
|
|
8763
8763
|
api: await getSaveApi(objectSchema, recordId, fields, ctx),
|
|
8764
8764
|
initFetch: recordId != 'new',
|
|
8765
|
-
body:
|
|
8765
|
+
body: {
|
|
8766
|
+
type: 'wrapper',
|
|
8767
|
+
className: 'p-0 m-0',
|
|
8768
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
8769
|
+
hiddenOn: "${editFormInited != true}",
|
|
8770
|
+
},
|
|
8766
8771
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
8767
8772
|
bodyClassName: 'p-0',
|
|
8768
8773
|
className: 'steedos-amis-form',
|
|
8769
|
-
hiddenOn: "${editFormInited != true}",
|
|
8770
8774
|
onEvent: {
|
|
8771
8775
|
"submitSucc": {
|
|
8772
8776
|
"weight": 0,
|
|
@@ -9149,7 +9153,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9149
9153
|
amisSchema: {
|
|
9150
9154
|
type: "service",
|
|
9151
9155
|
id: componentId,
|
|
9152
|
-
className: `steedos-record-related-list
|
|
9156
|
+
className: `steedos-record-related-list pt-4 pb-2 border-b first:pt-0 last:border-0 ${componentId} ${className}`,
|
|
9153
9157
|
data: {
|
|
9154
9158
|
relatedKey: relatedKey,
|
|
9155
9159
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9378,7 +9382,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9378
9382
|
* @Author: baozhoutao@steedos.com
|
|
9379
9383
|
* @Date: 2022-07-05 15:55:39
|
|
9380
9384
|
* @LastEditors: baozhoutao@steedos.com
|
|
9381
|
-
* @LastEditTime: 2024-01-
|
|
9385
|
+
* @LastEditTime: 2024-01-16 11:14:34
|
|
9382
9386
|
* @Description:
|
|
9383
9387
|
*/
|
|
9384
9388
|
|
|
@@ -9876,34 +9880,29 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9876
9880
|
"label": "对象表单",
|
|
9877
9881
|
"objectApiName": "${objectName}",
|
|
9878
9882
|
"recordId": "${recordId}",
|
|
9879
|
-
"id": "u:d4a495811d57",
|
|
9880
9883
|
appId: appId
|
|
9881
9884
|
}
|
|
9882
9885
|
],
|
|
9883
|
-
"id": "u:5d4e7e3f6ecc"
|
|
9884
9886
|
};
|
|
9885
9887
|
const related = {
|
|
9886
9888
|
"title": i18next__default["default"].t('frontend_record_detail_tab_related'),
|
|
9887
|
-
"className": "px-0
|
|
9889
|
+
"className": "px-0 py-4",
|
|
9888
9890
|
"body": [
|
|
9889
9891
|
{
|
|
9890
9892
|
"type": "steedos-object-related-lists",
|
|
9891
9893
|
"label": "相关列表",
|
|
9892
9894
|
"objectApiName": "${objectName}",
|
|
9893
9895
|
"recordId": "${recordId}",
|
|
9894
|
-
"id": "u:3b85b7b7a7f6",
|
|
9895
9896
|
appId: appId
|
|
9896
9897
|
}
|
|
9897
9898
|
],
|
|
9898
|
-
"id": "u:1a0326aeec2b"
|
|
9899
9899
|
};
|
|
9900
9900
|
const content = {
|
|
9901
9901
|
"type": "tabs",
|
|
9902
|
-
"className": "
|
|
9902
|
+
"className": "steedos-record-tabs p-4 m-0",
|
|
9903
9903
|
"tabs": [
|
|
9904
9904
|
detailed
|
|
9905
9905
|
],
|
|
9906
|
-
"id": "u:a649e4094a12"
|
|
9907
9906
|
};
|
|
9908
9907
|
if(relatedLists.length){
|
|
9909
9908
|
content.tabs.push(related);
|
|
@@ -9932,88 +9931,73 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9932
9931
|
}
|
|
9933
9932
|
}
|
|
9934
9933
|
|
|
9935
|
-
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
9934
|
+
async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
9936
9935
|
const uiSchema = await getUISchema(objectName);
|
|
9937
9936
|
const fields = ___default["default"].values(uiSchema.fields);
|
|
9937
|
+
const serviceId = `u:steedos-record-service-${objectName}`;
|
|
9938
9938
|
return {
|
|
9939
9939
|
uiSchema,
|
|
9940
9940
|
amisSchema: {
|
|
9941
|
-
|
|
9942
|
-
className:
|
|
9943
|
-
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
9944
|
-
"body": {
|
|
9945
|
-
"type": "wrapper",
|
|
9946
|
-
"className": "p-0 m-0",
|
|
9947
|
-
"body": [],
|
|
9948
|
-
"hiddenOn": "${recordLoaded != true}"
|
|
9949
|
-
},
|
|
9950
|
-
data: {
|
|
9951
|
-
"_master.objectName": "${objectName}",
|
|
9952
|
-
"_master.recordId": "${recordId}",
|
|
9953
|
-
...(props.data || {})
|
|
9954
|
-
},
|
|
9955
|
-
"style": {
|
|
9956
|
-
// "padding": "var(--Page-body-padding)",
|
|
9957
|
-
...props.style
|
|
9958
|
-
},
|
|
9941
|
+
type: 'service',
|
|
9942
|
+
className: "p-0 m-0",
|
|
9959
9943
|
onEvent: {
|
|
9960
9944
|
[`@data.changed.${objectName}`]: {
|
|
9961
|
-
"actions": [
|
|
9962
|
-
{
|
|
9963
|
-
"actionType": "reload",
|
|
9964
|
-
"expression": "this.__deletedRecord != true"
|
|
9965
|
-
},
|
|
9966
|
-
{
|
|
9967
|
-
"actionType": "custom",
|
|
9968
|
-
"script": "window.goBack()",
|
|
9969
|
-
"expression": "this.__deletedRecord === true"
|
|
9970
|
-
}
|
|
9971
|
-
]
|
|
9972
|
-
},
|
|
9973
|
-
// 如果定义了fetchInited,则无法接收到广播事件@data.changed
|
|
9974
|
-
// "fetchInited": {
|
|
9975
|
-
// "weight": 0,
|
|
9976
|
-
// "actions": [
|
|
9977
|
-
// // {
|
|
9978
|
-
// // actionType: 'broadcast',
|
|
9979
|
-
// // eventName: "recordLoaded",
|
|
9980
|
-
// // args: {
|
|
9981
|
-
// // eventName: "recordLoaded"
|
|
9982
|
-
// // },
|
|
9983
|
-
// // data: {
|
|
9984
|
-
// // objectName: "${event.data.__objectName}",
|
|
9985
|
-
// // record: "${event.data.__record}"
|
|
9986
|
-
// // },
|
|
9987
|
-
// // expression: "${event.data.__response.error != true}"
|
|
9988
|
-
// // },
|
|
9989
|
-
// {
|
|
9990
|
-
// "actionType": "setValue",
|
|
9991
|
-
// "args": {
|
|
9992
|
-
// value: {
|
|
9993
|
-
// "recordLoaded": true,
|
|
9994
|
-
// }
|
|
9995
|
-
// },
|
|
9996
|
-
// expression: "${event.data.__response.error != true}"
|
|
9997
|
-
// }
|
|
9998
|
-
// ]
|
|
9999
|
-
// },
|
|
10000
|
-
"recordLoaded": {
|
|
10001
9945
|
"actions": [
|
|
10002
9946
|
{
|
|
10003
9947
|
"actionType": "reload",
|
|
10004
|
-
"
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
9948
|
+
"componentId": serviceId,
|
|
9949
|
+
"expression": "this.__deletedRecord != true"
|
|
9950
|
+
},
|
|
9951
|
+
{
|
|
9952
|
+
"actionType": "custom",
|
|
9953
|
+
"script": "window.goBack()",
|
|
9954
|
+
"expression": "this.__deletedRecord === true"
|
|
10011
9955
|
}
|
|
10012
9956
|
]
|
|
10013
9957
|
},
|
|
10014
|
-
|
|
9958
|
+
},
|
|
9959
|
+
body: {
|
|
9960
|
+
"type": "service",
|
|
9961
|
+
id: serviceId,
|
|
9962
|
+
className: 'steedos-record-service p-0',
|
|
9963
|
+
api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
|
|
9964
|
+
body: {
|
|
9965
|
+
"type": "wrapper",
|
|
9966
|
+
"className": "p-0 m-0",
|
|
9967
|
+
"body": body || [],
|
|
9968
|
+
"hiddenOn": "${recordLoaded != true}"
|
|
9969
|
+
},
|
|
9970
|
+
data: {
|
|
9971
|
+
"_master.objectName": "${objectName}",
|
|
9972
|
+
"_master.recordId": "${recordId}",
|
|
9973
|
+
...(props.data || {})
|
|
9974
|
+
},
|
|
9975
|
+
"style": {
|
|
9976
|
+
// "padding": "var(--Page-body-padding)",
|
|
9977
|
+
...props.style
|
|
9978
|
+
},
|
|
9979
|
+
onEvent: {
|
|
9980
|
+
// 如果定义了fetchInited,则无法接收到广播事件@data.changed
|
|
9981
|
+
"fetchInited": {
|
|
9982
|
+
"weight": 0,
|
|
9983
|
+
"actions": [
|
|
9984
|
+
{
|
|
9985
|
+
actionType: 'broadcast',
|
|
9986
|
+
eventName: "recordLoaded",
|
|
9987
|
+
data: {
|
|
9988
|
+
objectName: "${event.data.__objectName}",
|
|
9989
|
+
record: "${event.data.record}"
|
|
9990
|
+
},
|
|
9991
|
+
expression: "${event.data.__response.error != true}"
|
|
9992
|
+
},
|
|
9993
|
+
]
|
|
9994
|
+
},
|
|
9995
|
+
...props.onEvent
|
|
9996
|
+
}
|
|
10015
9997
|
}
|
|
10016
9998
|
}
|
|
9999
|
+
|
|
10000
|
+
|
|
10017
10001
|
}
|
|
10018
10002
|
}
|
|
10019
10003
|
|
|
@@ -12909,7 +12893,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12909
12893
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12910
12894
|
* @Date: 2023-11-15 09:50:22
|
|
12911
12895
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12912
|
-
* @LastEditTime: 2024-01-
|
|
12896
|
+
* @LastEditTime: 2024-01-16 14:58:51
|
|
12913
12897
|
*/
|
|
12914
12898
|
|
|
12915
12899
|
/**
|
|
@@ -13846,38 +13830,44 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13846
13830
|
if (!props.primaryKey) {
|
|
13847
13831
|
props.primaryKey = "_id";
|
|
13848
13832
|
}
|
|
13833
|
+
let showOperation = props.showOperation;
|
|
13834
|
+
if(showOperation !== false){
|
|
13835
|
+
showOperation = true;
|
|
13836
|
+
}
|
|
13849
13837
|
let serviceId = getComponentId("table_service", props.id);
|
|
13850
13838
|
let buttonsForColumnOperations = [];
|
|
13851
13839
|
let inlineEditMode = props.inlineEditMode;
|
|
13852
13840
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
13853
|
-
if
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13841
|
+
if(showOperation){
|
|
13842
|
+
if (props.editable) {
|
|
13843
|
+
let showEditButton = true;
|
|
13844
|
+
if (showAsInlineEditMode) {
|
|
13845
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
13846
|
+
showEditButton = true;
|
|
13847
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
13848
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
|
|
13849
|
+
// showEditButton = true;
|
|
13850
|
+
// }
|
|
13851
|
+
// else {
|
|
13852
|
+
// showEditButton = false;
|
|
13853
|
+
// }
|
|
13854
|
+
}
|
|
13855
|
+
// 编辑时显示编辑按钮
|
|
13856
|
+
if (showEditButton) {
|
|
13857
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
13858
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
13859
|
+
}
|
|
13865
13860
|
}
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13861
|
+
else {
|
|
13862
|
+
// 只读时显示查看按钮
|
|
13863
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
13864
|
+
let buttonViewSchema = await getButtonView(props);
|
|
13865
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
13866
|
+
}
|
|
13867
|
+
if (props.removable) {
|
|
13868
|
+
let buttonDeleteSchema = await getButtonDelete(props);
|
|
13869
|
+
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
13870
13870
|
}
|
|
13871
|
-
}
|
|
13872
|
-
else {
|
|
13873
|
-
// 只读时显示查看按钮
|
|
13874
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
|
|
13875
|
-
let buttonViewSchema = await getButtonView(props);
|
|
13876
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
13877
|
-
}
|
|
13878
|
-
if (props.removable) {
|
|
13879
|
-
let buttonDeleteSchema = await getButtonDelete(props);
|
|
13880
|
-
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
13881
13871
|
}
|
|
13882
13872
|
let inputTableSchema = {
|
|
13883
13873
|
"type": "input-table",
|
|
@@ -13925,7 +13915,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13925
13915
|
return item.depend_on;
|
|
13926
13916
|
});
|
|
13927
13917
|
if (isAnyFieldHasDependOn) {
|
|
13928
|
-
// 有任意一个子字段有depend_on
|
|
13918
|
+
// 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
|
|
13929
13919
|
Object.assign(inputTableSchema, {
|
|
13930
13920
|
strictMode: false
|
|
13931
13921
|
});
|
|
@@ -14030,7 +14020,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
14030
14020
|
// 获取
|
|
14031
14021
|
async function getRecordPageInitSchema(objectApiName){
|
|
14032
14022
|
const relatedList = await getObjectRelatedList(objectApiName);
|
|
14033
|
-
|
|
14023
|
+
await getUISchema(objectApiName);
|
|
14034
14024
|
let body = [
|
|
14035
14025
|
// detailHeaderAmisSchema,
|
|
14036
14026
|
{
|
|
@@ -14038,28 +14028,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
14038
14028
|
"label": "标题面板",
|
|
14039
14029
|
"objectApiName": "${objectName}",
|
|
14040
14030
|
"recordId": "${recordId}",
|
|
14041
|
-
"onEvent": {
|
|
14042
|
-
"recordLoaded": {
|
|
14043
|
-
"actions": [
|
|
14044
|
-
{
|
|
14045
|
-
"actionType": "setValue",
|
|
14046
|
-
"args": {
|
|
14047
|
-
"value": {
|
|
14048
|
-
"recordLoaded": true,
|
|
14049
|
-
}
|
|
14050
|
-
}
|
|
14051
|
-
},
|
|
14052
|
-
{
|
|
14053
|
-
"actionType": "reload",
|
|
14054
|
-
"data": {
|
|
14055
|
-
"name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
|
|
14056
|
-
"record": `\${record}`,
|
|
14057
|
-
"recordLoaded": true,
|
|
14058
|
-
}
|
|
14059
|
-
}
|
|
14060
|
-
]
|
|
14061
|
-
}
|
|
14062
|
-
}
|
|
14031
|
+
"onEvent": {}
|
|
14063
14032
|
}
|
|
14064
14033
|
];
|
|
14065
14034
|
let contentBody = {
|