diff --git a/src/case/button/item.multiselect.js b/src/case/button/item.multiselect.js index b064761fa..2d4879079 100644 --- a/src/case/button/item.multiselect.js +++ b/src/case/button/item.multiselect.js @@ -1,5 +1,5 @@ -import { Checkbox, Label, BasicButton, SIZE_CONSANTS } from "@/base"; -import { VerticalAdaptLayout, CenterAdaptLayout, shortcut, extend, createWidget } from "@/core"; +import { Checkbox, Label, BasicButton } from "@/base"; +import { VerticalAdaptLayout, CenterAdaptLayout, shortcut, extend, createWidget, SIZE_CONSANTS } from "@/core"; /** * guy diff --git a/src/case/button/item.singleselect.icontext.js b/src/case/button/item.singleselect.icontext.js index 1a3d921c7..7d219725c 100644 --- a/src/case/button/item.singleselect.icontext.js +++ b/src/case/button/item.singleselect.icontext.js @@ -1,5 +1,5 @@ -import { IconTextItem, Single, SIZE_CONSANTS } from "@/base"; -import { shortcut, extend, createWidget, Controller } from "@/core"; +import { IconTextItem, Single } from "@/base"; +import { shortcut, extend, createWidget, Controller, SIZE_CONSANTS } from "@/core"; /** * Created by GUY on 2016/2/2. diff --git a/src/core/func/date.js b/src/core/func/date.js index f13c350b4..e35e45cca 100644 --- a/src/core/func/date.js +++ b/src/core/func/date.js @@ -1,5 +1,7 @@ /** Constants used for time computations */ -import { getDate, getTime, parseInt } from "../2.base"; +import { getDate, getTime, parseInt, i18nText } from "../2.base"; +import { StartOfWeek } from "../constant"; +import { isKhtml } from "../platform/web"; const SECOND = 1000; const MINUTE = 60 * SECOND; @@ -41,7 +43,7 @@ export const Date = { * @returns {String} */ export function getTimezone(date) { - return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, ""); + return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, ""); } /** @@ -94,7 +96,7 @@ export function getDayOfYear(date) { export function getWeekNumber(date) { const d = getDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); const week = d.getDay(); - const startOfWeek = BI.StartOfWeek % 7; + const startOfWeek = StartOfWeek % 7; let middleDay = (startOfWeek + 3) % 7; middleDay = middleDay || 7; // 偏移到周周首之前需要多少天 @@ -125,7 +127,7 @@ export function getOffsetDate(date, offset) { export function getOffsetQuarter(date, n) { const dt = getDate(getTime(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds())); let day = dt.getDate(); - const monthDay = BI.getMonthDays(getDate(dt.getFullYear(), dt.getMonth() + parseInt(n, 10) * 3, 1)); + const monthDay = getMonthDays(getDate(dt.getFullYear(), dt.getMonth() + parseInt(n, 10) * 3, 1)); if (day > monthDay) { day = monthDay; } @@ -205,7 +207,7 @@ export function getOffsetMonth(date, n) { */ export function getWeekStartDate(date) { const w = date.getDay(); - const startOfWeek = BI.StartOfWeek % 7; + const startOfWeek = StartOfWeek % 7; return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]); } @@ -217,61 +219,61 @@ export function getWeekStartDate(date) { */ export function getWeekEndDate(date) { const w = date.getDay(); - const startOfWeek = BI.StartOfWeek % 7; + const startOfWeek = StartOfWeek % 7; return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6); } export function getFullDayName(index) { return [ - BI.i18nText("BI-Basic_Sunday"), - BI.i18nText("BI-Basic_Monday"), - BI.i18nText("BI-Basic_Tuesday"), - BI.i18nText("BI-Basic_Wednesday"), - BI.i18nText("BI-Basic_Thursday"), - BI.i18nText("BI-Basic_Friday"), - BI.i18nText("BI-Basic_Saturday"), - BI.i18nText("BI-Basic_Sunday") + i18nText("BI-Basic_Sunday"), + i18nText("BI-Basic_Monday"), + i18nText("BI-Basic_Tuesday"), + i18nText("BI-Basic_Wednesday"), + i18nText("BI-Basic_Thursday"), + i18nText("BI-Basic_Friday"), + i18nText("BI-Basic_Saturday"), + i18nText("BI-Basic_Sunday") ][index]; } export function getShortDayName(index) { return [ - BI.i18nText("BI-Basic_Simple_Sunday"), - BI.i18nText("BI-Basic_Simple_Monday"), - BI.i18nText("BI-Basic_Simple_Tuesday"), - BI.i18nText("BI-Basic_Simple_Wednesday"), - BI.i18nText("BI-Basic_Simple_Thursday"), - BI.i18nText("BI-Basic_Simple_Friday"), - BI.i18nText("BI-Basic_Simple_Saturday"), - BI.i18nText("BI-Basic_Simple_Sunday") + i18nText("BI-Basic_Simple_Sunday"), + i18nText("BI-Basic_Simple_Monday"), + i18nText("BI-Basic_Simple_Tuesday"), + i18nText("BI-Basic_Simple_Wednesday"), + i18nText("BI-Basic_Simple_Thursday"), + i18nText("BI-Basic_Simple_Friday"), + i18nText("BI-Basic_Simple_Saturday"), + i18nText("BI-Basic_Simple_Sunday") ][index]; } export function getMonthName(index) { return [ - BI.i18nText("BI-Basic_January"), - BI.i18nText("BI-Basic_February"), - BI.i18nText("BI-Basic_March"), - BI.i18nText("BI-Basic_April"), - BI.i18nText("BI-Basic_May"), - BI.i18nText("BI-Basic_June"), - BI.i18nText("BI-Basic_July"), - BI.i18nText("BI-Basic_August"), - BI.i18nText("BI-Basic_September"), - BI.i18nText("BI-Basic_October"), - BI.i18nText("BI-Basic_November"), - BI.i18nText("BI-Basic_December") + i18nText("BI-Basic_January"), + i18nText("BI-Basic_February"), + i18nText("BI-Basic_March"), + i18nText("BI-Basic_April"), + i18nText("BI-Basic_May"), + i18nText("BI-Basic_June"), + i18nText("BI-Basic_July"), + i18nText("BI-Basic_August"), + i18nText("BI-Basic_September"), + i18nText("BI-Basic_October"), + i18nText("BI-Basic_November"), + i18nText("BI-Basic_December") ][index]; } export function getQuarterName(index) { return [ "", - BI.i18nText("BI-Quarter_1"), - BI.i18nText("BI-Quarter_2"), - BI.i18nText("BI-Quarter_3"), - BI.i18nText("BI-Quarter_4") + i18nText("BI-Quarter_1"), + i18nText("BI-Quarter_2"), + i18nText("BI-Quarter_3"), + i18nText("BI-Quarter_4") ][index]; } @@ -341,7 +343,7 @@ export function print(date, str) { s["%Q"] = qr; let re = /%./g; - BI.isKhtml = BI.isKhtml || function () { + isKhtml = isKhtml || function () { if (!_global.navigator) { return false; } @@ -371,7 +373,7 @@ export function print(date, str) { } } - if (!BI.isKhtml()) { + if (!isKhtml()) { return str.replace(re, par => s[par] || par); } const a = str.match(re); diff --git a/src/core/func/function.js b/src/core/func/function.js index 70d52da68..0f13dabdd 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -2,9 +2,10 @@ * 基本的函数 * Created by GUY on 2015/6/24. */ -import { every, isKey, isArray, toUpperCase, each, stripEL, isNotNull, isNull, isObject } from "../2.base"; +import { every, isKey, isArray, toUpperCase, each, stripEL, isNotNull, isNull, isObject, flatten, isFunction } from "../2.base"; import { makeFirstPY } from "../utils/chinesePY"; import { CODE_INDEX } from "@/third/sort.gb2312"; +import { MAX } from "../constant"; /** * 创建唯一的名字 @@ -17,6 +18,7 @@ export function createDistinctName(array, name) { let idx = 1; name = name || ""; while (true) { + // eslint-disable-next-line no-loop-func if (every(array, (i, item) => isKey(item) ? item !== name : item.name !== name)) { break; } @@ -46,7 +48,7 @@ export function getGBWidth(str) { */ export function getSearchResult(items, keyword, param) { const array = isArray(items); - items = array ? BI.flatten(items) : items; + items = array ? flatten(items) : items; param || (param = "text"); if (!isKey(keyword)) { return { @@ -104,15 +106,15 @@ export function getSearchResult(items, keyword, param) { * @return {any[]} */ export function getSortedResult(items, key = null) { - const getTextOfItem = BI.isFunction(key) ? key : + const getTextOfItem = isFunction(key) ? key : function (item, key) { - if (BI.isNotNull(key)) { + if (isNotNull(key)) { return item[key]; } - if (BI.isNotNull(item.text)) { + if (isNotNull(item.text)) { return item.text; } - if (BI.isNotNull(item.value)) { + if (isNotNull(item.value)) { return item.value; } @@ -122,13 +124,13 @@ export function getSortedResult(items, key = null) { return items.sort((item1, item2) => { const str1 = getTextOfItem(item1, key); const str2 = getTextOfItem(item2, key); - if (BI.isNull(str1) && BI.isNull(str2)) { + if (isNull(str1) && isNull(str2)) { return 0; } - if (BI.isNull(str1)) { + if (isNull(str1)) { return -1; } - if (BI.isNull(str2)) { + if (isNull(str2)) { return 1; } if (str1 === str2) { @@ -140,7 +142,7 @@ export function getSortedResult(items, key = null) { const char2 = str2[i]; if (char1 !== char2) { // 找不到的字符都往后面放 - return (BI.isNull(CODE_INDEX[char1]) ? BI.MAX : CODE_INDEX[char1]) - (BI.isNull(CODE_INDEX[char2]) ? BI.MAX : CODE_INDEX[char2]); + return (isNull(CODE_INDEX[char1]) ? MAX : CODE_INDEX[char1]) - (isNull(CODE_INDEX[char2]) ? MAX : CODE_INDEX[char2]); } } diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index e4812bd7b..6b75cb0f4 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -1,4 +1,8 @@ +import { extend, map, each, isNull } from "../../2.base"; +import { Providers } from "../../5.inject"; import { Plugin } from "../../6.plugin"; +import { isSupportCss3, isIE, getIEVersion } from "../../platform/web"; +import { HorizontalAlign, VerticalAlign } from "../../constant"; // 工程配置 // 注册布局 @@ -10,7 +14,7 @@ let _isSupportFlex, _isSupportGrid; function isSupportFlex() { if (!_isSupportFlex) { - _isSupportFlex = !!(BI.isSupportCss3 && BI.isSupportCss3("flex")); + _isSupportFlex = !!(isSupportCss3 && isSupportCss3("flex")); } return _isSupportFlex; @@ -18,7 +22,7 @@ function isSupportFlex() { function isSupportGrid() { if (!_isSupportGrid) { - _isSupportGrid = !!(BI.isSupportCss3 && BI.isSupportCss3("grid")); + _isSupportGrid = !!(isSupportCss3 && isSupportCss3("grid")); } return _isSupportGrid; @@ -46,27 +50,27 @@ configWidget("bi.horizontal", ob => { const supportFlex = isSupportFlex(); // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 - // if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { - // return BI.extend({}, ob, {type: "bi.table_adapt"}); + // if (ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch) { + // return extend({}, ob, {type: "bi.table_adapt"}); // } if (supportFlex) { - return BI.extend({}, ob, { type: "bi.flex_horizontal" }); + return extend({}, ob, { type: "bi.flex_horizontal" }); } - return BI.extend({ + return extend({ scrollx: true, }, ob, { type: "bi.inline" }); }); configWidget("bi.vertical", ob => { - if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) { + if (ob.horizontalAlign === HorizontalAlign.Left || ob.horizontalAlign === HorizontalAlign.Right) { if (isSupportFlex()) { - return BI.extend({}, ob, { type: "bi.flex_vertical" }); + return extend({}, ob, { type: "bi.flex_vertical" }); } - return BI.extend({}, ob, { - horizontalAlign: BI.HorizontalAlign.Stretch, + return extend({}, ob, { + horizontalAlign: HorizontalAlign.Stretch, type: "bi.vertical", - items: BI.map(ob.items, (i, item) => { + items: map(ob.items, (i, item) => { return { type: "bi.inline", horizontalAlign: ob.horizontalAlign, @@ -75,10 +79,10 @@ configWidget("bi.vertical", ob => { }), }); } - if (ob.verticalAlign === BI.VerticalAlign.Stretch) { + if (ob.verticalAlign === VerticalAlign.Stretch) { if (isSupportFlex()) { - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Stretch, + return extend({ + horizontalAlign: HorizontalAlign.Stretch, }, ob, { type: "bi.flex_vertical" }); } } @@ -94,10 +98,10 @@ configWidget("bi.inline", ob => { } } else { let hasAuto = false, hasFill = false; - BI.each(ob.items, (i, item) => { + each(ob.items, (i, item) => { if (item.width === "fill") { hasFill = true; - } else if (BI.isNull(item.width) || item.width === "" || item.width === "auto") { + } else if (isNull(item.width) || item.width === "" || item.width === "auto") { hasAuto = true; } }); @@ -106,80 +110,80 @@ configWidget("bi.inline", ob => { if (hasAutoAndFillColumnSize) { // 宽度是不是受限 - if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === BI.HorizontalAlign.Stretch) { - return BI.extend({ - verticalAlign: BI.VerticalAlign.Top, + if ((ob.scrollable !== true && ob.scrollx !== true) || ob.horizontalAlign === HorizontalAlign.Stretch) { + return extend({ + verticalAlign: VerticalAlign.Top, }, ob, { type: "bi.horizontal_float_fill" }); } - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Stretch, + return extend({ + horizontalAlign: HorizontalAlign.Stretch, }, ob, { type: "bi.table_adapt" }); } - if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { - return BI.extend({}, ob, { type: "bi.responsive_inline" }); + if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { + return extend({}, ob, { type: "bi.responsive_inline" }); } return ob; }); configWidget("bi.center_adapt", ob => { const supportFlex = isSupportFlex(); - // var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; + // var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; // if (!isAdapt || justOneItem) { if (supportFlex) { - return BI.extend({}, ob, { type: "bi.flex_center_adapt" }); + return extend({}, ob, { type: "bi.flex_center_adapt" }); } - return BI.extend({}, ob, { type: "bi.inline_center_adapt" }); + return extend({}, ob, { type: "bi.inline_center_adapt" }); // } // return ob; }); configWidget("bi.vertical_adapt", ob => { const supportFlex = isSupportFlex(); - // var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; + // var isAdapt = ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; // if (!isAdapt || justOneItem) { if (supportFlex) { - return BI.extend({}, ob, { type: "bi.flex_vertical_center_adapt" }); + return extend({}, ob, { type: "bi.flex_vertical_center_adapt" }); } - return BI.extend({}, ob, { type: "bi.inline_vertical_adapt" }); + return extend({}, ob, { type: "bi.inline_vertical_adapt" }); // } // return ob; }); configWidget("bi.horizontal_adapt", ob => { const justOneItem = (ob.items && ob.items.length <= 1); - const isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch; - const verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === BI.VerticalAlign.TOP; + const isAdapt = !ob.horizontalAlign || ob.horizontalAlign === HorizontalAlign.Center || ob.horizontalAlign === HorizontalAlign.Stretch; + const verticalAlignTop = !ob.verticalAlign || ob.verticalAlign === VerticalAlign.TOP; if (verticalAlignTop && justOneItem) { - return BI.extend({}, ob, { type: "bi.horizontal_auto" }); + return extend({}, ob, { type: "bi.horizontal_auto" }); } const supportFlex = isSupportFlex(); // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景 if (isAdapt) { - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Center, + return extend({ + horizontalAlign: HorizontalAlign.Center, }, ob, { type: "bi.table_adapt" }); } if (supportFlex) { - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Center, + return extend({ + horizontalAlign: HorizontalAlign.Center, scrollx: false, }, ob, { type: "bi.flex_horizontal" }); } - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Center, + return extend({ + horizontalAlign: HorizontalAlign.Center, }, ob, { type: "bi.table_adapt" }); }); configWidget("bi.horizontal_float", ob => { if (isSupportFlex()) { - return BI.extend({}, ob, { type: "bi.flex_horizontal_adapt" }); + return extend({}, ob, { type: "bi.flex_horizontal_adapt" }); } if (ob.items && ob.items.length <= 1) { - return BI.extend({}, ob, { type: "bi.inline_horizontal_adapt" }); + return extend({}, ob, { type: "bi.inline_horizontal_adapt" }); } return ob; @@ -187,35 +191,35 @@ configWidget("bi.horizontal_float", ob => { configWidget("bi.horizontal_fill", ob => { if (isSupportFlex()) { - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Stretch, - verticalAlign: BI.VerticalAlign.Stretch, + return extend({ + horizontalAlign: HorizontalAlign.Stretch, + verticalAlign: VerticalAlign.Stretch, scrollx: false, }, ob, { type: "bi.flex_horizontal" }); } - if ((ob.horizontalAlign && ob.horizontalAlign !== BI.HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) { + if ((ob.horizontalAlign && ob.horizontalAlign !== HorizontalAlign.Stretch) || (ob.scrollable === true || ob.scrollx === true)) { // 宽度不受限,要用table布局 - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Stretch, - verticalAlign: BI.VerticalAlign.Stretch, + return extend({ + horizontalAlign: HorizontalAlign.Stretch, + verticalAlign: VerticalAlign.Stretch, }, ob, { type: "bi.table_adapt" }); } - return BI.extend({}, ob, { type: "bi.horizontal_float_fill" }); + return extend({}, ob, { type: "bi.horizontal_float_fill" }); }); configWidget("bi.vertical_fill", ob => { if (isSupportFlex()) { - return BI.extend({ - horizontalAlign: BI.HorizontalAlign.Stretch, - verticalAlign: BI.VerticalAlign.Stretch, + return extend({ + horizontalAlign: HorizontalAlign.Stretch, + verticalAlign: VerticalAlign.Stretch, scrolly: false, }, ob, { type: "bi.flex_vertical" }); } if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { // 有滚动条,降级到table布局处理 - return BI.extend({}, ob, { + return extend({}, ob, { type: "bi.td", - items: BI.map(ob.items, (i, item) => [item]), + items: map(ob.items, (i, item) => [item]), }); } let hasAuto = false; @@ -224,35 +228,35 @@ configWidget("bi.vertical_fill", ob => { hasAuto = true; } } else { - BI.each(ob.items, (i, item) => { - if (BI.isNull(item.height) || item.height === "") { + each(ob.items, (i, item) => { + if (isNull(item.height) || item.height === "") { hasAuto = true; } }); } if (hasAuto) { // 有自动高的时候 - return BI.extend({}, ob, { type: "bi.vtape_auto" }); + return extend({}, ob, { type: "bi.vtape_auto" }); } - return BI.extend({}, ob, { type: "bi.vtape" }); + return extend({}, ob, { type: "bi.vtape" }); }); configWidget("bi.horizontal_sticky", ob => { if (!isSupportSticky) { - return BI.extend({ scrollx: true }, ob, { type: "bi.horizontal_fill" }); + return extend({ scrollx: true }, ob, { type: "bi.horizontal_fill" }); } }); configWidget("bi.vertical_sticky", ob => { if (!isSupportSticky) { - return BI.extend({ scrolly: true }, ob, { type: "bi.vertical_fill" }); + return extend({ scrolly: true }, ob, { type: "bi.vertical_fill" }); } }); configWidget("bi.left_right_vertical_adapt", ob => { if (isSupportFlex()) { // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况 - // if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { - return BI.extend({}, ob, { type: "bi.flex_left_right_vertical_adapt" }); + // if (!isIE() || (ob.scrollable !== true && ob.scrolly !== true)) { + return extend({}, ob, { type: "bi.flex_left_right_vertical_adapt" }); // } } @@ -261,55 +265,55 @@ configWidget("bi.left_right_vertical_adapt", ob => { configWidget("bi.flex_horizontal", ob => { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { - if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { - return BI.extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" }); + if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { + return extend({}, ob, { type: "bi.responsive_flex_scrollable_horizontal" }); } - return BI.extend({}, ob, { type: "bi.flex_scrollable_horizontal" }); + return extend({}, ob, { type: "bi.flex_scrollable_horizontal" }); } } - if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) { - return BI.extend({}, ob, { type: "bi.responsive_flex_horizontal" }); + if (Providers.getProvider("bi.provider.system").getResponsiveMode()) { + return extend({}, ob, { type: "bi.responsive_flex_horizontal" }); } }); configWidget("bi.flex_vertical", ob => { if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) { - return BI.extend({}, ob, { type: "bi.flex_scrollable_vertical" }); + return extend({}, ob, { type: "bi.flex_scrollable_vertical" }); } } }); configWidget("bi.table", ob => { if (!isSupportGrid()) { - return BI.extend({}, ob, { type: "bi.td" }); + return extend({}, ob, { type: "bi.td" }); } return ob; }); configWidget("bi.radio", ob => { - if (BI.isIE() && BI.getIEVersion() <= 9) { - return BI.extend({}, ob, { type: "bi.image_radio" }); + if (isIE() && getIEVersion() <= 9) { + return extend({}, ob, { type: "bi.image_radio" }); } return ob; }); configWidget("bi.checkbox", ob => { - if (BI.isIE() && BI.getIEVersion() <= 9) { - return BI.extend({}, ob, { type: "bi.image_checkbox" }); + if (isIE() && getIEVersion() <= 9) { + return extend({}, ob, { type: "bi.image_checkbox" }); } return ob; }); configWidget("bi.half_icon_button", ob => { - if (BI.isIE() && BI.getIEVersion() < 9) { + if (isIE() && getIEVersion() < 9) { return ob; } - return BI.extend({}, ob, { type: "bi.half_button" }); + return extend({}, ob, { type: "bi.half_button" }); }); diff --git a/src/widget/datepane/datepane.js b/src/widget/datepane/datepane.js index a98d87325..a408c3287 100644 --- a/src/widget/datepane/datepane.js +++ b/src/widget/datepane/datepane.js @@ -67,21 +67,21 @@ export class DynamicDatePane extends Widget { const value = this.switcher.getValue()[0]; this.dateTab.setSelect(value); switch (value) { - case DynamicDatePane.Static: - date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); - break; - case DynamicDatePane.Dynamic: - this.dynamicPane.setValue({ - year: 0, - }); - break; - default: - break; + case DynamicDatePane.Static: + date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + break; + case DynamicDatePane.Dynamic: + this.dynamicPane.setValue({ + year: 0, + }); + break; + default: + break; } this.fireEvent(DynamicDatePane.EVENT_CHANGE); }, @@ -101,92 +101,92 @@ export class DynamicDatePane extends Widget { showIndex: DynamicDatePane.Static, cardCreator: v => { switch (v) { - case DynamicDatePane.Static: - return { - type: StaticDatePaneCard.xtype, - min: o.minDate, - max: o.maxDate, - behaviors: o.behaviors, - listeners: [ - { - eventName: "EVENT_CHANGE", - action: () => { - this.fireEvent(DynamicDatePane.EVENT_CHANGE); + case DynamicDatePane.Static: + return { + type: StaticDatePaneCard.xtype, + min: o.minDate, + max: o.maxDate, + behaviors: o.behaviors, + listeners: [ + { + eventName: "EVENT_CHANGE", + action: () => { + this.fireEvent(DynamicDatePane.EVENT_CHANGE); + }, }, + { + eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", + action: () => { + this.fireEvent(DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }, + } + ], + ref: _ref => { + this.ymd = _ref; }, - { - eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", - action: () => { - this.fireEvent(DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }; + case DynamicDatePane.Dynamic: + default: + return { + type: VTapeLayout.xtype, + items: [ + { + type: DynamicDateCard.xtype, + min: o.minDate, + max: o.maxDate, + ref: _ref => { + this.dynamicPane = _ref; + }, }, - } - ], - ref: _ref => { - this.ymd = _ref; - }, - }; - case DynamicDatePane.Dynamic: - default: - return { - type: VTapeLayout.xtype, - items: [ - { - type: DynamicDateCard.xtype, - min: o.minDate, - max: o.maxDate, - ref: _ref => { - this.dynamicPane = _ref; - }, - }, - { - el: { - type: CenterLayout.xtype, - items: [ - { - type: TextButton.xtype, - cls: "bi-high-light bi-border-top", - shadow: true, - text: i18nText("BI-Basic_Clear"), - textHeight: 23, - listeners: [ - { - eventName: TextButton.EVENT_CHANGE, - action: () => { - this.setValue(); - this.fireEvent(DynamicDatePane.EVENT_CHANGE); - }, - } - ], - }, - { - type: TextButton.xtype, - cls: "bi-border-left bi-high-light bi-border-top", - textHeight: 23, - shadow: true, - text: i18nText("BI-Basic_OK"), - listeners: [ - { - eventName: TextButton.EVENT_CHANGE, - action: () => { - const type = this.dateTab.getSelect(); - if (type === DynamicDateCombo.Dynamic) { - this.dynamicPane.checkValidation(true) && + { + el: { + type: CenterLayout.xtype, + items: [ + { + type: TextButton.xtype, + cls: "bi-high-light bi-border-top", + shadow: true, + text: i18nText("BI-Basic_Clear"), + textHeight: 23, + listeners: [ + { + eventName: TextButton.EVENT_CHANGE, + action: () => { + this.setValue(); + this.fireEvent(DynamicDatePane.EVENT_CHANGE); + }, + } + ], + }, + { + type: TextButton.xtype, + cls: "bi-border-left bi-high-light bi-border-top", + textHeight: 23, + shadow: true, + text: i18nText("BI-Basic_OK"), + listeners: [ + { + eventName: TextButton.EVENT_CHANGE, + action: () => { + const type = this.dateTab.getSelect(); + if (type === DynamicDateCombo.Dynamic) { + this.dynamicPane.checkValidation(true) && this.fireEvent( DynamicDatePopup.EVENT_CHANGE ); - } else { - this.fireEvent(DynamicDatePane.EVENT_CHANGE); - } - }, - } - ], - } - ], - }, - height: 24, - } - ], - }; + } else { + this.fireEvent(DynamicDatePane.EVENT_CHANGE); + } + }, + } + ], + } + ], + }, + height: 24, + } + ], + }; } }, } @@ -204,11 +204,11 @@ export class DynamicDatePane extends Widget { _checkValue(v) { switch (v.type) { - case DynamicDateCombo.Dynamic: - return isNotEmptyObject(v.value); - case DynamicDateCombo.Static: - default: - return true; + case DynamicDateCombo.Dynamic: + return isNotEmptyObject(v.value); + case DynamicDateCombo.Static: + default: + return true; } } @@ -233,21 +233,21 @@ export class DynamicDatePane extends Widget { this.switcher.setValue(type); this.dateTab.setSelect(type); switch (type) { - case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); - break; - case DynamicDateCombo.Static: - default: - if (this._checkValueValid(value)) { - const date = getDate(); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - }); - } else { - this.ymd.setValue(value); - } - break; + case DynamicDateCombo.Dynamic: + this.dynamicPane.setValue(value); + break; + case DynamicDateCombo.Static: + default: + if (this._checkValueValid(value)) { + const date = getDate(); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + }); + } else { + this.ymd.setValue(value); + } + break; } } diff --git a/src/widget/datetimepane/datetimepane.js b/src/widget/datetimepane/datetimepane.js index 9bad2963e..6faa2f4e1 100644 --- a/src/widget/datetimepane/datetimepane.js +++ b/src/widget/datetimepane/datetimepane.js @@ -69,21 +69,21 @@ export class DynamicDateTimePane extends Widget { let date; this.dateTab.setSelect(value); switch (value) { - case DynamicDateTimePane.Static: - date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); - break; - case DynamicDateTimePane.Dynamic: - this.dynamicPane.setValue({ - year: 0, - }); - break; - default: - break; + case DynamicDateTimePane.Static: + date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + break; + case DynamicDateTimePane.Dynamic: + this.dynamicPane.setValue({ + year: 0, + }); + break; + default: + break; } this.fireEvent(DynamicDateTimePane.EVENT_CHANGE); }, @@ -103,92 +103,92 @@ export class DynamicDateTimePane extends Widget { showIndex: DynamicDateTimePane.Static, cardCreator: v => { switch (v) { - case DynamicDateTimePane.Static: - return { - type: StaticDateTimePaneCard.xtype, - min: o.minDate, - max: o.maxDate, - behaviors: o.behaviors, - listeners: [ - { - eventName: "EVENT_CHANGE", - action: () => { - this.fireEvent(DynamicDateTimePane.EVENT_CHANGE); + case DynamicDateTimePane.Static: + return { + type: StaticDateTimePaneCard.xtype, + min: o.minDate, + max: o.maxDate, + behaviors: o.behaviors, + listeners: [ + { + eventName: "EVENT_CHANGE", + action: () => { + this.fireEvent(DynamicDateTimePane.EVENT_CHANGE); + }, }, + { + eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", + action: () => { + this.fireEvent(DynamicDateTimePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }, + } + ], + ref: _ref => { + this.ymd = _ref; }, - { - eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", - action: () => { - this.fireEvent(DynamicDateTimePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }; + case DynamicDateTimePane.Dynamic: + default: + return { + type: VTapeLayout.xtype, + items: [ + { + type: DynamicDateCard.xtype, + min: o.minDate, + max: o.maxDate, + ref: _ref => { + this.dynamicPane = _ref; + }, }, - } - ], - ref: _ref => { - this.ymd = _ref; - }, - }; - case DynamicDateTimePane.Dynamic: - default: - return { - type: VTapeLayout.xtype, - items: [ - { - type: DynamicDateCard.xtype, - min: o.minDate, - max: o.maxDate, - ref: _ref => { - this.dynamicPane = _ref; - }, - }, - { - el: { - type: CenterLayout.xtype, - items: [ - { - type: TextButton.xtype, - cls: "bi-high-light bi-border-top", - shadow: true, - text: i18nText("BI-Basic_Clear"), - textHeight: 23, - listeners: [ - { - eventName: TextButton.EVENT_CHANGE, - action: () => { - this.setValue(); - this.fireEvent(DynamicDatePane.EVENT_CHANGE); - }, - } - ], - }, - { - type: TextButton.xtype, - cls: "bi-border-left bi-high-light bi-border-top", - textHeight: 23, - shadow: true, - text: i18nText("BI-Basic_OK"), - listeners: [ - { - eventName: TextButton.EVENT_CHANGE, - action: () => { - const type = this.dateTab.getSelect(); - if (type === DynamicDateCombo.Dynamic) { - this.dynamicPane.checkValidation(true) && + { + el: { + type: CenterLayout.xtype, + items: [ + { + type: TextButton.xtype, + cls: "bi-high-light bi-border-top", + shadow: true, + text: i18nText("BI-Basic_Clear"), + textHeight: 23, + listeners: [ + { + eventName: TextButton.EVENT_CHANGE, + action: () => { + this.setValue(); + this.fireEvent(DynamicDatePane.EVENT_CHANGE); + }, + } + ], + }, + { + type: TextButton.xtype, + cls: "bi-border-left bi-high-light bi-border-top", + textHeight: 23, + shadow: true, + text: i18nText("BI-Basic_OK"), + listeners: [ + { + eventName: TextButton.EVENT_CHANGE, + action: () => { + const type = this.dateTab.getSelect(); + if (type === DynamicDateCombo.Dynamic) { + this.dynamicPane.checkValidation(true) && this.fireEvent( DynamicDatePane.EVENT_CHANGE ); - } else { - this.fireEvent(DynamicDatePane.EVENT_CHANGE); - } - }, - } - ], - } - ], - }, - height: 24, - } - ], - }; + } else { + this.fireEvent(DynamicDatePane.EVENT_CHANGE); + } + }, + } + ], + } + ], + }, + height: 24, + } + ], + }; } }, } @@ -206,11 +206,11 @@ export class DynamicDateTimePane extends Widget { _checkValue(v) { switch (v.type) { - case DynamicDateCombo.Dynamic: - return isNotEmptyObject(v.value); - case DynamicDateCombo.Static: - default: - return true; + case DynamicDateCombo.Dynamic: + return isNotEmptyObject(v.value); + case DynamicDateCombo.Static: + default: + return true; } } @@ -235,21 +235,21 @@ export class DynamicDateTimePane extends Widget { this.switcher.setValue(type); this.dateTab.setSelect(type); switch (type) { - case DynamicDateTimePane.Dynamic: - this.dynamicPane.setValue(value); - break; - case DynamicDateTimePane.Static: - default: - if (this._checkValueValid(value)) { - const date = getDate(); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - }); - } else { - this.ymd.setValue(value); - } - break; + case DynamicDateTimePane.Dynamic: + this.dynamicPane.setValue(value); + break; + case DynamicDateTimePane.Static: + default: + if (this._checkValueValid(value)) { + const date = getDate(); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + }); + } else { + this.ymd.setValue(value); + } + break; } } diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index f67b2d59f..c75d3827c 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -113,7 +113,7 @@ export class DynamicDateTimeSelect extends Widget { { eventName: SignEditor.EVENT_CHANGE, action: () => { - const value = this._autoSwitch(this.getValue(), DynamicDateTimeSelect.MINUTE); + const value = this._autoSwitch(this.minute.getValue(), DynamicDateTimeSelect.MINUTE); this.minute.setValue(value); }, } diff --git a/webpack/attachments.js b/webpack/attachments.js index f04bf8ed7..0fa901609 100644 --- a/webpack/attachments.js +++ b/webpack/attachments.js @@ -6,6 +6,7 @@ const fixCompact = "./dist/fix/fix.compact.js"; const workerCompact = './dist/fix/worker.compact.js'; const lodashJs = "src/core/1.lodash.js"; const jqueryJs = "src/core/platform/web/jquery/_jquery.js"; +const popperJs = "src/core/controller/popper.js"; const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"]; @@ -19,6 +20,8 @@ const basicAttachmentMap = { "src/less/theme/**/*.less", lodashJs, jqueryJs, + popperJs, + "src/bundle.js", // "src/core/**/*.js", // "src/data/**/*.js", ]), @@ -238,7 +241,6 @@ const demo = [].concat( basicAttachmentMap.core, basicAttachmentMap.fix, basicAttachmentMap.config, - sync(["src/bundle.js"]), basicAttachmentMap.base, basicAttachmentMap.case, basicAttachmentMap.widget,