@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.esm.js
CHANGED
|
@@ -3104,7 +3104,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3104
3104
|
name: button.name,
|
|
3105
3105
|
objectName: button.objectName,
|
|
3106
3106
|
visibleOn: getButtonVisibleOn$1(button),
|
|
3107
|
-
className: `button_${button.name}
|
|
3107
|
+
className: `button_${button.name}`
|
|
3108
3108
|
}
|
|
3109
3109
|
});
|
|
3110
3110
|
}
|
|
@@ -5276,76 +5276,133 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5276
5276
|
if(isMobile){
|
|
5277
5277
|
showDisplayAs = false;
|
|
5278
5278
|
}
|
|
5279
|
+
let toolbarCount;
|
|
5280
|
+
if(!hiddenCount){
|
|
5281
|
+
toolbarCount = {
|
|
5282
|
+
"type": "tpl",
|
|
5283
|
+
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5284
|
+
};
|
|
5285
|
+
}
|
|
5286
|
+
let toolbarReloadButton;
|
|
5279
5287
|
if(formFactor === 'SMALL'){
|
|
5280
|
-
const onReloadScript = `
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
`;
|
|
5288
|
+
// const onReloadScript = `
|
|
5289
|
+
// const scope = event.context.scoped;
|
|
5290
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
5291
|
+
// return n.props.type === "crud";
|
|
5292
|
+
// });
|
|
5293
|
+
// listView.handleChangePage(1);
|
|
5294
|
+
// `;
|
|
5295
|
+
// toolbarReloadButton = {
|
|
5296
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
5297
|
+
// "type": "button",
|
|
5298
|
+
// "align": "right",
|
|
5299
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5300
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5301
|
+
// "tooltipPlacement": "top",
|
|
5302
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5303
|
+
// "label": "",
|
|
5304
|
+
// "icon": "fa fa-sync",
|
|
5305
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
5306
|
+
// "onEvent": {
|
|
5307
|
+
// "click": {
|
|
5308
|
+
// "actions": [
|
|
5309
|
+
// {
|
|
5310
|
+
// "actionType": "custom",
|
|
5311
|
+
// "script": onReloadScript
|
|
5312
|
+
// }
|
|
5313
|
+
// ]
|
|
5314
|
+
// }
|
|
5315
|
+
// },
|
|
5316
|
+
// };
|
|
5317
|
+
|
|
5318
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
5319
|
+
toolbarReloadButton = {
|
|
5320
|
+
"type": "reload",
|
|
5321
|
+
"align": "right",
|
|
5322
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5323
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5324
|
+
"tooltip":"",
|
|
5325
|
+
"tooltipPlacement": "top",
|
|
5326
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5327
|
+
};
|
|
5328
|
+
}
|
|
5329
|
+
else {
|
|
5330
|
+
toolbarReloadButton = {
|
|
5331
|
+
"type": "reload",
|
|
5332
|
+
"align": "right",
|
|
5333
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5334
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5335
|
+
"tooltip":"",
|
|
5336
|
+
"tooltipPlacement": "top",
|
|
5337
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5338
|
+
};
|
|
5339
|
+
}
|
|
5340
|
+
let toolbarFilter;
|
|
5341
|
+
if(filterVisible){
|
|
5342
|
+
toolbarFilter ={
|
|
5343
|
+
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5344
|
+
"icon": "fa fa-filter",
|
|
5345
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5346
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5347
|
+
// "tooltipPlacement": "top",
|
|
5348
|
+
"type": "button",
|
|
5349
|
+
"badge": {
|
|
5350
|
+
"offset": [
|
|
5351
|
+
-5,
|
|
5352
|
+
1
|
|
5353
|
+
],
|
|
5354
|
+
"size":8,
|
|
5355
|
+
"animation": true,
|
|
5356
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5357
|
+
},
|
|
5358
|
+
"align": "right",
|
|
5359
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5360
|
+
"onEvent": {
|
|
5361
|
+
"click": {
|
|
5362
|
+
"actions": [
|
|
5363
|
+
{
|
|
5364
|
+
"actionType": "custom",
|
|
5365
|
+
"script": onFieldsFilterToggleScript
|
|
5366
|
+
}
|
|
5367
|
+
]
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
};
|
|
5371
|
+
}
|
|
5372
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
5373
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
5374
|
+
|
|
5375
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
5376
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
5377
|
+
let toolbars = [];
|
|
5378
|
+
if(formFactor === 'SMALL'){
|
|
5379
|
+
if(toolbarCount){
|
|
5380
|
+
toolbars.push(toolbarCount);
|
|
5381
|
+
}
|
|
5382
|
+
toolbars.push(toolbarReloadButton);
|
|
5383
|
+
if(toolbarFilter){
|
|
5384
|
+
toolbars.push(toolbarFilter);
|
|
5385
|
+
}
|
|
5386
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5387
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5287
5388
|
return [
|
|
5288
5389
|
// "bulkActions",
|
|
5289
5390
|
...(headerToolbarItems || []),
|
|
5290
|
-
|
|
5291
|
-
"type": "tpl",
|
|
5292
|
-
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5293
|
-
},
|
|
5294
|
-
{
|
|
5295
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5296
|
-
"type": "button",
|
|
5297
|
-
"align": "right",
|
|
5298
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5299
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5300
|
-
"tooltipPlacement": "top",
|
|
5301
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5302
|
-
"label": "",
|
|
5303
|
-
"icon": "fa fa-sync",
|
|
5304
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
5305
|
-
"onEvent": {
|
|
5306
|
-
"click": {
|
|
5307
|
-
"actions": [
|
|
5308
|
-
{
|
|
5309
|
-
"actionType": "custom",
|
|
5310
|
-
"script": onReloadScript
|
|
5311
|
-
}
|
|
5312
|
-
]
|
|
5313
|
-
}
|
|
5314
|
-
},
|
|
5315
|
-
},
|
|
5316
|
-
filterVisible ? {
|
|
5317
|
-
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5318
|
-
"icon": "fa fa-search",
|
|
5319
|
-
"type": "button",
|
|
5320
|
-
"tooltipPlacement": "top",
|
|
5321
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5322
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5323
|
-
"badge": {
|
|
5324
|
-
"offset": [
|
|
5325
|
-
-5,
|
|
5326
|
-
1
|
|
5327
|
-
],
|
|
5328
|
-
"size":8,
|
|
5329
|
-
"animation": true,
|
|
5330
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5331
|
-
},
|
|
5332
|
-
"align": "right",
|
|
5333
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5334
|
-
"onEvent": {
|
|
5335
|
-
"click": {
|
|
5336
|
-
"actions": [
|
|
5337
|
-
{
|
|
5338
|
-
"actionType": "custom",
|
|
5339
|
-
"script": onFieldsFilterToggleScript
|
|
5340
|
-
}
|
|
5341
|
-
]
|
|
5342
|
-
}
|
|
5343
|
-
}
|
|
5344
|
-
} : {},
|
|
5345
|
-
getDisplayAsButton(mainObject?.name),
|
|
5346
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
5391
|
+
...toolbars,
|
|
5347
5392
|
]
|
|
5348
5393
|
}else {
|
|
5394
|
+
if(toolbarCount){
|
|
5395
|
+
toolbars.push(toolbarCount);
|
|
5396
|
+
}
|
|
5397
|
+
if(toolbarFilter){
|
|
5398
|
+
toolbars.push(toolbarFilter);
|
|
5399
|
+
}
|
|
5400
|
+
toolbars.push(toolbarReloadButton);
|
|
5401
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
5402
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5403
|
+
}
|
|
5404
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5405
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5349
5406
|
return [
|
|
5350
5407
|
// "filter-toggler",
|
|
5351
5408
|
...(headerToolbarItems || []),
|
|
@@ -5354,56 +5411,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5354
5411
|
"type": "columns-toggler",
|
|
5355
5412
|
"className": "hidden"
|
|
5356
5413
|
},
|
|
5414
|
+
...toolbars,
|
|
5357
5415
|
// {
|
|
5358
5416
|
// "type": "columns-toggler",
|
|
5359
5417
|
// "className": "mr-2"
|
|
5360
5418
|
// },
|
|
5361
|
-
hiddenCount ? {} : {
|
|
5362
|
-
"type": "tpl",
|
|
5363
|
-
"tpl": "${count} " + i18next.t('frontend_record_sum')
|
|
5364
|
-
},
|
|
5365
|
-
filterVisible ? {
|
|
5366
|
-
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5367
|
-
"icon": "fa fa-filter",
|
|
5368
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5369
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5370
|
-
// "tooltipPlacement": "top",
|
|
5371
|
-
"type": "button",
|
|
5372
|
-
"badge": {
|
|
5373
|
-
"offset": [
|
|
5374
|
-
-5,
|
|
5375
|
-
1
|
|
5376
|
-
],
|
|
5377
|
-
"size":8,
|
|
5378
|
-
"animation": true,
|
|
5379
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5380
|
-
},
|
|
5381
|
-
"align": "right",
|
|
5382
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5383
|
-
"onEvent": {
|
|
5384
|
-
"click": {
|
|
5385
|
-
"actions": [
|
|
5386
|
-
{
|
|
5387
|
-
"actionType": "custom",
|
|
5388
|
-
"script": onFieldsFilterToggleScript
|
|
5389
|
-
}
|
|
5390
|
-
]
|
|
5391
|
-
}
|
|
5392
|
-
}
|
|
5393
|
-
} : {},
|
|
5394
|
-
{
|
|
5395
|
-
"type": "reload",
|
|
5396
|
-
"align": "right",
|
|
5397
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5398
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5399
|
-
"tooltip":"",
|
|
5400
|
-
"tooltipPlacement": "top",
|
|
5401
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5402
|
-
},
|
|
5403
5419
|
// getExportExcelToolbarButtonSchema(),
|
|
5404
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
5405
|
-
getDisplayAsButton(mainObject?.name),
|
|
5406
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
5407
5420
|
// {
|
|
5408
5421
|
// "type": "drag-toggler",
|
|
5409
5422
|
// "align": "right"
|
|
@@ -7400,7 +7413,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7400
7413
|
convertData.className = 'm-1';
|
|
7401
7414
|
}
|
|
7402
7415
|
if(readonly){
|
|
7403
|
-
convertData.className = `${convertData.className}
|
|
7416
|
+
convertData.className = `${convertData.className} border-b`;
|
|
7404
7417
|
}
|
|
7405
7418
|
if(readonly){
|
|
7406
7419
|
convertData.quickEdit = false;
|