@steedos-widgets/amis-lib 1.3.0-beta.11 → 1.3.0-beta.12
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 +124 -111
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +124 -111
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +39 -23
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -3131,7 +3131,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3131
3131
|
name: button.name,
|
|
3132
3132
|
objectName: button.objectName,
|
|
3133
3133
|
visibleOn: getButtonVisibleOn$1(button),
|
|
3134
|
-
className: `button_${button.name}
|
|
3134
|
+
className: `button_${button.name}`
|
|
3135
3135
|
}
|
|
3136
3136
|
});
|
|
3137
3137
|
}
|
|
@@ -5303,76 +5303,133 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5303
5303
|
if(isMobile){
|
|
5304
5304
|
showDisplayAs = false;
|
|
5305
5305
|
}
|
|
5306
|
+
let toolbarCount;
|
|
5307
|
+
if(!hiddenCount){
|
|
5308
|
+
toolbarCount = {
|
|
5309
|
+
"type": "tpl",
|
|
5310
|
+
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5311
|
+
};
|
|
5312
|
+
}
|
|
5313
|
+
let toolbarReloadButton;
|
|
5306
5314
|
if(formFactor === 'SMALL'){
|
|
5307
|
-
const onReloadScript = `
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
`;
|
|
5315
|
+
// const onReloadScript = `
|
|
5316
|
+
// const scope = event.context.scoped;
|
|
5317
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
5318
|
+
// return n.props.type === "crud";
|
|
5319
|
+
// });
|
|
5320
|
+
// listView.handleChangePage(1);
|
|
5321
|
+
// `;
|
|
5322
|
+
// toolbarReloadButton = {
|
|
5323
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
5324
|
+
// "type": "button",
|
|
5325
|
+
// "align": "right",
|
|
5326
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5327
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5328
|
+
// "tooltipPlacement": "top",
|
|
5329
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5330
|
+
// "label": "",
|
|
5331
|
+
// "icon": "fa fa-sync",
|
|
5332
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
5333
|
+
// "onEvent": {
|
|
5334
|
+
// "click": {
|
|
5335
|
+
// "actions": [
|
|
5336
|
+
// {
|
|
5337
|
+
// "actionType": "custom",
|
|
5338
|
+
// "script": onReloadScript
|
|
5339
|
+
// }
|
|
5340
|
+
// ]
|
|
5341
|
+
// }
|
|
5342
|
+
// },
|
|
5343
|
+
// };
|
|
5344
|
+
|
|
5345
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
5346
|
+
toolbarReloadButton = {
|
|
5347
|
+
"type": "reload",
|
|
5348
|
+
"align": "right",
|
|
5349
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5350
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5351
|
+
"tooltip":"",
|
|
5352
|
+
"tooltipPlacement": "top",
|
|
5353
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5354
|
+
};
|
|
5355
|
+
}
|
|
5356
|
+
else {
|
|
5357
|
+
toolbarReloadButton = {
|
|
5358
|
+
"type": "reload",
|
|
5359
|
+
"align": "right",
|
|
5360
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5361
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5362
|
+
"tooltip":"",
|
|
5363
|
+
"tooltipPlacement": "top",
|
|
5364
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5365
|
+
};
|
|
5366
|
+
}
|
|
5367
|
+
let toolbarFilter;
|
|
5368
|
+
if(filterVisible){
|
|
5369
|
+
toolbarFilter ={
|
|
5370
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5371
|
+
"icon": "fa fa-filter",
|
|
5372
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5373
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5374
|
+
// "tooltipPlacement": "top",
|
|
5375
|
+
"type": "button",
|
|
5376
|
+
"badge": {
|
|
5377
|
+
"offset": [
|
|
5378
|
+
-5,
|
|
5379
|
+
1
|
|
5380
|
+
],
|
|
5381
|
+
"size":8,
|
|
5382
|
+
"animation": true,
|
|
5383
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5384
|
+
},
|
|
5385
|
+
"align": "right",
|
|
5386
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5387
|
+
"onEvent": {
|
|
5388
|
+
"click": {
|
|
5389
|
+
"actions": [
|
|
5390
|
+
{
|
|
5391
|
+
"actionType": "custom",
|
|
5392
|
+
"script": onFieldsFilterToggleScript
|
|
5393
|
+
}
|
|
5394
|
+
]
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
};
|
|
5398
|
+
}
|
|
5399
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
5400
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
5401
|
+
|
|
5402
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
5403
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
5404
|
+
let toolbars = [];
|
|
5405
|
+
if(formFactor === 'SMALL'){
|
|
5406
|
+
if(toolbarCount){
|
|
5407
|
+
toolbars.push(toolbarCount);
|
|
5408
|
+
}
|
|
5409
|
+
toolbars.push(toolbarReloadButton);
|
|
5410
|
+
if(toolbarFilter){
|
|
5411
|
+
toolbars.push(toolbarFilter);
|
|
5412
|
+
}
|
|
5413
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5414
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5314
5415
|
return [
|
|
5315
5416
|
// "bulkActions",
|
|
5316
5417
|
...(headerToolbarItems || []),
|
|
5317
|
-
|
|
5318
|
-
"type": "tpl",
|
|
5319
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5320
|
-
},
|
|
5321
|
-
{
|
|
5322
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5323
|
-
"type": "button",
|
|
5324
|
-
"align": "right",
|
|
5325
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5326
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5327
|
-
"tooltipPlacement": "top",
|
|
5328
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5329
|
-
"label": "",
|
|
5330
|
-
"icon": "fa fa-sync",
|
|
5331
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
5332
|
-
"onEvent": {
|
|
5333
|
-
"click": {
|
|
5334
|
-
"actions": [
|
|
5335
|
-
{
|
|
5336
|
-
"actionType": "custom",
|
|
5337
|
-
"script": onReloadScript
|
|
5338
|
-
}
|
|
5339
|
-
]
|
|
5340
|
-
}
|
|
5341
|
-
},
|
|
5342
|
-
},
|
|
5343
|
-
filterVisible ? {
|
|
5344
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5345
|
-
"icon": "fa fa-search",
|
|
5346
|
-
"type": "button",
|
|
5347
|
-
"tooltipPlacement": "top",
|
|
5348
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5349
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5350
|
-
"badge": {
|
|
5351
|
-
"offset": [
|
|
5352
|
-
-5,
|
|
5353
|
-
1
|
|
5354
|
-
],
|
|
5355
|
-
"size":8,
|
|
5356
|
-
"animation": true,
|
|
5357
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5358
|
-
},
|
|
5359
|
-
"align": "right",
|
|
5360
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5361
|
-
"onEvent": {
|
|
5362
|
-
"click": {
|
|
5363
|
-
"actions": [
|
|
5364
|
-
{
|
|
5365
|
-
"actionType": "custom",
|
|
5366
|
-
"script": onFieldsFilterToggleScript
|
|
5367
|
-
}
|
|
5368
|
-
]
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
} : {},
|
|
5372
|
-
getDisplayAsButton(mainObject?.name),
|
|
5373
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
5418
|
+
...toolbars,
|
|
5374
5419
|
]
|
|
5375
5420
|
}else {
|
|
5421
|
+
if(toolbarCount){
|
|
5422
|
+
toolbars.push(toolbarCount);
|
|
5423
|
+
}
|
|
5424
|
+
if(toolbarFilter){
|
|
5425
|
+
toolbars.push(toolbarFilter);
|
|
5426
|
+
}
|
|
5427
|
+
toolbars.push(toolbarReloadButton);
|
|
5428
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
5429
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5430
|
+
}
|
|
5431
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5432
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5376
5433
|
return [
|
|
5377
5434
|
// "filter-toggler",
|
|
5378
5435
|
...(headerToolbarItems || []),
|
|
@@ -5381,56 +5438,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5381
5438
|
"type": "columns-toggler",
|
|
5382
5439
|
"className": "hidden"
|
|
5383
5440
|
},
|
|
5441
|
+
...toolbars,
|
|
5384
5442
|
// {
|
|
5385
5443
|
// "type": "columns-toggler",
|
|
5386
5444
|
// "className": "mr-2"
|
|
5387
5445
|
// },
|
|
5388
|
-
hiddenCount ? {} : {
|
|
5389
|
-
"type": "tpl",
|
|
5390
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5391
|
-
},
|
|
5392
|
-
filterVisible ? {
|
|
5393
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5394
|
-
"icon": "fa fa-filter",
|
|
5395
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5396
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5397
|
-
// "tooltipPlacement": "top",
|
|
5398
|
-
"type": "button",
|
|
5399
|
-
"badge": {
|
|
5400
|
-
"offset": [
|
|
5401
|
-
-5,
|
|
5402
|
-
1
|
|
5403
|
-
],
|
|
5404
|
-
"size":8,
|
|
5405
|
-
"animation": true,
|
|
5406
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5407
|
-
},
|
|
5408
|
-
"align": "right",
|
|
5409
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5410
|
-
"onEvent": {
|
|
5411
|
-
"click": {
|
|
5412
|
-
"actions": [
|
|
5413
|
-
{
|
|
5414
|
-
"actionType": "custom",
|
|
5415
|
-
"script": onFieldsFilterToggleScript
|
|
5416
|
-
}
|
|
5417
|
-
]
|
|
5418
|
-
}
|
|
5419
|
-
}
|
|
5420
|
-
} : {},
|
|
5421
|
-
{
|
|
5422
|
-
"type": "reload",
|
|
5423
|
-
"align": "right",
|
|
5424
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5425
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5426
|
-
"tooltip":"",
|
|
5427
|
-
"tooltipPlacement": "top",
|
|
5428
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5429
|
-
},
|
|
5430
5446
|
// getExportExcelToolbarButtonSchema(),
|
|
5431
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
5432
|
-
getDisplayAsButton(mainObject?.name),
|
|
5433
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
5434
5447
|
// {
|
|
5435
5448
|
// "type": "drag-toggler",
|
|
5436
5449
|
// "align": "right"
|
|
@@ -7427,7 +7440,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7427
7440
|
convertData.className = 'm-1';
|
|
7428
7441
|
}
|
|
7429
7442
|
if(readonly){
|
|
7430
|
-
convertData.className = `${convertData.className}
|
|
7443
|
+
convertData.className = `${convertData.className} border-b`;
|
|
7431
7444
|
}
|
|
7432
7445
|
if(readonly){
|
|
7433
7446
|
convertData.quickEdit = false;
|