Browse Source

Pull request #3745: REPORT-119215 fix: 统一获取宽高的方法

Merge in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit '27f84abf072e1d4138e12eece00b054ae7c687ec':
  REPORT-119215 fix: 统一使用clientWidth和clientHeight,父页面代理掉子应用的body的clientHeight和clientWidth到父应用的body上
  REPORT-119215 fix: 统一使用clientWidth和clientHeight,父页面代理掉子应用的body的clientHeight和clientWidth到父应用的body上
  REPORT-119215 fix: 统一获取宽高的方法
research/test
imp-张健 7 months ago
parent
commit
bfe7256c57
  1. 8
      packages/fineui/src/base/layer/layer.popover.js
  2. 16
      packages/fineui/src/core/controller/controller.popover.js
  3. 10
      packages/fineui/webpack/webpack.dev.js

8
packages/fineui/src/base/layer/layer.popover.js

@ -198,11 +198,11 @@ export class Popover extends Widget {
mounted() {
this.startX = 0;
this.startY = 0;
const bodyDom = getOuterBody();
this.tracker = new MouseMoveTracker(
(deltaX, deltaY) => {
const W = Widget._renderEngine.createElement(bodyDom).width();
const H = Widget._renderEngine.createElement(bodyDom).height();
const el = Widget._renderEngine.createElement(getOuterBody())[0];
const W = el.clientWidth;
const H = el.clientHeight;
this.startX += deltaX;
this.startY += deltaY;
this.element.css({
@ -246,7 +246,7 @@ export class Popover extends Widget {
}
_getSuitableWidth(width) {
return clamp(width, 0, Widget._renderEngine.createElement(getOuterBody()).width());
return clamp(width, 0, Widget._renderEngine.createElement(getOuterBody())[0].clientWidth);
}
_calculateSize() {

16
packages/fineui/src/core/controller/controller.popover.js

@ -38,7 +38,7 @@ export class PopoverController extends Controller {
type: "bi.popover",
}, context);
this.add(name, popover, options, context);
return this;
}
@ -58,8 +58,8 @@ export class PopoverController extends Controller {
const popover = this.get(name);
popover.show && popover.show();
const render = this.getRender();
const W = Widget._renderEngine.createElement(render).width(),
H = Widget._renderEngine.createElement(render).height();
const el = Widget._renderEngine.createElement(render)[0];
const W = el.clientWidth, H = el.clientHeight;
const w = popover.element.width(), h = popover.element.height();
let left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
@ -74,7 +74,7 @@ export class PopoverController extends Controller {
top: `${top}px`,
});
}
return this;
}
@ -87,7 +87,7 @@ export class PopoverController extends Controller {
this.floatContainer[name].invisible();
this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]);
}
return this;
}
@ -135,7 +135,7 @@ export class PopoverController extends Controller {
bottom: 0,
}],
});
return this;
}
@ -167,7 +167,7 @@ export class PopoverController extends Controller {
delete this.zindexMap[name];
delete this.floatContainer[name];
delete this.floatOpened[name];
return this;
}
@ -181,7 +181,7 @@ export class PopoverController extends Controller {
this.floatContainer = {};
this.floatOpened = {};
this.zindexMap = {};
return this;
}

10
packages/fineui/webpack/webpack.dev.js

@ -6,7 +6,7 @@ const dirs = require("./dirs");
module.exports = merge(common, {
mode: "development",
devtool: "inline-source-map",
devtool: "eval-source-map",
output: {
path: dirs.DEST,
@ -14,14 +14,14 @@ module.exports = merge(common, {
},
devServer: {
headers: {
"Access-Control-Allow-Origin": "*",
},
port: 9001,
// liveReload: true,
client: {
logging: 'error',
overlay: {
errors: true,
warnings: false,
},
overlay: false,
},
}
});

Loading…
Cancel
Save