@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.cjs.js
CHANGED
|
@@ -471,7 +471,7 @@ function getLookupListView(refObjectConfig) {
|
|
|
471
471
|
* @Author: baozhoutao@steedos.com
|
|
472
472
|
* @Date: 2022-05-23 09:53:08
|
|
473
473
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
474
|
-
* @LastEditTime: 2023-
|
|
474
|
+
* @LastEditTime: 2023-09-19 14:38:39
|
|
475
475
|
* @Description:
|
|
476
476
|
*/
|
|
477
477
|
|
|
@@ -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 = {};
|
|
@@ -651,9 +651,13 @@ async function getLookupTpl(field, ctx){
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
function getSwitchTpl(field){
|
|
654
|
+
let fieldDataStrTpl = `data._display.${field.name}`;
|
|
655
|
+
if(field.isTableField){
|
|
656
|
+
fieldDataStrTpl = `data.${field.name}`;
|
|
657
|
+
}
|
|
654
658
|
return `<% if (data.${field.name}) { %>
|
|
655
|
-
<span class="slds-icon_container slds-icon-utility-check slds-current-color" title="
|
|
656
|
-
<span ><%=
|
|
659
|
+
<span class="slds-icon_container slds-icon-utility-check slds-current-color" title="<%=${fieldDataStrTpl}%>">
|
|
660
|
+
<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>
|
|
657
661
|
</span>
|
|
658
662
|
<% } %>`
|
|
659
663
|
}
|
|
@@ -1231,7 +1235,7 @@ var frontend_display_type_is_split = "分栏视图";
|
|
|
1231
1235
|
var frontend_display_as = "显示为";
|
|
1232
1236
|
var frontend_record_sum = "个项目";
|
|
1233
1237
|
var frontend_button_reload_tooltip = "刷新";
|
|
1234
|
-
var frontend_button_search_tooltip = "
|
|
1238
|
+
var frontend_button_search_tooltip = "筛选";
|
|
1235
1239
|
var frontend_fields_filter_button_search = "搜索";
|
|
1236
1240
|
var frontend_fields_filter_button_settings = "设置搜索项";
|
|
1237
1241
|
var frontend_button_listview_control_tooltip = "列表视图控制";
|
|
@@ -1853,7 +1857,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
1853
1857
|
* @Author: baozhoutao@steedos.com
|
|
1854
1858
|
* @Date: 2022-11-01 15:51:00
|
|
1855
1859
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1856
|
-
* @LastEditTime: 2023-
|
|
1860
|
+
* @LastEditTime: 2023-09-25 14:53:05
|
|
1857
1861
|
* @Description:
|
|
1858
1862
|
*/
|
|
1859
1863
|
|
|
@@ -1872,18 +1876,31 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1872
1876
|
formSchema = _.isString(payload.schema) ? JSON.parse(payload.schema) : payload.schema;
|
|
1873
1877
|
}
|
|
1874
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
|
+
|
|
1875
1894
|
const _master = api.body._master;
|
|
1876
1895
|
if(_master && _master._isRelated){
|
|
1877
1896
|
const relatedKey = _master.relatedKey;
|
|
1878
1897
|
const masterObjectName = _master.objectName;
|
|
1879
1898
|
const recordId = _master.recordId;
|
|
1880
1899
|
let relatedKeySaveValue = recordId;
|
|
1881
|
-
const fields = ${JSON.stringify(uiSchema.fields)};
|
|
1882
1900
|
const relatedField = fields[relatedKey];
|
|
1883
1901
|
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
1884
1902
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
1885
1903
|
}
|
|
1886
|
-
let defaultData = {};
|
|
1887
1904
|
let relatedKeyValue;
|
|
1888
1905
|
if(!_.isString(relatedField.reference_to)){
|
|
1889
1906
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
@@ -1893,6 +1910,9 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1893
1910
|
relatedKeyValue = relatedKeySaveValue;
|
|
1894
1911
|
}
|
|
1895
1912
|
defaultData[relatedKey]=relatedKeyValue;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
if(!_.isEmpty(defaultData)){
|
|
1896
1916
|
if(payload.schema){
|
|
1897
1917
|
// 表单微页面第一层要求是page
|
|
1898
1918
|
formSchema.data.defaultData = defaultData;
|
|
@@ -1915,6 +1935,18 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1915
1935
|
});
|
|
1916
1936
|
}, 200);
|
|
1917
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
|
+
`;
|
|
1918
1950
|
return {
|
|
1919
1951
|
"type": "service",
|
|
1920
1952
|
"body": [
|
|
@@ -1927,6 +1959,21 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1927
1959
|
"click": {
|
|
1928
1960
|
"weight": 0,
|
|
1929
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
|
+
},
|
|
1930
1977
|
{
|
|
1931
1978
|
"actionType": "dialog",
|
|
1932
1979
|
"dialog": {
|
|
@@ -1944,7 +1991,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1944
1991
|
"displayAs": "${displayAs}",
|
|
1945
1992
|
"uiSchema": "${uiSchema}",
|
|
1946
1993
|
"isLookup": "${isLookup}",
|
|
1947
|
-
"listName": "${listName}"
|
|
1994
|
+
"listName": "${listName}",
|
|
1995
|
+
"selectedRowResponseResult": "${selectedRowResponseResult}",
|
|
1948
1996
|
},
|
|
1949
1997
|
"title":i18next__default["default"].t('frontend_form_new') + " ${uiSchema.label | raw}",
|
|
1950
1998
|
"body": [
|
|
@@ -1956,7 +2004,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
1956
2004
|
"data": {
|
|
1957
2005
|
"isLookup": "${isLookup}",
|
|
1958
2006
|
"_master": "${_master}",
|
|
1959
|
-
"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}"
|
|
1960
2009
|
},
|
|
1961
2010
|
"url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
|
|
1962
2011
|
"method": "get",
|
|
@@ -2887,9 +2936,30 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2887
2936
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
2888
2937
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
2889
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
|
+
|
|
2890
2959
|
return {
|
|
2891
2960
|
"type": "button",
|
|
2892
2961
|
"icon": "fa fa-angle-down",
|
|
2962
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
2893
2963
|
"onEvent": {
|
|
2894
2964
|
"click": {
|
|
2895
2965
|
"actions": [
|
|
@@ -2905,16 +2975,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2905
2975
|
"id": "u:fd837823be5b",
|
|
2906
2976
|
"vertical": true,
|
|
2907
2977
|
"tiled": true,
|
|
2908
|
-
"buttons":
|
|
2909
|
-
...___namespace.map(buttons, (button)=>{
|
|
2910
|
-
button.className += ' w-full';
|
|
2911
|
-
return button;
|
|
2912
|
-
}),
|
|
2913
|
-
...___namespace.map(moreButtons, (button)=>{
|
|
2914
|
-
button.className += ' w-full';
|
|
2915
|
-
return button;
|
|
2916
|
-
})
|
|
2917
|
-
],
|
|
2978
|
+
"buttons": dropdownButtons,
|
|
2918
2979
|
"btnLevel": "enhance",
|
|
2919
2980
|
"className": "w-full",
|
|
2920
2981
|
"btnClassName": "w-full",
|
|
@@ -2939,7 +3000,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
2939
3000
|
type: "steedos-dropdown-button",
|
|
2940
3001
|
label: "",
|
|
2941
3002
|
buttons: moreButtons,
|
|
2942
|
-
className: 'slds-icon',
|
|
3003
|
+
className: 'slds-icon ml-1',
|
|
2943
3004
|
visibleOn: moreButtonsVisibleOn
|
|
2944
3005
|
};
|
|
2945
3006
|
buttons.push(dropdownButtonsSchema);
|
|
@@ -3682,13 +3743,15 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3682
3743
|
"visibleOn": "${display == 'split'?false:true}"
|
|
3683
3744
|
}];
|
|
3684
3745
|
if(ctx.formFactor !== 'SMALL'){
|
|
3746
|
+
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
3685
3747
|
buttonSchema.push({
|
|
3686
3748
|
"type": "flex",
|
|
3687
3749
|
"items":[
|
|
3688
3750
|
standardNewButton,
|
|
3689
|
-
{
|
|
3751
|
+
(restButtons.length > 0) && {
|
|
3690
3752
|
"type": "dropdown-button",
|
|
3691
|
-
"buttons":
|
|
3753
|
+
"buttons": restButtons,
|
|
3754
|
+
"className": " ml-1",
|
|
3692
3755
|
"menuClassName": "p-none split-dropdown-buttons",
|
|
3693
3756
|
"align": "right",
|
|
3694
3757
|
"size": "sm"
|
|
@@ -3820,7 +3883,6 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3820
3883
|
},
|
|
3821
3884
|
{
|
|
3822
3885
|
"body": [
|
|
3823
|
-
fieldsFilterButtonSchema,
|
|
3824
3886
|
{
|
|
3825
3887
|
"type": "button",
|
|
3826
3888
|
"label": "",
|
|
@@ -3829,6 +3891,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
3829
3891
|
"target": amisListViewId,
|
|
3830
3892
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
3831
3893
|
},
|
|
3894
|
+
fieldsFilterButtonSchema,
|
|
3832
3895
|
// {
|
|
3833
3896
|
// "type": "button",
|
|
3834
3897
|
// "label": "",
|
|
@@ -4076,7 +4139,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4076
4139
|
"body": [
|
|
4077
4140
|
{
|
|
4078
4141
|
"type": "tpl",
|
|
4079
|
-
"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>`,
|
|
4080
4143
|
"inline": false,
|
|
4081
4144
|
"wrapperComponent": "",
|
|
4082
4145
|
"className": "",
|
|
@@ -5165,7 +5228,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5165
5228
|
{
|
|
5166
5229
|
"type": "search-box",
|
|
5167
5230
|
"name": keywordsSearchBoxName,
|
|
5168
|
-
"placeholder": "
|
|
5231
|
+
"placeholder": "搜索此列表",
|
|
5169
5232
|
"value": crudKeywords,
|
|
5170
5233
|
"clearable": true,
|
|
5171
5234
|
"clearAndSubmit": true
|
|
@@ -5288,10 +5351,10 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5288
5351
|
if(toolbarCount){
|
|
5289
5352
|
toolbars.push(toolbarCount);
|
|
5290
5353
|
}
|
|
5291
|
-
toolbars.push(toolbarReloadButton);
|
|
5292
5354
|
if(toolbarFilter){
|
|
5293
5355
|
toolbars.push(toolbarFilter);
|
|
5294
5356
|
}
|
|
5357
|
+
toolbars.push(toolbarReloadButton);
|
|
5295
5358
|
toolbars.push(toolbarDisplayAsButton);
|
|
5296
5359
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5297
5360
|
return [
|
|
@@ -5307,19 +5370,20 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5307
5370
|
toolbars.push(toolbarFilter);
|
|
5308
5371
|
}
|
|
5309
5372
|
toolbars.push(toolbarReloadButton);
|
|
5373
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5310
5374
|
if(mainObject?.permissions?.allowCreateListViews){
|
|
5311
5375
|
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5312
5376
|
}
|
|
5313
|
-
toolbars.push(toolbarDisplayAsButton);
|
|
5314
5377
|
toolbars.push(toolbarDQuickSearchBox);
|
|
5315
5378
|
return [
|
|
5316
5379
|
// "filter-toggler",
|
|
5317
5380
|
...(headerToolbarItems || []),
|
|
5318
5381
|
"bulkActions",
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5382
|
+
// 不能放开crud columns-toggler否则crud card模式会报错
|
|
5383
|
+
// {
|
|
5384
|
+
// "type": "columns-toggler",
|
|
5385
|
+
// "className": "hidden"
|
|
5386
|
+
// },
|
|
5323
5387
|
...toolbars,
|
|
5324
5388
|
// {
|
|
5325
5389
|
// "type": "columns-toggler",
|
|
@@ -5926,10 +5990,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5926
5990
|
const op = api.data.$self.op;
|
|
5927
5991
|
if(!_.isEmpty(op)){
|
|
5928
5992
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
5993
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
5994
|
+
/*
|
|
5929
5995
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
5930
5996
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
5931
5997
|
})
|
|
5932
5998
|
payload.data.rows = rows;
|
|
5999
|
+
*/
|
|
5933
6000
|
return payload;
|
|
5934
6001
|
}
|
|
5935
6002
|
if(enable_tree){
|
|
@@ -7356,7 +7423,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7356
7423
|
label: subField.label,
|
|
7357
7424
|
quickEdit: readonly ? false : gridSub
|
|
7358
7425
|
};
|
|
7359
|
-
if(subField.type
|
|
7426
|
+
if(["lookup", "boolean", "toggle"].indexOf(subField.type) > -1){
|
|
7360
7427
|
gridItemSchema.type = gridSub.type;
|
|
7361
7428
|
gridItemSchema.tpl = gridSub.tpl;
|
|
7362
7429
|
}
|
|
@@ -8290,7 +8357,7 @@ async function getTableOperation(ctx){
|
|
|
8290
8357
|
label: i18next__default["default"].t('frontend_operation'),
|
|
8291
8358
|
fixed: 'right',
|
|
8292
8359
|
labelClassName: 'text-center',
|
|
8293
|
-
className: 'text-center steedos-listview-operation w-
|
|
8360
|
+
className: 'text-center steedos-listview-operation w-10',
|
|
8294
8361
|
buttons: [
|
|
8295
8362
|
{
|
|
8296
8363
|
"type": "steedos-dropdown-button",
|
|
@@ -8322,11 +8389,10 @@ async function getTableOperation(ctx){
|
|
|
8322
8389
|
}
|
|
8323
8390
|
|
|
8324
8391
|
async function getTableSchema$1(fields, options){
|
|
8325
|
-
let isLookup = options && options.isLookup;
|
|
8326
|
-
let hiddenColumnOperation = options && options.hiddenColumnOperation;
|
|
8327
8392
|
if(!options){
|
|
8328
8393
|
options = {};
|
|
8329
8394
|
}
|
|
8395
|
+
let { isLookup, hiddenColumnOperation } = options;
|
|
8330
8396
|
let columns = [];
|
|
8331
8397
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
8332
8398
|
if(isLookup){
|
|
@@ -8338,6 +8404,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8338
8404
|
}
|
|
8339
8405
|
else {
|
|
8340
8406
|
columns = await getTableColumns(fields, options);
|
|
8407
|
+
|
|
8341
8408
|
if(!isLookup && !hiddenColumnOperation){
|
|
8342
8409
|
columns.push(await getTableOperation(options));
|
|
8343
8410
|
}
|
|
@@ -8346,7 +8413,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8346
8413
|
return {
|
|
8347
8414
|
mode: "table",
|
|
8348
8415
|
name: "thelist",
|
|
8349
|
-
headerToolbarClassName: "py-2 px-2 border-gray-300
|
|
8416
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8350
8417
|
className: "",
|
|
8351
8418
|
draggable: false,
|
|
8352
8419
|
defaultParams: getDefaultParams(options),
|
|
@@ -9642,6 +9709,161 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
9642
9709
|
return amisSchema;
|
|
9643
9710
|
}
|
|
9644
9711
|
|
|
9712
|
+
/******************************************************************************
|
|
9713
|
+
Copyright (c) Microsoft Corporation.
|
|
9714
|
+
|
|
9715
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9716
|
+
purpose with or without fee is hereby granted.
|
|
9717
|
+
|
|
9718
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9719
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9720
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9721
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
9722
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
9723
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
9724
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
9725
|
+
***************************************************************************** */
|
|
9726
|
+
|
|
9727
|
+
var __assign = function() {
|
|
9728
|
+
__assign = Object.assign || function __assign(t) {
|
|
9729
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9730
|
+
s = arguments[i];
|
|
9731
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9732
|
+
}
|
|
9733
|
+
return t;
|
|
9734
|
+
};
|
|
9735
|
+
return __assign.apply(this, arguments);
|
|
9736
|
+
};
|
|
9737
|
+
|
|
9738
|
+
/**
|
|
9739
|
+
* 将例如像 a.b.c 或 a[1].b 的字符串转换为路径数组
|
|
9740
|
+
*
|
|
9741
|
+
* @param string 要转换的字符串
|
|
9742
|
+
*/
|
|
9743
|
+
var keyToPath = function (string) {
|
|
9744
|
+
var result = [];
|
|
9745
|
+
if (string.charCodeAt(0) === '.'.charCodeAt(0)) {
|
|
9746
|
+
result.push('');
|
|
9747
|
+
}
|
|
9748
|
+
string.replace(new RegExp('[^.[\\]]+|\\[(?:([^"\'][^[]*)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'), function (match, expression, quote, subString) {
|
|
9749
|
+
var key = match;
|
|
9750
|
+
if (quote) {
|
|
9751
|
+
key = subString.replace(/\\(\\)?/g, '$1');
|
|
9752
|
+
}
|
|
9753
|
+
else if (expression) {
|
|
9754
|
+
key = expression.trim();
|
|
9755
|
+
}
|
|
9756
|
+
result.push(key);
|
|
9757
|
+
return '';
|
|
9758
|
+
});
|
|
9759
|
+
return result;
|
|
9760
|
+
};
|
|
9761
|
+
|
|
9762
|
+
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
|
9763
|
+
function createObject(superProps, props, properties) {
|
|
9764
|
+
if (superProps && Object.isFrozen(superProps)) {
|
|
9765
|
+
superProps = cloneObject(superProps);
|
|
9766
|
+
}
|
|
9767
|
+
var obj = superProps
|
|
9768
|
+
? Object.create(superProps, __assign(__assign({}, properties), { __super: {
|
|
9769
|
+
value: superProps,
|
|
9770
|
+
writable: false,
|
|
9771
|
+
enumerable: false
|
|
9772
|
+
} }))
|
|
9773
|
+
: Object.create(Object.prototype, properties);
|
|
9774
|
+
props &&
|
|
9775
|
+
isObject(props) &&
|
|
9776
|
+
Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
|
|
9777
|
+
return obj;
|
|
9778
|
+
}
|
|
9779
|
+
function cloneObject(target, persistOwnProps) {
|
|
9780
|
+
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
9781
|
+
var obj = target && target.__super
|
|
9782
|
+
? Object.create(target.__super, {
|
|
9783
|
+
__super: {
|
|
9784
|
+
value: target.__super,
|
|
9785
|
+
writable: false,
|
|
9786
|
+
enumerable: false
|
|
9787
|
+
}
|
|
9788
|
+
})
|
|
9789
|
+
: Object.create(Object.prototype);
|
|
9790
|
+
persistOwnProps &&
|
|
9791
|
+
target &&
|
|
9792
|
+
Object.keys(target).forEach(function (key) { return (obj[key] = target[key]); });
|
|
9793
|
+
return obj;
|
|
9794
|
+
}
|
|
9795
|
+
function extendObject(target, src, persistOwnProps) {
|
|
9796
|
+
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
9797
|
+
var obj = cloneObject(target, persistOwnProps);
|
|
9798
|
+
src && Object.keys(src).forEach(function (key) { return (obj[key] = src[key]); });
|
|
9799
|
+
return obj;
|
|
9800
|
+
}
|
|
9801
|
+
function isObject(obj) {
|
|
9802
|
+
var typename = typeof obj;
|
|
9803
|
+
return (obj &&
|
|
9804
|
+
typename !== 'string' &&
|
|
9805
|
+
typename !== 'number' &&
|
|
9806
|
+
typename !== 'boolean' &&
|
|
9807
|
+
typename !== 'function' &&
|
|
9808
|
+
!Array.isArray(obj));
|
|
9809
|
+
}
|
|
9810
|
+
function setVariable(data, key, value, convertKeyToPath) {
|
|
9811
|
+
data = data || {};
|
|
9812
|
+
if (key in data) {
|
|
9813
|
+
data[key] = value;
|
|
9814
|
+
return;
|
|
9815
|
+
}
|
|
9816
|
+
var parts = convertKeyToPath !== false ? keyToPath(key) : [key];
|
|
9817
|
+
var last = parts.pop();
|
|
9818
|
+
while (parts.length) {
|
|
9819
|
+
var key_1 = parts.shift();
|
|
9820
|
+
if (isPlainObject__default["default"](data[key_1])) {
|
|
9821
|
+
data = data[key_1] = __assign({}, data[key_1]);
|
|
9822
|
+
}
|
|
9823
|
+
else if (Array.isArray(data[key_1])) {
|
|
9824
|
+
data[key_1] = data[key_1].concat();
|
|
9825
|
+
data = data[key_1];
|
|
9826
|
+
}
|
|
9827
|
+
else if (data[key_1]) {
|
|
9828
|
+
// throw new Error(`目标路径不是纯对象,不能覆盖`);
|
|
9829
|
+
// 强行转成对象
|
|
9830
|
+
data[key_1] = {};
|
|
9831
|
+
data = data[key_1];
|
|
9832
|
+
}
|
|
9833
|
+
else {
|
|
9834
|
+
data[key_1] = {};
|
|
9835
|
+
data = data[key_1];
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
data[last] = value;
|
|
9839
|
+
}
|
|
9840
|
+
function deleteVariable(data, key) {
|
|
9841
|
+
if (!data) {
|
|
9842
|
+
return;
|
|
9843
|
+
}
|
|
9844
|
+
else if (data.hasOwnProperty(key)) {
|
|
9845
|
+
delete data[key];
|
|
9846
|
+
return;
|
|
9847
|
+
}
|
|
9848
|
+
var parts = keyToPath(key);
|
|
9849
|
+
var last = parts.pop();
|
|
9850
|
+
while (parts.length) {
|
|
9851
|
+
var key_2 = parts.shift();
|
|
9852
|
+
if (isPlainObject__default["default"](data[key_2])) {
|
|
9853
|
+
data = data[key_2] = __assign({}, data[key_2]);
|
|
9854
|
+
}
|
|
9855
|
+
else if (data[key_2]) {
|
|
9856
|
+
throw new Error("\u76EE\u6807\u8DEF\u5F84\u4E0D\u662F\u7EAF\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u4FEE\u6539");
|
|
9857
|
+
}
|
|
9858
|
+
else {
|
|
9859
|
+
break;
|
|
9860
|
+
}
|
|
9861
|
+
}
|
|
9862
|
+
if (data && data.hasOwnProperty && data.hasOwnProperty(last)) {
|
|
9863
|
+
delete data[last];
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9645
9867
|
/*
|
|
9646
9868
|
* @Author: baozhoutao@steedos.com
|
|
9647
9869
|
* @Date: 2022-05-26 16:02:08
|
|
@@ -9882,9 +10104,30 @@ function getBulkActions(objectSchema){
|
|
|
9882
10104
|
]
|
|
9883
10105
|
}
|
|
9884
10106
|
|
|
10107
|
+
async function getCrudSchemaWithDataFilter(crud, options = {}){
|
|
10108
|
+
const { crudDataFilter, amisData, env } = options;
|
|
10109
|
+
let onCrudDataFilter = options.onCrudDataFilter;
|
|
10110
|
+
if (!onCrudDataFilter && typeof crudDataFilter === 'string') {
|
|
10111
|
+
onCrudDataFilter = new Function(
|
|
10112
|
+
'crud',
|
|
10113
|
+
'env',
|
|
10114
|
+
'data',
|
|
10115
|
+
crudDataFilter
|
|
10116
|
+
);
|
|
10117
|
+
}
|
|
10118
|
+
|
|
10119
|
+
try {
|
|
10120
|
+
onCrudDataFilter && (crud = await onCrudDataFilter(crud, env, amisData) || crud);
|
|
10121
|
+
} catch (e) {
|
|
10122
|
+
console.warn(e);
|
|
10123
|
+
}
|
|
10124
|
+
return crud;
|
|
10125
|
+
}
|
|
10126
|
+
|
|
9885
10127
|
async function getObjectCRUD(objectSchema, fields, options){
|
|
9886
10128
|
// console.time('getObjectCRUD');
|
|
9887
|
-
const { top, perPage, showDisplayAs = false, displayAs, crudClassName = ""
|
|
10129
|
+
const { top, perPage, showDisplayAs = false, displayAs, crudClassName = "",
|
|
10130
|
+
crudDataFilter, onCrudDataFilter, amisData, env } = options;
|
|
9888
10131
|
const nonpaged = objectSchema.paging && objectSchema.paging.enabled === false;
|
|
9889
10132
|
const isTreeObject = objectSchema.enable_tree;
|
|
9890
10133
|
const bulkActions = getBulkActions(objectSchema);
|
|
@@ -9925,6 +10168,14 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9925
10168
|
filterVisible: options.filterVisible
|
|
9926
10169
|
});
|
|
9927
10170
|
|
|
10171
|
+
options.amisData = createObject(options.amisData, {
|
|
10172
|
+
objectName: objectSchema.name,
|
|
10173
|
+
// _id: null,
|
|
10174
|
+
recordPermissions: objectSchema.permissions,
|
|
10175
|
+
uiSchema: objectSchema,
|
|
10176
|
+
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
10177
|
+
});
|
|
10178
|
+
|
|
9928
10179
|
|
|
9929
10180
|
let body = null;
|
|
9930
10181
|
const id = `listview_${objectSchema.name}`;
|
|
@@ -9950,7 +10201,12 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9950
10201
|
if(objectSchema.name === 'organizations'){
|
|
9951
10202
|
labelFieldName = 'name';
|
|
9952
10203
|
}
|
|
9953
|
-
|
|
10204
|
+
let tableOptions = Object.assign({
|
|
10205
|
+
idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
|
|
10206
|
+
permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit
|
|
10207
|
+
}, options);
|
|
10208
|
+
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
10209
|
+
const table = await getTableSchema$1(fields, tableOptions);
|
|
9954
10210
|
delete table.mode;
|
|
9955
10211
|
//image与avatar需要在提交修改时特别处理
|
|
9956
10212
|
const imageNames = ___default["default"].compact(___default["default"].map(___default["default"].filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
@@ -10008,17 +10264,26 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10008
10264
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
10009
10265
|
},
|
|
10010
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
|
+
`
|
|
10011
10274
|
},
|
|
10012
10275
|
rowClassNameExpr: options.rowClassNameExpr
|
|
10013
|
-
},
|
|
10014
|
-
|
|
10015
|
-
);
|
|
10276
|
+
}, bodyProps);
|
|
10277
|
+
|
|
10016
10278
|
}
|
|
10017
10279
|
|
|
10018
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
|
+
|
|
10019
10286
|
if (defaults) {
|
|
10020
|
-
const listSchema = defaults.listSchema || {};
|
|
10021
|
-
body = defaultsDeep({}, listSchema, body);
|
|
10022
10287
|
const headerSchema = defaults.headerSchema;
|
|
10023
10288
|
const footerSchema = defaults.footerSchema;
|
|
10024
10289
|
if (headerSchema || footerSchema) {
|
|
@@ -10047,16 +10312,10 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
10047
10312
|
return {
|
|
10048
10313
|
type: 'service',
|
|
10049
10314
|
className: '',
|
|
10050
|
-
//目前crud的service层id不认用户自定义id,只支持默认规则id
|
|
10315
|
+
//目前crud的service层id不认用户自定义id,只支持默认规则id,许多地方的格式都写死了service_listview_${objectname}
|
|
10051
10316
|
id: `service_${id}`,
|
|
10052
10317
|
name: `page`,
|
|
10053
|
-
data:
|
|
10054
|
-
objectName: objectSchema.name,
|
|
10055
|
-
// _id: null,
|
|
10056
|
-
recordPermissions: objectSchema.permissions,
|
|
10057
|
-
uiSchema: objectSchema,
|
|
10058
|
-
// loaded: false //crud接收适配器中设置为true,否则就是刷新浏览器第一次加载
|
|
10059
|
-
},
|
|
10318
|
+
data: options.amisData,
|
|
10060
10319
|
body: body
|
|
10061
10320
|
}
|
|
10062
10321
|
}
|
|
@@ -10356,7 +10615,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10356
10615
|
* @Author: baozhoutao@steedos.com
|
|
10357
10616
|
* @Date: 2022-07-05 15:55:39
|
|
10358
10617
|
* @LastEditors: liaodaxue
|
|
10359
|
-
* @LastEditTime: 2023-
|
|
10618
|
+
* @LastEditTime: 2023-09-25 17:18:08
|
|
10360
10619
|
* @Description:
|
|
10361
10620
|
*/
|
|
10362
10621
|
|
|
@@ -10531,7 +10790,8 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10531
10790
|
setDataToComponentId: componentId,
|
|
10532
10791
|
// tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
|
|
10533
10792
|
appId: appId,
|
|
10534
|
-
crudClassName: 'border-t border-
|
|
10793
|
+
crudClassName: 'border-t border-gray-300 hidden',
|
|
10794
|
+
refField,
|
|
10535
10795
|
...ctx
|
|
10536
10796
|
};
|
|
10537
10797
|
const amisSchema= (await getRelatedListSchema(relatedObjectName, 'all', options)).amisSchema;
|
|
@@ -10543,7 +10803,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10543
10803
|
amisSchema: {
|
|
10544
10804
|
type: "service",
|
|
10545
10805
|
id: componentId,
|
|
10546
|
-
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}`,
|
|
10547
10807
|
data: {
|
|
10548
10808
|
relatedKey: relatedKey,
|
|
10549
10809
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10646,10 +10906,33 @@ async function getRelatedListSchema(
|
|
|
10646
10906
|
ctx
|
|
10647
10907
|
) {
|
|
10648
10908
|
const uiSchema = await getUISchema(objectName);
|
|
10649
|
-
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
|
+
);
|
|
10650
10919
|
const listViewProps = getRelatedListProps(uiSchema,listViewName, ctx);
|
|
10651
10920
|
// console.log('listViewProps==>', listViewProps)
|
|
10652
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
|
+
}
|
|
10653
10936
|
|
|
10654
10937
|
const defaults = ctx.defaults || {};
|
|
10655
10938
|
|
|
@@ -10687,7 +10970,7 @@ async function getRelatedListSchema(
|
|
|
10687
10970
|
const amisSchema = {
|
|
10688
10971
|
"type": "steedos-object-table",
|
|
10689
10972
|
"objectApiName": objectName,
|
|
10690
|
-
"columns":
|
|
10973
|
+
"columns": relatedListColumns,
|
|
10691
10974
|
"extraColumns": listView.extra_columns,
|
|
10692
10975
|
"filters": listviewFilter,
|
|
10693
10976
|
"filtersFunction": filtersFunction,
|
|
@@ -10708,7 +10991,7 @@ async function getRelatedListSchema(
|
|
|
10708
10991
|
* @Author: baozhoutao@steedos.com
|
|
10709
10992
|
* @Date: 2022-07-05 15:55:39
|
|
10710
10993
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10711
|
-
* @LastEditTime: 2023-09-
|
|
10994
|
+
* @LastEditTime: 2023-09-21 17:35:06
|
|
10712
10995
|
* @Description:
|
|
10713
10996
|
*/
|
|
10714
10997
|
|
|
@@ -11041,7 +11324,9 @@ async function getListSchema(
|
|
|
11041
11324
|
"adaptor": listView.adaptor,
|
|
11042
11325
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
11043
11326
|
"filterVisible": ctx.filterVisible,
|
|
11044
|
-
"rowClassNameExpr": ctx.rowClassNameExpr
|
|
11327
|
+
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
11328
|
+
"crudDataFilter": ctx.crudDataFilter,
|
|
11329
|
+
"onCrudDataFilter": ctx.onCrudDataFilter
|
|
11045
11330
|
};
|
|
11046
11331
|
// console.log(`getListSchema===>`,amisSchema)
|
|
11047
11332
|
return {
|
|
@@ -11144,7 +11429,7 @@ async function getTableSchema(
|
|
|
11144
11429
|
fields = fields.concat(extraFields);
|
|
11145
11430
|
}
|
|
11146
11431
|
|
|
11147
|
-
|
|
11432
|
+
let crudOptions = {
|
|
11148
11433
|
tabId: objectName,
|
|
11149
11434
|
appId: appName,
|
|
11150
11435
|
objectName: objectName,
|
|
@@ -11153,8 +11438,9 @@ async function getTableSchema(
|
|
|
11153
11438
|
sort,
|
|
11154
11439
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
11155
11440
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
11156
|
-
}
|
|
11157
|
-
|
|
11441
|
+
};
|
|
11442
|
+
crudOptions.amisData = createObject(ctx.amisData || {}, {});
|
|
11443
|
+
const amisSchema = await getObjectCRUD(uiSchema, fields, crudOptions);
|
|
11158
11444
|
// console.timeEnd('getTableSchema');
|
|
11159
11445
|
return {
|
|
11160
11446
|
uiSchema,
|
|
@@ -11226,7 +11512,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
11226
11512
|
};
|
|
11227
11513
|
const content = {
|
|
11228
11514
|
"type": "tabs",
|
|
11229
|
-
"className": "sm:mt-3 bg-white sm:
|
|
11515
|
+
"className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
|
|
11230
11516
|
"tabs": [
|
|
11231
11517
|
detailed
|
|
11232
11518
|
],
|
|
@@ -11413,7 +11699,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
|
|
|
11413
11699
|
"columnsTogglable": false,
|
|
11414
11700
|
"showHeader": true,
|
|
11415
11701
|
// "headerSchema": headerSchema
|
|
11416
|
-
className: "sm:border bg-white sm:
|
|
11702
|
+
className: "sm:border bg-white sm:rounded border-gray-300 border-solid"
|
|
11417
11703
|
}]
|
|
11418
11704
|
}
|
|
11419
11705
|
}
|
|
@@ -11471,7 +11757,7 @@ async function getRecordPageInitSchema(objectApiName){
|
|
|
11471
11757
|
]
|
|
11472
11758
|
}
|
|
11473
11759
|
],
|
|
11474
|
-
"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",
|
|
11475
11761
|
"linksClassName": "pl-4 pt-2"
|
|
11476
11762
|
};
|
|
11477
11763
|
if(relatedList.length){
|
|
@@ -11938,161 +12224,6 @@ const registerRemoteAssets = async (assetUrls)=>{
|
|
|
11938
12224
|
}
|
|
11939
12225
|
};
|
|
11940
12226
|
|
|
11941
|
-
/******************************************************************************
|
|
11942
|
-
Copyright (c) Microsoft Corporation.
|
|
11943
|
-
|
|
11944
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11945
|
-
purpose with or without fee is hereby granted.
|
|
11946
|
-
|
|
11947
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11948
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11949
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11950
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11951
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11952
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
11953
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
11954
|
-
***************************************************************************** */
|
|
11955
|
-
|
|
11956
|
-
var __assign = function() {
|
|
11957
|
-
__assign = Object.assign || function __assign(t) {
|
|
11958
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
11959
|
-
s = arguments[i];
|
|
11960
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
11961
|
-
}
|
|
11962
|
-
return t;
|
|
11963
|
-
};
|
|
11964
|
-
return __assign.apply(this, arguments);
|
|
11965
|
-
};
|
|
11966
|
-
|
|
11967
|
-
/**
|
|
11968
|
-
* 将例如像 a.b.c 或 a[1].b 的字符串转换为路径数组
|
|
11969
|
-
*
|
|
11970
|
-
* @param string 要转换的字符串
|
|
11971
|
-
*/
|
|
11972
|
-
var keyToPath = function (string) {
|
|
11973
|
-
var result = [];
|
|
11974
|
-
if (string.charCodeAt(0) === '.'.charCodeAt(0)) {
|
|
11975
|
-
result.push('');
|
|
11976
|
-
}
|
|
11977
|
-
string.replace(new RegExp('[^.[\\]]+|\\[(?:([^"\'][^[]*)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'), function (match, expression, quote, subString) {
|
|
11978
|
-
var key = match;
|
|
11979
|
-
if (quote) {
|
|
11980
|
-
key = subString.replace(/\\(\\)?/g, '$1');
|
|
11981
|
-
}
|
|
11982
|
-
else if (expression) {
|
|
11983
|
-
key = expression.trim();
|
|
11984
|
-
}
|
|
11985
|
-
result.push(key);
|
|
11986
|
-
return '';
|
|
11987
|
-
});
|
|
11988
|
-
return result;
|
|
11989
|
-
};
|
|
11990
|
-
|
|
11991
|
-
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
|
11992
|
-
function createObject(superProps, props, properties) {
|
|
11993
|
-
if (superProps && Object.isFrozen(superProps)) {
|
|
11994
|
-
superProps = cloneObject(superProps);
|
|
11995
|
-
}
|
|
11996
|
-
var obj = superProps
|
|
11997
|
-
? Object.create(superProps, __assign(__assign({}, properties), { __super: {
|
|
11998
|
-
value: superProps,
|
|
11999
|
-
writable: false,
|
|
12000
|
-
enumerable: false
|
|
12001
|
-
} }))
|
|
12002
|
-
: Object.create(Object.prototype, properties);
|
|
12003
|
-
props &&
|
|
12004
|
-
isObject(props) &&
|
|
12005
|
-
Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
|
|
12006
|
-
return obj;
|
|
12007
|
-
}
|
|
12008
|
-
function cloneObject(target, persistOwnProps) {
|
|
12009
|
-
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
12010
|
-
var obj = target && target.__super
|
|
12011
|
-
? Object.create(target.__super, {
|
|
12012
|
-
__super: {
|
|
12013
|
-
value: target.__super,
|
|
12014
|
-
writable: false,
|
|
12015
|
-
enumerable: false
|
|
12016
|
-
}
|
|
12017
|
-
})
|
|
12018
|
-
: Object.create(Object.prototype);
|
|
12019
|
-
persistOwnProps &&
|
|
12020
|
-
target &&
|
|
12021
|
-
Object.keys(target).forEach(function (key) { return (obj[key] = target[key]); });
|
|
12022
|
-
return obj;
|
|
12023
|
-
}
|
|
12024
|
-
function extendObject(target, src, persistOwnProps) {
|
|
12025
|
-
if (persistOwnProps === void 0) { persistOwnProps = true; }
|
|
12026
|
-
var obj = cloneObject(target, persistOwnProps);
|
|
12027
|
-
src && Object.keys(src).forEach(function (key) { return (obj[key] = src[key]); });
|
|
12028
|
-
return obj;
|
|
12029
|
-
}
|
|
12030
|
-
function isObject(obj) {
|
|
12031
|
-
var typename = typeof obj;
|
|
12032
|
-
return (obj &&
|
|
12033
|
-
typename !== 'string' &&
|
|
12034
|
-
typename !== 'number' &&
|
|
12035
|
-
typename !== 'boolean' &&
|
|
12036
|
-
typename !== 'function' &&
|
|
12037
|
-
!Array.isArray(obj));
|
|
12038
|
-
}
|
|
12039
|
-
function setVariable(data, key, value, convertKeyToPath) {
|
|
12040
|
-
data = data || {};
|
|
12041
|
-
if (key in data) {
|
|
12042
|
-
data[key] = value;
|
|
12043
|
-
return;
|
|
12044
|
-
}
|
|
12045
|
-
var parts = convertKeyToPath !== false ? keyToPath(key) : [key];
|
|
12046
|
-
var last = parts.pop();
|
|
12047
|
-
while (parts.length) {
|
|
12048
|
-
var key_1 = parts.shift();
|
|
12049
|
-
if (isPlainObject__default["default"](data[key_1])) {
|
|
12050
|
-
data = data[key_1] = __assign({}, data[key_1]);
|
|
12051
|
-
}
|
|
12052
|
-
else if (Array.isArray(data[key_1])) {
|
|
12053
|
-
data[key_1] = data[key_1].concat();
|
|
12054
|
-
data = data[key_1];
|
|
12055
|
-
}
|
|
12056
|
-
else if (data[key_1]) {
|
|
12057
|
-
// throw new Error(`目标路径不是纯对象,不能覆盖`);
|
|
12058
|
-
// 强行转成对象
|
|
12059
|
-
data[key_1] = {};
|
|
12060
|
-
data = data[key_1];
|
|
12061
|
-
}
|
|
12062
|
-
else {
|
|
12063
|
-
data[key_1] = {};
|
|
12064
|
-
data = data[key_1];
|
|
12065
|
-
}
|
|
12066
|
-
}
|
|
12067
|
-
data[last] = value;
|
|
12068
|
-
}
|
|
12069
|
-
function deleteVariable(data, key) {
|
|
12070
|
-
if (!data) {
|
|
12071
|
-
return;
|
|
12072
|
-
}
|
|
12073
|
-
else if (data.hasOwnProperty(key)) {
|
|
12074
|
-
delete data[key];
|
|
12075
|
-
return;
|
|
12076
|
-
}
|
|
12077
|
-
var parts = keyToPath(key);
|
|
12078
|
-
var last = parts.pop();
|
|
12079
|
-
while (parts.length) {
|
|
12080
|
-
var key_2 = parts.shift();
|
|
12081
|
-
if (isPlainObject__default["default"](data[key_2])) {
|
|
12082
|
-
data = data[key_2] = __assign({}, data[key_2]);
|
|
12083
|
-
}
|
|
12084
|
-
else if (data[key_2]) {
|
|
12085
|
-
throw new Error("\u76EE\u6807\u8DEF\u5F84\u4E0D\u662F\u7EAF\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u4FEE\u6539");
|
|
12086
|
-
}
|
|
12087
|
-
else {
|
|
12088
|
-
break;
|
|
12089
|
-
}
|
|
12090
|
-
}
|
|
12091
|
-
if (data && data.hasOwnProperty && data.hasOwnProperty(last)) {
|
|
12092
|
-
delete data[last];
|
|
12093
|
-
}
|
|
12094
|
-
}
|
|
12095
|
-
|
|
12096
12227
|
/*
|
|
12097
12228
|
* @Author: baozhoutao@steedos.com
|
|
12098
12229
|
* @Date: 2022-12-17 17:03:40
|