diff --git a/packages/fineui/dist/font/iconfont.eot b/packages/fineui/dist/font/iconfont.eot index 460bf95a9..6a0f685a2 100644 Binary files a/packages/fineui/dist/font/iconfont.eot and b/packages/fineui/dist/font/iconfont.eot differ diff --git a/packages/fineui/dist/font/iconfont.svg b/packages/fineui/dist/font/iconfont.svg index 8f1e52f9f..32deecda8 100644 --- a/packages/fineui/dist/font/iconfont.svg +++ b/packages/fineui/dist/font/iconfont.svg @@ -14,7 +14,11 @@ /> - + + + + + @@ -92,7 +96,7 @@ - + @@ -380,7 +384,7 @@ - + @@ -852,7 +856,7 @@ - + diff --git a/packages/fineui/dist/font/iconfont.ttf b/packages/fineui/dist/font/iconfont.ttf index fb07f4dde..85e450f3a 100644 Binary files a/packages/fineui/dist/font/iconfont.ttf and b/packages/fineui/dist/font/iconfont.ttf differ diff --git a/packages/fineui/dist/font/iconfont.woff b/packages/fineui/dist/font/iconfont.woff index 01e3b1887..9c12cac44 100644 Binary files a/packages/fineui/dist/font/iconfont.woff and b/packages/fineui/dist/font/iconfont.woff differ diff --git a/packages/fineui/dist/font/iconfont.woff2 b/packages/fineui/dist/font/iconfont.woff2 index c779b6a78..497bc683b 100644 Binary files a/packages/fineui/dist/font/iconfont.woff2 and b/packages/fineui/dist/font/iconfont.woff2 differ diff --git a/packages/fineui/src/base/layer/layer.popover.js b/packages/fineui/src/base/layer/layer.popover.js index 37b4c3d5c..ea6db3662 100644 --- a/packages/fineui/src/base/layer/layer.popover.js +++ b/packages/fineui/src/base/layer/layer.popover.js @@ -16,6 +16,7 @@ import { } from "@/core"; import { Label, IconButton, Button } from "../single"; import { Resizers } from "../0.base"; +import { getOuterBody } from "@/core/utils/dom"; /** * Popover弹出层, @@ -66,10 +67,11 @@ export class Popover extends Widget { this.startX = 0; this.startY = 0; const size = this._calculateSize(); + const bodyDom = getOuterBody(); this.tracker = new MouseMoveTracker( (deltaX, deltaY) => { - const W = Widget._renderEngine.createElement("body").width(); - const H = Widget._renderEngine.createElement("body").height(); + const W = Widget._renderEngine.createElement(bodyDom).width(); + const H = Widget._renderEngine.createElement(bodyDom).height(); this.startX += deltaX; this.startY += deltaY; this.element.css({ @@ -228,11 +230,11 @@ export class Popover extends Widget { _getSuitableBodyHeight(height) { const { headerHeight, footer, footerHeight, bodyTgap } = this.options; - + const bodyDom = getOuterBody(); return clamp( height, 0, - Widget._renderEngine.createElement("body")[0].clientHeight - + Widget._renderEngine.createElement(bodyDom)[0].clientHeight - headerHeight - (footer ? footerHeight : 0) - bodyTgap @@ -240,11 +242,11 @@ export class Popover extends Widget { } _getSuitableHeight(height) { - return clamp(height, 0, Widget._renderEngine.createElement("body")[0].clientHeight); + return clamp(height, 0, Widget._renderEngine.createElement(getOuterBody())[0].clientHeight); } _getSuitableWidth(width) { - return clamp(width, 0, Widget._renderEngine.createElement("body").width()); + return clamp(width, 0, Widget._renderEngine.createElement(getOuterBody()).width()); } _calculateSize() { diff --git a/packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js b/packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js index 61a48946f..0a9f9a24c 100644 --- a/packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js +++ b/packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js @@ -22,7 +22,13 @@ import { Label, Combo, TextItem } from "@/base"; import { PopupPanel } from "../layer"; import { CustomColorChooser } from "./colorchooser.custom"; import { ColorChooserPopup } from "./colorchooser.popup"; -import { ColorPickerEditor, ColorPicker, HexColorPicker } from "./colorpicker"; +import { + ColorPickerEditor, + ColorPicker, + HexColorPicker, + SimpleHexColorPickerEditor, + HexColorPickerEditor +} from "./colorpicker"; /** * @author windy @@ -59,8 +65,8 @@ export class HexColorChooserPopup extends Widget { extend( { type: o.simple - ? "bi.simple_hex_color_picker_editor" - : "bi.hex_color_picker_editor", + ? SimpleHexColorPickerEditor.xtype + : HexColorPickerEditor.xtype, value: o.value, height: o.simple ? 36 : 70, listeners: [ diff --git a/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js b/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js index f512888be..25ffb0a2a 100644 --- a/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js +++ b/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js @@ -39,7 +39,7 @@ export class HexColorPickerEditor extends Widget { static EVENT_CHANGE = "EVENT_CHANGE"; props = { - baseCls: "bi-color-picker-editor", + baseCls: "bi-color-picker-editor bi-hex-color-picker-editor", height: 30, }; diff --git a/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js b/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js index 3c13b1aba..14386afac 100644 --- a/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js +++ b/packages/fineui/src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js @@ -23,7 +23,8 @@ import { TextEditor } from "@/widget/editor/editor.text"; const RGB_WIDTH = 32, HEX_WIDTH = 70, - HEX_PREFIX_POSITION = 1; + HEX_PREFIX_POSITION = 1, + DEFAULT_HEX = "ffffff"; /** * @author windy @@ -37,7 +38,7 @@ export class SimpleHexColorPickerEditor extends Widget { static EVENT_CHANGE = "EVENT_CHANGE"; props = { - baseCls: "bi-color-picker-editor", + baseCls: "bi-color-picker-editor bi-simple-hex-color-picker-editor", height: 36, }; @@ -112,6 +113,7 @@ export class SimpleHexColorPickerEditor extends Widget { errorText: i18nText("BI-Color_Picker_Error_Text_Hex"), width: HEX_WIDTH, height: 24, + value: DEFAULT_HEX, listeners: [ { eventName: "EVENT_CHANGE", diff --git a/packages/fineui/src/case/list/list.select.js b/packages/fineui/src/case/list/list.select.js index 4301aff57..30f78ac40 100644 --- a/packages/fineui/src/case/list/list.select.js +++ b/packages/fineui/src/case/list/list.select.js @@ -71,10 +71,12 @@ export class SelectList extends Widget { itemsCreator: (op, callback) => { op.times === 1 && this.toolbar.setVisible(false); o.itemsCreator(op, (items, keywords, context, ...args) => { - callback(items, keywords, context, ...args); + const tipText = get(context, "tipText", ""); + const isEmptyTipText = isEmptyString(tipText); + // tipText 和 items 本身就是互斥的 + callback(isEmptyTipText ? items : [], keywords, context, ...args); if (op.times === 1) { - const tipText = get(context, "tipText", ""); - const visible = isEmptyString(tipText) && items && items.length > 0; + const visible = isEmptyTipText && items && items.length > 0; this.toolbar.setVisible(visible); this.toolbar.setEnable(this.isEnabled() && visible); } diff --git a/packages/fineui/src/core/controller/controller.layer.js b/packages/fineui/src/core/controller/controller.layer.js index 7b3196ef2..9dcac7f83 100644 --- a/packages/fineui/src/core/controller/controller.layer.js +++ b/packages/fineui/src/core/controller/controller.layer.js @@ -8,7 +8,7 @@ import { isNull, isNotNull, each, keys, isWidget, isNotEmptyString, extend, bind import { Widget } from "../4.widget"; import { createWidget } from "../5.inject"; import { zIndex_layer } from "../constant"; -import { DOM } from "../utils"; +import { getPositionRelativeContainingBlockRect, getOuterBody } from "../utils/dom"; export class LayerController extends Controller { constructor(Resizers) { @@ -63,7 +63,7 @@ export class LayerController extends Controller { w = from.element; } if (isNotEmptyString(w)) { - w = Widget._renderEngine.createElement(w); + w = Widget._renderEngine.createElement(w === 'body' ? getOuterBody() : w); } if (this.has(name)) { return this.get(name); @@ -86,7 +86,7 @@ export class LayerController extends Controller { }, context); createWidget({ type: "bi.absolute", - element: op.container || this.options.render, + element: op.container || this.getRender(), items: [ { el: layout, @@ -108,7 +108,7 @@ export class LayerController extends Controller { height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "", }; - const { top, left, scaleY, scaleX } = DOM.getPositionRelativeContainingBlockRect(layout.element[0]); + const { top, left, scaleY, scaleX } = getPositionRelativeContainingBlockRect(layout.element[0]); css.top = (css.top - top) / scaleY; css.left = (css.left - left) / scaleX; @@ -164,6 +164,15 @@ export class LayerController extends Controller { return this; } + getRender() { + // 默认挂在body上的都找最外层的body + let render = this.options.render; + if (render === 'body') { + return getOuterBody(); + } + return render; + } + _getLayout(name) { return this.layouts[name]; } diff --git a/packages/fineui/src/core/controller/controller.popover.js b/packages/fineui/src/core/controller/controller.popover.js index b3fa2bbc5..c4b8337b8 100644 --- a/packages/fineui/src/core/controller/controller.popover.js +++ b/packages/fineui/src/core/controller/controller.popover.js @@ -7,6 +7,7 @@ import { isNotNull, each } from "../2.base"; import { Widget } from "../4.widget"; import { createWidget } from "../5.inject"; import { zIndex_popover } from "../constant"; +import { getOuterBody } from "../utils/dom"; export class PopoverController extends Controller { constructor() { @@ -56,8 +57,9 @@ export class PopoverController extends Controller { this.floatContainer[name].visible(); const popover = this.get(name); popover.show && popover.show(); - const W = Widget._renderEngine.createElement(this.options.render).width(), - H = Widget._renderEngine.createElement(this.options.render).height(); + const render = this.getRender(); + const W = Widget._renderEngine.createElement(render).width(), + H = Widget._renderEngine.createElement(render).height(); const w = popover.element.width(), h = popover.element.height(); let left = (W - w) / 2, top = (H - h) / 2; if (left < 0) { @@ -124,7 +126,7 @@ export class PopoverController extends Controller { popover.on(BI.Popover.EVENT_CLOSE, () => this.close(name)); createWidget({ type: "bi.absolute", - element: options.container || this.options.render, + element: options.container || this.getRender(), items: [{ el: this.floatContainer[name], left: 0, @@ -137,6 +139,15 @@ export class PopoverController extends Controller { return this; } + getRender() { + // 默认挂在body上的都找最外层的body + let render = this.options.render; + if (render === 'body') { + return getOuterBody(); + } + return render; + } + get(name) { return this.floatManager[name]; } diff --git a/packages/fineui/src/core/func/date.js b/packages/fineui/src/core/func/date.js index b592ad7d7..599e006c7 100644 --- a/packages/fineui/src/core/func/date.js +++ b/packages/fineui/src/core/func/date.js @@ -56,7 +56,7 @@ export function getMonthDays(date, month = date.getMonth()) { if (((0 === (year % 4)) && ((0 !== (year % 100)) || (0 === (year % 400)))) && month === 1) { return 29; } - + return _MD[month]; } @@ -85,7 +85,7 @@ export function getDayOfYear(date) { const now = getDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); const then = getDate(date.getFullYear(), 0, 0, 0, 0, 0); const time = now - then; - + return Math.floor(time / DAY); } @@ -108,7 +108,7 @@ export function getWeekNumber(date) { const ms = d.valueOf(); d.setMonth(0); d.setDate(1); - + return Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; } @@ -135,7 +135,7 @@ export function getOffsetQuarter(date, n) { } dt.setDate(day); dt.setMonth(dt.getMonth() + parseInt(n, 10) * 3); - + return dt; } @@ -159,7 +159,7 @@ export function getQuarterStartMonth(date) { if (nowMonth > 8) { quarterStartMonth = 9; } - + return quarterStartMonth; } @@ -179,8 +179,8 @@ export function getQuarterStartDate(date) { */ export function getQuarterEndDate(date) { const quarterEndMonth = getQuarterStartMonth(date) + 2; - - return getDate(date.getFullYear(), quarterEndMonth, getMonthDays(date)); + + return getDate(date.getFullYear(), quarterEndMonth, getMonthDays(date, quarterEndMonth)); } /** @@ -198,7 +198,7 @@ export function getOffsetMonth(date, n) { } dt.setDate(day); dt.setMonth(dt.getMonth() + parseInt(n, 10)); - + return dt; } @@ -210,7 +210,7 @@ export function getOffsetMonth(date, n) { export function getWeekStartDate(date) { const w = date.getDay(); const startOfWeek = StartOfWeek % 7; - + return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]); } @@ -222,7 +222,7 @@ export function getWeekStartDate(date) { export function getWeekEndDate(date) { const w = date.getDay(); const startOfWeek = StartOfWeek % 7; - + return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6); } @@ -349,7 +349,7 @@ export function print(date, str) { if (!_global.navigator) { return false; } - + return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); }; diff --git a/packages/fineui/src/core/utils/dom.js b/packages/fineui/src/core/utils/dom.js index 552a60d44..fee24904f 100644 --- a/packages/fineui/src/core/utils/dom.js +++ b/packages/fineui/src/core/utils/dom.js @@ -1,9 +1,9 @@ /** * 对DOM操作的通用函数 */ -import { Widget } from "../4.widget"; -import { each, isEmpty, isNull, isNotNull } from "../2.base"; import $ from "jquery"; +import { each, isEmpty, isNotNull, isNull } from "../2.base"; +import { Widget } from "../4.widget"; import { isIE } from "./../platform"; export function ready(fn) { @@ -788,3 +788,20 @@ export function getPositionRelativeContainingBlockRect(element) { scaleY: rect.height / positionRelativeElement.offsetHeight, }; } + +/** + * 获取最外层的body + */ +export function getOuterBody() { + // 默认挂在body上的都找最外层的body + // let parentWindow = window; + // let body = document.body; + // try { + // while (parentWindow.parent !== parentWindow) { + // parentWindow = parentWindow.parent; + // } + // body = parentWindow.document.body; + // } catch (e) {} + // return body; + return document.body; +} diff --git a/packages/fineui/src/widget/intervalslider/intervalslider.js b/packages/fineui/src/widget/intervalslider/intervalslider.js index 894ef7a2c..b24a795af 100644 --- a/packages/fineui/src/widget/intervalslider/intervalslider.js +++ b/packages/fineui/src/widget/intervalslider/intervalslider.js @@ -31,6 +31,7 @@ export class IntervalSlider extends Single { EDITOR_R_GAP: 60, EDITOR_HEIGHT: 20, SLIDER_WIDTH_HALF: 15, + LABEL_HEIGHT: 30, SLIDER_WIDTH: 30, SLIDER_HEIGHT: 30, TRACK_HEIGHT: 24, @@ -60,6 +61,7 @@ export class IntervalSlider extends Single { render() { const c = this._constant; + const o = this.options; this.enable = false; this.valueOne = ""; this.valueTwo = ""; @@ -150,7 +152,7 @@ export class IntervalSlider extends Single { return { type: VerticalFillLayout.xtype, - rowSize: [30, 30], + rowSize: [o.labelHeight || c.LABEL_HEIGHT, o.sliderHeight || c.SLIDER_HEIGHT], items: [ this._createLabelWrapper(), { @@ -250,6 +252,7 @@ export class IntervalSlider extends Single { } _createLabelWrapper() { + const o = this.options; const c = this._constant; return { @@ -272,7 +275,7 @@ export class IntervalSlider extends Single { ], }, ], - height: c.SLIDER_HEIGHT, + height: o.labelHeight || c.LABEL_HEIGHT, }, top: 0, left: 0,