diff --git a/src/common/action-toolbar/action-toolbar.scss b/src/common/action-toolbar/action-toolbar.scss
index d010149b583c38c3dcfda47b1f218c5cd06f033d..baeadca3ebf2e6f37c840c9d435a6a36647f3478 100644
--- a/src/common/action-toolbar/action-toolbar.scss
+++ b/src/common/action-toolbar/action-toolbar.scss
@@ -22,14 +22,27 @@ $action-toolbar: (
padding: getCssVar('spacing', 'extra-tight') getCssVar('spacing', 'none');
margin: getCssVar(action-toolbar, item-margin);
+ @include m('botton'){
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 getCssVar('spacing','extra-tight');
+ @include when('has-icon-label'){
+ gap: getCssVar('spacing','extra-tight');
+ }
+ }
+
@include m(icon) {
display: flex;
align-items: center;
justify-content: center;
- width: getCssVar('width-icon','medium');
- height: getCssVar('width-icon','medium');
- margin-right: getCssVar('spacing','extra-tight');
+
+ // margin-right: getCssVar('spacing','extra-tight');
font-size: getCssVar('width-icon','medium');
+ @include when('has-icon'){
+ width: getCssVar('width-icon','medium');
+ height: getCssVar('width-icon','medium');
+ }
}
&+& {
diff --git a/src/common/action-toolbar/action-toolbar.tsx b/src/common/action-toolbar/action-toolbar.tsx
index 14df69129b056ae1095cdd0cf6cd5a888a43a542..75671f0becd6a0b75035638afec11b6f068be3cb 100644
--- a/src/common/action-toolbar/action-toolbar.tsx
+++ b/src/common/action-toolbar/action-toolbar.tsx
@@ -147,13 +147,31 @@ export const IBizActionToolbar = defineComponent({
disabled={this.actionsState[detail.id!].disabled}
class={this.calcActionItemClass(detail)}
>
-
- {detail.showCaption ? detail.caption : ''}
+
+
+ {detail.showIcon && detail.sysImage && (
+
+ )}
+
+
+ {detail.showCaption ? detail.caption : ''}
+
,
];
diff --git a/src/control/chart/chart.tsx b/src/control/chart/chart.tsx
index 2fe9d9957b74a24617eeb60cfc213d5125630716..38bdd7892d15ebc5114242641591929b45e78028 100644
--- a/src/control/chart/chart.tsx
+++ b/src/control/chart/chart.tsx
@@ -1,8 +1,4 @@
-import {
- useControlController,
- useNamespace,
- useClickOutside,
-} from '@ibiz-template/vue3-util';
+import { useControlController, useNamespace } from '@ibiz-template/vue3-util';
import {
defineComponent,
nextTick,
@@ -41,7 +37,6 @@ const ChartControl = defineComponent({
const showCheck = ref(false);
const drillDetailPos = ref({}); // 数据反查框位置
const drillDetailRef = ref(); // 数据反查框
- let func: { stop: () => void };
let tempParams: IData; // 点击的图表回调事件参数
// 本地数据模式
@@ -98,13 +93,33 @@ const ChartControl = defineComponent({
const computedDrillDetailPos = (params: IParams) => {
if (params.event) {
const event: PointerEvent = params.event.event;
- event.stopPropagation();
- event.preventDefault();
const { offsetX, offsetY } = params.event;
- drillDetailPos.value = {
- top: `${offsetY}px`,
- left: `${offsetX + 16}px`,
- };
+ const { clientWidth } = event.target as HTMLDivElement;
+ if (offsetX + 160 > clientWidth) {
+ // 放在左边
+ drillDetailPos.value = {
+ top: `${offsetY - 20}px`,
+ left: `${offsetX - 160}px`,
+ };
+ } else {
+ // 放在右边
+ drillDetailPos.value = {
+ top: `${offsetY}px`,
+ left: `${offsetX + 16}px`,
+ };
+ }
+ }
+ };
+
+ // 设置反查按钮显隐状态
+ const setDrillState = () => {
+ showCheck.value = false;
+ };
+
+ // 设置tooltip显示配置
+ const setTipState = () => {
+ if (!showCheck.value) {
+ c.changeTooltipState(true);
}
};
@@ -115,6 +130,8 @@ const ChartControl = defineComponent({
const chart = init(chartRef.value);
c.initChart(chart);
window.addEventListener('resize', setHeight);
+ window.addEventListener('pointerdown', setDrillState);
+ window.addEventListener('click', setTipState);
if (chartRef.value && ResizeObserver) {
resizeObserver = new ResizeObserver(() => {
c.resizeChart();
@@ -138,26 +155,21 @@ const ChartControl = defineComponent({
return;
}
tempParams = params;
- chart.dispatchAction({ type: 'hideTip' });
- showCheck.value = true;
- c.changeTooltipState(false);
- func = useClickOutside(drillDetailRef, () => {
- showCheck.value = false;
- c.changeTooltipState(true);
- func.stop();
- });
- computedDrillDetailPos(params);
+ computedDrillDetailPos(params); // 计算反查按钮位置
+ chart.dispatchAction({ type: 'hideTip' }); // 隐藏Tip提示框
+ c.changeTooltipState(false); // 关闭提示配置
+ showCheck.value = true; // 显示反查按钮
});
}
});
// 查看明细
const openDrillDetail = (_event: MouseEvent) => {
+ _event.stopPropagation();
+ _event.preventDefault();
showCheck.value = false;
- if (func) {
- func.stop();
- }
c.changeTooltipState(true);
+ // 计算反查需要的指标和维度数据
const param = c.computedDrillDetailParam(tempParams);
emit('drillDetail', param);
};
@@ -199,6 +211,8 @@ const ChartControl = defineComponent({
onBeforeUnmount(() => {
window.removeEventListener('resize', setHeight);
+ window.removeEventListener('pointerdown', setDrillState);
+ window.removeEventListener('click', setTipState);
resizeObserver?.disconnect();
});
@@ -251,7 +265,7 @@ const ChartControl = defineComponent({
ref='drillDetailRef'
class={this.ns.e('drill-detail')}
style={this.drillDetailPos}
- onClick={this.openDrillDetail}
+ onPointerdown={this.openDrillDetail}
>