@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.esm.js
CHANGED
|
@@ -2421,15 +2421,15 @@ const getSchema = async (uiSchema, ctx) => {
|
|
|
2421
2421
|
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2422
2422
|
|
|
2423
2423
|
url_tmp = api.url.split('?')[0];
|
|
2424
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
2424
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2425
2425
|
|
|
2426
2426
|
// 判断sort 和 filters
|
|
2427
2427
|
if (sort.length > 0) {
|
|
2428
|
-
api.url += "&$orderby=" + order;
|
|
2428
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2429
2429
|
}
|
|
2430
2430
|
let filters = list_views[list_views_name].filters;
|
|
2431
2431
|
if (filters && filters.length > 0) {
|
|
2432
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
2432
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2433
2433
|
}
|
|
2434
2434
|
return api;
|
|
2435
2435
|
`;
|
|
@@ -3215,28 +3215,42 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3215
3215
|
// }
|
|
3216
3216
|
// }
|
|
3217
3217
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
3218
|
-
|
|
3219
|
-
let
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3238
|
-
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter: false});
|
|
3218
|
+
// 点击搜索的时候自动收起搜索栏
|
|
3219
|
+
let resizeWindow = function(){
|
|
3220
|
+
//触发amis crud 高度重算
|
|
3221
|
+
setTimeout(()=>{
|
|
3222
|
+
window.dispatchEvent(new Event("resize"))
|
|
3223
|
+
}, 500);
|
|
3224
|
+
}
|
|
3225
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3226
|
+
return n.props.type === "service";
|
|
3227
|
+
});
|
|
3228
|
+
let showFieldsFilter = false;
|
|
3229
|
+
const isMobile = window.innerWidth < 768;
|
|
3230
|
+
if(event.data.__from_fields_filter_settings_confirm){
|
|
3231
|
+
// 如果是从设置搜索项点击确认按钮触发的搜索事件不应该自动关闭搜索栏
|
|
3232
|
+
showFieldsFilter = true;
|
|
3233
|
+
}
|
|
3234
|
+
else if(isMobile){
|
|
3235
|
+
// 如果是手机端,点击搜索后自动关闭搜索栏
|
|
3236
|
+
showFieldsFilter = false;
|
|
3239
3237
|
}
|
|
3238
|
+
else if(event.data.displayAs === "split") {
|
|
3239
|
+
// PC上分栏模式下的列表,始终按手机上效果处理,即自动关闭搜索栏
|
|
3240
|
+
showFieldsFilter = false;
|
|
3241
|
+
}
|
|
3242
|
+
else if(window.innerHeight >= 1200){
|
|
3243
|
+
// 高分辨率屏幕(2k+),列表高度比较高,没必要自动关闭搜索栏
|
|
3244
|
+
showFieldsFilter = true;
|
|
3245
|
+
}
|
|
3246
|
+
filterService.setData({showFieldsFilter});
|
|
3247
|
+
resizeWindow();
|
|
3248
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
3249
|
+
let filterFormValues = event.data;
|
|
3250
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
3251
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
3252
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3253
|
+
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter});
|
|
3240
3254
|
`;
|
|
3241
3255
|
const onCancelScript = `
|
|
3242
3256
|
const scope = event.context.scoped;
|
|
@@ -3275,12 +3289,9 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3275
3289
|
setTimeout(()=>{
|
|
3276
3290
|
window.dispatchEvent(new Event("resize"))
|
|
3277
3291
|
}, 100);
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3282
|
-
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3283
|
-
}
|
|
3292
|
+
// 移除搜索按钮上的红点
|
|
3293
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3294
|
+
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3284
3295
|
`;
|
|
3285
3296
|
const dataProviderInited = `
|
|
3286
3297
|
const objectName = data.objectName;
|
|
@@ -3333,17 +3344,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3333
3344
|
|| (_.isArray(n) && _.isEmpty(n.filter(function(item){return !_.isNil(item)})))
|
|
3334
3345
|
|| (_.isString(n) && n.length === 0);
|
|
3335
3346
|
});
|
|
3336
|
-
//
|
|
3347
|
+
// 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
|
|
3337
3348
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
3338
|
-
let
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3342
|
-
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3343
|
-
}
|
|
3344
|
-
else{
|
|
3345
|
-
setData({ showFieldsFilter: true });
|
|
3346
|
-
}
|
|
3349
|
+
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3350
|
+
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3351
|
+
// setData({ showFieldsFilter: true });//自动展开搜索栏
|
|
3347
3352
|
}
|
|
3348
3353
|
}
|
|
3349
3354
|
}
|
|
@@ -3609,7 +3614,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3609
3614
|
},
|
|
3610
3615
|
{
|
|
3611
3616
|
"actionType": "click",
|
|
3612
|
-
"componentId": btnSearchId
|
|
3617
|
+
"componentId": btnSearchId,
|
|
3618
|
+
"args": {
|
|
3619
|
+
"__from_fields_filter_settings_confirm": true
|
|
3620
|
+
}
|
|
3613
3621
|
},
|
|
3614
3622
|
{
|
|
3615
3623
|
"componentId": "",
|
|
@@ -4108,97 +4116,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4108
4116
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
4109
4117
|
}
|
|
4110
4118
|
|
|
4111
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
4112
|
-
return {
|
|
4113
|
-
"type": "button",
|
|
4114
|
-
"icon": "fa fa-download",
|
|
4115
|
-
"align": "right",
|
|
4116
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4117
|
-
"tooltipPlacement": "bottom",
|
|
4118
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4119
|
-
"tooltip": i18next.t('frontend_export_excel'),
|
|
4120
|
-
"onEvent": {
|
|
4121
|
-
"click": {
|
|
4122
|
-
"weight": 0,
|
|
4123
|
-
"actions": [
|
|
4124
|
-
{
|
|
4125
|
-
"args": {
|
|
4126
|
-
"api": {
|
|
4127
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
4128
|
-
"method": "get",
|
|
4129
|
-
"messages": {},
|
|
4130
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
4131
|
-
"data": {
|
|
4132
|
-
"uiSchema": "${uiSchema}",
|
|
4133
|
-
"listName": "${listName}"
|
|
4134
|
-
},
|
|
4135
|
-
"headers": {
|
|
4136
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4137
|
-
}
|
|
4138
|
-
}
|
|
4139
|
-
},
|
|
4140
|
-
"actionType": "download"
|
|
4141
|
-
}
|
|
4142
|
-
]
|
|
4143
|
-
}
|
|
4144
|
-
}
|
|
4145
|
-
}
|
|
4146
|
-
};
|
|
4147
|
-
|
|
4148
|
-
function requestAdaptor$1(){
|
|
4149
|
-
return `
|
|
4150
|
-
// 获取列表视图的属性
|
|
4151
|
-
let uiSchema = api.body.uiSchema;
|
|
4152
|
-
let list_views = uiSchema.list_views;
|
|
4153
|
-
let list_views_name = api.body.listName;
|
|
4154
|
-
let col = list_views[list_views_name].columns;
|
|
4155
|
-
let sort_test = list_views[list_views_name].sort;
|
|
4156
|
-
|
|
4157
|
-
// 获取下载字段
|
|
4158
|
-
let select = [];
|
|
4159
|
-
_.each(col, (col) => {
|
|
4160
|
-
if (col.field == undefined)
|
|
4161
|
-
select.push(col);
|
|
4162
|
-
else select.push(col.field);
|
|
4163
|
-
});
|
|
4164
|
-
|
|
4165
|
-
// 获取排序字段
|
|
4166
|
-
|
|
4167
|
-
let sort = [];
|
|
4168
|
-
_.forEach(sort_test, (sortField) => {
|
|
4169
|
-
if (sortField.field_name == undefined)
|
|
4170
|
-
sort.push(sortField);
|
|
4171
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
4172
|
-
})
|
|
4173
|
-
|
|
4174
|
-
let orders = [];
|
|
4175
|
-
_.map(sort, (value) => {
|
|
4176
|
-
let order_tmp = [];
|
|
4177
|
-
if (value[1] == "desc")
|
|
4178
|
-
order_tmp = value[0] + ' desc';
|
|
4179
|
-
else
|
|
4180
|
-
order_tmp = value[0];
|
|
4181
|
-
orders.push(order_tmp);
|
|
4182
|
-
});
|
|
4183
|
-
let order = orders.join(',');
|
|
4184
|
-
|
|
4185
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
4186
|
-
|
|
4187
|
-
url_tmp = api.url.split('?')[0];
|
|
4188
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
4189
|
-
|
|
4190
|
-
// 判断sort 和 filters
|
|
4191
|
-
if (sort.length > 0) {
|
|
4192
|
-
api.url += "&$orderby=" + order;
|
|
4193
|
-
}
|
|
4194
|
-
let filters = list_views[list_views_name].filters;
|
|
4195
|
-
if (filters && filters.length > 0) {
|
|
4196
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
4197
|
-
}
|
|
4198
|
-
return api;
|
|
4199
|
-
`
|
|
4200
|
-
}
|
|
4201
|
-
|
|
4202
4119
|
const getNewListviewButtonSchema = ()=>{
|
|
4203
4120
|
return {
|
|
4204
4121
|
"type": "button",
|
|
@@ -4232,7 +4149,8 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
4232
4149
|
"name":"",
|
|
4233
4150
|
"label":"",
|
|
4234
4151
|
"filters":"",
|
|
4235
|
-
"shared":false
|
|
4152
|
+
"shared":false,
|
|
4153
|
+
"object_name": "${targetObjectName}",
|
|
4236
4154
|
},
|
|
4237
4155
|
"fieldsExtend": fieldsExtend$4(),
|
|
4238
4156
|
"fields": fields$1(),
|
|
@@ -4279,13 +4197,11 @@ function fields$1(){
|
|
|
4279
4197
|
"object_name",
|
|
4280
4198
|
"filter_scope",
|
|
4281
4199
|
"show_count",
|
|
4282
|
-
"columns
|
|
4283
|
-
"
|
|
4284
|
-
"sort.$.field_name",
|
|
4285
|
-
"sort.$.order",
|
|
4200
|
+
"columns",
|
|
4201
|
+
"sort",
|
|
4286
4202
|
"filters",
|
|
4287
|
-
"mobile_columns
|
|
4288
|
-
"searchable_fields
|
|
4203
|
+
"mobile_columns",
|
|
4204
|
+
"searchable_fields",
|
|
4289
4205
|
"is_system",
|
|
4290
4206
|
"shared"
|
|
4291
4207
|
]
|
|
@@ -4298,7 +4214,8 @@ function fieldsExtend$4(){
|
|
|
4298
4214
|
},
|
|
4299
4215
|
"name": {
|
|
4300
4216
|
"amis": {
|
|
4301
|
-
"hidden": true
|
|
4217
|
+
"hidden": true,
|
|
4218
|
+
"required": false
|
|
4302
4219
|
}
|
|
4303
4220
|
},
|
|
4304
4221
|
"object_name": {
|
|
@@ -4308,37 +4225,56 @@ function fieldsExtend$4(){
|
|
|
4308
4225
|
},
|
|
4309
4226
|
"filter_scope": {
|
|
4310
4227
|
"amis": {
|
|
4311
|
-
"hidden": true
|
|
4228
|
+
"hidden": true,
|
|
4229
|
+
"required": false
|
|
4312
4230
|
}
|
|
4313
4231
|
},
|
|
4314
4232
|
"columns": {
|
|
4315
4233
|
"amis": {
|
|
4316
|
-
"hidden": true
|
|
4234
|
+
"hidden": true,
|
|
4235
|
+
"required": false
|
|
4236
|
+
}
|
|
4237
|
+
},
|
|
4238
|
+
"mobile_columns":{
|
|
4239
|
+
"amis": {
|
|
4240
|
+
"hidden": true,
|
|
4241
|
+
"required": false
|
|
4242
|
+
}
|
|
4243
|
+
},
|
|
4244
|
+
"searchable_fields":{
|
|
4245
|
+
"amis": {
|
|
4246
|
+
"hidden": true,
|
|
4247
|
+
"required": false
|
|
4317
4248
|
}
|
|
4318
4249
|
},
|
|
4319
4250
|
"filter_fields": {
|
|
4320
4251
|
"amis": {
|
|
4321
|
-
"hidden": true
|
|
4252
|
+
"hidden": true,
|
|
4253
|
+
"required": false
|
|
4322
4254
|
}
|
|
4323
4255
|
},
|
|
4324
4256
|
"scrolling_mode": {
|
|
4325
4257
|
"amis": {
|
|
4326
|
-
"hidden": true
|
|
4258
|
+
"hidden": true,
|
|
4259
|
+
"required": false
|
|
4327
4260
|
}
|
|
4328
4261
|
},
|
|
4329
4262
|
"sort": {
|
|
4330
4263
|
"amis": {
|
|
4331
|
-
"hidden": true
|
|
4264
|
+
"hidden": true,
|
|
4265
|
+
"required": false
|
|
4332
4266
|
}
|
|
4333
4267
|
},
|
|
4334
4268
|
"show_count": {
|
|
4335
4269
|
"amis": {
|
|
4336
|
-
"hidden": true
|
|
4270
|
+
"hidden": true,
|
|
4271
|
+
"required": false
|
|
4337
4272
|
}
|
|
4338
4273
|
},
|
|
4339
4274
|
"type": {
|
|
4340
4275
|
"amis": {
|
|
4341
|
-
"hidden": true
|
|
4276
|
+
"hidden": true,
|
|
4277
|
+
"required": false
|
|
4342
4278
|
}
|
|
4343
4279
|
},
|
|
4344
4280
|
"shared": {
|
|
@@ -5161,36 +5097,38 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
5161
5097
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
5162
5098
|
return n.props.type === "service";
|
|
5163
5099
|
});
|
|
5164
|
-
|
|
5100
|
+
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
5101
|
+
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5165
5102
|
let resizeWindow = function(){
|
|
5166
5103
|
//触发amis crud 高度重算
|
|
5167
5104
|
setTimeout(()=>{
|
|
5168
5105
|
window.dispatchEvent(new Event("resize"))
|
|
5169
5106
|
}, 500);
|
|
5170
5107
|
}
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
}
|
|
5108
|
+
resizeWindow();
|
|
5109
|
+
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5110
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5111
|
+
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5112
|
+
// if(filterService.props.data.showFieldsFilter){
|
|
5113
|
+
// if(isMobile){
|
|
5114
|
+
// // 手机上只能通过取消按钮来关闭搜索栏
|
|
5115
|
+
// return;
|
|
5116
|
+
// }
|
|
5117
|
+
// let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
5118
|
+
// direction: "down",
|
|
5119
|
+
// name: "btn_filter_form_cancel"
|
|
5120
|
+
// });
|
|
5121
|
+
// buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
5122
|
+
// resizeWindow();
|
|
5123
|
+
// });
|
|
5124
|
+
// }
|
|
5125
|
+
// else{
|
|
5126
|
+
// if(isMobile){
|
|
5127
|
+
// // 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5128
|
+
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5129
|
+
// crudService && crudService.setData({showFieldsFilter: true});
|
|
5130
|
+
// }
|
|
5131
|
+
// }
|
|
5194
5132
|
`;
|
|
5195
5133
|
|
|
5196
5134
|
|
|
@@ -5236,7 +5174,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5236
5174
|
},
|
|
5237
5175
|
},
|
|
5238
5176
|
filterVisible ? {
|
|
5239
|
-
"label":
|
|
5177
|
+
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5240
5178
|
"icon": "fa fa-search",
|
|
5241
5179
|
"type": "button",
|
|
5242
5180
|
"tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
@@ -5288,13 +5226,24 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5288
5226
|
"tooltipPlacement": "bottom",
|
|
5289
5227
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5290
5228
|
},
|
|
5291
|
-
getExportExcelToolbarButtonSchema(),
|
|
5229
|
+
// getExportExcelToolbarButtonSchema(),
|
|
5230
|
+
getSettingListviewToolbarButtonSchema(),
|
|
5231
|
+
getDisplayAsButton(showDisplayAs),
|
|
5292
5232
|
filterVisible ? {
|
|
5293
|
-
"label":
|
|
5233
|
+
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5294
5234
|
"icon": "fa fa-search",
|
|
5295
5235
|
"tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5296
5236
|
"tooltipPlacement": "bottom",
|
|
5297
5237
|
"type": "button",
|
|
5238
|
+
"badge": {
|
|
5239
|
+
"offset": [
|
|
5240
|
+
-5,
|
|
5241
|
+
1
|
|
5242
|
+
],
|
|
5243
|
+
"size":8,
|
|
5244
|
+
"animation": true,
|
|
5245
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
5246
|
+
},
|
|
5298
5247
|
"align": "right",
|
|
5299
5248
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5300
5249
|
"onEvent": {
|
|
@@ -5307,9 +5256,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5307
5256
|
]
|
|
5308
5257
|
}
|
|
5309
5258
|
}
|
|
5310
|
-
} : {}
|
|
5311
|
-
getSettingListviewToolbarButtonSchema(),
|
|
5312
|
-
getDisplayAsButton(showDisplayAs)
|
|
5259
|
+
} : {}
|
|
5313
5260
|
// {
|
|
5314
5261
|
// "type": "search-box",
|
|
5315
5262
|
// "align": "right",
|
|
@@ -5939,6 +5886,58 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5939
5886
|
"actions": [
|
|
5940
5887
|
{
|
|
5941
5888
|
"actionType": "reload"
|
|
5889
|
+
},
|
|
5890
|
+
{
|
|
5891
|
+
"actionType": "custom",
|
|
5892
|
+
"script": `
|
|
5893
|
+
const masterRecord = event.data._master?.record;
|
|
5894
|
+
const fieldConfig = ${JSON.stringify(field)};
|
|
5895
|
+
let reference_to = fieldConfig.reference_to;
|
|
5896
|
+
let saveValue;
|
|
5897
|
+
const newRecord = {
|
|
5898
|
+
_id: event.data.result.data.recordId,
|
|
5899
|
+
...event.data.__super.__super
|
|
5900
|
+
}
|
|
5901
|
+
const saveField = fieldConfig.reference_to_field || '_id';
|
|
5902
|
+
const saveFieldValue = newRecord[saveField];
|
|
5903
|
+
|
|
5904
|
+
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
5905
|
+
|
|
5906
|
+
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
5907
|
+
const baseSaveValue = {
|
|
5908
|
+
o: reference_to,
|
|
5909
|
+
ids: [saveFieldValue]
|
|
5910
|
+
};
|
|
5911
|
+
if(fieldValue && fieldValue.o){
|
|
5912
|
+
if(fieldValue.o === reference_to){
|
|
5913
|
+
saveValue = fieldConfig.multiple ? { o: reference_to, ids: fieldValue.ids.concat(saveFieldValue)} : baseSaveValue;
|
|
5914
|
+
}else{
|
|
5915
|
+
saveValue = baseSaveValue;
|
|
5916
|
+
}
|
|
5917
|
+
}else{
|
|
5918
|
+
saveValue = baseSaveValue;
|
|
5919
|
+
}
|
|
5920
|
+
|
|
5921
|
+
}else{
|
|
5922
|
+
if(fieldConfig.multiple){
|
|
5923
|
+
// TODO: 连续新建多个记录时,因为获取的主记录不是实时的,所以只会勾选最后一个新建的记录。
|
|
5924
|
+
const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
5925
|
+
saveValue = fieldValue.concat(saveFieldValue);
|
|
5926
|
+
}else{
|
|
5927
|
+
saveValue = saveFieldValue;
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
|
|
5931
|
+
const ctx = ${JSON.stringify(ctx)};
|
|
5932
|
+
const componentId = ctx.defaults.formSchema.id ? 'service-'+ctx.defaults.formSchema.id : 'new-'+ctx.defaults.formSchema.objectApiName;
|
|
5933
|
+
doAction({
|
|
5934
|
+
actionType: 'setValue',
|
|
5935
|
+
componentId: componentId,
|
|
5936
|
+
args: {
|
|
5937
|
+
value: { [fieldConfig.name]: saveValue }
|
|
5938
|
+
}
|
|
5939
|
+
});
|
|
5940
|
+
`
|
|
5942
5941
|
}
|
|
5943
5942
|
]
|
|
5944
5943
|
};
|
|
@@ -6169,7 +6168,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6169
6168
|
type: 'steedos-field-lookup',
|
|
6170
6169
|
field,
|
|
6171
6170
|
readonly,
|
|
6172
|
-
ctx
|
|
6171
|
+
ctx,
|
|
6173
6172
|
}
|
|
6174
6173
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
6175
6174
|
}
|
|
@@ -6323,8 +6322,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6323
6322
|
/*
|
|
6324
6323
|
* @Author: baozhoutao@steedos.com
|
|
6325
6324
|
* @Date: 2023-01-13 17:27:54
|
|
6326
|
-
* @LastEditors:
|
|
6327
|
-
* @LastEditTime: 2023-
|
|
6325
|
+
* @LastEditors: liaodaxue
|
|
6326
|
+
* @LastEditTime: 2023-06-16 15:58:21
|
|
6328
6327
|
* @Description:
|
|
6329
6328
|
*/
|
|
6330
6329
|
|
|
@@ -6376,6 +6375,7 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6376
6375
|
}else {
|
|
6377
6376
|
return {
|
|
6378
6377
|
"type": "input-rich-text",
|
|
6378
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
6379
6379
|
"name": field.name
|
|
6380
6380
|
}
|
|
6381
6381
|
// return {
|
|
@@ -7662,7 +7662,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
7662
7662
|
level: "link",
|
|
7663
7663
|
actionType: "link",
|
|
7664
7664
|
link: url,
|
|
7665
|
-
innerClassName:
|
|
7665
|
+
innerClassName: {
|
|
7666
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
7667
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
7668
|
+
},
|
|
7666
7669
|
body: {
|
|
7667
7670
|
"type": "wrapper",
|
|
7668
7671
|
"body": columnLines,
|
|
@@ -9559,6 +9562,8 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9559
9562
|
};
|
|
9560
9563
|
if(formSchema.id){
|
|
9561
9564
|
amisSchema.id = `service-${formSchema.id}`;
|
|
9565
|
+
}else {
|
|
9566
|
+
amisSchema.id = `new-${objectSchema.name}`;
|
|
9562
9567
|
}
|
|
9563
9568
|
return amisSchema;
|
|
9564
9569
|
}
|