@steedos-widgets/amis-lib 1.2.25 → 1.2.27
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 +51 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +51 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +51 -31
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +6 -0
- package/dist/types/lib/converter/amis/header.d.ts +3 -0
- package/dist/types/lib/converter/amis/toolbar.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
* @Author: baozhoutao@steedos.com
|
|
361
361
|
* @Date: 2022-08-16 17:02:08
|
|
362
362
|
* @LastEditors: baozhoutao@steedos.com
|
|
363
|
-
* @LastEditTime: 2023-
|
|
363
|
+
* @LastEditTime: 2023-06-20 13:50:15
|
|
364
364
|
* @Description:
|
|
365
365
|
*/
|
|
366
366
|
|
|
@@ -371,14 +371,14 @@
|
|
|
371
371
|
if(urlSearch.has('display')){
|
|
372
372
|
return urlSearch.get('display')
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
const key = `page_display`;
|
|
374
|
+
const key = `tab_${tab_id}_display`;
|
|
375
|
+
// const key = `page_display`;
|
|
376
376
|
const value = localStorage.getItem(key);
|
|
377
377
|
return value ? value : 'grid'
|
|
378
378
|
},
|
|
379
379
|
|
|
380
380
|
setTabDisplayAs(tab_id, displayAs){
|
|
381
|
-
const key = `
|
|
381
|
+
const key = `tab_${tab_id}_display`;
|
|
382
382
|
localStorage.setItem(key, displayAs);
|
|
383
383
|
},
|
|
384
384
|
getAppPath({formFactor, appId}){
|
|
@@ -392,15 +392,10 @@
|
|
|
392
392
|
},
|
|
393
393
|
getObjectDetailPath(props){
|
|
394
394
|
const {formFactor, appId, objectName, recordId, listViewName, _templateType} = props;
|
|
395
|
-
// var urlParams = new URLSearchParams(window.location.search);
|
|
396
|
-
// if(objectName === 'instances'){
|
|
397
|
-
// return `/workflow/space/\${context.tenantId}/\${listName}/${recordId}`;
|
|
398
|
-
// }
|
|
399
|
-
const displayAs = Router.getTabDisplayAs(objectName); //urlParams.get("display") ||
|
|
400
395
|
if(_templateType === 'JavaScript'){
|
|
401
|
-
return `/app/${appId}/${objectName}/view/${recordId}?
|
|
396
|
+
return `/app/${appId}/${objectName}/view/${recordId}?side_object=<%=item.objectName%>&side_listview_id=<%=item.listName%>`;
|
|
402
397
|
}
|
|
403
|
-
return `/app/${appId}/${objectName}/view/${recordId}?
|
|
398
|
+
return `/app/${appId}/${objectName}/view/${recordId}?side_object=\${objectName}&side_listview_id=\${listName}`;
|
|
404
399
|
},
|
|
405
400
|
getObjectRelatedViewPath({formFactor, appId, masterObjectName, masterRecordId, objectName, foreignKey}){
|
|
406
401
|
return `/app/${appId}/${masterObjectName}/${masterRecordId}/${objectName}/grid?related_field_name=${foreignKey}`;
|
|
@@ -676,6 +671,10 @@
|
|
|
676
671
|
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
677
672
|
displayFields.push(`${field.name}`);
|
|
678
673
|
}
|
|
674
|
+
}else {
|
|
675
|
+
objectFieldName = field.name.split('.')[0];
|
|
676
|
+
fieldsName.push(objectFieldName);
|
|
677
|
+
displayFields.push(objectFieldName);
|
|
679
678
|
}
|
|
680
679
|
}
|
|
681
680
|
|
|
@@ -3150,7 +3149,10 @@
|
|
|
3150
3149
|
const formSchema = {
|
|
3151
3150
|
"type": "service",
|
|
3152
3151
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3153
|
-
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2" : "slds-filters__body p-0 sm:grid sm:gap-2 sm:grid-cols-4 mb-2",
|
|
3152
|
+
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-2 sm:grid-cols-4 mb-2",
|
|
3153
|
+
"style":{
|
|
3154
|
+
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
3155
|
+
},
|
|
3154
3156
|
"schemaApi": {
|
|
3155
3157
|
method: 'post',
|
|
3156
3158
|
url: `\${context.rootUrl}/graphql?reload=\${filterFormSearchableFields|join}`,
|
|
@@ -5083,14 +5085,14 @@
|
|
|
5083
5085
|
{
|
|
5084
5086
|
"type": "button",
|
|
5085
5087
|
"label": i18next__default["default"].t('frontend_display_type_is_table'),
|
|
5086
|
-
"onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
5088
|
+
"onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
5087
5089
|
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
5088
5090
|
"rightIconClassName": "m-l-sm"
|
|
5089
5091
|
},
|
|
5090
5092
|
{
|
|
5091
5093
|
"type": "button",
|
|
5092
5094
|
"label": i18next__default["default"].t('frontend_display_type_is_split'),
|
|
5093
|
-
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
5095
|
+
"onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
5094
5096
|
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
5095
5097
|
"rightIconClassName": "m-l-sm"
|
|
5096
5098
|
}
|
|
@@ -5252,7 +5254,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5252
5254
|
},
|
|
5253
5255
|
// getExportExcelToolbarButtonSchema(),
|
|
5254
5256
|
getSettingListviewToolbarButtonSchema(),
|
|
5255
|
-
getDisplayAsButton(
|
|
5257
|
+
getDisplayAsButton(mainObject?.name),
|
|
5256
5258
|
filterVisible ? {
|
|
5257
5259
|
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5258
5260
|
"icon": "fa fa-search",
|
|
@@ -7948,6 +7950,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7948
7950
|
let valueField = mainObject.key_field || '_id';
|
|
7949
7951
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
7950
7952
|
|
|
7953
|
+
api.url += "&objectName=${objectName}";//设计器上对象表格组件需要切换对象重新请求列表数据
|
|
7951
7954
|
if(options.isRelated){
|
|
7952
7955
|
api.url += "&recordId=${_master.recordId}";
|
|
7953
7956
|
}
|
|
@@ -8083,13 +8086,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8083
8086
|
const masterRecord = self._master.record;
|
|
8084
8087
|
const masterObjectName = self._master.objectName;
|
|
8085
8088
|
let relatedValue = self._master.recordId;
|
|
8086
|
-
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
8089
|
+
if(refField && refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
8087
8090
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
8088
8091
|
}
|
|
8089
8092
|
let relatedFilters;
|
|
8090
8093
|
if (
|
|
8091
|
-
refField._reference_to ||
|
|
8092
|
-
(refField.reference_to && !_.isString(refField.reference_to))
|
|
8094
|
+
refField && (refField._reference_to ||
|
|
8095
|
+
(refField.reference_to && !_.isString(refField.reference_to)))
|
|
8093
8096
|
) {
|
|
8094
8097
|
relatedFilters = [
|
|
8095
8098
|
[relatedKey + "/o", "=", masterObjectName],
|
|
@@ -8239,7 +8242,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8239
8242
|
|
|
8240
8243
|
const API_CACHE = 100;
|
|
8241
8244
|
|
|
8242
|
-
function getReadonlyFormAdaptor(object, fields){
|
|
8245
|
+
function getReadonlyFormAdaptor(object, fields, options){
|
|
8243
8246
|
let scriptStr = '';
|
|
8244
8247
|
const selectFields = ___namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
|
|
8245
8248
|
const gridAndObjectFieldsName = ___namespace.map(___namespace.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
|
|
@@ -8277,11 +8280,24 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8277
8280
|
// }
|
|
8278
8281
|
// })
|
|
8279
8282
|
|
|
8283
|
+
var fieldNames = ___namespace.map(fields, function(n){return n.name});
|
|
8280
8284
|
return `
|
|
8281
8285
|
if(payload.data.data.length === 0){
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8286
|
+
var isEditor = !!${options && options.isEditor};
|
|
8287
|
+
if(isEditor){
|
|
8288
|
+
var fieldNames = ${JSON.stringify(fieldNames)};
|
|
8289
|
+
var emptyDoc = {};//这里如果不把每个字段值设置为空的话,表单上会显示上一次表单上的字段值
|
|
8290
|
+
fieldNames.forEach(function(n){
|
|
8291
|
+
emptyDoc[n] = null;
|
|
8292
|
+
});
|
|
8293
|
+
// 设计器中始终显示表单,有记录则显示第一条记录,没记录时显示为空表单
|
|
8294
|
+
payload.data.data = [emptyDoc];
|
|
8295
|
+
}
|
|
8296
|
+
else{
|
|
8297
|
+
return {
|
|
8298
|
+
status: 2,
|
|
8299
|
+
msg: "无法找到记录"
|
|
8300
|
+
}
|
|
8285
8301
|
}
|
|
8286
8302
|
}
|
|
8287
8303
|
if(payload.data.data){
|
|
@@ -8298,7 +8314,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8298
8314
|
var record = _.cloneDeep(data);
|
|
8299
8315
|
try{
|
|
8300
8316
|
_.each(gridAndObjectFieldsName, function(name){
|
|
8301
|
-
data[name] = data._display[name];
|
|
8317
|
+
data[name] = data._display && data._display[name];
|
|
8302
8318
|
})
|
|
8303
8319
|
}catch(e){
|
|
8304
8320
|
console.error(e)
|
|
@@ -8319,10 +8335,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
8319
8335
|
async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
8320
8336
|
return {
|
|
8321
8337
|
method: "post",
|
|
8322
|
-
url: getApi$2()+"&recordId=${recordId}",
|
|
8338
|
+
url: getApi$2() + '&objectName=${objectName}' + "&recordId=${recordId}",
|
|
8323
8339
|
cache: API_CACHE,
|
|
8324
8340
|
// requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
|
|
8325
|
-
adaptor: getReadonlyFormAdaptor(object, fields),
|
|
8341
|
+
adaptor: getReadonlyFormAdaptor(object, fields, options),
|
|
8326
8342
|
data: await getFindOneQuery$1(object, recordId, fields, options),
|
|
8327
8343
|
headers: {
|
|
8328
8344
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -9754,8 +9770,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
9754
9770
|
/*
|
|
9755
9771
|
* @Author: baozhoutao@steedos.com
|
|
9756
9772
|
* @Date: 2022-07-05 15:55:39
|
|
9757
|
-
* @LastEditors:
|
|
9758
|
-
* @LastEditTime: 2023-
|
|
9773
|
+
* @LastEditors: liaodaxue
|
|
9774
|
+
* @LastEditTime: 2023-06-20 14:05:50
|
|
9759
9775
|
* @Description:
|
|
9760
9776
|
*/
|
|
9761
9777
|
|
|
@@ -9798,10 +9814,11 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
9798
9814
|
if(!_$1.isEmpty(relatedLists)){
|
|
9799
9815
|
for (const relatedList of relatedLists) {
|
|
9800
9816
|
const arr = relatedList.related_field_fullname.split(".");
|
|
9817
|
+
const foreign_key = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9801
9818
|
related.push({
|
|
9802
9819
|
masterObjectName: objectName,
|
|
9803
9820
|
object_name: arr[0],
|
|
9804
|
-
foreign_key
|
|
9821
|
+
foreign_key,
|
|
9805
9822
|
label: relatedList.label,
|
|
9806
9823
|
columns: relatedList.field_names,
|
|
9807
9824
|
sort: relatedList.sort,
|
|
@@ -9814,10 +9831,11 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
9814
9831
|
const details = [].concat(uiSchema.details || []);
|
|
9815
9832
|
for (const detail of details) {
|
|
9816
9833
|
const arr = detail.split(".");
|
|
9834
|
+
const foreign_key = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9817
9835
|
related.push({
|
|
9818
9836
|
masterObjectName: objectName,
|
|
9819
9837
|
object_name: arr[0],
|
|
9820
|
-
foreign_key
|
|
9838
|
+
foreign_key
|
|
9821
9839
|
});
|
|
9822
9840
|
}
|
|
9823
9841
|
}
|
|
@@ -9849,14 +9867,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
9849
9867
|
if(!_$1.isEmpty(mainRelatedLists)){
|
|
9850
9868
|
for (const relatedList of mainRelatedLists) {
|
|
9851
9869
|
const arr = relatedList.related_field_fullname.split(".");
|
|
9852
|
-
|
|
9870
|
+
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9871
|
+
mainRelated[arr[0]] = foreign_key_value;
|
|
9853
9872
|
}
|
|
9854
9873
|
}else {
|
|
9855
9874
|
const details = _$1.union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
9856
9875
|
for (const detail of details) {
|
|
9857
9876
|
const arr = detail.split(".");
|
|
9877
|
+
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9858
9878
|
if(!_$1.has(mainRelated,arr[0])){
|
|
9859
|
-
mainRelated[arr[0]] =
|
|
9879
|
+
mainRelated[arr[0]] = foreign_key_value;
|
|
9860
9880
|
}
|
|
9861
9881
|
}
|
|
9862
9882
|
}
|