@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.cjs.js
CHANGED
|
@@ -2155,7 +2155,7 @@ async function getTableColumns(fields, options){
|
|
|
2155
2155
|
var data = event.data;
|
|
2156
2156
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
2157
2157
|
var file_id = data._id;
|
|
2158
|
-
|
|
2158
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
2159
2159
|
`;
|
|
2160
2160
|
columnItem = {
|
|
2161
2161
|
"type": "button",
|
|
@@ -2184,7 +2184,7 @@ async function getTableColumns(fields, options){
|
|
|
2184
2184
|
"actionType": "custom",
|
|
2185
2185
|
"script": previewFileScript,
|
|
2186
2186
|
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
2187
|
-
"expression": "
|
|
2187
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
2188
2188
|
}
|
|
2189
2189
|
]
|
|
2190
2190
|
}
|
|
@@ -2967,6 +2967,18 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2967
2967
|
return api;
|
|
2968
2968
|
`;
|
|
2969
2969
|
api.adaptor = `
|
|
2970
|
+
let fields = ${JSON.stringify(___namespace.map(fields, 'name'))};
|
|
2971
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
2972
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
2973
|
+
(fields || []).forEach((itemField) => {
|
|
2974
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
2975
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
2976
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
2977
|
+
itemRow[itemField] = "";
|
|
2978
|
+
}
|
|
2979
|
+
});
|
|
2980
|
+
});
|
|
2981
|
+
|
|
2970
2982
|
if(api.body.listName == "recent"){
|
|
2971
2983
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
2972
2984
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -5811,7 +5823,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
5811
5823
|
const formSchema = {
|
|
5812
5824
|
"type": "service",
|
|
5813
5825
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
5814
|
-
"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-
|
|
5826
|
+
"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",
|
|
5815
5827
|
"style":{
|
|
5816
5828
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
5817
5829
|
},
|
|
@@ -6398,7 +6410,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6398
6410
|
"className": "slds-filters"
|
|
6399
6411
|
},
|
|
6400
6412
|
"size": "xs",
|
|
6401
|
-
"className": `border-
|
|
6413
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
6402
6414
|
"visibleOn": "this.showFieldsFilter",
|
|
6403
6415
|
},
|
|
6404
6416
|
"className": "bg-white"
|
|
@@ -6586,7 +6598,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6586
6598
|
"icon": "fa fa-refresh",
|
|
6587
6599
|
"actionType": "reload",
|
|
6588
6600
|
"target": amisListViewId,
|
|
6589
|
-
"className": "bg-white p-2 rounded
|
|
6601
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
6590
6602
|
},
|
|
6591
6603
|
fieldsFilterButtonSchema,
|
|
6592
6604
|
// {
|
|
@@ -6594,7 +6606,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6594
6606
|
// "label": "",
|
|
6595
6607
|
// "icon": "fa fa-filter",
|
|
6596
6608
|
// "actionType": "custom",
|
|
6597
|
-
// "className": "bg-transparent p-2 rounded
|
|
6609
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
6598
6610
|
// "id": "u:c20cb87d96c9",
|
|
6599
6611
|
// "onEvent": {
|
|
6600
6612
|
// "click": {
|
|
@@ -6642,7 +6654,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6642
6654
|
let headerSchema = [{
|
|
6643
6655
|
"type": "wrapper",
|
|
6644
6656
|
"body": body,
|
|
6645
|
-
"className": `
|
|
6657
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
6646
6658
|
}];
|
|
6647
6659
|
return headerSchema;
|
|
6648
6660
|
}
|
|
@@ -6777,7 +6789,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6777
6789
|
let body = [
|
|
6778
6790
|
{
|
|
6779
6791
|
"type": "wrapper",
|
|
6780
|
-
"className": "p-4
|
|
6792
|
+
"className": "p-4 border-b",
|
|
6781
6793
|
"body": [
|
|
6782
6794
|
{
|
|
6783
6795
|
"type": "grid",
|
|
@@ -7903,7 +7915,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7903
7915
|
"icon": "fa fa-cog",
|
|
7904
7916
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7905
7917
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
7906
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7918
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7907
7919
|
"align": "right",
|
|
7908
7920
|
"visibleOn": "${!isLookup}",
|
|
7909
7921
|
"buttons": [
|
|
@@ -7948,7 +7960,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7948
7960
|
"icon": "fa fa-table-columns",
|
|
7949
7961
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7950
7962
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
7951
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7963
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7952
7964
|
"align": "right",
|
|
7953
7965
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
7954
7966
|
"buttons": [
|
|
@@ -8141,7 +8153,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8141
8153
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8142
8154
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8143
8155
|
// "tooltipPlacement": "top",
|
|
8144
|
-
// "className": "bg-white p-2 rounded
|
|
8156
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
8145
8157
|
// "label": "",
|
|
8146
8158
|
// "icon": "fa fa-sync",
|
|
8147
8159
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -8165,7 +8177,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8165
8177
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8166
8178
|
"tooltip":"",
|
|
8167
8179
|
"tooltipPlacement": "top",
|
|
8168
|
-
"className": "bg-white p-2 rounded
|
|
8180
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8169
8181
|
};
|
|
8170
8182
|
}
|
|
8171
8183
|
else {
|
|
@@ -8176,7 +8188,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8176
8188
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8177
8189
|
"tooltip":"",
|
|
8178
8190
|
"tooltipPlacement": "top",
|
|
8179
|
-
"className": "bg-white p-2 rounded
|
|
8191
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8180
8192
|
};
|
|
8181
8193
|
}
|
|
8182
8194
|
let toolbarFilter;
|
|
@@ -8198,7 +8210,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8198
8210
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8199
8211
|
},
|
|
8200
8212
|
"align": "right",
|
|
8201
|
-
"className": "bg-white p-2 rounded
|
|
8213
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
8202
8214
|
"onEvent": {
|
|
8203
8215
|
"click": {
|
|
8204
8216
|
"actions": [
|
|
@@ -8525,7 +8537,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8525
8537
|
const bodyProps = {
|
|
8526
8538
|
// toolbar: getToolbar(),
|
|
8527
8539
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
8528
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
8540
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
8529
8541
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
8530
8542
|
...options,
|
|
8531
8543
|
disableStatistics: options.queryCount === false
|
|
@@ -8694,7 +8706,6 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8694
8706
|
payload.status = 2;
|
|
8695
8707
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8696
8708
|
}
|
|
8697
|
-
debugger;
|
|
8698
8709
|
var scope = SteedosUI.getRef(context.scopeId);
|
|
8699
8710
|
var scopeParent = scope && scope.parent;
|
|
8700
8711
|
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
@@ -9259,7 +9270,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9259
9270
|
amisSchema: {
|
|
9260
9271
|
type: "service",
|
|
9261
9272
|
id: componentId,
|
|
9262
|
-
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9273
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b-0 last:border-b-0 ${componentId} ${className}`,
|
|
9263
9274
|
data: {
|
|
9264
9275
|
relatedKey: relatedKey,
|
|
9265
9276
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10005,7 +10016,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10005
10016
|
};
|
|
10006
10017
|
const content = {
|
|
10007
10018
|
"type": "tabs",
|
|
10008
|
-
"className": "steedos-record-tabs bg-white p-4 m-0
|
|
10019
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 border-b",
|
|
10009
10020
|
"contentClassName": "bg-none",
|
|
10010
10021
|
"tabs": [
|
|
10011
10022
|
detailed
|
|
@@ -10940,6 +10951,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10940
10951
|
}
|
|
10941
10952
|
});
|
|
10942
10953
|
|
|
10954
|
+
let listviewFilter = getListViewFilter(listView);
|
|
10955
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
10956
|
+
|
|
10943
10957
|
let sort = "";
|
|
10944
10958
|
if(listView){
|
|
10945
10959
|
sort = getListViewSort(listView);
|
|
@@ -10986,7 +11000,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10986
11000
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10987
11001
|
}
|
|
10988
11002
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10989
|
-
var filters = [];
|
|
11003
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
10990
11004
|
var pageSize = api.data.pageSize || 10;
|
|
10991
11005
|
var pageNo = api.data.pageNo || 1;
|
|
10992
11006
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -11048,6 +11062,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11048
11062
|
}
|
|
11049
11063
|
|
|
11050
11064
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11065
|
+
|
|
11066
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11067
|
+
|
|
11068
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11069
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
11070
|
+
if(_filters0 && _filters0.length){
|
|
11071
|
+
filters.push(_filters0);
|
|
11072
|
+
}
|
|
11073
|
+
}
|
|
11074
|
+
|
|
11051
11075
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11052
11076
|
|
|
11053
11077
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11360,6 +11384,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11360
11384
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11361
11385
|
let listView = getLookupListView(refObjectConfig);
|
|
11362
11386
|
|
|
11387
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11388
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11389
|
+
|
|
11363
11390
|
let sort = "";
|
|
11364
11391
|
if(listView){
|
|
11365
11392
|
sort = getListViewSort(listView);
|
|
@@ -11389,7 +11416,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11389
11416
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
11390
11417
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
11391
11418
|
apiInfo.requestAdaptor = `
|
|
11392
|
-
var filters = [];
|
|
11419
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
11393
11420
|
var top = 200;
|
|
11394
11421
|
if(api.data.$term){
|
|
11395
11422
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -11412,6 +11439,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11412
11439
|
}
|
|
11413
11440
|
|
|
11414
11441
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11442
|
+
|
|
11443
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11444
|
+
|
|
11445
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11446
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
11447
|
+
if(_filters0 && _filters0.length){
|
|
11448
|
+
filters.push(_filters0);
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
|
|
11415
11452
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11416
11453
|
|
|
11417
11454
|
if(filtersFunction && !inFilterForm){
|
|
@@ -12384,6 +12421,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12384
12421
|
convertData = {
|
|
12385
12422
|
type: 'static-text'
|
|
12386
12423
|
};
|
|
12424
|
+
}else if(field.autonumber_enable_modify){
|
|
12425
|
+
convertData = {
|
|
12426
|
+
"type": "input-group",
|
|
12427
|
+
"body": [
|
|
12428
|
+
{
|
|
12429
|
+
"type": "input-text",
|
|
12430
|
+
"name": field.name
|
|
12431
|
+
},
|
|
12432
|
+
{
|
|
12433
|
+
"type": "button",
|
|
12434
|
+
"label": "自动获取",
|
|
12435
|
+
"actionType": "ajax",
|
|
12436
|
+
"api": {
|
|
12437
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
12438
|
+
"method": "post",
|
|
12439
|
+
"headers": {
|
|
12440
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12441
|
+
},
|
|
12442
|
+
"adaptor": `
|
|
12443
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
12444
|
+
delete payload.data.autonumber;
|
|
12445
|
+
return payload;
|
|
12446
|
+
`
|
|
12447
|
+
},
|
|
12448
|
+
"messages": {
|
|
12449
|
+
"success": "获取成功"
|
|
12450
|
+
}
|
|
12451
|
+
}
|
|
12452
|
+
]
|
|
12453
|
+
};
|
|
12387
12454
|
}
|
|
12388
12455
|
break;
|
|
12389
12456
|
case 'url':
|