@steedos-widgets/amis-lib 1.3.3 → 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 +359 -228
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +359 -228
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +117 -117
- 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/converter/amis/index.d.ts +2 -6
- package/dist/types/lib/objects.d.ts +7 -6
- 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
|
@@ -444,7 +444,7 @@ function getLookupListView(refObjectConfig) {
|
|
|
444
444
|
* @Author: baozhoutao@steedos.com
|
|
445
445
|
* @Date: 2022-05-23 09:53:08
|
|
446
446
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
447
|
-
* @LastEditTime: 2023-
|
|
447
|
+
* @LastEditTime: 2023-09-19 14:38:39
|
|
448
448
|
* @Description:
|
|
449
449
|
*/
|
|
450
450
|
|
|
@@ -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 = {};
|
|
@@ -624,9 +624,13 @@ async function getLookupTpl(field, ctx){
|
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
function getSwitchTpl(field){
|
|
627
|
+
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
628
|
+
if(field.isTableField){
|
|
629
|
+
fieldDataStrTpl = `data.${field.name}`;
|
|
630
|
+
}
|
|
627
631
|
return `<% if (data.${field.name}) { %>
|
|
628
|
-
<span class="slds-icon_container slds-icon-utility-check slds-current-color" title="
|
|
629
|
-
<span ><%=
|
|
632
|
+
<span class="slds-icon_container slds-icon-utility-check slds-current-color" title="<%=${fieldDataStrTpl}%>">
|
|
633
|
+
<span ><%= ${fieldDataStrTpl} === "√" ? "<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='currentColor' class='w-4 h-4'><path stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.75l6 6 9-13.5' /></svg>" : ${fieldDataStrTpl} %></span>
|
|
630
634
|
</span>
|
|
631
635
|
<% } %>`
|
|
632
636
|
}
|
|
@@ -1204,7 +1208,7 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
1204
1208
|
var frontend_display_as = "显示为";
|
|
1205
1209
|
var frontend_record_sum = "个项目";
|
|
1206
1210
|
var frontend_button_reload_tooltip = "刷新";
|
|
1207
|
-
var frontend_button_search_tooltip = "
|
|
1211
|
+
var frontend_button_search_tooltip = "筛选";
|
|
1208
1212
|
var frontend_fields_filter_button_search = "搜索";
|
|
1209
1213
|
var frontend_fields_filter_button_settings = "设置搜索项";
|
|
1210
1214
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
@@ -1826,7 +1830,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
1826
1830
|
* @Author: baozhoutao@steedos.com
|
|
1827
1831
|
* @Date: 2022-11-01 15:51:00
|
|
1828
1832
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1829
|
-
* @LastEditTime: 2023-
|
|
1833
|
+
* @LastEditTime: 2023-09-25 14:53:05
|
|
1830
1834
|
* @Description:
|
|
1831
1835
|
*/
|
|
1832
1836
|
|
|
@@ -1845,18 +1849,31 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1845
1849
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1846
1850
|
}
|
|
1847
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
|
+
|
|
1848
1867
|
const _master = api.body._master;
|
|
1849
1868
|
if(_master && _master._isRelated){
|
|
1850
1869
|
const relatedKey = _master.relatedKey;
|
|
1851
1870
|
const masterObjectName = _master.objectName;
|
|
1852
1871
|
const recordId = _master.recordId;
|
|
1853
1872
|
let relatedKeySaveValue = recordId;
|
|
1854
|
-
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1855
1873
|
const relatedField = fields[relatedKey];
|
|
1856
1874
|
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
1857
1875
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
1858
1876
|
}
|
|
1859
|
-
let defaultData = {};
|
|
1860
1877
|
let relatedKeyValue;
|
|
1861
1878
|
if(!_.isString(relatedField.reference_to)){
|
|
1862
1879
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
@@ -1866,6 +1883,9 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1866
1883
|
relatedKeyValue = relatedKeySaveValue;
|
|
1867
1884
|
}
|
|
1868
1885
|
defaultData[relatedKey]=relatedKeyValue;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
if(!_.isEmpty(defaultData)){
|
|
1869
1889
|
if(payload.schema){
|
|
1870
1890
|
// 表单微页面第一层要求是page
|
|
1871
1891
|
formSchema.data.defaultData = defaultData;
|
|
@@ -1888,6 +1908,18 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1888
1908
|
});
|
|
1889
1909
|
}, 200);
|
|
1890
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
|
+
`;
|
|
1891
1923
|
return {
|
|
1892
1924
|
"type": "service",
|
|
1893
1925
|
"body": [
|
|
@@ -1900,6 +1932,21 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1900
1932
|
"click": {
|
|
1901
1933
|
"weight": 0,
|
|
1902
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
|
+
},
|
|
1903
1950
|
{
|
|
1904
1951
|
"actionType": "dialog",
|
|
1905
1952
|
"dialog": {
|
|
@@ -1917,7 +1964,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1917
1964
|
"displayAs": "${displayAs}",
|
|
1918
1965
|
"uiSchema": "${uiSchema}",
|
|
1919
1966
|
"isLookup": "${isLookup}",
|
|
1920
|
-
"listName": "${listName}"
|
|
1967
|
+
"listName": "${listName}",
|
|
1968
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}",
|
|
1921
1969
|
},
|
|
1922
1970
|
"title":i18next.t('frontend_form_new') + " ${uiSchema.label | raw}",
|
|
1923
1971
|
"body": [
|
|
@@ -1929,7 +1977,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1929
1977
|
"data": {
|
|
1930
1978
|
"isLookup": "${isLookup}",
|
|
1931
1979
|
"_master": "${_master}",
|
|
1932
|
-
"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}"
|
|
1933
1982
|
},
|
|
1934
1983
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1935
1984
|
"method": "get",
|
|
@@ -2860,9 +2909,30 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2860
2909
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2861
2910
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2862
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
|
+
|
|
2863
2932
|
return {
|
|
2864
2933
|
"type": "button",
|
|
2865
2934
|
"icon": "fa fa-angle-down",
|
|
2935
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
2866
2936
|
"onEvent": {
|
|
2867
2937
|
"click": {
|
|
2868
2938
|
"actions": [
|
|
@@ -2878,16 +2948,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2878
2948
|
"id": "u:fd837823be5b",
|
|
2879
2949
|
"vertical": true,
|
|
2880
2950
|
"tiled": true,
|
|
2881
|
-
"buttons":
|
|
2882
|
-
..._$1.map(buttons, (button)=>{
|
|
2883
|
-
button.className += ' w-full';
|
|
2884
|
-
return button;
|
|
2885
|
-
}),
|
|
2886
|
-
..._$1.map(moreButtons, (button)=>{
|
|
2887
|
-
button.className += ' w-full';
|
|
2888
|
-
return button;
|
|
2889
|
-
})
|
|
2890
|
-
],
|
|
2951
|
+
"buttons": dropdownButtons,
|
|
2891
2952
|
"btnLevel": "enhance",
|
|
2892
2953
|
"className": "w-full",
|
|
2893
2954
|
"btnClassName": "w-full",
|
|
@@ -2912,7 +2973,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2912
2973
|
type: "steedos-dropdown-button",
|
|
2913
2974
|
label: "",
|
|
2914
2975
|
buttons: moreButtons,
|
|
2915
|
-
className: 'slds-icon',
|
|
2976
|
+
className: 'slds-icon ml-1',
|
|
2916
2977
|
visibleOn: moreButtonsVisibleOn
|
|
2917
2978
|
};
|
|
2918
2979
|
buttons.push(dropdownButtonsSchema);
|
|
@@ -3655,13 +3716,15 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3655
3716
|
"visibleOn": "${display == 'split'?false:true}"
|
|
3656
3717
|
}];
|
|
3657
3718
|
if(ctx.formFactor !== 'SMALL'){
|
|
3719
|
+
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
3658
3720
|
buttonSchema.push({
|
|
3659
3721
|
"type": "flex",
|
|
3660
3722
|
"items":[
|
|
3661
3723
|
standardNewButton,
|
|
3662
|
-
{
|
|
3724
|
+
(restButtons.length > 0) && {
|
|
3663
3725
|
"type": "dropdown-button",
|
|
3664
|
-
"buttons":
|
|
3726
|
+
"buttons": restButtons,
|
|
3727
|
+
"className": " ml-1",
|
|
3665
3728
|
"menuClassName": "p-none split-dropdown-buttons",
|
|
3666
3729
|
"align": "right",
|
|
3667
3730
|
"size": "sm"
|
|
@@ -3793,7 +3856,6 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3793
3856
|
},
|
|
3794
3857
|
{
|
|
3795
3858
|
"body": [
|
|
3796
|
-
fieldsFilterButtonSchema,
|
|
3797
3859
|
{
|
|
3798
3860
|
"type": "button",
|
|
3799
3861
|
"label": "",
|
|
@@ -3802,6 +3864,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3802
3864
|
"target": amisListViewId,
|
|
3803
3865
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
3804
3866
|
},
|
|
3867
|
+
fieldsFilterButtonSchema,
|
|
3805
3868
|
// {
|
|
3806
3869
|
// "type": "button",
|
|
3807
3870
|
// "label": "",
|
|
@@ -4049,7 +4112,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4049
4112
|
"body": [
|
|
4050
4113
|
{
|
|
4051
4114
|
"type": "tpl",
|
|
4052
|
-
"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>`,
|
|
4053
4116
|
"inline": false,
|
|
4054
4117
|
"wrapperComponent": "",
|
|
4055
4118
|
"className": "",
|
|
@@ -5138,7 +5201,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5138
5201
|
{
|
|
5139
5202
|
"type": "search-box",
|
|
5140
5203
|
"name": keywordsSearchBoxName,
|
|
5141
|
-
"placeholder": "
|
|
5204
|
+
"placeholder": "搜索此列表",
|
|
5142
5205
|
"value": crudKeywords,
|
|
5143
5206
|
"clearable": true,
|
|
5144
5207
|
"clearAndSubmit": true
|
|
@@ -5261,10 +5324,10 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5261
5324
|
if(toolbarCount){
|
|
5262
5325
|
toolbars.push(toolbarCount);
|
|
5263
5326
|
}
|
|
5264
|
-
toolbars.push(toolbarReloadButton);
|
|
5265
5327
|
if(toolbarFilter){
|
|
5266
5328
|
toolbars.push(toolbarFilter);
|
|
5267
5329
|
}
|
|
5330
|
+
toolbars.push(toolbarReloadButton);
|
|
5268
5331
|
toolbars.push(toolbarDisplayAsButton);
|
|
5269
5332
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5270
5333
|
return [
|
|
@@ -5280,19 +5343,20 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5280
5343
|
toolbars.push(toolbarFilter);
|
|
5281
5344
|
}
|
|
5282
5345
|
toolbars.push(toolbarReloadButton);
|
|
5346
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5283
5347
|
if(mainObject?.permissions?.allowCreateListViews){
|
|
5284
5348
|
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5285
5349
|
}
|
|
5286
|
-
toolbars.push(toolbarDisplayAsButton);
|
|
5287
5350
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5288
5351
|
return [
|
|
5289
5352
|
// "filter-toggler",
|
|
5290
5353
|
...(headerToolbarItems || []),
|
|
5291
5354
|
"bulkActions",
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5355
|
+
// 不能放开crud columns-toggler否则crud card模式会报错
|
|
5356
|
+
// {
|
|
5357
|
+
// "type": "columns-toggler",
|
|
5358
|
+
// "className": "hidden"
|
|
5359
|
+
// },
|
|
5296
5360
|
...toolbars,
|
|
5297
5361
|
// {
|
|
5298
5362
|
// "type": "columns-toggler",
|
|
@@ -5899,10 +5963,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5899
5963
|
const op = api.data.$self.op;
|
|
5900
5964
|
if(!_.isEmpty(op)){
|
|
5901
5965
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
5966
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
5967
|
+
/*
|
|
5902
5968
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
5903
5969
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
5904
5970
|
})
|
|
5905
5971
|
payload.data.rows = rows;
|
|
5972
|
+
*/
|
|
5906
5973
|
return payload;
|
|
5907
5974
|
}
|
|
5908
5975
|
if(enable_tree){
|
|
@@ -7329,7 +7396,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7329
7396
|
label: subField.label,
|
|
7330
7397
|
quickEdit: readonly ? false : gridSub
|
|
7331
7398
|
};
|
|
7332
|
-
if(subField.type
|
|
7399
|
+
if(["lookup", "boolean", "toggle"].indexOf(subField.type) > -1){
|
|
7333
7400
|
gridItemSchema.type = gridSub.type;
|
|
7334
7401
|
gridItemSchema.tpl = gridSub.tpl;
|
|
7335
7402
|
}
|
|
@@ -8263,7 +8330,7 @@ async function getTableOperation(ctx){
|
|
|
8263
8330
|
label: i18next.t('frontend_operation'),
|
|
8264
8331
|
fixed: 'right',
|
|
8265
8332
|
labelClassName: 'text-center',
|
|
8266
|
-
className: 'text-center steedos-listview-operation w-
|
|
8333
|
+
className: 'text-center steedos-listview-operation w-10',
|
|
8267
8334
|
buttons: [
|
|
8268
8335
|
{
|
|
8269
8336
|
"type": "steedos-dropdown-button",
|
|
@@ -8295,11 +8362,10 @@ async function getTableOperation(ctx){
|
|
|
8295
8362
|
}
|
|
8296
8363
|
|
|
8297
8364
|
async function getTableSchema$1(fields, options){
|
|
8298
|
-
let isLookup = options && options.isLookup;
|
|
8299
|
-
let hiddenColumnOperation = options && options.hiddenColumnOperation;
|
|
8300
8365
|
if(!options){
|
|
8301
8366
|
options = {};
|
|
8302
8367
|
}
|
|
8368
|
+
let { isLookup, hiddenColumnOperation } = options;
|
|
8303
8369
|
let columns = [];
|
|
8304
8370
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
8305
8371
|
if(isLookup){
|
|
@@ -8311,6 +8377,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8311
8377
|
}
|
|
8312
8378
|
else {
|
|
8313
8379
|
columns = await getTableColumns(fields, options);
|
|
8380
|
+
|
|
8314
8381
|
if(!isLookup && !hiddenColumnOperation){
|
|
8315
8382
|
columns.push(await getTableOperation(options));
|
|
8316
8383
|
}
|
|
@@ -8319,7 +8386,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8319
8386
|
return {
|
|
8320
8387
|
mode: "table",
|
|
8321
8388
|
name: "thelist",
|
|
8322
|
-
headerToolbarClassName: "py-2 px-2 border-gray-300
|
|
8389
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8323
8390
|
className: "",
|
|
8324
8391
|
draggable: false,
|
|
8325
8392
|
defaultParams: getDefaultParams(options),
|
|
@@ -9615,6 +9682,161 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9615
9682
|
return amisSchema;
|
|
9616
9683
|
}
|
|
9617
9684
|
|
|
9685
|
+
/******************************************************************************
|
|
9686
|
+
Copyright (c) Microsoft Corporation.
|
|
9687
|
+
|
|
9688
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9689
|
+
purpose with or without fee is hereby granted.
|
|
9690
|
+
|
|
9691
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9692
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9693
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9694
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9695
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9696
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9697
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
9698
|
+
***************************************************************************** */
|
|
9699
|
+
|
|
9700
|
+
var __assign = function() {
|
|
9701
|
+
__assign = Object.assign || function __assign(t) {
|
|
9702
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9703
|
+
s = arguments[i];
|
|
9704
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9705
|
+
}
|
|
9706
|
+
return t;
|
|
9707
|
+
};
|
|
9708
|
+
return __assign.apply(this, arguments);
|
|
9709
|
+
};
|
|
9710
|
+
|
|
9711
|
+
/**
|
|
9712
|
+
* 将例如像 a.b.c 或 a[1].b 的字符串转换为路径数组
|
|
9713
|
+
*
|
|
9714
|
+
* @param string 要转换的字符串
|
|
9715
|
+
*/
|
|
9716
|
+
var keyToPath = function (string) {
|
|
9717
|
+
var result = [];
|
|
9718
|
+
if (string.charCodeAt(0) === '.'.charCodeAt(0)) {
|
|
9719
|
+
result.push('');
|
|
9720
|
+
}
|
|
9721
|
+
string.replace(new RegExp('[^.[\\]]+|\\[(?:([^"\'][^[]*)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'), function (match, expression, quote, subString) {
|
|
9722
|
+
var key = match;
|
|
9723
|
+
if (quote) {
|
|
9724
|
+
key = subString.replace(/\\(\\)?/g, '$1');
|
|
9725
|
+
}
|
|
9726
|
+
else if (expression) {
|
|
9727
|
+
key = expression.trim();
|
|
9728
|
+
}
|
|
9729
|
+
result.push(key);
|
|
9730
|
+
return '';
|
|
9731
|
+
});
|
|
9732
|
+
return result;
|
|
9733
|
+
};
|
|
9734
|
+
|
|
9735
|
+
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
|
9736
|
+
function createObject(superProps, props, properties) {
|
|
9737
|
+
if (superProps && Object.isFrozen(superProps)) {
|
|
9738
|
+
superProps = cloneObject(superProps);
|
|
9739
|
+
}
|
|
9740
|
+
var obj = superProps
|
|
9741
|
+
? Object.create(superProps, __assign(__assign({}, properties), { __super: {
|
|
9742
|
+
value: superProps,
|
|
9743
|
+
writable: false,
|
|
9744
|
+
enumerable: false
|
|
9745
|
+
} }))
|
|
9746
|
+
: Object.create(Object.prototype, properties);
|
|
9747
|
+
props &&
|
|
9748
|
+
isObject(props) &&
|
|
9749
|
+
Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
|
|
9750
|
+
return obj;
|
|
9751
|
+
}
|
|
9752
|
+
function cloneObject(target, persistOwnProps) {
|
|
9753
|
+
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
9754
|
+
var obj = target && target.__super
|
|
9755
|
+
? Object.create(target.__super, {
|
|
9756
|
+
__super: {
|
|
9757
|
+
value: target.__super,
|
|
9758
|
+
writable: false,
|
|
9759
|
+
enumerable: false
|
|
9760
|
+
}
|
|
9761
|
+
})
|
|
9762
|
+
: Object.create(Object.prototype);
|
|
9763
|
+
persistOwnProps &&
|
|
9764
|
+
target &&
|
|
9765
|
+
Object.keys(target).forEach(function (key) { return (obj[key] = target[key]); });
|
|
9766
|
+
return obj;
|
|
9767
|
+
}
|
|
9768
|
+
function extendObject(target, src, persistOwnProps) {
|
|
9769
|
+
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
9770
|
+
var obj = cloneObject(target, persistOwnProps);
|
|
9771
|
+
src && Object.keys(src).forEach(function (key) { return (obj[key] = src[key]); });
|
|
9772
|
+
return obj;
|
|
9773
|
+
}
|
|
9774
|
+
function isObject(obj) {
|
|
9775
|
+
var typename = typeof obj;
|
|
9776
|
+
return (obj &&
|
|
9777
|
+
typename !== 'string' &&
|
|
9778
|
+
typename !== 'number' &&
|
|
9779
|
+
typename !== 'boolean' &&
|
|
9780
|
+
typename !== 'function' &&
|
|
9781
|
+
!Array.isArray(obj));
|
|
9782
|
+
}
|
|
9783
|
+
function setVariable(data, key, value, convertKeyToPath) {
|
|
9784
|
+
data = data || {};
|
|
9785
|
+
if (key in data) {
|
|
9786
|
+
data[key] = value;
|
|
9787
|
+
return;
|
|
9788
|
+
}
|
|
9789
|
+
var parts = convertKeyToPath !== false ? keyToPath(key) : [key];
|
|
9790
|
+
var last = parts.pop();
|
|
9791
|
+
while (parts.length) {
|
|
9792
|
+
var key_1 = parts.shift();
|
|
9793
|
+
if (isPlainObject(data[key_1])) {
|
|
9794
|
+
data = data[key_1] = __assign({}, data[key_1]);
|
|
9795
|
+
}
|
|
9796
|
+
else if (Array.isArray(data[key_1])) {
|
|
9797
|
+
data[key_1] = data[key_1].concat();
|
|
9798
|
+
data = data[key_1];
|
|
9799
|
+
}
|
|
9800
|
+
else if (data[key_1]) {
|
|
9801
|
+
// throw new Error(`目标路径不是纯对象,不能覆盖`);
|
|
9802
|
+
// 强行转成对象
|
|
9803
|
+
data[key_1] = {};
|
|
9804
|
+
data = data[key_1];
|
|
9805
|
+
}
|
|
9806
|
+
else {
|
|
9807
|
+
data[key_1] = {};
|
|
9808
|
+
data = data[key_1];
|
|
9809
|
+
}
|
|
9810
|
+
}
|
|
9811
|
+
data[last] = value;
|
|
9812
|
+
}
|
|
9813
|
+
function deleteVariable(data, key) {
|
|
9814
|
+
if (!data) {
|
|
9815
|
+
return;
|
|
9816
|
+
}
|
|
9817
|
+
else if (data.hasOwnProperty(key)) {
|
|
9818
|
+
delete data[key];
|
|
9819
|
+
return;
|
|
9820
|
+
}
|
|
9821
|
+
var parts = keyToPath(key);
|
|
9822
|
+
var last = parts.pop();
|
|
9823
|
+
while (parts.length) {
|
|
9824
|
+
var key_2 = parts.shift();
|
|
9825
|
+
if (isPlainObject(data[key_2])) {
|
|
9826
|
+
data = data[key_2] = __assign({}, data[key_2]);
|
|
9827
|
+
}
|
|
9828
|
+
else if (data[key_2]) {
|
|
9829
|
+
throw new Error("\u76EE\u6807\u8DEF\u5F84\u4E0D\u662F\u7EAF\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u4FEE\u6539");
|
|
9830
|
+
}
|
|
9831
|
+
else {
|
|
9832
|
+
break;
|
|
9833
|
+
}
|
|
9834
|
+
}
|
|
9835
|
+
if (data && data.hasOwnProperty && data.hasOwnProperty(last)) {
|
|
9836
|
+
delete data[last];
|
|
9837
|
+
}
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9618
9840
|
/*
|
|
9619
9841
|
* @Author: baozhoutao@steedos.com
|
|
9620
9842
|
* @Date: 2022-05-26 16:02:08
|
|
@@ -9855,9 +10077,30 @@ function getBulkActions(objectSchema){
|
|
|
9855
10077
|
]
|
|
9856
10078
|
}
|
|
9857
10079
|
|
|
10080
|
+
async function getCrudSchemaWithDataFilter(crud, options = {}){
|
|
10081
|
+
const { crudDataFilter, amisData, env } = options;
|
|
10082
|
+
let onCrudDataFilter = options.onCrudDataFilter;
|
|
10083
|
+
if (!onCrudDataFilter && typeof crudDataFilter === 'string') {
|
|
10084
|
+
onCrudDataFilter = new Function(
|
|
10085
|
+
'crud',
|
|
10086
|
+
'env',
|
|
10087
|
+
'data',
|
|
10088
|
+
crudDataFilter
|
|
10089
|
+
);
|
|
10090
|
+
}
|
|
10091
|
+
|
|
10092
|
+
try {
|
|
10093
|
+
onCrudDataFilter && (crud = await onCrudDataFilter(crud, env, amisData) || crud);
|
|
10094
|
+
} catch (e) {
|
|
10095
|
+
console.warn(e);
|
|
10096
|
+
}
|
|
10097
|
+
return crud;
|
|
10098
|
+
}
|
|
10099
|
+
|
|
9858
10100
|
async function getObjectCRUD(objectSchema, fields, options){
|
|
9859
10101
|
// console.time('getObjectCRUD');
|
|
9860
|
-
const { top, perPage, showDisplayAs = false, displayAs, crudClassName = ""
|
|
10102
|
+
const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "",
|
|
10103
|
+
crudDataFilter, onCrudDataFilter, amisData, env } = options;
|
|
9861
10104
|
const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
|
|
9862
10105
|
const isTreeObject = objectSchema.enable_tree;
|
|
9863
10106
|
const bulkActions = getBulkActions(objectSchema);
|
|
@@ -9898,6 +10141,14 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9898
10141
|
filterVisible: options.filterVisible
|
|
9899
10142
|
});
|
|
9900
10143
|
|
|
10144
|
+
options.amisData = createObject(options.amisData, {
|
|
10145
|
+
objectName: objectSchema.name,
|
|
10146
|
+
// _id: null,
|
|
10147
|
+
recordPermissions: objectSchema.permissions,
|
|
10148
|
+
uiSchema: objectSchema,
|
|
10149
|
+
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
10150
|
+
});
|
|
10151
|
+
|
|
9901
10152
|
|
|
9902
10153
|
let body = null;
|
|
9903
10154
|
const id = `listview_${objectSchema.name}`;
|
|
@@ -9923,7 +10174,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9923
10174
|
if(objectSchema.name === 'organizations'){
|
|
9924
10175
|
labelFieldName = 'name';
|
|
9925
10176
|
}
|
|
9926
|
-
|
|
10177
|
+
let tableOptions = Object.assign({
|
|
10178
|
+
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
10179
|
+
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit
|
|
10180
|
+
}, options);
|
|
10181
|
+
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
10182
|
+
const table = await getTableSchema$1(fields, tableOptions);
|
|
9927
10183
|
delete table.mode;
|
|
9928
10184
|
//image与avatar需要在提交修改时特别处理
|
|
9929
10185
|
const imageNames = ___default.compact(___default.map(___default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
@@ -9981,17 +10237,26 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9981
10237
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
9982
10238
|
},
|
|
9983
10239
|
requestAdaptor: quickSaveApiRequestAdaptor,
|
|
10240
|
+
adaptor: `
|
|
10241
|
+
if(payload.errors){
|
|
10242
|
+
payload.status = 2;
|
|
10243
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
10244
|
+
}
|
|
10245
|
+
return payload;
|
|
10246
|
+
`
|
|
9984
10247
|
},
|
|
9985
10248
|
rowClassNameExpr: options.rowClassNameExpr
|
|
9986
|
-
},
|
|
9987
|
-
|
|
9988
|
-
);
|
|
10249
|
+
}, bodyProps);
|
|
10250
|
+
|
|
9989
10251
|
}
|
|
9990
10252
|
|
|
9991
10253
|
const defaults = options.defaults;
|
|
10254
|
+
|
|
10255
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
10256
|
+
body = defaultsDeep({}, listSchema, body);
|
|
10257
|
+
body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
|
|
10258
|
+
|
|
9992
10259
|
if (defaults) {
|
|
9993
|
-
const listSchema = defaults.listSchema || {};
|
|
9994
|
-
body = defaultsDeep({}, listSchema, body);
|
|
9995
10260
|
const headerSchema = defaults.headerSchema;
|
|
9996
10261
|
const footerSchema = defaults.footerSchema;
|
|
9997
10262
|
if (headerSchema || footerSchema) {
|
|
@@ -10020,16 +10285,10 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10020
10285
|
return {
|
|
10021
10286
|
type: 'service',
|
|
10022
10287
|
className: '',
|
|
10023
|
-
//目前crud的service层id不认用户自定义id,只支持默认规则id
|
|
10288
|
+
//目前crud的service层id不认用户自定义id,只支持默认规则id,许多地方的格式都写死了service_listview_${objectname}
|
|
10024
10289
|
id: `service_${id}`,
|
|
10025
10290
|
name: `page`,
|
|
10026
|
-
data:
|
|
10027
|
-
objectName: objectSchema.name,
|
|
10028
|
-
// _id: null,
|
|
10029
|
-
recordPermissions: objectSchema.permissions,
|
|
10030
|
-
uiSchema: objectSchema,
|
|
10031
|
-
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
10032
|
-
},
|
|
10291
|
+
data: options.amisData,
|
|
10033
10292
|
body: body
|
|
10034
10293
|
}
|
|
10035
10294
|
}
|
|
@@ -10329,7 +10588,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10329
10588
|
* @Author: baozhoutao@steedos.com
|
|
10330
10589
|
* @Date: 2022-07-05 15:55:39
|
|
10331
10590
|
* @LastEditors: liaodaxue
|
|
10332
|
-
* @LastEditTime: 2023-
|
|
10591
|
+
* @LastEditTime: 2023-09-25 17:18:08
|
|
10333
10592
|
* @Description:
|
|
10334
10593
|
*/
|
|
10335
10594
|
|
|
@@ -10504,7 +10763,8 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10504
10763
|
setDataToComponentId: componentId,
|
|
10505
10764
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
10506
10765
|
appId: appId,
|
|
10507
|
-
crudClassName: 'border-t border-
|
|
10766
|
+
crudClassName: 'border-t border-gray-300 hidden',
|
|
10767
|
+
refField,
|
|
10508
10768
|
...ctx
|
|
10509
10769
|
};
|
|
10510
10770
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -10516,7 +10776,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10516
10776
|
amisSchema: {
|
|
10517
10777
|
type: "service",
|
|
10518
10778
|
id: componentId,
|
|
10519
|
-
className: `steedos-record-related-list ${componentId} rounded border border-
|
|
10779
|
+
className: `steedos-record-related-list ${componentId} rounded border border-gray-300 bg-gray-100 mb-4 ${className}`,
|
|
10520
10780
|
data: {
|
|
10521
10781
|
relatedKey: relatedKey,
|
|
10522
10782
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10619,10 +10879,33 @@ async function getRelatedListSchema(
|
|
|
10619
10879
|
ctx
|
|
10620
10880
|
) {
|
|
10621
10881
|
const uiSchema = await getUISchema(objectName);
|
|
10622
|
-
const listView =
|
|
10882
|
+
const listView = find(
|
|
10883
|
+
uiSchema.list_views,
|
|
10884
|
+
(listView, name) => {
|
|
10885
|
+
// 传入listViewName空值则取第一个
|
|
10886
|
+
if(!listViewName){
|
|
10887
|
+
listViewName = name;
|
|
10888
|
+
}
|
|
10889
|
+
return name === listViewName || listView._id === listViewName;
|
|
10890
|
+
}
|
|
10891
|
+
);
|
|
10623
10892
|
const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
|
|
10624
10893
|
// console.log('listViewProps==>', listViewProps)
|
|
10625
10894
|
const {columns: listViewColumns, sort: listViewSort, filter: listviewFilter, filtersFunction } = listViewProps;
|
|
10895
|
+
|
|
10896
|
+
const refFieldName = ctx.refField && ctx.refField.name;
|
|
10897
|
+
|
|
10898
|
+
let relatedListColumns = listViewColumns;
|
|
10899
|
+
if(refFieldName){
|
|
10900
|
+
relatedListColumns = listViewColumns.filter(function(columnItem){
|
|
10901
|
+
if(typeof columnItem === "string"){
|
|
10902
|
+
return columnItem !== refFieldName;
|
|
10903
|
+
}
|
|
10904
|
+
else {
|
|
10905
|
+
return columnItem.field !== refFieldName;
|
|
10906
|
+
}
|
|
10907
|
+
});
|
|
10908
|
+
}
|
|
10626
10909
|
|
|
10627
10910
|
const defaults = ctx.defaults || {};
|
|
10628
10911
|
|
|
@@ -10660,7 +10943,7 @@ async function getRelatedListSchema(
|
|
|
10660
10943
|
const amisSchema = {
|
|
10661
10944
|
"type": "steedos-object-table",
|
|
10662
10945
|
"objectApiName": objectName,
|
|
10663
|
-
"columns":
|
|
10946
|
+
"columns": relatedListColumns,
|
|
10664
10947
|
"extraColumns": listView.extra_columns,
|
|
10665
10948
|
"filters": listviewFilter,
|
|
10666
10949
|
"filtersFunction": filtersFunction,
|
|
@@ -10681,7 +10964,7 @@ async function getRelatedListSchema(
|
|
|
10681
10964
|
* @Author: baozhoutao@steedos.com
|
|
10682
10965
|
* @Date: 2022-07-05 15:55:39
|
|
10683
10966
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10684
|
-
* @LastEditTime: 2023-09-
|
|
10967
|
+
* @LastEditTime: 2023-09-21 17:35:06
|
|
10685
10968
|
* @Description:
|
|
10686
10969
|
*/
|
|
10687
10970
|
|
|
@@ -11014,7 +11297,9 @@ async function getListSchema(
|
|
|
11014
11297
|
"adaptor": listView.adaptor,
|
|
11015
11298
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
11016
11299
|
"filterVisible": ctx.filterVisible,
|
|
11017
|
-
"rowClassNameExpr": ctx.rowClassNameExpr
|
|
11300
|
+
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
11301
|
+
"crudDataFilter": ctx.crudDataFilter,
|
|
11302
|
+
"onCrudDataFilter": ctx.onCrudDataFilter
|
|
11018
11303
|
};
|
|
11019
11304
|
// console.log(`getListSchema===>`,amisSchema)
|
|
11020
11305
|
return {
|
|
@@ -11117,7 +11402,7 @@ async function getTableSchema(
|
|
|
11117
11402
|
fields = fields.concat(extraFields);
|
|
11118
11403
|
}
|
|
11119
11404
|
|
|
11120
|
-
|
|
11405
|
+
let crudOptions = {
|
|
11121
11406
|
tabId: objectName,
|
|
11122
11407
|
appId: appName,
|
|
11123
11408
|
objectName: objectName,
|
|
@@ -11126,8 +11411,9 @@ async function getTableSchema(
|
|
|
11126
11411
|
sort,
|
|
11127
11412
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
11128
11413
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
11129
|
-
}
|
|
11130
|
-
|
|
11414
|
+
};
|
|
11415
|
+
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11416
|
+
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11131
11417
|
// console.timeEnd('getTableSchema');
|
|
11132
11418
|
return {
|
|
11133
11419
|
uiSchema,
|
|
@@ -11199,7 +11485,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11199
11485
|
};
|
|
11200
11486
|
const content = {
|
|
11201
11487
|
"type": "tabs",
|
|
11202
|
-
"className": "sm:mt-3 bg-white sm:
|
|
11488
|
+
"className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
|
|
11203
11489
|
"tabs": [
|
|
11204
11490
|
detailed
|
|
11205
11491
|
],
|
|
@@ -11386,7 +11672,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
11386
11672
|
"columnsTogglable": false,
|
|
11387
11673
|
"showHeader": true,
|
|
11388
11674
|
// "headerSchema": headerSchema
|
|
11389
|
-
className: "sm:border bg-white sm:
|
|
11675
|
+
className: "sm:border bg-white sm:rounded border-gray-300 border-solid"
|
|
11390
11676
|
}]
|
|
11391
11677
|
}
|
|
11392
11678
|
}
|
|
@@ -11444,7 +11730,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
11444
11730
|
]
|
|
11445
11731
|
}
|
|
11446
11732
|
],
|
|
11447
|
-
"className": "sm:mt-3 flex flex-col region-main bg-white sm:
|
|
11733
|
+
"className": "sm:mt-3 flex flex-col region-main bg-white sm:rounded sm:border border-gray-300",
|
|
11448
11734
|
"linksClassName": "pl-4 pt-2"
|
|
11449
11735
|
};
|
|
11450
11736
|
if(relatedList.length){
|
|
@@ -11911,161 +12197,6 @@ const registerRemoteAssets = async (assetUrls)=>{
|
|
|
11911
12197
|
}
|
|
11912
12198
|
};
|
|
11913
12199
|
|
|
11914
|
-
/******************************************************************************
|
|
11915
|
-
Copyright (c) Microsoft Corporation.
|
|
11916
|
-
|
|
11917
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11918
|
-
purpose with or without fee is hereby granted.
|
|
11919
|
-
|
|
11920
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11921
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11922
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11923
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11924
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11925
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
11926
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
11927
|
-
***************************************************************************** */
|
|
11928
|
-
|
|
11929
|
-
var __assign = function() {
|
|
11930
|
-
__assign = Object.assign || function __assign(t) {
|
|
11931
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
11932
|
-
s = arguments[i];
|
|
11933
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
11934
|
-
}
|
|
11935
|
-
return t;
|
|
11936
|
-
};
|
|
11937
|
-
return __assign.apply(this, arguments);
|
|
11938
|
-
};
|
|
11939
|
-
|
|
11940
|
-
/**
|
|
11941
|
-
* 将例如像 a.b.c 或 a[1].b 的字符串转换为路径数组
|
|
11942
|
-
*
|
|
11943
|
-
* @param string 要转换的字符串
|
|
11944
|
-
*/
|
|
11945
|
-
var keyToPath = function (string) {
|
|
11946
|
-
var result = [];
|
|
11947
|
-
if (string.charCodeAt(0) === '.'.charCodeAt(0)) {
|
|
11948
|
-
result.push('');
|
|
11949
|
-
}
|
|
11950
|
-
string.replace(new RegExp('[^.[\\]]+|\\[(?:([^"\'][^[]*)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'), function (match, expression, quote, subString) {
|
|
11951
|
-
var key = match;
|
|
11952
|
-
if (quote) {
|
|
11953
|
-
key = subString.replace(/\\(\\)?/g, '$1');
|
|
11954
|
-
}
|
|
11955
|
-
else if (expression) {
|
|
11956
|
-
key = expression.trim();
|
|
11957
|
-
}
|
|
11958
|
-
result.push(key);
|
|
11959
|
-
return '';
|
|
11960
|
-
});
|
|
11961
|
-
return result;
|
|
11962
|
-
};
|
|
11963
|
-
|
|
11964
|
-
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
|
11965
|
-
function createObject(superProps, props, properties) {
|
|
11966
|
-
if (superProps && Object.isFrozen(superProps)) {
|
|
11967
|
-
superProps = cloneObject(superProps);
|
|
11968
|
-
}
|
|
11969
|
-
var obj = superProps
|
|
11970
|
-
? Object.create(superProps, __assign(__assign({}, properties), { __super: {
|
|
11971
|
-
value: superProps,
|
|
11972
|
-
writable: false,
|
|
11973
|
-
enumerable: false
|
|
11974
|
-
} }))
|
|
11975
|
-
: Object.create(Object.prototype, properties);
|
|
11976
|
-
props &&
|
|
11977
|
-
isObject(props) &&
|
|
11978
|
-
Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
|
|
11979
|
-
return obj;
|
|
11980
|
-
}
|
|
11981
|
-
function cloneObject(target, persistOwnProps) {
|
|
11982
|
-
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
11983
|
-
var obj = target && target.__super
|
|
11984
|
-
? Object.create(target.__super, {
|
|
11985
|
-
__super: {
|
|
11986
|
-
value: target.__super,
|
|
11987
|
-
writable: false,
|
|
11988
|
-
enumerable: false
|
|
11989
|
-
}
|
|
11990
|
-
})
|
|
11991
|
-
: Object.create(Object.prototype);
|
|
11992
|
-
persistOwnProps &&
|
|
11993
|
-
target &&
|
|
11994
|
-
Object.keys(target).forEach(function (key) { return (obj[key] = target[key]); });
|
|
11995
|
-
return obj;
|
|
11996
|
-
}
|
|
11997
|
-
function extendObject(target, src, persistOwnProps) {
|
|
11998
|
-
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
11999
|
-
var obj = cloneObject(target, persistOwnProps);
|
|
12000
|
-
src && Object.keys(src).forEach(function (key) { return (obj[key] = src[key]); });
|
|
12001
|
-
return obj;
|
|
12002
|
-
}
|
|
12003
|
-
function isObject(obj) {
|
|
12004
|
-
var typename = typeof obj;
|
|
12005
|
-
return (obj &&
|
|
12006
|
-
typename !== 'string' &&
|
|
12007
|
-
typename !== 'number' &&
|
|
12008
|
-
typename !== 'boolean' &&
|
|
12009
|
-
typename !== 'function' &&
|
|
12010
|
-
!Array.isArray(obj));
|
|
12011
|
-
}
|
|
12012
|
-
function setVariable(data, key, value, convertKeyToPath) {
|
|
12013
|
-
data = data || {};
|
|
12014
|
-
if (key in data) {
|
|
12015
|
-
data[key] = value;
|
|
12016
|
-
return;
|
|
12017
|
-
}
|
|
12018
|
-
var parts = convertKeyToPath !== false ? keyToPath(key) : [key];
|
|
12019
|
-
var last = parts.pop();
|
|
12020
|
-
while (parts.length) {
|
|
12021
|
-
var key_1 = parts.shift();
|
|
12022
|
-
if (isPlainObject(data[key_1])) {
|
|
12023
|
-
data = data[key_1] = __assign({}, data[key_1]);
|
|
12024
|
-
}
|
|
12025
|
-
else if (Array.isArray(data[key_1])) {
|
|
12026
|
-
data[key_1] = data[key_1].concat();
|
|
12027
|
-
data = data[key_1];
|
|
12028
|
-
}
|
|
12029
|
-
else if (data[key_1]) {
|
|
12030
|
-
// throw new Error(`目标路径不是纯对象,不能覆盖`);
|
|
12031
|
-
// 强行转成对象
|
|
12032
|
-
data[key_1] = {};
|
|
12033
|
-
data = data[key_1];
|
|
12034
|
-
}
|
|
12035
|
-
else {
|
|
12036
|
-
data[key_1] = {};
|
|
12037
|
-
data = data[key_1];
|
|
12038
|
-
}
|
|
12039
|
-
}
|
|
12040
|
-
data[last] = value;
|
|
12041
|
-
}
|
|
12042
|
-
function deleteVariable(data, key) {
|
|
12043
|
-
if (!data) {
|
|
12044
|
-
return;
|
|
12045
|
-
}
|
|
12046
|
-
else if (data.hasOwnProperty(key)) {
|
|
12047
|
-
delete data[key];
|
|
12048
|
-
return;
|
|
12049
|
-
}
|
|
12050
|
-
var parts = keyToPath(key);
|
|
12051
|
-
var last = parts.pop();
|
|
12052
|
-
while (parts.length) {
|
|
12053
|
-
var key_2 = parts.shift();
|
|
12054
|
-
if (isPlainObject(data[key_2])) {
|
|
12055
|
-
data = data[key_2] = __assign({}, data[key_2]);
|
|
12056
|
-
}
|
|
12057
|
-
else if (data[key_2]) {
|
|
12058
|
-
throw new Error("\u76EE\u6807\u8DEF\u5F84\u4E0D\u662F\u7EAF\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u4FEE\u6539");
|
|
12059
|
-
}
|
|
12060
|
-
else {
|
|
12061
|
-
break;
|
|
12062
|
-
}
|
|
12063
|
-
}
|
|
12064
|
-
if (data && data.hasOwnProperty && data.hasOwnProperty(last)) {
|
|
12065
|
-
delete data[last];
|
|
12066
|
-
}
|
|
12067
|
-
}
|
|
12068
|
-
|
|
12069
12200
|
/*
|
|
12070
12201
|
* @Author: baozhoutao@steedos.com
|
|
12071
12202
|
* @Date: 2022-12-17 17:03:40
|