@steedos-widgets/amis-lib 3.6.2-beta.15 → 3.6.2-beta.17
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 +87 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +87 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +30 -30
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2128,7 +2128,7 @@ async function getTableColumns(fields, options){
|
|
|
2128
2128
|
var data = event.data;
|
|
2129
2129
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
2130
2130
|
var file_id = data._id;
|
|
2131
|
-
|
|
2131
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
2132
2132
|
`;
|
|
2133
2133
|
columnItem = {
|
|
2134
2134
|
"type": "button",
|
|
@@ -2157,7 +2157,7 @@ async function getTableColumns(fields, options){
|
|
|
2157
2157
|
"actionType": "custom",
|
|
2158
2158
|
"script": previewFileScript,
|
|
2159
2159
|
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
2160
|
-
"expression": "
|
|
2160
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
2161
2161
|
}
|
|
2162
2162
|
]
|
|
2163
2163
|
}
|
|
@@ -2940,6 +2940,18 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2940
2940
|
return api;
|
|
2941
2941
|
`;
|
|
2942
2942
|
api.adaptor = `
|
|
2943
|
+
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
2944
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
2945
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
2946
|
+
(fields || []).forEach((itemField) => {
|
|
2947
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
2948
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
2949
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
2950
|
+
itemRow[itemField] = "";
|
|
2951
|
+
}
|
|
2952
|
+
});
|
|
2953
|
+
});
|
|
2954
|
+
|
|
2943
2955
|
if(api.body.listName == "recent"){
|
|
2944
2956
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
2945
2957
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -5784,7 +5796,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
5784
5796
|
const formSchema = {
|
|
5785
5797
|
"type": "service",
|
|
5786
5798
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
5787
|
-
"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-
|
|
5799
|
+
"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-4 sm:grid-cols-4 p-2",
|
|
5788
5800
|
"style":{
|
|
5789
5801
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
5790
5802
|
},
|
|
@@ -6371,7 +6383,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6371
6383
|
"className": "slds-filters"
|
|
6372
6384
|
},
|
|
6373
6385
|
"size": "xs",
|
|
6374
|
-
"className": `border-
|
|
6386
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
6375
6387
|
"visibleOn": "this.showFieldsFilter",
|
|
6376
6388
|
},
|
|
6377
6389
|
"className": "bg-white"
|
|
@@ -6559,7 +6571,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6559
6571
|
"icon": "fa fa-refresh",
|
|
6560
6572
|
"actionType": "reload",
|
|
6561
6573
|
"target": amisListViewId,
|
|
6562
|
-
"className": "bg-white p-2 rounded
|
|
6574
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
6563
6575
|
},
|
|
6564
6576
|
fieldsFilterButtonSchema,
|
|
6565
6577
|
// {
|
|
@@ -6567,7 +6579,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6567
6579
|
// "label": "",
|
|
6568
6580
|
// "icon": "fa fa-filter",
|
|
6569
6581
|
// "actionType": "custom",
|
|
6570
|
-
// "className": "bg-transparent p-2 rounded
|
|
6582
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
6571
6583
|
// "id": "u:c20cb87d96c9",
|
|
6572
6584
|
// "onEvent": {
|
|
6573
6585
|
// "click": {
|
|
@@ -6615,7 +6627,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6615
6627
|
let headerSchema = [{
|
|
6616
6628
|
"type": "wrapper",
|
|
6617
6629
|
"body": body,
|
|
6618
|
-
"className": `
|
|
6630
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
6619
6631
|
}];
|
|
6620
6632
|
return headerSchema;
|
|
6621
6633
|
}
|
|
@@ -6750,7 +6762,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6750
6762
|
let body = [
|
|
6751
6763
|
{
|
|
6752
6764
|
"type": "wrapper",
|
|
6753
|
-
"className": "p-4
|
|
6765
|
+
"className": "p-4 border-b",
|
|
6754
6766
|
"body": [
|
|
6755
6767
|
{
|
|
6756
6768
|
"type": "grid",
|
|
@@ -7876,7 +7888,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7876
7888
|
"icon": "fa fa-cog",
|
|
7877
7889
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7878
7890
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
7879
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7891
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7880
7892
|
"align": "right",
|
|
7881
7893
|
"visibleOn": "${!isLookup}",
|
|
7882
7894
|
"buttons": [
|
|
@@ -7921,7 +7933,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7921
7933
|
"icon": "fa fa-table-columns",
|
|
7922
7934
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7923
7935
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
7924
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7936
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7925
7937
|
"align": "right",
|
|
7926
7938
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
7927
7939
|
"buttons": [
|
|
@@ -8114,7 +8126,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8114
8126
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8115
8127
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8116
8128
|
// "tooltipPlacement": "top",
|
|
8117
|
-
// "className": "bg-white p-2 rounded
|
|
8129
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
8118
8130
|
// "label": "",
|
|
8119
8131
|
// "icon": "fa fa-sync",
|
|
8120
8132
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -8138,7 +8150,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8138
8150
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8139
8151
|
"tooltip":"",
|
|
8140
8152
|
"tooltipPlacement": "top",
|
|
8141
|
-
"className": "bg-white p-2 rounded
|
|
8153
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8142
8154
|
};
|
|
8143
8155
|
}
|
|
8144
8156
|
else {
|
|
@@ -8149,7 +8161,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8149
8161
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8150
8162
|
"tooltip":"",
|
|
8151
8163
|
"tooltipPlacement": "top",
|
|
8152
|
-
"className": "bg-white p-2 rounded
|
|
8164
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8153
8165
|
};
|
|
8154
8166
|
}
|
|
8155
8167
|
let toolbarFilter;
|
|
@@ -8171,7 +8183,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8171
8183
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8172
8184
|
},
|
|
8173
8185
|
"align": "right",
|
|
8174
|
-
"className": "bg-white p-2 rounded
|
|
8186
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
8175
8187
|
"onEvent": {
|
|
8176
8188
|
"click": {
|
|
8177
8189
|
"actions": [
|
|
@@ -8498,7 +8510,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8498
8510
|
const bodyProps = {
|
|
8499
8511
|
// toolbar: getToolbar(),
|
|
8500
8512
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
8501
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
8513
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
8502
8514
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
8503
8515
|
...options,
|
|
8504
8516
|
disableStatistics: options.queryCount === false
|
|
@@ -8667,7 +8679,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8667
8679
|
payload.status = 2;
|
|
8668
8680
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8669
8681
|
}
|
|
8670
|
-
debugger;
|
|
8671
8682
|
var scope = SteedosUI.getRef(context.scopeId);
|
|
8672
8683
|
var scopeParent = scope && scope.parent;
|
|
8673
8684
|
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
@@ -9232,7 +9243,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9232
9243
|
amisSchema: {
|
|
9233
9244
|
type: "service",
|
|
9234
9245
|
id: componentId,
|
|
9235
|
-
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9246
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b-0 last:border-b-0 ${componentId} ${className}`,
|
|
9236
9247
|
data: {
|
|
9237
9248
|
relatedKey: relatedKey,
|
|
9238
9249
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9978,7 +9989,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9978
9989
|
};
|
|
9979
9990
|
const content = {
|
|
9980
9991
|
"type": "tabs",
|
|
9981
|
-
"className": "steedos-record-tabs bg-white p-4 m-0
|
|
9992
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 border-b",
|
|
9982
9993
|
"contentClassName": "bg-none",
|
|
9983
9994
|
"tabs": [
|
|
9984
9995
|
detailed
|
|
@@ -10913,6 +10924,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10913
10924
|
}
|
|
10914
10925
|
});
|
|
10915
10926
|
|
|
10927
|
+
let listviewFilter = getListViewFilter(listView);
|
|
10928
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
10929
|
+
|
|
10916
10930
|
let sort = "";
|
|
10917
10931
|
if(listView){
|
|
10918
10932
|
sort = getListViewSort(listView);
|
|
@@ -10959,7 +10973,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10959
10973
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10960
10974
|
}
|
|
10961
10975
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10962
|
-
var filters = [];
|
|
10976
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
10963
10977
|
var pageSize = api.data.pageSize || 10;
|
|
10964
10978
|
var pageNo = api.data.pageNo || 1;
|
|
10965
10979
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -11021,6 +11035,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11021
11035
|
}
|
|
11022
11036
|
|
|
11023
11037
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11038
|
+
|
|
11039
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11040
|
+
|
|
11041
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11042
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
11043
|
+
if(_filters0 && _filters0.length){
|
|
11044
|
+
filters.push(_filters0);
|
|
11045
|
+
}
|
|
11046
|
+
}
|
|
11047
|
+
|
|
11024
11048
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11025
11049
|
|
|
11026
11050
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11333,6 +11357,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11333
11357
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11334
11358
|
let listView = getLookupListView(refObjectConfig);
|
|
11335
11359
|
|
|
11360
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11361
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11362
|
+
|
|
11336
11363
|
let sort = "";
|
|
11337
11364
|
if(listView){
|
|
11338
11365
|
sort = getListViewSort(listView);
|
|
@@ -11362,7 +11389,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11362
11389
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
11363
11390
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
11364
11391
|
apiInfo.requestAdaptor = `
|
|
11365
|
-
var filters = [];
|
|
11392
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
11366
11393
|
var top = 200;
|
|
11367
11394
|
if(api.data.$term){
|
|
11368
11395
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -11385,6 +11412,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11385
11412
|
}
|
|
11386
11413
|
|
|
11387
11414
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11415
|
+
|
|
11416
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11417
|
+
|
|
11418
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11419
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
11420
|
+
if(_filters0 && _filters0.length){
|
|
11421
|
+
filters.push(_filters0);
|
|
11422
|
+
}
|
|
11423
|
+
}
|
|
11424
|
+
|
|
11388
11425
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11389
11426
|
|
|
11390
11427
|
if(filtersFunction && !inFilterForm){
|
|
@@ -12357,6 +12394,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12357
12394
|
convertData = {
|
|
12358
12395
|
type: 'static-text'
|
|
12359
12396
|
};
|
|
12397
|
+
}else if(field.autonumber_enable_modify){
|
|
12398
|
+
convertData = {
|
|
12399
|
+
"type": "input-group",
|
|
12400
|
+
"body": [
|
|
12401
|
+
{
|
|
12402
|
+
"type": "input-text",
|
|
12403
|
+
"name": field.name
|
|
12404
|
+
},
|
|
12405
|
+
{
|
|
12406
|
+
"type": "button",
|
|
12407
|
+
"label": "自动获取",
|
|
12408
|
+
"actionType": "ajax",
|
|
12409
|
+
"api": {
|
|
12410
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
12411
|
+
"method": "post",
|
|
12412
|
+
"headers": {
|
|
12413
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12414
|
+
},
|
|
12415
|
+
"adaptor": `
|
|
12416
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
12417
|
+
delete payload.data.autonumber;
|
|
12418
|
+
return payload;
|
|
12419
|
+
`
|
|
12420
|
+
},
|
|
12421
|
+
"messages": {
|
|
12422
|
+
"success": "获取成功"
|
|
12423
|
+
}
|
|
12424
|
+
}
|
|
12425
|
+
]
|
|
12426
|
+
};
|
|
12360
12427
|
}
|
|
12361
12428
|
break;
|
|
12362
12429
|
case 'url':
|