@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.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",
|
|
@@ -5360,6 +5420,7 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
5360
5420
|
]
|
|
5361
5421
|
}else {
|
|
5362
5422
|
return [
|
|
5423
|
+
"statistics",
|
|
5363
5424
|
{
|
|
5364
5425
|
"type": "pagination",
|
|
5365
5426
|
"maxButtons": 5
|
|
@@ -5930,10 +5991,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5930
5991
|
const op = api.data.$self.op;
|
|
5931
5992
|
if(!_.isEmpty(op)){
|
|
5932
5993
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
5994
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
5995
|
+
/*
|
|
5933
5996
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
5934
5997
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
5935
5998
|
})
|
|
5936
5999
|
payload.data.rows = rows;
|
|
6000
|
+
*/
|
|
5937
6001
|
return payload;
|
|
5938
6002
|
}
|
|
5939
6003
|
if(enable_tree){
|
|
@@ -8294,7 +8358,7 @@ async function getTableOperation(ctx){
|
|
|
8294
8358
|
label: i18next__default["default"].t('frontend_operation'),
|
|
8295
8359
|
fixed: 'right',
|
|
8296
8360
|
labelClassName: 'text-center',
|
|
8297
|
-
className: 'text-center steedos-listview-operation w-
|
|
8361
|
+
className: 'text-center steedos-listview-operation w-10',
|
|
8298
8362
|
buttons: [
|
|
8299
8363
|
{
|
|
8300
8364
|
"type": "steedos-dropdown-button",
|
|
@@ -8350,7 +8414,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8350
8414
|
return {
|
|
8351
8415
|
mode: "table",
|
|
8352
8416
|
name: "thelist",
|
|
8353
|
-
headerToolbarClassName: "py-2 px-2 border-gray-300
|
|
8417
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8354
8418
|
className: "",
|
|
8355
8419
|
draggable: false,
|
|
8356
8420
|
defaultParams: getDefaultParams(options),
|
|
@@ -10142,7 +10206,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10142
10206
|
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
10143
10207
|
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit
|
|
10144
10208
|
}, options);
|
|
10145
|
-
tableOptions.amisData = createObject(options.amisData || {}, {})
|
|
10209
|
+
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
10146
10210
|
const table = await getTableSchema$1(fields, tableOptions);
|
|
10147
10211
|
delete table.mode;
|
|
10148
10212
|
//image与avatar需要在提交修改时特别处理
|
|
@@ -10201,17 +10265,26 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10201
10265
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
10202
10266
|
},
|
|
10203
10267
|
requestAdaptor: quickSaveApiRequestAdaptor,
|
|
10268
|
+
adaptor: `
|
|
10269
|
+
if(payload.errors){
|
|
10270
|
+
payload.status = 2;
|
|
10271
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
10272
|
+
}
|
|
10273
|
+
return payload;
|
|
10274
|
+
`
|
|
10204
10275
|
},
|
|
10205
10276
|
rowClassNameExpr: options.rowClassNameExpr
|
|
10206
10277
|
}, bodyProps);
|
|
10207
10278
|
|
|
10208
|
-
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10209
10279
|
}
|
|
10210
10280
|
|
|
10211
10281
|
const defaults = options.defaults;
|
|
10282
|
+
|
|
10283
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
10284
|
+
body = defaultsDeep({}, listSchema, body);
|
|
10285
|
+
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10286
|
+
|
|
10212
10287
|
if (defaults) {
|
|
10213
|
-
const listSchema = defaults.listSchema || {};
|
|
10214
|
-
body = defaultsDeep({}, listSchema, body);
|
|
10215
10288
|
const headerSchema = defaults.headerSchema;
|
|
10216
10289
|
const footerSchema = defaults.footerSchema;
|
|
10217
10290
|
if (headerSchema || footerSchema) {
|
|
@@ -10543,7 +10616,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10543
10616
|
* @Author: baozhoutao@steedos.com
|
|
10544
10617
|
* @Date: 2022-07-05 15:55:39
|
|
10545
10618
|
* @LastEditors: liaodaxue
|
|
10546
|
-
* @LastEditTime: 2023-
|
|
10619
|
+
* @LastEditTime: 2023-09-25 17:18:08
|
|
10547
10620
|
* @Description:
|
|
10548
10621
|
*/
|
|
10549
10622
|
|
|
@@ -10718,7 +10791,8 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10718
10791
|
setDataToComponentId: componentId,
|
|
10719
10792
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
10720
10793
|
appId: appId,
|
|
10721
|
-
crudClassName: 'border-t border-
|
|
10794
|
+
crudClassName: 'border-t border-gray-300 hidden',
|
|
10795
|
+
refField,
|
|
10722
10796
|
...ctx
|
|
10723
10797
|
};
|
|
10724
10798
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -10730,7 +10804,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10730
10804
|
amisSchema: {
|
|
10731
10805
|
type: "service",
|
|
10732
10806
|
id: componentId,
|
|
10733
|
-
className: `steedos-record-related-list ${componentId} rounded border border-
|
|
10807
|
+
className: `steedos-record-related-list ${componentId} rounded border border-gray-300 bg-gray-100 mb-4 ${className}`,
|
|
10734
10808
|
data: {
|
|
10735
10809
|
relatedKey: relatedKey,
|
|
10736
10810
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10833,10 +10907,33 @@ async function getRelatedListSchema(
|
|
|
10833
10907
|
ctx
|
|
10834
10908
|
) {
|
|
10835
10909
|
const uiSchema = await getUISchema(objectName);
|
|
10836
|
-
const listView =
|
|
10910
|
+
const listView = _$1.find(
|
|
10911
|
+
uiSchema.list_views,
|
|
10912
|
+
(listView, name) => {
|
|
10913
|
+
// 传入listViewName空值则取第一个
|
|
10914
|
+
if(!listViewName){
|
|
10915
|
+
listViewName = name;
|
|
10916
|
+
}
|
|
10917
|
+
return name === listViewName || listView._id === listViewName;
|
|
10918
|
+
}
|
|
10919
|
+
);
|
|
10837
10920
|
const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
|
|
10838
10921
|
// console.log('listViewProps==>', listViewProps)
|
|
10839
10922
|
const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
|
|
10923
|
+
|
|
10924
|
+
const refFieldName = ctx.refField && ctx.refField.name;
|
|
10925
|
+
|
|
10926
|
+
let relatedListColumns = listViewColumns;
|
|
10927
|
+
if(refFieldName){
|
|
10928
|
+
relatedListColumns = listViewColumns.filter(function(columnItem){
|
|
10929
|
+
if(typeof columnItem === "string"){
|
|
10930
|
+
return columnItem !== refFieldName;
|
|
10931
|
+
}
|
|
10932
|
+
else {
|
|
10933
|
+
return columnItem.field !== refFieldName;
|
|
10934
|
+
}
|
|
10935
|
+
});
|
|
10936
|
+
}
|
|
10840
10937
|
|
|
10841
10938
|
const defaults = ctx.defaults || {};
|
|
10842
10939
|
|
|
@@ -10874,7 +10971,7 @@ async function getRelatedListSchema(
|
|
|
10874
10971
|
const amisSchema = {
|
|
10875
10972
|
"type": "steedos-object-table",
|
|
10876
10973
|
"objectApiName": objectName,
|
|
10877
|
-
"columns":
|
|
10974
|
+
"columns": relatedListColumns,
|
|
10878
10975
|
"extraColumns": listView.extra_columns,
|
|
10879
10976
|
"filters": listviewFilter,
|
|
10880
10977
|
"filtersFunction": filtersFunction,
|
|
@@ -10895,7 +10992,7 @@ async function getRelatedListSchema(
|
|
|
10895
10992
|
* @Author: baozhoutao@steedos.com
|
|
10896
10993
|
* @Date: 2022-07-05 15:55:39
|
|
10897
10994
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10898
|
-
* @LastEditTime: 2023-09-
|
|
10995
|
+
* @LastEditTime: 2023-09-21 17:35:06
|
|
10899
10996
|
* @Description:
|
|
10900
10997
|
*/
|
|
10901
10998
|
|
|
@@ -11343,7 +11440,7 @@ async function getTableSchema(
|
|
|
11343
11440
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
11344
11441
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
11345
11442
|
};
|
|
11346
|
-
crudOptions.amisData = createObject(ctx.amisData || {}, {})
|
|
11443
|
+
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11347
11444
|
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11348
11445
|
// console.timeEnd('getTableSchema');
|
|
11349
11446
|
return {
|
|
@@ -11416,7 +11513,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11416
11513
|
};
|
|
11417
11514
|
const content = {
|
|
11418
11515
|
"type": "tabs",
|
|
11419
|
-
"className": "sm:mt-3 bg-white sm:
|
|
11516
|
+
"className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
|
|
11420
11517
|
"tabs": [
|
|
11421
11518
|
detailed
|
|
11422
11519
|
],
|
|
@@ -11603,7 +11700,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
11603
11700
|
"columnsTogglable": false,
|
|
11604
11701
|
"showHeader": true,
|
|
11605
11702
|
// "headerSchema": headerSchema
|
|
11606
|
-
className: "sm:border bg-white sm:
|
|
11703
|
+
className: "sm:border bg-white sm:rounded border-gray-300 border-solid"
|
|
11607
11704
|
}]
|
|
11608
11705
|
}
|
|
11609
11706
|
}
|
|
@@ -11661,7 +11758,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
11661
11758
|
]
|
|
11662
11759
|
}
|
|
11663
11760
|
],
|
|
11664
|
-
"className": "sm:mt-3 flex flex-col region-main bg-white sm:
|
|
11761
|
+
"className": "sm:mt-3 flex flex-col region-main bg-white sm:rounded sm:border border-gray-300",
|
|
11665
11762
|
"linksClassName": "pl-4 pt-2"
|
|
11666
11763
|
};
|
|
11667
11764
|
if(relatedList.length){
|