Browse Source

Pull request #5: Feature/x

Merge in ~DAILER/fineui-decision from feature/x to release/11.0

* commit '86c0168498f115222e87bb2c80b1a884d0a1fccc':
  无 jira 任务 refactor: 类型补充
  KERNEL-11877 feat: 修复bug
  REPORT-84736 feat: 多门户首页切换-平台前端开发
research/test
Dailer-刘荣歆 2 years ago
parent
commit
d8ef96a4b8
  1. 12
      src/base/combination/combo.js
  2. 10
      src/case/linearsegment/linear.segment.js
  3. 9
      src/case/segment/segment.js
  4. 8
      src/core/platform/web/dom.js
  5. 2
      typescript/base/single/button/button.basic.ts

12
src/base/combination/combo.js

@ -220,7 +220,7 @@
}, },
}, },
} : this.combo; } : this.combo;
var positionRelativeElement = o.supportCSSTransform ? BI.DOM.getPositionRelativeContainingBlock(BI.isNull(o.container) ? this.element[0] : BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]) : null; var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(BI.isNull(o.container) ? this.element[0] : BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]);
switch (o.direction) { switch (o.direction) {
case "bottom": case "bottom":
case "bottom,right": case "bottom,right":
@ -290,10 +290,6 @@
break; break;
} }
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
var width = this.combo.element.outerWidth(); var width = this.combo.element.outerWidth();
var height = this.combo.element.outerHeight(); var height = this.combo.element.outerHeight();
this.popupView.setDirection && this.popupView.setDirection(p.dir, { this.popupView.setDirection && this.popupView.setDirection(p.dir, {
@ -314,6 +310,12 @@
p.top && (p.top = p.top / scaleY); p.top && (p.top = p.top / scaleY);
p.left && (p.left = p.left / scaleX); p.left && (p.left = p.left / scaleX);
p.adaptHeight && (p.adaptHeight = p.adaptHeight / scaleY);
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
} }
if ("left" in p) { if ("left" in p) {

10
src/case/linearsegment/linear.segment.js

@ -47,6 +47,14 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
getValue: function () { getValue: function () {
return this.buttonGroup.getValue(); return this.buttonGroup.getValue();
} },
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.linear_segment_button",
height: o.height
})])
},
}); });
BI.shortcut("bi.linear_segment", BI.LinearSegment); BI.shortcut("bi.linear_segment", BI.LinearSegment);

9
src/case/segment/segment.js

@ -58,6 +58,15 @@ BI.Segment = BI.inherit(BI.Widget, {
getValue: function () { getValue: function () {
return this.buttonGroup.getValue(); return this.buttonGroup.getValue();
}, },
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.segment_button",
height: BI.toPix(o.height, 2),
whiteSpace: o.whiteSpace,
})]);
},
}); });
BI.Segment.EVENT_CHANGE = "EVENT_CHANGE"; BI.Segment.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.segment", BI.Segment); BI.shortcut("bi.segment", BI.Segment);

8
src/core/platform/web/dom.js

@ -327,7 +327,7 @@
top = comboOffset.top - containerBounds.top + extraHeight; top = comboOffset.top - containerBounds.top + extraHeight;
} else if (needAdaptHeight) { } else if (needAdaptHeight) {
top = comboBounds.top - containerBounds.top + extraHeight; top = comboBounds.top - containerBounds.top + extraHeight;
adaptHeight = viewportBounds.height - top; adaptHeight = viewportBounds.height - comboBounds.top;
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { } else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐 // 下方空间不足且不允许调整高度的情况下,优先使用上对齐
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight; top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight;
@ -671,13 +671,13 @@
}, },
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, container) { getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, positionRelativeElement) {
extraWidth || (extraWidth = 0); extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0); extraHeight || (extraHeight = 0);
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight; var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight;
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight);
popup.resetHeight && popup.resetHeight(maxHeight); popup.resetHeight && popup.resetHeight(maxHeight);
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], container); var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], positionRelativeElement);
switch (offsetStyle) { switch (offsetStyle) {
case "center": case "center":
if (position.change) { if (position.change) {
@ -699,7 +699,7 @@
break; break;
} }
if (needAdaptHeight === true) { if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
} }
return position; return position;
}, },

2
typescript/base/single/button/button.basic.ts

@ -38,7 +38,7 @@ export declare class BasicButton extends Single {
trigger?: string | null; trigger?: string | null;
handler?: Function; handler?: Function;
bubble?: Function | null | string; bubble?: Function | null | string;
text?: string; text?: string | ((context: any) => string);
el?: Obj; el?: Obj;
} & Single["props"]; } & Single["props"];

Loading…
Cancel
Save