@steedos-widgets/amis-lib 1.2.18 → 1.2.25
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 +186 -181
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +186 -181
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +186 -181
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +2 -0
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +8 -2
- package/dist/types/lib/converter/amis/fields/table.d.ts +4 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +6 -2
- package/dist/types/lib/converter/amis/header.d.ts +6 -2
- package/dist/types/lib/converter/amis/toolbar.d.ts +6 -2
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +21 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +21 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2448,15 +2448,15 @@ const getSchema = async (uiSchema, ctx) => {
|
|
|
2448
2448
|
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2449
2449
|
|
|
2450
2450
|
url_tmp = api.url.split('?')[0];
|
|
2451
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
2451
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2452
2452
|
|
|
2453
2453
|
// 判断sort 和 filters
|
|
2454
2454
|
if (sort.length > 0) {
|
|
2455
|
-
api.url += "&$orderby=" + order;
|
|
2455
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2456
2456
|
}
|
|
2457
2457
|
let filters = list_views[list_views_name].filters;
|
|
2458
2458
|
if (filters && filters.length > 0) {
|
|
2459
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
2459
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2460
2460
|
}
|
|
2461
2461
|
return api;
|
|
2462
2462
|
`;
|
|
@@ -3242,28 +3242,42 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3242
3242
|
// }
|
|
3243
3243
|
// }
|
|
3244
3244
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
3245
|
-
|
|
3246
|
-
let
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3265
|
-
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter: false});
|
|
3245
|
+
// 点击搜索的时候自动收起搜索栏
|
|
3246
|
+
let resizeWindow = function(){
|
|
3247
|
+
//触发amis crud 高度重算
|
|
3248
|
+
setTimeout(()=>{
|
|
3249
|
+
window.dispatchEvent(new Event("resize"))
|
|
3250
|
+
}, 500);
|
|
3251
|
+
}
|
|
3252
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3253
|
+
return n.props.type === "service";
|
|
3254
|
+
});
|
|
3255
|
+
let showFieldsFilter = false;
|
|
3256
|
+
const isMobile = window.innerWidth < 768;
|
|
3257
|
+
if(event.data.__from_fields_filter_settings_confirm){
|
|
3258
|
+
// 如果是从设置搜索项点击确认按钮触发的搜索事件不应该自动关闭搜索栏
|
|
3259
|
+
showFieldsFilter = true;
|
|
3260
|
+
}
|
|
3261
|
+
else if(isMobile){
|
|
3262
|
+
// 如果是手机端,点击搜索后自动关闭搜索栏
|
|
3263
|
+
showFieldsFilter = false;
|
|
3266
3264
|
}
|
|
3265
|
+
else if(event.data.displayAs === "split") {
|
|
3266
|
+
// PC上分栏模式下的列表,始终按手机上效果处理,即自动关闭搜索栏
|
|
3267
|
+
showFieldsFilter = false;
|
|
3268
|
+
}
|
|
3269
|
+
else if(window.innerHeight >= 1200){
|
|
3270
|
+
// 高分辨率屏幕(2k+),列表高度比较高,没必要自动关闭搜索栏
|
|
3271
|
+
showFieldsFilter = true;
|
|
3272
|
+
}
|
|
3273
|
+
filterService.setData({showFieldsFilter});
|
|
3274
|
+
resizeWindow();
|
|
3275
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
3276
|
+
let filterFormValues = event.data;
|
|
3277
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
3278
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
3279
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3280
|
+
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter});
|
|
3267
3281
|
`;
|
|
3268
3282
|
const onCancelScript = `
|
|
3269
3283
|
const scope = event.context.scoped;
|
|
@@ -3302,12 +3316,9 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3302
3316
|
setTimeout(()=>{
|
|
3303
3317
|
window.dispatchEvent(new Event("resize"))
|
|
3304
3318
|
}, 100);
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3309
|
-
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3310
|
-
}
|
|
3319
|
+
// 移除搜索按钮上的红点
|
|
3320
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3321
|
+
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3311
3322
|
`;
|
|
3312
3323
|
const dataProviderInited = `
|
|
3313
3324
|
const objectName = data.objectName;
|
|
@@ -3360,17 +3371,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3360
3371
|
|| (_.isArray(n) && _.isEmpty(n.filter(function(item){return !_.isNil(item)})))
|
|
3361
3372
|
|| (_.isString(n) && n.length === 0);
|
|
3362
3373
|
});
|
|
3363
|
-
//
|
|
3374
|
+
// 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
|
|
3364
3375
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
3365
|
-
let
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3369
|
-
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3370
|
-
}
|
|
3371
|
-
else{
|
|
3372
|
-
setData({ showFieldsFilter: true });
|
|
3373
|
-
}
|
|
3376
|
+
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3377
|
+
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3378
|
+
// setData({ showFieldsFilter: true });//自动展开搜索栏
|
|
3374
3379
|
}
|
|
3375
3380
|
}
|
|
3376
3381
|
}
|
|
@@ -3636,7 +3641,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3636
3641
|
},
|
|
3637
3642
|
{
|
|
3638
3643
|
"actionType": "click",
|
|
3639
|
-
"componentId": btnSearchId
|
|
3644
|
+
"componentId": btnSearchId,
|
|
3645
|
+
"args": {
|
|
3646
|
+
"__from_fields_filter_settings_confirm": true
|
|
3647
|
+
}
|
|
3640
3648
|
},
|
|
3641
3649
|
{
|
|
3642
3650
|
"componentId": "",
|
|
@@ -4135,97 +4143,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4135
4143
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
4136
4144
|
}
|
|
4137
4145
|
|
|
4138
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
4139
|
-
return {
|
|
4140
|
-
"type": "button",
|
|
4141
|
-
"icon": "fa fa-download",
|
|
4142
|
-
"align": "right",
|
|
4143
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4144
|
-
"tooltipPlacement": "bottom",
|
|
4145
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4146
|
-
"tooltip": i18next__default["default"].t('frontend_export_excel'),
|
|
4147
|
-
"onEvent": {
|
|
4148
|
-
"click": {
|
|
4149
|
-
"weight": 0,
|
|
4150
|
-
"actions": [
|
|
4151
|
-
{
|
|
4152
|
-
"args": {
|
|
4153
|
-
"api": {
|
|
4154
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
4155
|
-
"method": "get",
|
|
4156
|
-
"messages": {},
|
|
4157
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
4158
|
-
"data": {
|
|
4159
|
-
"uiSchema": "${uiSchema}",
|
|
4160
|
-
"listName": "${listName}"
|
|
4161
|
-
},
|
|
4162
|
-
"headers": {
|
|
4163
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4164
|
-
}
|
|
4165
|
-
}
|
|
4166
|
-
},
|
|
4167
|
-
"actionType": "download"
|
|
4168
|
-
}
|
|
4169
|
-
]
|
|
4170
|
-
}
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
};
|
|
4174
|
-
|
|
4175
|
-
function requestAdaptor$1(){
|
|
4176
|
-
return `
|
|
4177
|
-
// 获取列表视图的属性
|
|
4178
|
-
let uiSchema = api.body.uiSchema;
|
|
4179
|
-
let list_views = uiSchema.list_views;
|
|
4180
|
-
let list_views_name = api.body.listName;
|
|
4181
|
-
let col = list_views[list_views_name].columns;
|
|
4182
|
-
let sort_test = list_views[list_views_name].sort;
|
|
4183
|
-
|
|
4184
|
-
// 获取下载字段
|
|
4185
|
-
let select = [];
|
|
4186
|
-
_.each(col, (col) => {
|
|
4187
|
-
if (col.field == undefined)
|
|
4188
|
-
select.push(col);
|
|
4189
|
-
else select.push(col.field);
|
|
4190
|
-
});
|
|
4191
|
-
|
|
4192
|
-
// 获取排序字段
|
|
4193
|
-
|
|
4194
|
-
let sort = [];
|
|
4195
|
-
_.forEach(sort_test, (sortField) => {
|
|
4196
|
-
if (sortField.field_name == undefined)
|
|
4197
|
-
sort.push(sortField);
|
|
4198
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
4199
|
-
})
|
|
4200
|
-
|
|
4201
|
-
let orders = [];
|
|
4202
|
-
_.map(sort, (value) => {
|
|
4203
|
-
let order_tmp = [];
|
|
4204
|
-
if (value[1] == "desc")
|
|
4205
|
-
order_tmp = value[0] + ' desc';
|
|
4206
|
-
else
|
|
4207
|
-
order_tmp = value[0];
|
|
4208
|
-
orders.push(order_tmp);
|
|
4209
|
-
});
|
|
4210
|
-
let order = orders.join(',');
|
|
4211
|
-
|
|
4212
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
4213
|
-
|
|
4214
|
-
url_tmp = api.url.split('?')[0];
|
|
4215
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
4216
|
-
|
|
4217
|
-
// 判断sort 和 filters
|
|
4218
|
-
if (sort.length > 0) {
|
|
4219
|
-
api.url += "&$orderby=" + order;
|
|
4220
|
-
}
|
|
4221
|
-
let filters = list_views[list_views_name].filters;
|
|
4222
|
-
if (filters && filters.length > 0) {
|
|
4223
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
4224
|
-
}
|
|
4225
|
-
return api;
|
|
4226
|
-
`
|
|
4227
|
-
}
|
|
4228
|
-
|
|
4229
4146
|
const getNewListviewButtonSchema = ()=>{
|
|
4230
4147
|
return {
|
|
4231
4148
|
"type": "button",
|
|
@@ -4259,7 +4176,8 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
4259
4176
|
"name":"",
|
|
4260
4177
|
"label":"",
|
|
4261
4178
|
"filters":"",
|
|
4262
|
-
"shared":false
|
|
4179
|
+
"shared":false,
|
|
4180
|
+
"object_name": "${targetObjectName}",
|
|
4263
4181
|
},
|
|
4264
4182
|
"fieldsExtend": fieldsExtend$4(),
|
|
4265
4183
|
"fields": fields$1(),
|
|
@@ -4306,13 +4224,11 @@ function fields$1(){
|
|
|
4306
4224
|
"object_name",
|
|
4307
4225
|
"filter_scope",
|
|
4308
4226
|
"show_count",
|
|
4309
|
-
"columns
|
|
4310
|
-
"
|
|
4311
|
-
"sort.$.field_name",
|
|
4312
|
-
"sort.$.order",
|
|
4227
|
+
"columns",
|
|
4228
|
+
"sort",
|
|
4313
4229
|
"filters",
|
|
4314
|
-
"mobile_columns
|
|
4315
|
-
"searchable_fields
|
|
4230
|
+
"mobile_columns",
|
|
4231
|
+
"searchable_fields",
|
|
4316
4232
|
"is_system",
|
|
4317
4233
|
"shared"
|
|
4318
4234
|
]
|
|
@@ -4325,7 +4241,8 @@ function fieldsExtend$4(){
|
|
|
4325
4241
|
},
|
|
4326
4242
|
"name": {
|
|
4327
4243
|
"amis": {
|
|
4328
|
-
"hidden": true
|
|
4244
|
+
"hidden": true,
|
|
4245
|
+
"required": false
|
|
4329
4246
|
}
|
|
4330
4247
|
},
|
|
4331
4248
|
"object_name": {
|
|
@@ -4335,37 +4252,56 @@ function fieldsExtend$4(){
|
|
|
4335
4252
|
},
|
|
4336
4253
|
"filter_scope": {
|
|
4337
4254
|
"amis": {
|
|
4338
|
-
"hidden": true
|
|
4255
|
+
"hidden": true,
|
|
4256
|
+
"required": false
|
|
4339
4257
|
}
|
|
4340
4258
|
},
|
|
4341
4259
|
"columns": {
|
|
4342
4260
|
"amis": {
|
|
4343
|
-
"hidden": true
|
|
4261
|
+
"hidden": true,
|
|
4262
|
+
"required": false
|
|
4263
|
+
}
|
|
4264
|
+
},
|
|
4265
|
+
"mobile_columns":{
|
|
4266
|
+
"amis": {
|
|
4267
|
+
"hidden": true,
|
|
4268
|
+
"required": false
|
|
4269
|
+
}
|
|
4270
|
+
},
|
|
4271
|
+
"searchable_fields":{
|
|
4272
|
+
"amis": {
|
|
4273
|
+
"hidden": true,
|
|
4274
|
+
"required": false
|
|
4344
4275
|
}
|
|
4345
4276
|
},
|
|
4346
4277
|
"filter_fields": {
|
|
4347
4278
|
"amis": {
|
|
4348
|
-
"hidden": true
|
|
4279
|
+
"hidden": true,
|
|
4280
|
+
"required": false
|
|
4349
4281
|
}
|
|
4350
4282
|
},
|
|
4351
4283
|
"scrolling_mode": {
|
|
4352
4284
|
"amis": {
|
|
4353
|
-
"hidden": true
|
|
4285
|
+
"hidden": true,
|
|
4286
|
+
"required": false
|
|
4354
4287
|
}
|
|
4355
4288
|
},
|
|
4356
4289
|
"sort": {
|
|
4357
4290
|
"amis": {
|
|
4358
|
-
"hidden": true
|
|
4291
|
+
"hidden": true,
|
|
4292
|
+
"required": false
|
|
4359
4293
|
}
|
|
4360
4294
|
},
|
|
4361
4295
|
"show_count": {
|
|
4362
4296
|
"amis": {
|
|
4363
|
-
"hidden": true
|
|
4297
|
+
"hidden": true,
|
|
4298
|
+
"required": false
|
|
4364
4299
|
}
|
|
4365
4300
|
},
|
|
4366
4301
|
"type": {
|
|
4367
4302
|
"amis": {
|
|
4368
|
-
"hidden": true
|
|
4303
|
+
"hidden": true,
|
|
4304
|
+
"required": false
|
|
4369
4305
|
}
|
|
4370
4306
|
},
|
|
4371
4307
|
"shared": {
|
|
@@ -5188,36 +5124,38 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
5188
5124
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
5189
5125
|
return n.props.type === "service";
|
|
5190
5126
|
});
|
|
5191
|
-
|
|
5127
|
+
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
5128
|
+
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5192
5129
|
let resizeWindow = function(){
|
|
5193
5130
|
//触发amis crud 高度重算
|
|
5194
5131
|
setTimeout(()=>{
|
|
5195
5132
|
window.dispatchEvent(new Event("resize"))
|
|
5196
5133
|
}, 500);
|
|
5197
5134
|
}
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
}
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
}
|
|
5135
|
+
resizeWindow();
|
|
5136
|
+
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5137
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5138
|
+
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5139
|
+
// if(filterService.props.data.showFieldsFilter){
|
|
5140
|
+
// if(isMobile){
|
|
5141
|
+
// // 手机上只能通过取消按钮来关闭搜索栏
|
|
5142
|
+
// return;
|
|
5143
|
+
// }
|
|
5144
|
+
// let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
5145
|
+
// direction: "down",
|
|
5146
|
+
// name: "btn_filter_form_cancel"
|
|
5147
|
+
// });
|
|
5148
|
+
// buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
5149
|
+
// resizeWindow();
|
|
5150
|
+
// });
|
|
5151
|
+
// }
|
|
5152
|
+
// else{
|
|
5153
|
+
// if(isMobile){
|
|
5154
|
+
// // 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5155
|
+
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5156
|
+
// crudService && crudService.setData({showFieldsFilter: true});
|
|
5157
|
+
// }
|
|
5158
|
+
// }
|
|
5221
5159
|
`;
|
|
5222
5160
|
|
|
5223
5161
|
|
|
@@ -5263,7 +5201,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5263
5201
|
},
|
|
5264
5202
|
},
|
|
5265
5203
|
filterVisible ? {
|
|
5266
|
-
"label": "",
|
|
5204
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5267
5205
|
"icon": "fa fa-search",
|
|
5268
5206
|
"type": "button",
|
|
5269
5207
|
"tooltip": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
@@ -5315,13 +5253,24 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5315
5253
|
"tooltipPlacement": "bottom",
|
|
5316
5254
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5317
5255
|
},
|
|
5318
|
-
getExportExcelToolbarButtonSchema(),
|
|
5256
|
+
// getExportExcelToolbarButtonSchema(),
|
|
5257
|
+
getSettingListviewToolbarButtonSchema(),
|
|
5258
|
+
getDisplayAsButton(showDisplayAs),
|
|
5319
5259
|
filterVisible ? {
|
|
5320
|
-
"label": "",
|
|
5260
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5321
5261
|
"icon": "fa fa-search",
|
|
5322
5262
|
"tooltip": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5323
5263
|
"tooltipPlacement": "bottom",
|
|
5324
5264
|
"type": "button",
|
|
5265
|
+
"badge": {
|
|
5266
|
+
"offset": [
|
|
5267
|
+
-5,
|
|
5268
|
+
1
|
|
5269
|
+
],
|
|
5270
|
+
"size":8,
|
|
5271
|
+
"animation": true,
|
|
5272
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
5273
|
+
},
|
|
5325
5274
|
"align": "right",
|
|
5326
5275
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5327
5276
|
"onEvent": {
|
|
@@ -5334,9 +5283,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5334
5283
|
]
|
|
5335
5284
|
}
|
|
5336
5285
|
}
|
|
5337
|
-
} : {}
|
|
5338
|
-
getSettingListviewToolbarButtonSchema(),
|
|
5339
|
-
getDisplayAsButton(showDisplayAs)
|
|
5286
|
+
} : {}
|
|
5340
5287
|
// {
|
|
5341
5288
|
// "type": "search-box",
|
|
5342
5289
|
// "align": "right",
|
|
@@ -5966,6 +5913,58 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5966
5913
|
"actions": [
|
|
5967
5914
|
{
|
|
5968
5915
|
"actionType": "reload"
|
|
5916
|
+
},
|
|
5917
|
+
{
|
|
5918
|
+
"actionType": "custom",
|
|
5919
|
+
"script": `
|
|
5920
|
+
const masterRecord = event.data._master?.record;
|
|
5921
|
+
const fieldConfig = ${JSON.stringify(field)};
|
|
5922
|
+
let reference_to = fieldConfig.reference_to;
|
|
5923
|
+
let saveValue;
|
|
5924
|
+
const newRecord = {
|
|
5925
|
+
_id: event.data.result.data.recordId,
|
|
5926
|
+
...event.data.__super.__super
|
|
5927
|
+
}
|
|
5928
|
+
const saveField = fieldConfig.reference_to_field || '_id';
|
|
5929
|
+
const saveFieldValue = newRecord[saveField];
|
|
5930
|
+
|
|
5931
|
+
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
5932
|
+
|
|
5933
|
+
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
5934
|
+
const baseSaveValue = {
|
|
5935
|
+
o: reference_to,
|
|
5936
|
+
ids: [saveFieldValue]
|
|
5937
|
+
};
|
|
5938
|
+
if(fieldValue && fieldValue.o){
|
|
5939
|
+
if(fieldValue.o === reference_to){
|
|
5940
|
+
saveValue = fieldConfig.multiple ? { o: reference_to, ids: fieldValue.ids.concat(saveFieldValue)} : baseSaveValue;
|
|
5941
|
+
}else{
|
|
5942
|
+
saveValue = baseSaveValue;
|
|
5943
|
+
}
|
|
5944
|
+
}else{
|
|
5945
|
+
saveValue = baseSaveValue;
|
|
5946
|
+
}
|
|
5947
|
+
|
|
5948
|
+
}else{
|
|
5949
|
+
if(fieldConfig.multiple){
|
|
5950
|
+
// TODO: 连续新建多个记录时,因为获取的主记录不是实时的,所以只会勾选最后一个新建的记录。
|
|
5951
|
+
const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
5952
|
+
saveValue = fieldValue.concat(saveFieldValue);
|
|
5953
|
+
}else{
|
|
5954
|
+
saveValue = saveFieldValue;
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
const ctx = ${JSON.stringify(ctx)};
|
|
5959
|
+
const componentId = ctx.defaults.formSchema.id ? 'service-'+ctx.defaults.formSchema.id : 'new-'+ctx.defaults.formSchema.objectApiName;
|
|
5960
|
+
doAction({
|
|
5961
|
+
actionType: 'setValue',
|
|
5962
|
+
componentId: componentId,
|
|
5963
|
+
args: {
|
|
5964
|
+
value: { [fieldConfig.name]: saveValue }
|
|
5965
|
+
}
|
|
5966
|
+
});
|
|
5967
|
+
`
|
|
5969
5968
|
}
|
|
5970
5969
|
]
|
|
5971
5970
|
};
|
|
@@ -6196,7 +6195,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6196
6195
|
type: 'steedos-field-lookup',
|
|
6197
6196
|
field,
|
|
6198
6197
|
readonly,
|
|
6199
|
-
ctx
|
|
6198
|
+
ctx,
|
|
6200
6199
|
}
|
|
6201
6200
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
6202
6201
|
}
|
|
@@ -6350,8 +6349,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6350
6349
|
/*
|
|
6351
6350
|
* @Author: baozhoutao@steedos.com
|
|
6352
6351
|
* @Date: 2023-01-13 17:27:54
|
|
6353
|
-
* @LastEditors:
|
|
6354
|
-
* @LastEditTime: 2023-
|
|
6352
|
+
* @LastEditors: liaodaxue
|
|
6353
|
+
* @LastEditTime: 2023-06-16 15:58:21
|
|
6355
6354
|
* @Description:
|
|
6356
6355
|
*/
|
|
6357
6356
|
|
|
@@ -6403,6 +6402,7 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6403
6402
|
}else {
|
|
6404
6403
|
return {
|
|
6405
6404
|
"type": "input-rich-text",
|
|
6405
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
6406
6406
|
"name": field.name
|
|
6407
6407
|
}
|
|
6408
6408
|
// return {
|
|
@@ -7689,7 +7689,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
7689
7689
|
level: "link",
|
|
7690
7690
|
actionType: "link",
|
|
7691
7691
|
link: url,
|
|
7692
|
-
innerClassName:
|
|
7692
|
+
innerClassName: {
|
|
7693
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
7694
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
7695
|
+
},
|
|
7693
7696
|
body: {
|
|
7694
7697
|
"type": "wrapper",
|
|
7695
7698
|
"body": columnLines,
|
|
@@ -9586,6 +9589,8 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9586
9589
|
};
|
|
9587
9590
|
if(formSchema.id){
|
|
9588
9591
|
amisSchema.id = `service-${formSchema.id}`;
|
|
9592
|
+
}else {
|
|
9593
|
+
amisSchema.id = `new-${objectSchema.name}`;
|
|
9589
9594
|
}
|
|
9590
9595
|
return amisSchema;
|
|
9591
9596
|
}
|