@steedos-widgets/amis-lib 1.3.4-beta.1 → 1.3.4-beta.11
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 +150 -53
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +150 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +30 -29
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +1 -0
- package/dist/types/lib/converter/amis/header.d.ts +2 -7
- package/dist/types/lib/objects.d.ts +1 -0
- package/dist/types/schema/standard_new.amis.d.ts +27 -2
- package/dist/types/standard/button.d.ts +27 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -452,39 +452,39 @@ function getCreatedInfoTpl(formFactor){
|
|
|
452
452
|
const href = Router.getObjectDetailPath({
|
|
453
453
|
formFactor, appId: "admin", objectName: 'users', recordId: '${created_by._id}'
|
|
454
454
|
});
|
|
455
|
-
return `<
|
|
455
|
+
return `<span><a href='${href}'>\${_display.created_by.label}</a>\${_display.created}</span>`
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
function getModifiedInfoTpl(formFactor){
|
|
459
459
|
const href = Router.getObjectDetailPath({
|
|
460
460
|
formFactor, appId: "admin", objectName: 'users', recordId: '${modified_by._id}'
|
|
461
461
|
});
|
|
462
|
-
return `<
|
|
462
|
+
return `<span><a href='${href}'>\${_display.modified_by.label}</a>\${_display.modified}</span>`
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
function getNumberTpl(field){
|
|
466
|
-
return `<
|
|
466
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
function getTimeTpl(field){
|
|
470
|
-
return `<
|
|
470
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
function getDateTpl(field){
|
|
474
|
-
return `<
|
|
474
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
|
|
478
478
|
function getDateTimeTpl(field){
|
|
479
|
-
return `<
|
|
479
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
function getUiFieldTpl(field){
|
|
483
|
-
return `<
|
|
483
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
function getUiFileSizeTpl(field){
|
|
487
|
-
return `<
|
|
487
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
//TODO 处理name字段
|
|
@@ -495,7 +495,7 @@ async function getRefObjectNameFieldName(field){
|
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
function getSelectTpl(field){
|
|
498
|
-
return `<
|
|
498
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
499
499
|
}
|
|
500
500
|
function getSelectMap(selectOptions){
|
|
501
501
|
let map = {};
|
|
@@ -1208,7 +1208,7 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
1208
1208
|
var frontend_display_as = "显示为";
|
|
1209
1209
|
var frontend_record_sum = "个项目";
|
|
1210
1210
|
var frontend_button_reload_tooltip = "刷新";
|
|
1211
|
-
var frontend_button_search_tooltip = "
|
|
1211
|
+
var frontend_button_search_tooltip = "筛选";
|
|
1212
1212
|
var frontend_fields_filter_button_search = "搜索";
|
|
1213
1213
|
var frontend_fields_filter_button_settings = "设置搜索项";
|
|
1214
1214
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
@@ -1830,7 +1830,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
1830
1830
|
* @Author: baozhoutao@steedos.com
|
|
1831
1831
|
* @Date: 2022-11-01 15:51:00
|
|
1832
1832
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1833
|
-
* @LastEditTime: 2023-
|
|
1833
|
+
* @LastEditTime: 2023-09-25 14:53:05
|
|
1834
1834
|
* @Description:
|
|
1835
1835
|
*/
|
|
1836
1836
|
|
|
@@ -1849,18 +1849,31 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1849
1849
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1850
1850
|
}
|
|
1851
1851
|
|
|
1852
|
+
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1853
|
+
const selectedRowResponseResult = api.body.selectedRowResponseResult;
|
|
1854
|
+
let defaultData = {};
|
|
1855
|
+
|
|
1856
|
+
if(!_.isEmpty(selectedRowResponseResult)){
|
|
1857
|
+
const fieldsKeys = _.keys(fields);
|
|
1858
|
+
// 如果新建记录时复制的数据中有omit或其他不相关字段数据时不应该一起保存到数据库,
|
|
1859
|
+
// 原规则见:https://github.com/steedos/steedos-frontend/issues/297
|
|
1860
|
+
_.forEach(selectedRowResponseResult, (val, key) => {
|
|
1861
|
+
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true) {
|
|
1862
|
+
defaultData[key] = val;
|
|
1863
|
+
}
|
|
1864
|
+
})
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1852
1867
|
const _master = api.body._master;
|
|
1853
1868
|
if(_master && _master._isRelated){
|
|
1854
1869
|
const relatedKey = _master.relatedKey;
|
|
1855
1870
|
const masterObjectName = _master.objectName;
|
|
1856
1871
|
const recordId = _master.recordId;
|
|
1857
1872
|
let relatedKeySaveValue = recordId;
|
|
1858
|
-
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1859
1873
|
const relatedField = fields[relatedKey];
|
|
1860
1874
|
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
1861
1875
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
1862
1876
|
}
|
|
1863
|
-
let defaultData = {};
|
|
1864
1877
|
let relatedKeyValue;
|
|
1865
1878
|
if(!_.isString(relatedField.reference_to)){
|
|
1866
1879
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
@@ -1870,6 +1883,9 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1870
1883
|
relatedKeyValue = relatedKeySaveValue;
|
|
1871
1884
|
}
|
|
1872
1885
|
defaultData[relatedKey]=relatedKeyValue;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
if(!_.isEmpty(defaultData)){
|
|
1873
1889
|
if(payload.schema){
|
|
1874
1890
|
// 表单微页面第一层要求是page
|
|
1875
1891
|
formSchema.data.defaultData = defaultData;
|
|
@@ -1892,6 +1908,18 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1892
1908
|
});
|
|
1893
1909
|
}, 200);
|
|
1894
1910
|
`;
|
|
1911
|
+
const getSelectedRowsScript = `
|
|
1912
|
+
const isLookup = event.data.isLookup;
|
|
1913
|
+
if(isLookup){
|
|
1914
|
+
// lookup弹出窗口的新建功能不需要支持复制新建
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
const uiSchema = event.data.uiSchema;
|
|
1918
|
+
const objectName = event.data.objectName;
|
|
1919
|
+
const listViewRef = event.context.scoped.getComponentById("listview_" + objectName);
|
|
1920
|
+
const selectedItems = listViewRef && listViewRef.props.store.toJSON().selectedItems || [];
|
|
1921
|
+
event.data.selectedIds = _.map(selectedItems, uiSchema.idFieldName || '_id');
|
|
1922
|
+
`;
|
|
1895
1923
|
return {
|
|
1896
1924
|
"type": "service",
|
|
1897
1925
|
"body": [
|
|
@@ -1904,6 +1932,21 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1904
1932
|
"click": {
|
|
1905
1933
|
"weight": 0,
|
|
1906
1934
|
"actions": [
|
|
1935
|
+
{
|
|
1936
|
+
"actionType": "custom",
|
|
1937
|
+
"script": getSelectedRowsScript
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
"actionType": "ajax",
|
|
1941
|
+
"outputVar": "selectedRowResponseResult",
|
|
1942
|
+
"args": {
|
|
1943
|
+
"api": {
|
|
1944
|
+
"url": "${context.rootUrl}/api/v1/${uiSchema.name}/${selectedIds|first}",
|
|
1945
|
+
"method": "get"
|
|
1946
|
+
}
|
|
1947
|
+
},
|
|
1948
|
+
"expression": "${selectedIds.length > 0}"
|
|
1949
|
+
},
|
|
1907
1950
|
{
|
|
1908
1951
|
"actionType": "dialog",
|
|
1909
1952
|
"dialog": {
|
|
@@ -1921,7 +1964,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1921
1964
|
"displayAs": "${displayAs}",
|
|
1922
1965
|
"uiSchema": "${uiSchema}",
|
|
1923
1966
|
"isLookup": "${isLookup}",
|
|
1924
|
-
"listName": "${listName}"
|
|
1967
|
+
"listName": "${listName}",
|
|
1968
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}",
|
|
1925
1969
|
},
|
|
1926
1970
|
"title":i18next.t('frontend_form_new') + " ${uiSchema.label | raw}",
|
|
1927
1971
|
"body": [
|
|
@@ -1933,7 +1977,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1933
1977
|
"data": {
|
|
1934
1978
|
"isLookup": "${isLookup}",
|
|
1935
1979
|
"_master": "${_master}",
|
|
1936
|
-
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
|
|
1980
|
+
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1981
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}"
|
|
1937
1982
|
},
|
|
1938
1983
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1939
1984
|
"method": "get",
|
|
@@ -2864,9 +2909,30 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2864
2909
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2865
2910
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2866
2911
|
if(ctx.formFactor === 'SMALL'){
|
|
2912
|
+
const dropdownButtons = [
|
|
2913
|
+
..._$1.map(buttons, (button) => {
|
|
2914
|
+
button.className += ' w-full';
|
|
2915
|
+
return button;
|
|
2916
|
+
}),
|
|
2917
|
+
..._$1.map(moreButtons, (button) => {
|
|
2918
|
+
button.className += ' w-full';
|
|
2919
|
+
return button;
|
|
2920
|
+
})
|
|
2921
|
+
];
|
|
2922
|
+
|
|
2923
|
+
let phoneMoreButtonsVisibleOn = '';
|
|
2924
|
+
_$1.forEach(dropdownButtons, (button, index) => {
|
|
2925
|
+
if(index === 0){
|
|
2926
|
+
phoneMoreButtonsVisibleOn = button.visibleOn;
|
|
2927
|
+
}else {
|
|
2928
|
+
phoneMoreButtonsVisibleOn = phoneMoreButtonsVisibleOn + ' || ' + button.visibleOn;
|
|
2929
|
+
}
|
|
2930
|
+
});
|
|
2931
|
+
|
|
2867
2932
|
return {
|
|
2868
2933
|
"type": "button",
|
|
2869
2934
|
"icon": "fa fa-angle-down",
|
|
2935
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
2870
2936
|
"onEvent": {
|
|
2871
2937
|
"click": {
|
|
2872
2938
|
"actions": [
|
|
@@ -2882,16 +2948,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2882
2948
|
"id": "u:fd837823be5b",
|
|
2883
2949
|
"vertical": true,
|
|
2884
2950
|
"tiled": true,
|
|
2885
|
-
"buttons":
|
|
2886
|
-
..._$1.map(buttons, (button)=>{
|
|
2887
|
-
button.className += ' w-full';
|
|
2888
|
-
return button;
|
|
2889
|
-
}),
|
|
2890
|
-
..._$1.map(moreButtons, (button)=>{
|
|
2891
|
-
button.className += ' w-full';
|
|
2892
|
-
return button;
|
|
2893
|
-
})
|
|
2894
|
-
],
|
|
2951
|
+
"buttons": dropdownButtons,
|
|
2895
2952
|
"btnLevel": "enhance",
|
|
2896
2953
|
"className": "w-full",
|
|
2897
2954
|
"btnClassName": "w-full",
|
|
@@ -2916,7 +2973,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2916
2973
|
type: "steedos-dropdown-button",
|
|
2917
2974
|
label: "",
|
|
2918
2975
|
buttons: moreButtons,
|
|
2919
|
-
className: 'slds-icon',
|
|
2976
|
+
className: 'slds-icon ml-1',
|
|
2920
2977
|
visibleOn: moreButtonsVisibleOn
|
|
2921
2978
|
};
|
|
2922
2979
|
buttons.push(dropdownButtonsSchema);
|
|
@@ -3659,13 +3716,15 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3659
3716
|
"visibleOn": "${display == 'split'?false:true}"
|
|
3660
3717
|
}];
|
|
3661
3718
|
if(ctx.formFactor !== 'SMALL'){
|
|
3719
|
+
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
3662
3720
|
buttonSchema.push({
|
|
3663
3721
|
"type": "flex",
|
|
3664
3722
|
"items":[
|
|
3665
3723
|
standardNewButton,
|
|
3666
|
-
{
|
|
3724
|
+
(restButtons.length > 0) && {
|
|
3667
3725
|
"type": "dropdown-button",
|
|
3668
|
-
"buttons":
|
|
3726
|
+
"buttons": restButtons,
|
|
3727
|
+
"className": " ml-1",
|
|
3669
3728
|
"menuClassName": "p-none split-dropdown-buttons",
|
|
3670
3729
|
"align": "right",
|
|
3671
3730
|
"size": "sm"
|
|
@@ -3797,7 +3856,6 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3797
3856
|
},
|
|
3798
3857
|
{
|
|
3799
3858
|
"body": [
|
|
3800
|
-
fieldsFilterButtonSchema,
|
|
3801
3859
|
{
|
|
3802
3860
|
"type": "button",
|
|
3803
3861
|
"label": "",
|
|
@@ -3806,6 +3864,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3806
3864
|
"target": amisListViewId,
|
|
3807
3865
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
3808
3866
|
},
|
|
3867
|
+
fieldsFilterButtonSchema,
|
|
3809
3868
|
// {
|
|
3810
3869
|
// "type": "button",
|
|
3811
3870
|
// "label": "",
|
|
@@ -4053,7 +4112,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4053
4112
|
"body": [
|
|
4054
4113
|
{
|
|
4055
4114
|
"type": "tpl",
|
|
4056
|
-
"tpl": `<a class="text-black text-base font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
4115
|
+
"tpl": `<a class="text-black text-base font-bold hover:font-bold" href="/app/\${appId}/\${_master.objectName}/\${_master.recordId}/\${objectName}/grid?related_field_name=\${relatedKey}">${relatedLabel}(\${$count})</a>`,
|
|
4057
4116
|
"inline": false,
|
|
4058
4117
|
"wrapperComponent": "",
|
|
4059
4118
|
"className": "",
|
|
@@ -5142,7 +5201,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5142
5201
|
{
|
|
5143
5202
|
"type": "search-box",
|
|
5144
5203
|
"name": keywordsSearchBoxName,
|
|
5145
|
-
"placeholder": "
|
|
5204
|
+
"placeholder": "搜索此列表",
|
|
5146
5205
|
"value": crudKeywords,
|
|
5147
5206
|
"clearable": true,
|
|
5148
5207
|
"clearAndSubmit": true
|
|
@@ -5265,10 +5324,10 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5265
5324
|
if(toolbarCount){
|
|
5266
5325
|
toolbars.push(toolbarCount);
|
|
5267
5326
|
}
|
|
5268
|
-
toolbars.push(toolbarReloadButton);
|
|
5269
5327
|
if(toolbarFilter){
|
|
5270
5328
|
toolbars.push(toolbarFilter);
|
|
5271
5329
|
}
|
|
5330
|
+
toolbars.push(toolbarReloadButton);
|
|
5272
5331
|
toolbars.push(toolbarDisplayAsButton);
|
|
5273
5332
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5274
5333
|
return [
|
|
@@ -5284,19 +5343,20 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5284
5343
|
toolbars.push(toolbarFilter);
|
|
5285
5344
|
}
|
|
5286
5345
|
toolbars.push(toolbarReloadButton);
|
|
5346
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5287
5347
|
if(mainObject?.permissions?.allowCreateListViews){
|
|
5288
5348
|
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5289
5349
|
}
|
|
5290
|
-
toolbars.push(toolbarDisplayAsButton);
|
|
5291
5350
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5292
5351
|
return [
|
|
5293
5352
|
// "filter-toggler",
|
|
5294
5353
|
...(headerToolbarItems || []),
|
|
5295
5354
|
"bulkActions",
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5355
|
+
// 不能放开crud columns-toggler否则crud card模式会报错
|
|
5356
|
+
// {
|
|
5357
|
+
// "type": "columns-toggler",
|
|
5358
|
+
// "className": "hidden"
|
|
5359
|
+
// },
|
|
5300
5360
|
...toolbars,
|
|
5301
5361
|
// {
|
|
5302
5362
|
// "type": "columns-toggler",
|
|
@@ -5333,6 +5393,7 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
5333
5393
|
]
|
|
5334
5394
|
}else {
|
|
5335
5395
|
return [
|
|
5396
|
+
"statistics",
|
|
5336
5397
|
{
|
|
5337
5398
|
"type": "pagination",
|
|
5338
5399
|
"maxButtons": 5
|
|
@@ -5903,10 +5964,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5903
5964
|
const op = api.data.$self.op;
|
|
5904
5965
|
if(!_.isEmpty(op)){
|
|
5905
5966
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
5967
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
5968
|
+
/*
|
|
5906
5969
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
5907
5970
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
5908
5971
|
})
|
|
5909
5972
|
payload.data.rows = rows;
|
|
5973
|
+
*/
|
|
5910
5974
|
return payload;
|
|
5911
5975
|
}
|
|
5912
5976
|
if(enable_tree){
|
|
@@ -8267,7 +8331,7 @@ async function getTableOperation(ctx){
|
|
|
8267
8331
|
label: i18next.t('frontend_operation'),
|
|
8268
8332
|
fixed: 'right',
|
|
8269
8333
|
labelClassName: 'text-center',
|
|
8270
|
-
className: 'text-center steedos-listview-operation w-
|
|
8334
|
+
className: 'text-center steedos-listview-operation w-10',
|
|
8271
8335
|
buttons: [
|
|
8272
8336
|
{
|
|
8273
8337
|
"type": "steedos-dropdown-button",
|
|
@@ -8323,7 +8387,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8323
8387
|
return {
|
|
8324
8388
|
mode: "table",
|
|
8325
8389
|
name: "thelist",
|
|
8326
|
-
headerToolbarClassName: "py-2 px-2 border-gray-300
|
|
8390
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8327
8391
|
className: "",
|
|
8328
8392
|
draggable: false,
|
|
8329
8393
|
defaultParams: getDefaultParams(options),
|
|
@@ -10115,7 +10179,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10115
10179
|
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
10116
10180
|
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit
|
|
10117
10181
|
}, options);
|
|
10118
|
-
tableOptions.amisData = createObject(options.amisData || {}, {})
|
|
10182
|
+
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
10119
10183
|
const table = await getTableSchema$1(fields, tableOptions);
|
|
10120
10184
|
delete table.mode;
|
|
10121
10185
|
//image与avatar需要在提交修改时特别处理
|
|
@@ -10174,17 +10238,26 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10174
10238
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
10175
10239
|
},
|
|
10176
10240
|
requestAdaptor: quickSaveApiRequestAdaptor,
|
|
10241
|
+
adaptor: `
|
|
10242
|
+
if(payload.errors){
|
|
10243
|
+
payload.status = 2;
|
|
10244
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
10245
|
+
}
|
|
10246
|
+
return payload;
|
|
10247
|
+
`
|
|
10177
10248
|
},
|
|
10178
10249
|
rowClassNameExpr: options.rowClassNameExpr
|
|
10179
10250
|
}, bodyProps);
|
|
10180
10251
|
|
|
10181
|
-
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10182
10252
|
}
|
|
10183
10253
|
|
|
10184
10254
|
const defaults = options.defaults;
|
|
10255
|
+
|
|
10256
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
10257
|
+
body = defaultsDeep({}, listSchema, body);
|
|
10258
|
+
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10259
|
+
|
|
10185
10260
|
if (defaults) {
|
|
10186
|
-
const listSchema = defaults.listSchema || {};
|
|
10187
|
-
body = defaultsDeep({}, listSchema, body);
|
|
10188
10261
|
const headerSchema = defaults.headerSchema;
|
|
10189
10262
|
const footerSchema = defaults.footerSchema;
|
|
10190
10263
|
if (headerSchema || footerSchema) {
|
|
@@ -10516,7 +10589,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10516
10589
|
* @Author: baozhoutao@steedos.com
|
|
10517
10590
|
* @Date: 2022-07-05 15:55:39
|
|
10518
10591
|
* @LastEditors: liaodaxue
|
|
10519
|
-
* @LastEditTime: 2023-
|
|
10592
|
+
* @LastEditTime: 2023-09-25 17:18:08
|
|
10520
10593
|
* @Description:
|
|
10521
10594
|
*/
|
|
10522
10595
|
|
|
@@ -10691,7 +10764,8 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10691
10764
|
setDataToComponentId: componentId,
|
|
10692
10765
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
10693
10766
|
appId: appId,
|
|
10694
|
-
crudClassName: 'border-t border-
|
|
10767
|
+
crudClassName: 'border-t border-gray-300 hidden',
|
|
10768
|
+
refField,
|
|
10695
10769
|
...ctx
|
|
10696
10770
|
};
|
|
10697
10771
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -10703,7 +10777,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10703
10777
|
amisSchema: {
|
|
10704
10778
|
type: "service",
|
|
10705
10779
|
id: componentId,
|
|
10706
|
-
className: `steedos-record-related-list ${componentId} rounded border border-
|
|
10780
|
+
className: `steedos-record-related-list ${componentId} rounded border border-gray-300 bg-gray-100 mb-4 ${className}`,
|
|
10707
10781
|
data: {
|
|
10708
10782
|
relatedKey: relatedKey,
|
|
10709
10783
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10806,10 +10880,33 @@ async function getRelatedListSchema(
|
|
|
10806
10880
|
ctx
|
|
10807
10881
|
) {
|
|
10808
10882
|
const uiSchema = await getUISchema(objectName);
|
|
10809
|
-
const listView =
|
|
10883
|
+
const listView = find(
|
|
10884
|
+
uiSchema.list_views,
|
|
10885
|
+
(listView, name) => {
|
|
10886
|
+
// 传入listViewName空值则取第一个
|
|
10887
|
+
if(!listViewName){
|
|
10888
|
+
listViewName = name;
|
|
10889
|
+
}
|
|
10890
|
+
return name === listViewName || listView._id === listViewName;
|
|
10891
|
+
}
|
|
10892
|
+
);
|
|
10810
10893
|
const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
|
|
10811
10894
|
// console.log('listViewProps==>', listViewProps)
|
|
10812
10895
|
const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
|
|
10896
|
+
|
|
10897
|
+
const refFieldName = ctx.refField && ctx.refField.name;
|
|
10898
|
+
|
|
10899
|
+
let relatedListColumns = listViewColumns;
|
|
10900
|
+
if(refFieldName){
|
|
10901
|
+
relatedListColumns = listViewColumns.filter(function(columnItem){
|
|
10902
|
+
if(typeof columnItem === "string"){
|
|
10903
|
+
return columnItem !== refFieldName;
|
|
10904
|
+
}
|
|
10905
|
+
else {
|
|
10906
|
+
return columnItem.field !== refFieldName;
|
|
10907
|
+
}
|
|
10908
|
+
});
|
|
10909
|
+
}
|
|
10813
10910
|
|
|
10814
10911
|
const defaults = ctx.defaults || {};
|
|
10815
10912
|
|
|
@@ -10847,7 +10944,7 @@ async function getRelatedListSchema(
|
|
|
10847
10944
|
const amisSchema = {
|
|
10848
10945
|
"type": "steedos-object-table",
|
|
10849
10946
|
"objectApiName": objectName,
|
|
10850
|
-
"columns":
|
|
10947
|
+
"columns": relatedListColumns,
|
|
10851
10948
|
"extraColumns": listView.extra_columns,
|
|
10852
10949
|
"filters": listviewFilter,
|
|
10853
10950
|
"filtersFunction": filtersFunction,
|
|
@@ -10868,7 +10965,7 @@ async function getRelatedListSchema(
|
|
|
10868
10965
|
* @Author: baozhoutao@steedos.com
|
|
10869
10966
|
* @Date: 2022-07-05 15:55:39
|
|
10870
10967
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10871
|
-
* @LastEditTime: 2023-09-
|
|
10968
|
+
* @LastEditTime: 2023-09-21 17:35:06
|
|
10872
10969
|
* @Description:
|
|
10873
10970
|
*/
|
|
10874
10971
|
|
|
@@ -11316,7 +11413,7 @@ async function getTableSchema(
|
|
|
11316
11413
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
11317
11414
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
11318
11415
|
};
|
|
11319
|
-
crudOptions.amisData = createObject(ctx.amisData || {}, {})
|
|
11416
|
+
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11320
11417
|
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11321
11418
|
// console.timeEnd('getTableSchema');
|
|
11322
11419
|
return {
|
|
@@ -11389,7 +11486,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11389
11486
|
};
|
|
11390
11487
|
const content = {
|
|
11391
11488
|
"type": "tabs",
|
|
11392
|
-
"className": "sm:mt-3 bg-white sm:
|
|
11489
|
+
"className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
|
|
11393
11490
|
"tabs": [
|
|
11394
11491
|
detailed
|
|
11395
11492
|
],
|
|
@@ -11576,7 +11673,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
11576
11673
|
"columnsTogglable": false,
|
|
11577
11674
|
"showHeader": true,
|
|
11578
11675
|
// "headerSchema": headerSchema
|
|
11579
|
-
className: "sm:border bg-white sm:
|
|
11676
|
+
className: "sm:border bg-white sm:rounded border-gray-300 border-solid"
|
|
11580
11677
|
}]
|
|
11581
11678
|
}
|
|
11582
11679
|
}
|
|
@@ -11634,7 +11731,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
11634
11731
|
]
|
|
11635
11732
|
}
|
|
11636
11733
|
],
|
|
11637
|
-
"className": "sm:mt-3 flex flex-col region-main bg-white sm:
|
|
11734
|
+
"className": "sm:mt-3 flex flex-col region-main bg-white sm:rounded sm:border border-gray-300",
|
|
11638
11735
|
"linksClassName": "pl-4 pt-2"
|
|
11639
11736
|
};
|
|
11640
11737
|
if(relatedList.length){
|