@steedos-widgets/amis-lib 1.3.4-beta.1 → 1.3.4-beta.10
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 +149 -53
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +149 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +29 -28
- 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.cjs.js
CHANGED
|
@@ -479,39 +479,39 @@ function getCreatedInfoTpl(formFactor){
|
|
|
479
479
|
const href = Router.getObjectDetailPath({
|
|
480
480
|
formFactor, appId: "admin", objectName: 'users', recordId: '${created_by._id}'
|
|
481
481
|
});
|
|
482
|
-
return `<
|
|
482
|
+
return `<span><a href='${href}'>\${_display.created_by.label}</a>\${_display.created}</span>`
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
function getModifiedInfoTpl(formFactor){
|
|
486
486
|
const href = Router.getObjectDetailPath({
|
|
487
487
|
formFactor, appId: "admin", objectName: 'users', recordId: '${modified_by._id}'
|
|
488
488
|
});
|
|
489
|
-
return `<
|
|
489
|
+
return `<span><a href='${href}'>\${_display.modified_by.label}</a>\${_display.modified}</span>`
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
function getNumberTpl(field){
|
|
493
|
-
return `<
|
|
493
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
function getTimeTpl(field){
|
|
497
|
-
return `<
|
|
497
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
function getDateTpl(field){
|
|
501
|
-
return `<
|
|
501
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
|
|
505
505
|
function getDateTimeTpl(field){
|
|
506
|
-
return `<
|
|
506
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
507
507
|
}
|
|
508
508
|
|
|
509
509
|
function getUiFieldTpl(field){
|
|
510
|
-
return `<
|
|
510
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
function getUiFileSizeTpl(field){
|
|
514
|
-
return `<
|
|
514
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
//TODO 处理name字段
|
|
@@ -522,7 +522,7 @@ async function getRefObjectNameFieldName(field){
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
function getSelectTpl(field){
|
|
525
|
-
return `<
|
|
525
|
+
return `<span>\${_display.${field.name}}</span>`
|
|
526
526
|
}
|
|
527
527
|
function getSelectMap(selectOptions){
|
|
528
528
|
let map = {};
|
|
@@ -1235,7 +1235,7 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
1235
1235
|
var frontend_display_as = "显示为";
|
|
1236
1236
|
var frontend_record_sum = "个项目";
|
|
1237
1237
|
var frontend_button_reload_tooltip = "刷新";
|
|
1238
|
-
var frontend_button_search_tooltip = "
|
|
1238
|
+
var frontend_button_search_tooltip = "筛选";
|
|
1239
1239
|
var frontend_fields_filter_button_search = "搜索";
|
|
1240
1240
|
var frontend_fields_filter_button_settings = "设置搜索项";
|
|
1241
1241
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
@@ -1857,7 +1857,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
1857
1857
|
* @Author: baozhoutao@steedos.com
|
|
1858
1858
|
* @Date: 2022-11-01 15:51:00
|
|
1859
1859
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1860
|
-
* @LastEditTime: 2023-
|
|
1860
|
+
* @LastEditTime: 2023-09-25 14:53:05
|
|
1861
1861
|
* @Description:
|
|
1862
1862
|
*/
|
|
1863
1863
|
|
|
@@ -1876,18 +1876,31 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1876
1876
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1877
1877
|
}
|
|
1878
1878
|
|
|
1879
|
+
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1880
|
+
const selectedRowResponseResult = api.body.selectedRowResponseResult;
|
|
1881
|
+
let defaultData = {};
|
|
1882
|
+
|
|
1883
|
+
if(!_.isEmpty(selectedRowResponseResult)){
|
|
1884
|
+
const fieldsKeys = _.keys(fields);
|
|
1885
|
+
// 如果新建记录时复制的数据中有omit或其他不相关字段数据时不应该一起保存到数据库,
|
|
1886
|
+
// 原规则见:https://github.com/steedos/steedos-frontend/issues/297
|
|
1887
|
+
_.forEach(selectedRowResponseResult, (val, key) => {
|
|
1888
|
+
if (fieldsKeys.indexOf(key) > -1 && fields[key].omit !== true) {
|
|
1889
|
+
defaultData[key] = val;
|
|
1890
|
+
}
|
|
1891
|
+
})
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1879
1894
|
const _master = api.body._master;
|
|
1880
1895
|
if(_master && _master._isRelated){
|
|
1881
1896
|
const relatedKey = _master.relatedKey;
|
|
1882
1897
|
const masterObjectName = _master.objectName;
|
|
1883
1898
|
const recordId = _master.recordId;
|
|
1884
1899
|
let relatedKeySaveValue = recordId;
|
|
1885
|
-
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1886
1900
|
const relatedField = fields[relatedKey];
|
|
1887
1901
|
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
1888
1902
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
1889
1903
|
}
|
|
1890
|
-
let defaultData = {};
|
|
1891
1904
|
let relatedKeyValue;
|
|
1892
1905
|
if(!_.isString(relatedField.reference_to)){
|
|
1893
1906
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
@@ -1897,6 +1910,9 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1897
1910
|
relatedKeyValue = relatedKeySaveValue;
|
|
1898
1911
|
}
|
|
1899
1912
|
defaultData[relatedKey]=relatedKeyValue;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
if(!_.isEmpty(defaultData)){
|
|
1900
1916
|
if(payload.schema){
|
|
1901
1917
|
// 表单微页面第一层要求是page
|
|
1902
1918
|
formSchema.data.defaultData = defaultData;
|
|
@@ -1919,6 +1935,18 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1919
1935
|
});
|
|
1920
1936
|
}, 200);
|
|
1921
1937
|
`;
|
|
1938
|
+
const getSelectedRowsScript = `
|
|
1939
|
+
const isLookup = event.data.isLookup;
|
|
1940
|
+
if(isLookup){
|
|
1941
|
+
// lookup弹出窗口的新建功能不需要支持复制新建
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
const uiSchema = event.data.uiSchema;
|
|
1945
|
+
const objectName = event.data.objectName;
|
|
1946
|
+
const listViewRef = event.context.scoped.getComponentById("listview_" + objectName);
|
|
1947
|
+
const selectedItems = listViewRef && listViewRef.props.store.toJSON().selectedItems || [];
|
|
1948
|
+
event.data.selectedIds = _.map(selectedItems, uiSchema.idFieldName || '_id');
|
|
1949
|
+
`;
|
|
1922
1950
|
return {
|
|
1923
1951
|
"type": "service",
|
|
1924
1952
|
"body": [
|
|
@@ -1931,6 +1959,21 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1931
1959
|
"click": {
|
|
1932
1960
|
"weight": 0,
|
|
1933
1961
|
"actions": [
|
|
1962
|
+
{
|
|
1963
|
+
"actionType": "custom",
|
|
1964
|
+
"script": getSelectedRowsScript
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
"actionType": "ajax",
|
|
1968
|
+
"outputVar": "selectedRowResponseResult",
|
|
1969
|
+
"args": {
|
|
1970
|
+
"api": {
|
|
1971
|
+
"url": "${context.rootUrl}/api/v1/${uiSchema.name}/${selectedIds|first}",
|
|
1972
|
+
"method": "get"
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
"expression": "${selectedIds.length > 0}"
|
|
1976
|
+
},
|
|
1934
1977
|
{
|
|
1935
1978
|
"actionType": "dialog",
|
|
1936
1979
|
"dialog": {
|
|
@@ -1948,7 +1991,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1948
1991
|
"displayAs": "${displayAs}",
|
|
1949
1992
|
"uiSchema": "${uiSchema}",
|
|
1950
1993
|
"isLookup": "${isLookup}",
|
|
1951
|
-
"listName": "${listName}"
|
|
1994
|
+
"listName": "${listName}",
|
|
1995
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}",
|
|
1952
1996
|
},
|
|
1953
1997
|
"title":i18next__default["default"].t('frontend_form_new') + " ${uiSchema.label | raw}",
|
|
1954
1998
|
"body": [
|
|
@@ -1960,7 +2004,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1960
2004
|
"data": {
|
|
1961
2005
|
"isLookup": "${isLookup}",
|
|
1962
2006
|
"_master": "${_master}",
|
|
1963
|
-
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
|
|
2007
|
+
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
2008
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}"
|
|
1964
2009
|
},
|
|
1965
2010
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1966
2011
|
"method": "get",
|
|
@@ -2891,9 +2936,30 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2891
2936
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2892
2937
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2893
2938
|
if(ctx.formFactor === 'SMALL'){
|
|
2939
|
+
const dropdownButtons = [
|
|
2940
|
+
...___namespace.map(buttons, (button) => {
|
|
2941
|
+
button.className += ' w-full';
|
|
2942
|
+
return button;
|
|
2943
|
+
}),
|
|
2944
|
+
...___namespace.map(moreButtons, (button) => {
|
|
2945
|
+
button.className += ' w-full';
|
|
2946
|
+
return button;
|
|
2947
|
+
})
|
|
2948
|
+
];
|
|
2949
|
+
|
|
2950
|
+
let phoneMoreButtonsVisibleOn = '';
|
|
2951
|
+
___namespace.forEach(dropdownButtons, (button, index) => {
|
|
2952
|
+
if(index === 0){
|
|
2953
|
+
phoneMoreButtonsVisibleOn = button.visibleOn;
|
|
2954
|
+
}else {
|
|
2955
|
+
phoneMoreButtonsVisibleOn = phoneMoreButtonsVisibleOn + ' || ' + button.visibleOn;
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
|
|
2894
2959
|
return {
|
|
2895
2960
|
"type": "button",
|
|
2896
2961
|
"icon": "fa fa-angle-down",
|
|
2962
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
2897
2963
|
"onEvent": {
|
|
2898
2964
|
"click": {
|
|
2899
2965
|
"actions": [
|
|
@@ -2909,16 +2975,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2909
2975
|
"id": "u:fd837823be5b",
|
|
2910
2976
|
"vertical": true,
|
|
2911
2977
|
"tiled": true,
|
|
2912
|
-
"buttons":
|
|
2913
|
-
...___namespace.map(buttons, (button)=>{
|
|
2914
|
-
button.className += ' w-full';
|
|
2915
|
-
return button;
|
|
2916
|
-
}),
|
|
2917
|
-
...___namespace.map(moreButtons, (button)=>{
|
|
2918
|
-
button.className += ' w-full';
|
|
2919
|
-
return button;
|
|
2920
|
-
})
|
|
2921
|
-
],
|
|
2978
|
+
"buttons": dropdownButtons,
|
|
2922
2979
|
"btnLevel": "enhance",
|
|
2923
2980
|
"className": "w-full",
|
|
2924
2981
|
"btnClassName": "w-full",
|
|
@@ -2943,7 +3000,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2943
3000
|
type: "steedos-dropdown-button",
|
|
2944
3001
|
label: "",
|
|
2945
3002
|
buttons: moreButtons,
|
|
2946
|
-
className: 'slds-icon',
|
|
3003
|
+
className: 'slds-icon ml-1',
|
|
2947
3004
|
visibleOn: moreButtonsVisibleOn
|
|
2948
3005
|
};
|
|
2949
3006
|
buttons.push(dropdownButtonsSchema);
|
|
@@ -3686,13 +3743,15 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3686
3743
|
"visibleOn": "${display == 'split'?false:true}"
|
|
3687
3744
|
}];
|
|
3688
3745
|
if(ctx.formFactor !== 'SMALL'){
|
|
3746
|
+
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
3689
3747
|
buttonSchema.push({
|
|
3690
3748
|
"type": "flex",
|
|
3691
3749
|
"items":[
|
|
3692
3750
|
standardNewButton,
|
|
3693
|
-
{
|
|
3751
|
+
(restButtons.length > 0) && {
|
|
3694
3752
|
"type": "dropdown-button",
|
|
3695
|
-
"buttons":
|
|
3753
|
+
"buttons": restButtons,
|
|
3754
|
+
"className": " ml-1",
|
|
3696
3755
|
"menuClassName": "p-none split-dropdown-buttons",
|
|
3697
3756
|
"align": "right",
|
|
3698
3757
|
"size": "sm"
|
|
@@ -3824,7 +3883,6 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3824
3883
|
},
|
|
3825
3884
|
{
|
|
3826
3885
|
"body": [
|
|
3827
|
-
fieldsFilterButtonSchema,
|
|
3828
3886
|
{
|
|
3829
3887
|
"type": "button",
|
|
3830
3888
|
"label": "",
|
|
@@ -3833,6 +3891,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3833
3891
|
"target": amisListViewId,
|
|
3834
3892
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
3835
3893
|
},
|
|
3894
|
+
fieldsFilterButtonSchema,
|
|
3836
3895
|
// {
|
|
3837
3896
|
// "type": "button",
|
|
3838
3897
|
// "label": "",
|
|
@@ -4080,7 +4139,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4080
4139
|
"body": [
|
|
4081
4140
|
{
|
|
4082
4141
|
"type": "tpl",
|
|
4083
|
-
"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>`,
|
|
4142
|
+
"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>`,
|
|
4084
4143
|
"inline": false,
|
|
4085
4144
|
"wrapperComponent": "",
|
|
4086
4145
|
"className": "",
|
|
@@ -5169,7 +5228,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5169
5228
|
{
|
|
5170
5229
|
"type": "search-box",
|
|
5171
5230
|
"name": keywordsSearchBoxName,
|
|
5172
|
-
"placeholder": "
|
|
5231
|
+
"placeholder": "搜索此列表",
|
|
5173
5232
|
"value": crudKeywords,
|
|
5174
5233
|
"clearable": true,
|
|
5175
5234
|
"clearAndSubmit": true
|
|
@@ -5292,10 +5351,10 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5292
5351
|
if(toolbarCount){
|
|
5293
5352
|
toolbars.push(toolbarCount);
|
|
5294
5353
|
}
|
|
5295
|
-
toolbars.push(toolbarReloadButton);
|
|
5296
5354
|
if(toolbarFilter){
|
|
5297
5355
|
toolbars.push(toolbarFilter);
|
|
5298
5356
|
}
|
|
5357
|
+
toolbars.push(toolbarReloadButton);
|
|
5299
5358
|
toolbars.push(toolbarDisplayAsButton);
|
|
5300
5359
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5301
5360
|
return [
|
|
@@ -5311,19 +5370,20 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5311
5370
|
toolbars.push(toolbarFilter);
|
|
5312
5371
|
}
|
|
5313
5372
|
toolbars.push(toolbarReloadButton);
|
|
5373
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5314
5374
|
if(mainObject?.permissions?.allowCreateListViews){
|
|
5315
5375
|
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5316
5376
|
}
|
|
5317
|
-
toolbars.push(toolbarDisplayAsButton);
|
|
5318
5377
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5319
5378
|
return [
|
|
5320
5379
|
// "filter-toggler",
|
|
5321
5380
|
...(headerToolbarItems || []),
|
|
5322
5381
|
"bulkActions",
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5382
|
+
// 不能放开crud columns-toggler否则crud card模式会报错
|
|
5383
|
+
// {
|
|
5384
|
+
// "type": "columns-toggler",
|
|
5385
|
+
// "className": "hidden"
|
|
5386
|
+
// },
|
|
5327
5387
|
...toolbars,
|
|
5328
5388
|
// {
|
|
5329
5389
|
// "type": "columns-toggler",
|
|
@@ -5930,10 +5990,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5930
5990
|
const op = api.data.$self.op;
|
|
5931
5991
|
if(!_.isEmpty(op)){
|
|
5932
5992
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
5993
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
5994
|
+
/*
|
|
5933
5995
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
5934
5996
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
5935
5997
|
})
|
|
5936
5998
|
payload.data.rows = rows;
|
|
5999
|
+
*/
|
|
5937
6000
|
return payload;
|
|
5938
6001
|
}
|
|
5939
6002
|
if(enable_tree){
|
|
@@ -8294,7 +8357,7 @@ async function getTableOperation(ctx){
|
|
|
8294
8357
|
label: i18next__default["default"].t('frontend_operation'),
|
|
8295
8358
|
fixed: 'right',
|
|
8296
8359
|
labelClassName: 'text-center',
|
|
8297
|
-
className: 'text-center steedos-listview-operation w-
|
|
8360
|
+
className: 'text-center steedos-listview-operation w-10',
|
|
8298
8361
|
buttons: [
|
|
8299
8362
|
{
|
|
8300
8363
|
"type": "steedos-dropdown-button",
|
|
@@ -8350,7 +8413,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8350
8413
|
return {
|
|
8351
8414
|
mode: "table",
|
|
8352
8415
|
name: "thelist",
|
|
8353
|
-
headerToolbarClassName: "py-2 px-2 border-gray-300
|
|
8416
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8354
8417
|
className: "",
|
|
8355
8418
|
draggable: false,
|
|
8356
8419
|
defaultParams: getDefaultParams(options),
|
|
@@ -10142,7 +10205,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10142
10205
|
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
10143
10206
|
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit
|
|
10144
10207
|
}, options);
|
|
10145
|
-
tableOptions.amisData = createObject(options.amisData || {}, {})
|
|
10208
|
+
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
10146
10209
|
const table = await getTableSchema$1(fields, tableOptions);
|
|
10147
10210
|
delete table.mode;
|
|
10148
10211
|
//image与avatar需要在提交修改时特别处理
|
|
@@ -10201,17 +10264,26 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10201
10264
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
10202
10265
|
},
|
|
10203
10266
|
requestAdaptor: quickSaveApiRequestAdaptor,
|
|
10267
|
+
adaptor: `
|
|
10268
|
+
if(payload.errors){
|
|
10269
|
+
payload.status = 2;
|
|
10270
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
10271
|
+
}
|
|
10272
|
+
return payload;
|
|
10273
|
+
`
|
|
10204
10274
|
},
|
|
10205
10275
|
rowClassNameExpr: options.rowClassNameExpr
|
|
10206
10276
|
}, bodyProps);
|
|
10207
10277
|
|
|
10208
|
-
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10209
10278
|
}
|
|
10210
10279
|
|
|
10211
10280
|
const defaults = options.defaults;
|
|
10281
|
+
|
|
10282
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
10283
|
+
body = defaultsDeep({}, listSchema, body);
|
|
10284
|
+
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10285
|
+
|
|
10212
10286
|
if (defaults) {
|
|
10213
|
-
const listSchema = defaults.listSchema || {};
|
|
10214
|
-
body = defaultsDeep({}, listSchema, body);
|
|
10215
10287
|
const headerSchema = defaults.headerSchema;
|
|
10216
10288
|
const footerSchema = defaults.footerSchema;
|
|
10217
10289
|
if (headerSchema || footerSchema) {
|
|
@@ -10543,7 +10615,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10543
10615
|
* @Author: baozhoutao@steedos.com
|
|
10544
10616
|
* @Date: 2022-07-05 15:55:39
|
|
10545
10617
|
* @LastEditors: liaodaxue
|
|
10546
|
-
* @LastEditTime: 2023-
|
|
10618
|
+
* @LastEditTime: 2023-09-25 17:18:08
|
|
10547
10619
|
* @Description:
|
|
10548
10620
|
*/
|
|
10549
10621
|
|
|
@@ -10718,7 +10790,8 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10718
10790
|
setDataToComponentId: componentId,
|
|
10719
10791
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
10720
10792
|
appId: appId,
|
|
10721
|
-
crudClassName: 'border-t border-
|
|
10793
|
+
crudClassName: 'border-t border-gray-300 hidden',
|
|
10794
|
+
refField,
|
|
10722
10795
|
...ctx
|
|
10723
10796
|
};
|
|
10724
10797
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -10730,7 +10803,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10730
10803
|
amisSchema: {
|
|
10731
10804
|
type: "service",
|
|
10732
10805
|
id: componentId,
|
|
10733
|
-
className: `steedos-record-related-list ${componentId} rounded border border-
|
|
10806
|
+
className: `steedos-record-related-list ${componentId} rounded border border-gray-300 bg-gray-100 mb-4 ${className}`,
|
|
10734
10807
|
data: {
|
|
10735
10808
|
relatedKey: relatedKey,
|
|
10736
10809
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10833,10 +10906,33 @@ async function getRelatedListSchema(
|
|
|
10833
10906
|
ctx
|
|
10834
10907
|
) {
|
|
10835
10908
|
const uiSchema = await getUISchema(objectName);
|
|
10836
|
-
const listView =
|
|
10909
|
+
const listView = _$1.find(
|
|
10910
|
+
uiSchema.list_views,
|
|
10911
|
+
(listView, name) => {
|
|
10912
|
+
// 传入listViewName空值则取第一个
|
|
10913
|
+
if(!listViewName){
|
|
10914
|
+
listViewName = name;
|
|
10915
|
+
}
|
|
10916
|
+
return name === listViewName || listView._id === listViewName;
|
|
10917
|
+
}
|
|
10918
|
+
);
|
|
10837
10919
|
const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
|
|
10838
10920
|
// console.log('listViewProps==>', listViewProps)
|
|
10839
10921
|
const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
|
|
10922
|
+
|
|
10923
|
+
const refFieldName = ctx.refField && ctx.refField.name;
|
|
10924
|
+
|
|
10925
|
+
let relatedListColumns = listViewColumns;
|
|
10926
|
+
if(refFieldName){
|
|
10927
|
+
relatedListColumns = listViewColumns.filter(function(columnItem){
|
|
10928
|
+
if(typeof columnItem === "string"){
|
|
10929
|
+
return columnItem !== refFieldName;
|
|
10930
|
+
}
|
|
10931
|
+
else {
|
|
10932
|
+
return columnItem.field !== refFieldName;
|
|
10933
|
+
}
|
|
10934
|
+
});
|
|
10935
|
+
}
|
|
10840
10936
|
|
|
10841
10937
|
const defaults = ctx.defaults || {};
|
|
10842
10938
|
|
|
@@ -10874,7 +10970,7 @@ async function getRelatedListSchema(
|
|
|
10874
10970
|
const amisSchema = {
|
|
10875
10971
|
"type": "steedos-object-table",
|
|
10876
10972
|
"objectApiName": objectName,
|
|
10877
|
-
"columns":
|
|
10973
|
+
"columns": relatedListColumns,
|
|
10878
10974
|
"extraColumns": listView.extra_columns,
|
|
10879
10975
|
"filters": listviewFilter,
|
|
10880
10976
|
"filtersFunction": filtersFunction,
|
|
@@ -10895,7 +10991,7 @@ async function getRelatedListSchema(
|
|
|
10895
10991
|
* @Author: baozhoutao@steedos.com
|
|
10896
10992
|
* @Date: 2022-07-05 15:55:39
|
|
10897
10993
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10898
|
-
* @LastEditTime: 2023-09-
|
|
10994
|
+
* @LastEditTime: 2023-09-21 17:35:06
|
|
10899
10995
|
* @Description:
|
|
10900
10996
|
*/
|
|
10901
10997
|
|
|
@@ -11343,7 +11439,7 @@ async function getTableSchema(
|
|
|
11343
11439
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
11344
11440
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
11345
11441
|
};
|
|
11346
|
-
crudOptions.amisData = createObject(ctx.amisData || {}, {})
|
|
11442
|
+
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11347
11443
|
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11348
11444
|
// console.timeEnd('getTableSchema');
|
|
11349
11445
|
return {
|
|
@@ -11416,7 +11512,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11416
11512
|
};
|
|
11417
11513
|
const content = {
|
|
11418
11514
|
"type": "tabs",
|
|
11419
|
-
"className": "sm:mt-3 bg-white sm:
|
|
11515
|
+
"className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
|
|
11420
11516
|
"tabs": [
|
|
11421
11517
|
detailed
|
|
11422
11518
|
],
|
|
@@ -11603,7 +11699,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
11603
11699
|
"columnsTogglable": false,
|
|
11604
11700
|
"showHeader": true,
|
|
11605
11701
|
// "headerSchema": headerSchema
|
|
11606
|
-
className: "sm:border bg-white sm:
|
|
11702
|
+
className: "sm:border bg-white sm:rounded border-gray-300 border-solid"
|
|
11607
11703
|
}]
|
|
11608
11704
|
}
|
|
11609
11705
|
}
|
|
@@ -11661,7 +11757,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
11661
11757
|
]
|
|
11662
11758
|
}
|
|
11663
11759
|
],
|
|
11664
|
-
"className": "sm:mt-3 flex flex-col region-main bg-white sm:
|
|
11760
|
+
"className": "sm:mt-3 flex flex-col region-main bg-white sm:rounded sm:border border-gray-300",
|
|
11665
11761
|
"linksClassName": "pl-4 pt-2"
|
|
11666
11762
|
};
|
|
11667
11763
|
if(relatedList.length){
|