@steedos-widgets/amis-lib 6.3.12-beta.3 → 6.3.12-beta.31
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 +217 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +217 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +57 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/file.d.ts +2 -2
- package/dist/types/schema/standard_new.amis.d.ts +3 -0
- package/dist/types/standard/button.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1213,7 +1213,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1213
1213
|
* @Author: baozhoutao@steedos.com
|
|
1214
1214
|
* @Date: 2022-10-28 14:15:09
|
|
1215
1215
|
* @LastEditors: baozhoutao@steedos.com
|
|
1216
|
-
* @LastEditTime:
|
|
1216
|
+
* @LastEditTime: 2025-02-13 09:31:02
|
|
1217
1217
|
* @Description:
|
|
1218
1218
|
*/
|
|
1219
1219
|
|
|
@@ -1272,7 +1272,7 @@ async function getLookupLinkOnClick(field, options) {
|
|
|
1272
1272
|
"title": " ",
|
|
1273
1273
|
"headerClassName": "hidden",
|
|
1274
1274
|
"size": "lg",
|
|
1275
|
-
"width": "70%",
|
|
1275
|
+
"width": window.drawerWidth || "70%",
|
|
1276
1276
|
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
1277
1277
|
"closeOnEsc": true,
|
|
1278
1278
|
"closeOnOutside": true,
|
|
@@ -1868,7 +1868,6 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
1868
1868
|
{
|
|
1869
1869
|
actionType: "custom",
|
|
1870
1870
|
script: `
|
|
1871
|
-
console.log("asdasd");
|
|
1872
1871
|
let items = _.cloneDeep(event.data.items);
|
|
1873
1872
|
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
1874
1873
|
if(event.data.isBatchEdit){
|
|
@@ -2365,7 +2364,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2365
2364
|
"title": " ",
|
|
2366
2365
|
"headerClassName": "hidden",
|
|
2367
2366
|
"size": "lg",
|
|
2368
|
-
"width": "70%",
|
|
2367
|
+
"width": window.drawerWidth || "70%",
|
|
2369
2368
|
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2370
2369
|
"closeOnEsc": true,
|
|
2371
2370
|
"closeOnOutside": true,
|
|
@@ -3409,6 +3408,11 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3409
3408
|
}, 600);
|
|
3410
3409
|
}
|
|
3411
3410
|
}
|
|
3411
|
+
|
|
3412
|
+
// 列表搜索和快速搜索,有时在某些操作情况下还是会造成crud接口请求使用的过滤条件是上次的,这里强制把正确的过滤条件返回到crud,详细规则见:https://github.com/steedos/steedos-platform/issues/7112
|
|
3413
|
+
// lookup字段的弹出列表搜索不受这里影响,因为lookup字段的弹出列表搜索是单独的接口请求
|
|
3414
|
+
payload.data.__changedFilterFormValues = api.context.__changedFilterFormValues;
|
|
3415
|
+
payload.data.__changedSearchBoxValues = api.context.__changedSearchBoxValues;
|
|
3412
3416
|
${options.adaptor || ''}
|
|
3413
3417
|
return payload;
|
|
3414
3418
|
`;
|
|
@@ -4809,7 +4813,7 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4809
4813
|
* @Author: baozhoutao@steedos.com
|
|
4810
4814
|
* @Date: 2022-11-01 15:51:00
|
|
4811
4815
|
* @LastEditors: baozhoutao@steedos.com
|
|
4812
|
-
* @LastEditTime: 2024-
|
|
4816
|
+
* @LastEditTime: 2024-12-26 20:28:43
|
|
4813
4817
|
* @Description:
|
|
4814
4818
|
*/
|
|
4815
4819
|
|
|
@@ -4969,20 +4973,23 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4969
4973
|
{
|
|
4970
4974
|
type: 'button',
|
|
4971
4975
|
actionType: 'cancel',
|
|
4972
|
-
label: i18next.t('frontend_form_cancel')
|
|
4976
|
+
label: i18next.t('frontend_form_cancel'),
|
|
4977
|
+
className: 'form-btn-cancel'
|
|
4973
4978
|
},
|
|
4974
4979
|
{
|
|
4975
4980
|
type: 'button',
|
|
4976
4981
|
label: i18next.t('frontend_form_save_and_new'),
|
|
4977
4982
|
actionType: 'confirm',
|
|
4978
4983
|
close: false,
|
|
4979
|
-
id: "confirmAndNew"
|
|
4984
|
+
id: "confirmAndNew",
|
|
4985
|
+
className: 'form-btn-save_and_new'
|
|
4980
4986
|
},
|
|
4981
4987
|
{
|
|
4982
4988
|
type: 'button',
|
|
4983
4989
|
actionType: 'confirm',
|
|
4984
4990
|
label: i18next.t('frontend_form_save'),
|
|
4985
|
-
primary: true
|
|
4991
|
+
primary: true,
|
|
4992
|
+
className: 'form-btn-save'
|
|
4986
4993
|
},
|
|
4987
4994
|
]
|
|
4988
4995
|
}
|
|
@@ -6137,15 +6144,38 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6137
6144
|
if (!ctx) {
|
|
6138
6145
|
ctx = {};
|
|
6139
6146
|
}
|
|
6147
|
+
const searchableFields = ctx.searchable_fields;
|
|
6148
|
+
const autoOpenFilter = !!ctx.auto_open_filter;
|
|
6140
6149
|
const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
|
|
6141
6150
|
const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
|
|
6142
6151
|
const keywordsSearchBoxName = ctx.keywordsSearchBoxName || "__keywords";
|
|
6143
6152
|
const onSearchScript = `
|
|
6144
|
-
|
|
6153
|
+
let isLookup = event.data.isLookup;
|
|
6154
|
+
let __lookupField = event.data.__lookupField;
|
|
6145
6155
|
const scope = event.context.scoped;
|
|
6156
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
6146
6157
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
6147
6158
|
return n.props.type === "form";
|
|
6148
6159
|
});
|
|
6160
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取,因为本地存储中的过滤条件自动填充到表单上时filterForm.getValues()拿不到。
|
|
6161
|
+
let filterFormValues = event.data;
|
|
6162
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
6163
|
+
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
|
|
6164
|
+
// 同步__changedFilterFormValues中的值
|
|
6165
|
+
// crud && crud.setData({__changedFilterFormValues: {}});
|
|
6166
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
6167
|
+
if(isLookup && __lookupField){
|
|
6168
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
6169
|
+
if(__lookupField.reference_to_field){
|
|
6170
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
6171
|
+
}
|
|
6172
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
6173
|
+
}
|
|
6174
|
+
if(crud){
|
|
6175
|
+
let crudData = crud.getData();
|
|
6176
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
6177
|
+
crud.setData(crudData);
|
|
6178
|
+
}
|
|
6149
6179
|
filterForm.handleFormSubmit(event);
|
|
6150
6180
|
// var filterFormValues = filterForm.getValues();
|
|
6151
6181
|
// var listView = scope.parent.parent.parent.getComponents().find(function(n){
|
|
@@ -6194,11 +6224,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6194
6224
|
}
|
|
6195
6225
|
filterService.setData({showFieldsFilter});
|
|
6196
6226
|
// resizeWindow();//已迁移到搜索栏表单提交事件中执行,因为表单项change后也会触发表单提交了
|
|
6197
|
-
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
6198
|
-
let filterFormValues = event.data;
|
|
6199
6227
|
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
6200
|
-
let
|
|
6201
|
-
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
6228
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
6202
6229
|
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter});
|
|
6203
6230
|
`;
|
|
6204
6231
|
const onCancelScript = `
|
|
@@ -6284,10 +6311,27 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6284
6311
|
|
|
6285
6312
|
// 移除搜索按钮上的红点
|
|
6286
6313
|
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
6287
|
-
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
6314
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
6288
6315
|
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
6289
6316
|
`;
|
|
6317
|
+
/**
|
|
6318
|
+
给lookup字段配置filter_form_data时可以配置为amis变量,也可以配置为事态key-value键值对象值:
|
|
6319
|
+
```
|
|
6320
|
+
"filter_form_data": "${selectedPublicGroupFilterFormData|toJson}"
|
|
6321
|
+
```
|
|
6322
|
+
or
|
|
6323
|
+
```
|
|
6324
|
+
"filter_form_data": {
|
|
6325
|
+
"public_group_ids": [
|
|
6326
|
+
"67addbef39f9a4503789b38d"
|
|
6327
|
+
]
|
|
6328
|
+
}
|
|
6329
|
+
```
|
|
6330
|
+
*/
|
|
6331
|
+
const filterFormValues = ctx.filter_form_data;
|
|
6290
6332
|
const dataProviderInited = `
|
|
6333
|
+
const searchableFields = ${JSON.stringify(searchableFields)};
|
|
6334
|
+
const autoOpenFilter = ${autoOpenFilter};
|
|
6291
6335
|
const objectName = data.objectName;
|
|
6292
6336
|
const isLookup = data.isLookup;
|
|
6293
6337
|
const listName = data.listName;
|
|
@@ -6300,6 +6344,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6300
6344
|
if(defaultSearchableFields){
|
|
6301
6345
|
defaultSearchableFields = defaultSearchableFields.split(",");
|
|
6302
6346
|
}
|
|
6347
|
+
if(_.isEmpty(defaultSearchableFields) && searchableFields){
|
|
6348
|
+
if(searchableFields.length){
|
|
6349
|
+
defaultSearchableFields = _.map(searchableFields, 'field');
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6303
6352
|
if(_.isEmpty(defaultSearchableFields) && data.uiSchema){
|
|
6304
6353
|
let listView = data.uiSchema.list_views[data.listName];
|
|
6305
6354
|
const sFields = listView && listView.searchable_fields;
|
|
@@ -6317,8 +6366,18 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6317
6366
|
}
|
|
6318
6367
|
setData({ filterFormSearchableFields: defaultSearchableFields });
|
|
6319
6368
|
if(isLookup){
|
|
6369
|
+
let filterFormValues = ${_.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
6370
|
+
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
6371
|
+
if (isAmisFormula){
|
|
6372
|
+
filterFormValues = AmisCore.evaluate(filterFormValues, data) || {};
|
|
6373
|
+
}
|
|
6374
|
+
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
6375
|
+
let fields = data.uiSchema && data.uiSchema.fields;
|
|
6376
|
+
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
6377
|
+
setData({ ...filterFormValues });
|
|
6378
|
+
}
|
|
6320
6379
|
// looup字段过滤器不在本地缓存记住过滤条件,所以初始始终隐藏过滤器
|
|
6321
|
-
setData({ showFieldsFilter:
|
|
6380
|
+
setData({ showFieldsFilter: autoOpenFilter });
|
|
6322
6381
|
}
|
|
6323
6382
|
else{
|
|
6324
6383
|
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
@@ -7583,7 +7642,7 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
|
|
|
7583
7642
|
* @param {*} objectSchema 对象UISchema
|
|
7584
7643
|
* @returns amisSchema
|
|
7585
7644
|
*/
|
|
7586
|
-
function getObjectListHeader
|
|
7645
|
+
function getObjectListHeader(objectSchema, listViewName, ctx) {
|
|
7587
7646
|
if (!ctx) {
|
|
7588
7647
|
ctx = {};
|
|
7589
7648
|
}
|
|
@@ -8909,10 +8968,9 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8909
8968
|
}
|
|
8910
8969
|
|
|
8911
8970
|
const onChangeScript = `
|
|
8912
|
-
// console.log("==search=onChangeScript===");
|
|
8913
8971
|
const scope = event.context.scoped;
|
|
8914
8972
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
8915
|
-
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
8973
|
+
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
8916
8974
|
let __changedSearchBoxValues = {};
|
|
8917
8975
|
__changedSearchBoxValues["${keywordsSearchBoxName}"] = event.data["${keywordsSearchBoxName}"];
|
|
8918
8976
|
// crudService && crudService.setData({__changedSearchBoxValues: __changedSearchBoxValues});
|
|
@@ -9279,10 +9337,28 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
9279
9337
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
9280
9338
|
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
9281
9339
|
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
9282
|
-
let filterFormValues = filterFormService.getData()
|
|
9340
|
+
let filterFormValues = filterFormService.getData();
|
|
9341
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
9283
9342
|
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
9284
9343
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
9285
|
-
|
|
9344
|
+
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
|
|
9345
|
+
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
9346
|
+
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
9347
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
9348
|
+
if(isLookup && __lookupField){
|
|
9349
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
9350
|
+
if(__lookupField.reference_to_field){
|
|
9351
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
9352
|
+
}
|
|
9353
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
9354
|
+
}
|
|
9355
|
+
if(crud){
|
|
9356
|
+
let crudData = crud.getData();
|
|
9357
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
9358
|
+
crud.setData(crudData);
|
|
9359
|
+
}
|
|
9360
|
+
|
|
9361
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
9286
9362
|
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
9287
9363
|
`;
|
|
9288
9364
|
let onChangeScript = `
|
|
@@ -9297,7 +9373,7 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
9297
9373
|
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
9298
9374
|
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
9299
9375
|
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});;
|
|
9300
|
-
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
9376
|
+
// let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
|
|
9301
9377
|
// crudService && crudService.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
9302
9378
|
// 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
|
|
9303
9379
|
// crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
|
|
@@ -9653,7 +9729,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9653
9729
|
className: crudModeClassName,
|
|
9654
9730
|
//目前crud的service层id不认用户自定义id,只支持默认规则id,许多地方的格式都写死了service_listview_${objectname}
|
|
9655
9731
|
id: `service_${id}`,
|
|
9656
|
-
name:
|
|
9732
|
+
name: "service_object_table_crud",
|
|
9657
9733
|
data: options.amisData,
|
|
9658
9734
|
body: body,
|
|
9659
9735
|
//监听广播事件,重算crud高度
|
|
@@ -10000,8 +10076,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10000
10076
|
/*
|
|
10001
10077
|
* @Author: baozhoutao@steedos.com
|
|
10002
10078
|
* @Date: 2022-07-05 15:55:39
|
|
10003
|
-
* @LastEditors:
|
|
10004
|
-
* @LastEditTime:
|
|
10079
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10080
|
+
* @LastEditTime: 2025-01-08 13:32:51
|
|
10005
10081
|
* @Description:
|
|
10006
10082
|
*/
|
|
10007
10083
|
|
|
@@ -10075,7 +10151,7 @@ async function getObjectRelatedList(
|
|
|
10075
10151
|
|
|
10076
10152
|
// 获取单个相关表
|
|
10077
10153
|
async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObjectName, relatedKey, ctx){
|
|
10078
|
-
let { top, perPage, appId, relatedLabel, className, columns, sort, filters, visible_on } = ctx;
|
|
10154
|
+
let { top, perPage, appId, relatedLabel, className, columns, sort, filters, visible_on, enableHeaderToolbar } = ctx;
|
|
10079
10155
|
// console.log('getRecordDetailRelatedListSchema==>',objectName,recordId,relatedObjectName)
|
|
10080
10156
|
const relatedObjectUiSchema = await getUISchema(relatedObjectName);
|
|
10081
10157
|
if(!relatedObjectUiSchema){
|
|
@@ -10140,6 +10216,10 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10140
10216
|
let headerToolbar = [];
|
|
10141
10217
|
if(!isMobile){
|
|
10142
10218
|
headerToolbar.push("bulkActions");
|
|
10219
|
+
if (enableHeaderToolbar) {
|
|
10220
|
+
// 通过 enableHeaderToolbar = true 可以控制是否显示内置的带过滤器的headerToolbar
|
|
10221
|
+
headerToolbar = undefined;
|
|
10222
|
+
}
|
|
10143
10223
|
}
|
|
10144
10224
|
const options = {
|
|
10145
10225
|
globalFilter,
|
|
@@ -10178,7 +10258,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
10178
10258
|
amisSchema: {
|
|
10179
10259
|
type: "service",
|
|
10180
10260
|
id: componentId,
|
|
10181
|
-
className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className}`,
|
|
10261
|
+
className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className} ${enableHeaderToolbar ? 'enable-header-toolbar' : ''}`,
|
|
10182
10262
|
data: {
|
|
10183
10263
|
relatedKey: relatedKey,
|
|
10184
10264
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10280,6 +10360,7 @@ async function getRelatedListSchema(
|
|
|
10280
10360
|
listViewName,
|
|
10281
10361
|
ctx
|
|
10282
10362
|
) {
|
|
10363
|
+
const { enableHeaderToolbar } = ctx;
|
|
10283
10364
|
const uiSchema = await getUISchema(objectName);
|
|
10284
10365
|
if(!uiSchema){
|
|
10285
10366
|
return {}
|
|
@@ -10332,10 +10413,14 @@ async function getRelatedListSchema(
|
|
|
10332
10413
|
delete ctx.filters;
|
|
10333
10414
|
|
|
10334
10415
|
delete ctx.globalFilter;
|
|
10416
|
+
delete ctx.enableHeaderToolbar;
|
|
10335
10417
|
|
|
10336
10418
|
const adaptor = `
|
|
10337
10419
|
try{
|
|
10338
10420
|
if(setDataToComponentId){
|
|
10421
|
+
// 子表列表在headerToolbar过滤器中设置过过滤条件的话,始终显示子表列表,无论是否查询到数据
|
|
10422
|
+
// 改为使用css样式控制子表列表放开headerToolbar时,始终显示crud,只隐藏crud内部的表格,从而始终显示headerToolbar不受这里逻辑影响
|
|
10423
|
+
// var headerToolbarFilterChanged = context.isFieldsFilterEmpty === false;
|
|
10339
10424
|
if(payload.data.count){
|
|
10340
10425
|
setTimeout(function(){
|
|
10341
10426
|
// 设计器中获取不到window.$从而导致报错, 所以用纯js替换下。
|
|
@@ -10358,7 +10443,7 @@ async function getRelatedListSchema(
|
|
|
10358
10443
|
"filters": listviewFilter,
|
|
10359
10444
|
"filtersFunction": filtersFunction,
|
|
10360
10445
|
"sort": listViewSort,
|
|
10361
|
-
"filterVisible":
|
|
10446
|
+
"filterVisible": !!enableHeaderToolbar,
|
|
10362
10447
|
"requestAdaptor": ctx.requestAdaptor,
|
|
10363
10448
|
"adaptor": adaptor + ctx.adaptor || '',
|
|
10364
10449
|
"ctx": ctx,
|
|
@@ -10914,7 +10999,8 @@ async function getRecordDetailHeaderSchema(objectName,recordId, options){
|
|
|
10914
10999
|
}
|
|
10915
11000
|
|
|
10916
11001
|
async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
10917
|
-
const uiSchema = await getUISchema(objectName);
|
|
11002
|
+
const uiSchema = await getUISchema(objectName);
|
|
11003
|
+
|
|
10918
11004
|
const relatedLists = await getObjectRelatedList(objectName);
|
|
10919
11005
|
const detailed = {
|
|
10920
11006
|
"title": i18next.t('frontend_record_detail_tab_detailed'),
|
|
@@ -10953,6 +11039,21 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10953
11039
|
if(relatedLists.length){
|
|
10954
11040
|
content.tabs.push(related);
|
|
10955
11041
|
}
|
|
11042
|
+
const contents = [content];
|
|
11043
|
+
if (uiSchema.enable_chatter && window.BuilderLiveblocks) {
|
|
11044
|
+
const chatter = {
|
|
11045
|
+
"type": "rooms-provider",
|
|
11046
|
+
"baseUrl": "${context.rootUrl}",
|
|
11047
|
+
"body": [
|
|
11048
|
+
{
|
|
11049
|
+
"type": "rooms-comments",
|
|
11050
|
+
"className": "flex flex-col gap-3 m-4",
|
|
11051
|
+
"roomId": "objects:${objectName}:${recordId}",
|
|
11052
|
+
}
|
|
11053
|
+
]
|
|
11054
|
+
};
|
|
11055
|
+
contents.push(chatter);
|
|
11056
|
+
}
|
|
10956
11057
|
// content.tabs = reverse(content.tabs)
|
|
10957
11058
|
return {
|
|
10958
11059
|
uiSchema,
|
|
@@ -10968,7 +11069,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10968
11069
|
"showButtons": props.showButtons,
|
|
10969
11070
|
"showBackButton": props.showBackButton,
|
|
10970
11071
|
},
|
|
10971
|
-
|
|
11072
|
+
...contents,
|
|
10972
11073
|
],
|
|
10973
11074
|
"objectApiName": "${objectName}",
|
|
10974
11075
|
"recordId": "${recordId}",
|
|
@@ -11752,14 +11853,42 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
11752
11853
|
{
|
|
11753
11854
|
"actionType": "custom",
|
|
11754
11855
|
"script": `
|
|
11856
|
+
console.log("lookup-tree-event.data:",event.data);
|
|
11857
|
+
console.log("lookup-tree-event.data.value.label:",event.data.value.label);
|
|
11858
|
+
console.log("lookup-tree-event.data.value.value:",event.data.value.value);
|
|
11755
11859
|
const scope = event.context.scoped;
|
|
11756
|
-
var
|
|
11860
|
+
var treeFilterFormValues={
|
|
11757
11861
|
"__searchable__organizations_parents":event.data.value.value
|
|
11758
11862
|
}
|
|
11759
|
-
var listView = scope.parent.getComponents().find(function(n){
|
|
11760
|
-
|
|
11863
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
11864
|
+
// return n.props.type === "crud";
|
|
11865
|
+
// });
|
|
11866
|
+
// listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
11867
|
+
let __lookupField = event.data.__lookupField;
|
|
11868
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
11869
|
+
var filterForm = scope.getComponents().find(function(n){
|
|
11870
|
+
return n.props.type === "form";
|
|
11761
11871
|
});
|
|
11762
|
-
|
|
11872
|
+
let filterFormValues = filterForm.getData();
|
|
11873
|
+
filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
|
|
11874
|
+
const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
|
|
11875
|
+
Object.assign(changedFilterFormValues, treeFilterFormValues);
|
|
11876
|
+
// 同步__changedFilterFormValues中的值
|
|
11877
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
11878
|
+
if(__lookupField){
|
|
11879
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
11880
|
+
if(__lookupField.reference_to_field){
|
|
11881
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
11882
|
+
}
|
|
11883
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
11884
|
+
}
|
|
11885
|
+
if(crud){
|
|
11886
|
+
let crudData = crud.getData();
|
|
11887
|
+
crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
|
|
11888
|
+
crud.setData(crudData);
|
|
11889
|
+
}
|
|
11890
|
+
filterForm.setData(treeFilterFormValues);
|
|
11891
|
+
filterForm.handleFormSubmit(event);
|
|
11763
11892
|
`
|
|
11764
11893
|
},
|
|
11765
11894
|
{
|
|
@@ -11853,6 +11982,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11853
11982
|
ctx.idFieldName = refObjectConfig.idFieldName;
|
|
11854
11983
|
ctx.objectName = refObjectConfig.name;
|
|
11855
11984
|
|
|
11985
|
+
// 是否显示lookup字段左侧的过滤器(如果有的话),默认为true,目前只有lookup选人字段有左侧树过滤器
|
|
11986
|
+
const showLeftFilter = field.show_left_filter !== false;
|
|
11987
|
+
|
|
11856
11988
|
let tableFields = [];
|
|
11857
11989
|
const searchableFields = [];
|
|
11858
11990
|
|
|
@@ -11974,6 +12106,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11974
12106
|
// field.name可能是带点的名称,比如审批王中子表字段'instances.instances_submitter',如果不替换掉点,会造成审批王表单中新建子表行时报错
|
|
11975
12107
|
let keywordsSearchBoxName = `__keywords_lookup__${field.name.replace(/\./g, "_")}__to__${refObjectConfig.name}`;
|
|
11976
12108
|
|
|
12109
|
+
const filterFormValues = field.filter_form_data;
|
|
11977
12110
|
source.requestAdaptor = `
|
|
11978
12111
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
11979
12112
|
let __lookupField = api.data.$self.__lookupField;
|
|
@@ -12016,7 +12149,20 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12016
12149
|
}
|
|
12017
12150
|
}
|
|
12018
12151
|
|
|
12019
|
-
|
|
12152
|
+
let filterFormValues = {};
|
|
12153
|
+
if (selfData.op !== 'loadOptions'){
|
|
12154
|
+
filterFormValues = ${_$1.isObject(filterFormValues) ? JSON.stringify(filterFormValues) : ('"' + filterFormValues + '"')} || {};
|
|
12155
|
+
const isAmisFormula = typeof filterFormValues === "string" && filterFormValues.indexOf("\${") > -1;
|
|
12156
|
+
if (isAmisFormula){
|
|
12157
|
+
filterFormValues = AmisCore.evaluate(filterFormValues, context) || {};
|
|
12158
|
+
}
|
|
12159
|
+
if (_.isObject(filterFormValues) || !_.isEmpty(filterFormValues)){
|
|
12160
|
+
let fields = api.data.$self.uiSchema && api.data.$self.uiSchema.fields;
|
|
12161
|
+
filterFormValues = SteedosUI.getSearchFilterFormValues(filterFormValues, fields);
|
|
12162
|
+
}
|
|
12163
|
+
}
|
|
12164
|
+
|
|
12165
|
+
var searchableFilter = SteedosUI.getSearchFilter(Object.assign({}, { ...filterFormValues }, selfData)) || [];
|
|
12020
12166
|
|
|
12021
12167
|
if(searchableFilter.length > 0){
|
|
12022
12168
|
if(filters.length > 0 ){
|
|
@@ -12184,6 +12330,20 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12184
12330
|
});
|
|
12185
12331
|
payload.data.rows = updatedResult;
|
|
12186
12332
|
}
|
|
12333
|
+
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
12334
|
+
let __lookupField = api.data.$self.__lookupField;
|
|
12335
|
+
if(__lookupField){
|
|
12336
|
+
let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
|
|
12337
|
+
if(__lookupField.reference_to_field){
|
|
12338
|
+
lookupTag += "__" + __lookupField.reference_to_field;
|
|
12339
|
+
}
|
|
12340
|
+
__changedFilterFormValuesKey += lookupTag;
|
|
12341
|
+
}
|
|
12342
|
+
let __changedFilterFormValues = api.context[__changedFilterFormValuesKey] || {};
|
|
12343
|
+
let __changedSearchBoxValues = api.context.__changedSearchBoxValues || {};
|
|
12344
|
+
// 列表搜索和快速搜索,有时在某些操作情况下还是会造成crud接口请求使用的过滤条件是上次的,这里强制把正确的过滤条件返回到crud,详细规则见:https://github.com/steedos/steedos-platform/issues/7112
|
|
12345
|
+
payload.data[__changedFilterFormValuesKey] = __changedFilterFormValues;
|
|
12346
|
+
payload.data.__changedSearchBoxValues = __changedSearchBoxValues;
|
|
12187
12347
|
return payload;
|
|
12188
12348
|
`;
|
|
12189
12349
|
if(field.optionsFunction || field._optionsFunction){
|
|
@@ -12192,7 +12352,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12192
12352
|
return payload;
|
|
12193
12353
|
`;
|
|
12194
12354
|
}
|
|
12195
|
-
let top =
|
|
12355
|
+
let top = 500;
|
|
12196
12356
|
|
|
12197
12357
|
if(refObjectConfig.paging && refObjectConfig.paging.enabled === false){
|
|
12198
12358
|
top = 1000;
|
|
@@ -12219,7 +12379,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12219
12379
|
|
|
12220
12380
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
|
|
12221
12381
|
|
|
12222
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
12382
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && showLeftFilter){
|
|
12223
12383
|
pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
|
|
12224
12384
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
12225
12385
|
}
|
|
@@ -12239,7 +12399,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
12239
12399
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
12240
12400
|
...ctx,
|
|
12241
12401
|
isLookup: true,
|
|
12242
|
-
keywordsSearchBoxName
|
|
12402
|
+
keywordsSearchBoxName,
|
|
12403
|
+
searchable_fields: field.searchable_fields,
|
|
12404
|
+
auto_open_filter: field.auto_open_filter,
|
|
12405
|
+
show_left_filter: field.show_left_filter,
|
|
12406
|
+
filter_form_data: field.filter_form_data
|
|
12243
12407
|
});
|
|
12244
12408
|
}
|
|
12245
12409
|
pickerSchema.data = Object.assign({}, pickerSchema.data, {
|
|
@@ -12733,6 +12897,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
12733
12897
|
}
|
|
12734
12898
|
let amisSchema;
|
|
12735
12899
|
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
12900
|
+
if(enableEnhancedLookup == true && field.amis && field.amis.type && field.amis.type !== 'picker'){
|
|
12901
|
+
// 如果配置了amis.type且其值不是picker,则不使用弹出增强模式
|
|
12902
|
+
enableEnhancedLookup = false;
|
|
12903
|
+
}
|
|
12736
12904
|
if(enableEnhancedLookup == true){
|
|
12737
12905
|
amisSchema = await lookupToAmisPicker(field, readonly, ctx);
|
|
12738
12906
|
}else if(refObject.enable_tree) {
|
|
@@ -13864,7 +14032,16 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
13864
14032
|
return convertData
|
|
13865
14033
|
}
|
|
13866
14034
|
// if(ctx.mode === 'edit'){
|
|
13867
|
-
let convertDataResult
|
|
14035
|
+
let convertDataResult;
|
|
14036
|
+
if(convertData.type == "steedos-field"){
|
|
14037
|
+
// 如果是steedos-field,不能把amis属性合并到steedos-field根属性中,要合并也是合并到steedos-field的config.amis中
|
|
14038
|
+
// 而steedos-field字段的amis属性本身就在config.amis中了,所以这里不需要再合并field.amis
|
|
14039
|
+
// 目前测试到受影响的是,把字段的amis属性配置为{"type": "checkboxes"}时,ObjectForm只读模式下,lookup字段返回的是type为steedos-field的组件,此时field.amis中的type不应该合并到steedos-field根属性中
|
|
14040
|
+
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, {name: baseData.name});
|
|
14041
|
+
}
|
|
14042
|
+
else {
|
|
14043
|
+
convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
14044
|
+
}
|
|
13868
14045
|
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
13869
14046
|
if(readonly && field.type == "file") {
|
|
13870
14047
|
convertDataResult.name = "";
|
|
@@ -16009,7 +16186,7 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
|
|
|
16009
16186
|
const defaults = ctx.defaults || {};
|
|
16010
16187
|
if(!defaults.headerSchema){
|
|
16011
16188
|
//传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
|
|
16012
|
-
const headerSchema = await getObjectListHeader
|
|
16189
|
+
const headerSchema = await getObjectListHeader(uiSchema, listViewName, {
|
|
16013
16190
|
onlySecordLine: true,
|
|
16014
16191
|
isListviewInit: true
|
|
16015
16192
|
});
|
|
@@ -18492,5 +18669,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
18492
18669
|
};
|
|
18493
18670
|
};
|
|
18494
18671
|
|
|
18495
|
-
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getAmisInputTableSchema, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn, getButtons, getCalendarSchema, getCreatedInfoTpl, getDateTimeTpl, getDateTpl, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFieldTpl, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getGlobalNowData, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLocationTpl, getLookupSapceUserTreeSchema, getLookupTpl, getModifiedInfoTpl, getNameTpl, getNameTplUrl, getNotifications, getNumberTpl, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader
|
|
18672
|
+
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getAmisInputTableSchema, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn, getButtons, getCalendarSchema, getCreatedInfoTpl, getDateTimeTpl, getDateTpl, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFieldTpl, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getGlobalNowData, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLocationTpl, getLookupSapceUserTreeSchema, getLookupTpl, getModifiedInfoTpl, getNameTpl, getNameTplUrl, getNotifications, getNumberTpl, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListButtonsSchemas, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getObjectRelatedListsMiniSchema, getPage, getPasswordTpl, getRecord, getRecordDetailHeaderSchema, getRecordDetailMiniSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRefObjectNameFieldName, getReferenceTo, getReferenceToFieldSchema, getReferenceToSync, getRelatedFieldTpl, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectMap, getSelectTpl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getSwitchTpl, getTableSchema, getTenantId, getTimeTpl, getUISchema, getUISchemaSync$1 as getUISchemaSync, getUiFieldTpl, getUiFileSizeTpl, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo, uuidv4 };
|
|
18496
18673
|
//# sourceMappingURL=index.esm.js.map
|