Browse Source

Merge branch 'es6' of ssh://code.fineres.com:7999/~dailer/fineui into es6

es6
zsmj 2 years ago
parent
commit
47a9ac4d31
  1. 13
      src/base/0.base.js
  2. 2
      src/base/1.pane.js
  3. 2
      src/base/combination/bubble.js
  4. 4
      src/base/combination/combo.js
  5. 2
      src/base/combination/expander.js
  6. 2
      src/base/combination/group.button.js
  7. 2
      src/base/combination/group.combo.js
  8. 2
      src/base/combination/group.virtual.js
  9. 12
      src/base/combination/index.js
  10. 2
      src/base/combination/loader.js
  11. 2
      src/base/combination/navigation.js
  12. 4
      src/base/combination/searcher.js
  13. 2
      src/base/combination/switcher.js
  14. 2
      src/base/combination/tab.js
  15. 4
      src/base/combination/tree.button.js
  16. 54
      src/base/foundation/message.js
  17. 98
      src/base/index.js
  18. 4
      src/base/layer/index.js
  19. 2
      src/base/layer/layer.drawer.js
  20. 2
      src/base/layer/layer.popup.js
  21. 4
      src/base/layer/layer.searcher.js
  22. 3
      src/base/list/index.js
  23. 2
      src/base/list/listview.js
  24. 2
      src/base/list/virtualgrouplist.js
  25. 2
      src/base/list/virtuallist.js
  26. 2
      src/base/single/0.single.js
  27. 6
      src/base/single/1.text.js
  28. 4
      src/base/single/a/a.js
  29. 4
      src/base/single/index.js
  30. 4
      src/base/single/tip/0.tip.js
  31. 3
      src/base/single/tip/index.js
  32. 4
      src/base/single/tip/tip.toast.js
  33. 4
      src/base/single/tip/tip.tooltip.js
  34. 121
      src/core/2.base.js
  35. 6
      src/core/3.ob.js
  36. 16
      src/core/4.widget.js
  37. 26
      src/core/5.inject.js
  38. 4
      src/core/action/action.js
  39. 4
      src/core/action/action.show.js
  40. 2
      src/core/action/index.js
  41. 4
      src/core/behavior/0.behavior.js
  42. 4
      src/core/behavior/behavior.highlight.js
  43. 4
      src/core/behavior/behavior.redmark.js
  44. 3
      src/core/behavior/index.js
  45. 4
      src/core/controller/0.controller.js
  46. 4
      src/core/controller/controller.broadcast.js
  47. 4
      src/core/controller/controller.bubbles.js
  48. 4
      src/core/controller/controller.drawer.js
  49. 4
      src/core/controller/controller.layer.js
  50. 4
      src/core/controller/controller.masker.js
  51. 4
      src/core/controller/controller.popover.js
  52. 4
      src/core/controller/controller.resizer.js
  53. 4
      src/core/controller/controller.tooltips.js
  54. 9
      src/core/controller/index.js
  55. 17
      src/core/func/index.js
  56. 90
      src/core/index.js
  57. 6
      src/core/listener/listener.show.js
  58. 4
      src/core/loader/loader.style.js

13
src/base/0.base.js

@ -8,7 +8,6 @@ import {
ResizeController,
TooltipsController,
StyleLoaderManager,
extend
} from "../core";
const Resizers = new ResizeController();
@ -21,18 +20,6 @@ const Drawers = new DrawerController();
const Broadcasts = new BroadcastController();
const StyleLoaders = new StyleLoaderManager();
extend(BI, {
Resizers,
Layers,
Maskers,
Bubbles,
Tooltips,
Popovers,
Drawers,
Broadcasts,
StyleLoaders
});
export {
Resizers,
Layers,

2
src/base/1.pane.js

@ -10,7 +10,7 @@ import { Widget, shortcut, isNotEmptyString, extend, isNull, isEmpty, createWidg
import { Layers } from "./0.base";
@shortcut()
export default class Pane extends Widget {
export class Pane extends Widget {
static xtype = "bi.pane";
static EVENT_LOADED = "EVENT_LOADED";
static EVENT_LOADING = "EVENT_LOADING";

2
src/base/combination/bubble.js

@ -5,7 +5,7 @@
import { shortcut, Widget, Controller, extend, nextTick, createWidget, each, defer, debounce, delay, isNull, isFunction, contains, bind } from "../../core";
@shortcut()
export default class Bubble extends Widget {
export class Bubble extends Widget {
static xtype = "bi.bubble";
static EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";

4
src/base/combination/combo.js

@ -4,14 +4,14 @@
*/
import { shortcut, Widget, Controller, extend, createWidget, nextTick, bind, isNotNull, isNull, isFunction, each } from "../../core";
import Bubble from "./bubble";
import { Bubble } from "./bubble";
import { Resizers } from "../0.base";
let needHideWhenAnotherComboOpen = {};
let currentOpenedCombos = {};
@shortcut()
export default class Combo extends Bubble {
export class Combo extends Bubble {
static xtype = "bi.combo";
static EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";

2
src/base/combination/expander.js

@ -9,7 +9,7 @@
import { shortcut, Widget, Controller, extend, nextTick, each, debounce, isNull, createWidget } from "../../core";
@shortcut()
export default class Expander extends Widget {
export class Expander extends Widget {
static xtype = "bi.expander";
static EVENT_EXPAND = "EVENT_EXPAND";

2
src/base/combination/group.button.js

@ -6,7 +6,7 @@
import { shortcut, Widget, Controller, extend, createWidget, createWidgets, each, isFunction, isKey, isNotEmptyArray, createItems, isArray, remove, map, stripEL, makeArrayByArray, clone, deepClone, formatEL, isEmpty, concat, removeAt, deepContains, has, any } from "../../core";
@shortcut()
export default class ButtonGroup extends Widget {
export class ButtonGroup extends Widget {
static xtype = "bi.button_group";
static EVENT_CHANGE = "EVENT_CHANGE";

2
src/base/combination/group.combo.js

@ -5,7 +5,7 @@
import { shortcut, Widget, Controller, extend, isEmpty, each, formatEL, clone, createWidget } from "../../core";
@shortcut()
export default class ComboGroup extends Widget {
export class ComboGroup extends Widget {
static xtype = "bi.combo_group";
static EVENT_CHANGE = "EVENT_CHANGE";

2
src/base/combination/group.virtual.js

@ -1,7 +1,7 @@
import { shortcut, Widget, Controller, extend, isFunction, isKey, isArray, map, stripEL, deepClone, formatEL, isEmpty, each, createWidget } from "../../core";
@shortcut()
export default class VirtualGroup extends Widget {
export class VirtualGroup extends Widget {
static xtype = "bi.virtual_group";
static EVENT_CHANGE = "EVENT_CHANGE";

12
src/base/combination/index.js

@ -0,0 +1,12 @@
export { Bubble } from "./bubble";
export { Combo } from "./combo";
export { Expander } from "./expander";
export { ButtonGroup } from "./group.button";
export { ComboGroup } from "./group.combo";
export { VirtualGroup } from "./group.virtual";
export { Loader } from "./loader";
export { Navigation } from "./navigation";
export { Searcher } from "./searcher";
export { Switcher } from "./switcher";
export { Tab } from "./tab";
export { ButtonTree } from "./tree.button";

2
src/base/combination/loader.js

@ -8,7 +8,7 @@
import { shortcut, Widget, Controller, extend, createWidget, isEmpty, nextTick, bind, isFunction, isNotEmptyArray, isNumber, isObject, each } from "../../core";
@shortcut()
export default class Loader extends Widget {
export class Loader extends Widget {
static xtype = "bi.loader";
static EVENT_CHANGE = "EVENT_CHANGE";

2
src/base/combination/navigation.js

@ -4,7 +4,7 @@
import { shortcut, Widget, Controller, extend, createWidget, bind, ShowListener, isFunction, each, nextTick, isKey, values } from "../../core";
@shortcut()
export default class Navigation extends Widget {
export class Navigation extends Widget {
static xtype = "bi.navigation";
static EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/searcher.js

@ -6,11 +6,11 @@
* @extends BI.Widget
*/
import { shortcut, Widget, Controller, extend, createWidget, debounce, bind, endWith, deepWithout, nextTick, isEmptyString, isNull } from "../../core";
import ButtonGroup from "./group.button";
import { ButtonGroup } from "./group.button";
import { Maskers } from "../0.base";
@shortcut()
export default class Searcher extends Widget {
export class Searcher extends Widget {
static xtype = "bi.searcher";
static EVENT_CHANGE = "EVENT_CHANGE";

2
src/base/combination/switcher.js

@ -10,7 +10,7 @@ import { shortcut, Widget, Controller, extend, nextTick, createWidget, each, deb
import { Maskers } from "../0.base";
@shortcut()
export default class Switcher extends Widget {
export class Switcher extends Widget {
static xtype = "bi.switcher";
static EVENT_EXPAND = "EVENT_EXPAND";

2
src/base/combination/tab.js

@ -4,7 +4,7 @@
import { shortcut, Widget, Controller, ShowListener, extend, createWidget, isObject, each, isFunction, contains, any, isEqual } from "../../core";
@shortcut()
export default class Tab extends Widget {
export class Tab extends Widget {
static xtype = "bi.tab";
static EVENT_CHANGE = "EVENT_CHANGE";

4
src/base/combination/tree.button.js

@ -4,10 +4,10 @@
* @extends BI.ButtonGroup
*/
import { shortcut, Widget, extend, isArray, each, isFunction, deepContains, concat, any, contains } from "../../core";
import ButtonGroup from "./group.button";
import { ButtonGroup } from "./group.button";
@shortcut()
export default class ButtonTree extends ButtonGroup {
export class ButtonTree extends ButtonGroup {
static xtype = "bi.button_tree";
static EVENT_CHANGE = "EVENT_CHANGE";

54
src/base/foundation/message.js

@ -3,12 +3,14 @@
* 弹出提示消息框用于模拟阻塞操作通过回调函数实现
* @class BI.Msg
*/
BI.Msg = ((function () {
var $mask, $pop;
import { Widget, isString, isNull, isFunction, createWidget, remove, each } from "../../core"
var messageShows = [];
export const Msg = ((() => {
let $mask, $pop;
var toastStack = [];
let messageShows = [];
let toastStack = [];
return {
alert: function (title, message, callback) {
@ -21,13 +23,13 @@ BI.Msg = ((function () {
// BI.Msg.prompt(title, message, value, callback, min_width);
},
toast: function (message, options, context) {
BI.isString(options) && (options = { level: options });
isString(options) && (options = { level: options });
options = options || {};
context = context || BI.Widget._renderEngine.createElement("body");
var level = options.level || "common";
var autoClose = BI.isNull(options.autoClose) ? true : options.autoClose;
var callback = BI.isFunction(options.callback) ? options.callback : BI.emptyFn;
var toast = BI.createWidget({
context = context || Widget._renderEngine.createElement("body");
const level = options.level || "common";
const autoClose = isNull(options.autoClose) ? true : options.autoClose;
const callback = isFunction(options.callback) ? options.callback : BI.emptyFn;
const toast = createWidget({
type: "bi.toast",
cls: "bi-message-animate bi-message-leave",
level: level,
@ -37,9 +39,9 @@ BI.Msg = ((function () {
listeners: [{
eventName: BI.Toast.EVENT_DESTORY,
action: function () {
BI.remove(toastStack, toast.element);
var _height = BI.SIZE_CONSANTS.TOAST_TOP;
BI.each(toastStack, function (i, element) {
remove(toastStack, toast.element);
let _height = BI.SIZE_CONSANTS.TOAST_TOP;
each(toastStack, function (i, element) {
element.css({ "top": _height });
_height += element.outerHeight() + 10;
});
@ -47,11 +49,11 @@ BI.Msg = ((function () {
},
}],
});
var height = BI.SIZE_CONSANTS.TOAST_TOP;
BI.each(toastStack, function (i, element) {
const height = BI.SIZE_CONSANTS.TOAST_TOP;
each(toastStack, function (i, element) {
height += element.outerHeight() + 10;
});
BI.createWidget({
createWidget({
type: "bi.absolute",
element: context,
items: [{
@ -75,7 +77,7 @@ BI.Msg = ((function () {
};
},
_show: function (hasCancel, title, message, callback) {
BI.isNull($mask) && ($mask = BI.Widget._renderEngine.createElement("<div class=\"bi-z-index-mask\">").css({
isNull($mask) && ($mask = Widget._renderEngine.createElement("<div class=\"bi-z-index-mask\">").css({
position: "absolute",
zIndex: BI.zIndex_tip - 2,
top: 0,
@ -84,7 +86,7 @@ BI.Msg = ((function () {
bottom: 0,
opacity: 0.5,
}).appendTo("body"));
$pop = BI.Widget._renderEngine.createElement("<div class=\"bi-message-depend\">").css({
$pop = Widget._renderEngine.createElement("<div class=\"bi-message-depend\">").css({
position: "absolute",
zIndex: BI.zIndex_tip - 1,
top: 0,
@ -100,7 +102,7 @@ BI.Msg = ((function () {
$mask = null;
}
}
var controlItems = [];
let controlItems = [];
if (hasCancel === true) {
controlItems.push({
el: {
@ -109,7 +111,7 @@ BI.Msg = ((function () {
level: "ignore",
handler: function () {
close();
if (BI.isFunction(callback)) {
if (isFunction(callback)) {
callback.apply(null, [false]);
}
},
@ -122,13 +124,13 @@ BI.Msg = ((function () {
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
close();
if (BI.isFunction(callback)) {
if (isFunction(callback)) {
callback.apply(null, [true]);
}
},
},
});
var conf = {
const conf = {
element: $pop,
type: "bi.center_adapt",
items: [
@ -141,13 +143,13 @@ BI.Msg = ((function () {
this.element.keyup(function (e) {
if (e.keyCode === BI.KeyCode.ENTER) {
close();
if (BI.isFunction(callback)) {
if (isFunction(callback)) {
callback.apply(null, [true]);
}
} else if (e.keyCode === BI.KeyCode.ESCAPE) {
close();
if (hasCancel === true) {
if (BI.isFunction(callback)) {
if (isFunction(callback)) {
callback.apply(null, [false]);
}
}
@ -183,7 +185,7 @@ BI.Msg = ((function () {
// height: 50,
handler: function () {
close();
if (BI.isFunction(callback)) {
if (isFunction(callback)) {
callback.apply(null, [false]);
}
},
@ -228,7 +230,7 @@ BI.Msg = ((function () {
],
};
messageShows[messageShows.length] = BI.createWidget(conf);
messageShows[messageShows.length] = createWidget(conf);
},
};
})());

98
src/base/index.js

@ -1,93 +1,31 @@
import { extend } from "../core";
import Pane from "./1.pane";
import Single from "./single/0.single";
import Text from "./single/1.text";
import A from "./single/a/a";
import Tip from "./single/tip/0.tip";
import Toast from "./single/tip/tip.toast";
import Tooltip from "./single/tip/tip.tooltip";
import Drawer from "./layer/layer.drawer";
import { Popover, BarPopover } from "./layer/layer.popover";
import PopupView from "./layer/layer.popup";
import SearcherView from "./layer/layer.searcher";
import ListView from "./list/listview";
import VirtualGroupList from "./list/virtualgrouplist";
import VirtualList from "./list/virtuallist";
import { Pane } from "./1.pane";
import * as single from "./single";
import * as layer from "./layer";
import * as list from "./list";
import GridView from "./grid/grid";
import Pager from "./pager/pager";
import Bubble from "./combination/bubble";
import Combo from "./combination/combo";
import Expander from "./combination/expander";
import ButtonGroup from "./combination/group.button";
import ComboGroup from "./combination/group.combo";
import VirtualGroup from "./combination/group.virtual";
import Loader from "./combination/loader";
import Navigation from "./combination/navigation";
import Searcher from "./combination/searcher";
import Switcher from "./combination/switcher";
import Tab from "./combination/tab";
import ButtonTree from "./combination/tree.button";
import * as combination from "./combination";
import { Msg } from "./foundation/message";
extend(BI, {
Object.assign(BI, {
Pane,
Single,
Text,
A,
Tip,
Toast,
Tooltip,
Drawer,
Popover,
BarPopover,
PopupView,
SearcherView,
ListView,
VirtualGroupList,
VirtualList,
...layer,
...list,
...single,
GridView,
Pager,
Bubble,
Combo,
Expander,
ButtonGroup,
ComboGroup,
VirtualGroup,
Loader,
Navigation,
Searcher,
Switcher,
Tab,
ButtonTree,
...combination,
Msg,
});
export * from "./0.base";
export * from "./combination";
export * from "./layer";
export * from "./list";
export * from "./single";
export {
Pane,
Single,
Text,
A,
Tip,
Toast,
Tooltip,
Drawer,
Popover,
BarPopover,
PopupView,
SearcherView,
ListView,
VirtualGroupList,
VirtualList,
GridView,
Pager,
Bubble,
Combo,
Expander,
ButtonGroup,
ComboGroup,
VirtualGroup,
Loader,
Navigation,
Searcher,
Switcher,
Tab,
ButtonTree,
Msg,
}

4
src/base/layer/index.js

@ -0,0 +1,4 @@
export { Drawer } from "./layer.drawer";
export { Popover, BarPopover } from "./layer.popover";
export { PopupView } from "./layer.popup";
export { SearcherView } from "./layer.searcher";

2
src/base/layer/layer.drawer.js

@ -6,7 +6,7 @@
import { Widget, shortcut } from "../../core";
@shortcut()
export default class Drawer extends Widget {
export class Drawer extends Widget {
SIZE = {
SMALL: "small",
NORMAL: "normal",

2
src/base/layer/layer.popup.js

@ -6,7 +6,7 @@
import { Widget, shortcut } from "../../core";
@shortcut()
export default class PopupView extends Widget {
export class PopupView extends Widget {
_const = {
TRIANGLE_LENGTH: 12,
}

4
src/base/layer/layer.searcher.js

@ -7,10 +7,10 @@
*/
import { shortcut } from "../../core";
import Pane from "../1.pane";
import { Pane } from "../1.pane";
@shortcut()
export default class SearcherView extends Pane {
export class SearcherView extends Pane {
static xtype = "bi.searcher_view";
static EVENT_CHANGE = "EVENT_CHANGE";

3
src/base/list/index.js

@ -0,0 +1,3 @@
export { ListView } from "./listview";
export { VirtualGroupList } from "./virtualgrouplist";
export { VirtualList } from "./virtuallist";

2
src/base/list/listview.js

@ -7,7 +7,7 @@
*/
import { Widget, shortcut } from "../../core";
@shortcut()
export default class ListView extends Widget {
export class ListView extends Widget {
props() {
return {
baseCls: "bi-list-view",

2
src/base/list/virtualgrouplist.js

@ -8,7 +8,7 @@
import { Widget, shortcut } from "../../core";
@shortcut()
export default class VirtualGroupList extends Widget {
export class VirtualGroupList extends Widget {
props() {
return {
baseCls: "bi-virtual-group-list",

2
src/base/list/virtuallist.js

@ -8,7 +8,7 @@
import { Widget, shortcut } from "../../core";
@shortcut()
export default class VirtualList extends Widget {
export class VirtualList extends Widget {
props() {
return {
baseCls: "bi-virtual-list",

2
src/base/single/0.single.js

@ -14,7 +14,7 @@ import { Widget, shortcut } from "../../core";
import { Tooltips } from "../0.base";
@shortcut()
export default class Single extends Widget {
export class Single extends Widget {
static xtype = "bi.single";
_defaultConfig() {

6
src/base/single/1.text.js

@ -3,11 +3,11 @@
* @class BI.Text
* @extends BI.Single
*/
import { shortcut } from "../../core/decorator";
import { Single } from "../index";
import { shortcut } from "../../core";
import { Single } from "./0.single";
@shortcut()
export default class Text extends Single {
export class Text extends Single {
static xtype = "bi.text";
props = {

4
src/base/single/a/a.js

@ -7,9 +7,9 @@
* @abstract
*/
import { shortcut } from "../../../core";
import Text from "../1.text";
import { Text } from "../1.text";
@shortcut()
export default class A extends Text {
export class A extends Text {
static xtype = "bi.a";
_defaultConfig() {

4
src/base/single/index.js

@ -0,0 +1,4 @@
export { Single } from "./0.single";
export { Text } from "./1.text";
export { A } from "./a/a";
export * from "./tip";

4
src/base/single/tip/0.tip.js

@ -7,8 +7,8 @@
* @abstract
*/
import Single from "../0.single";
export default class Tip extends Single {
import { Single } from "../0.single";
export class Tip extends Single {
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return BI.extend(conf, {

3
src/base/single/tip/index.js

@ -0,0 +1,3 @@
export { Tip } from "./0.tip";
export { Toast } from "./tip.toast";
export { Tooltip } from "./tip.tooltip";

4
src/base/single/tip/tip.toast.js

@ -7,9 +7,9 @@
*/
import { shortcut } from "../../../core";
import Tip from "./0.tip";
import { Tip } from "./0.tip";
@shortcut()
export default class Toast extends Tip {
export class Toast extends Tip {
_const= {
closableMinWidth: 146,
minWidth: 100,

4
src/base/single/tip/tip.tooltip.js

@ -7,9 +7,9 @@
*/
import { shortcut } from "../../../core";
import Tip from "./0.tip";
import { Tip } from "./0.tip";
@shortcut()
export default class Tooltip extends Tip {
export class Tooltip extends Tip {
_const = {
hgap: 8,
vgap: 4,

121
src/core/2.base.js

@ -139,20 +139,6 @@ export function trans2Element(widgets) {
return map(widgets, (i, wi) => wi.element);
}
// Utility
BI._.extend(BI, {
assert,
warn,
UUID,
isWidget,
createWidgets,
createItems,
packageItems,
formatEL,
stripEL,
trans2Element,
});
// 集合相关方法
BI._.each(["where", "findWhere", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) {
BI[name] = _apply(name);
@ -384,27 +370,6 @@ export function int2Abc(num) {
return str;
}
BI._.extend(BI, {
count,
inverse,
firstKey,
lastKey,
firstObject,
lastObject,
concat,
backEach,
backAny,
backEvery,
backFindKey,
backFind,
remove,
removeAt,
string2Array,
array2String,
abc2Int,
int2Abc,
});
// 数组相关的方法
BI._.each([
"first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
@ -493,13 +458,6 @@ export function uniq(array, isSorted, iteratee, context) {
return uniq.call(BI._, array, isSorted, iteratee, context);
}
BI._.extend(BI, {
makeArray,
makeObject,
makeArrayByArray,
uniq,
});
// 对象相关方法
BI._.each([
"keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn",
@ -652,24 +610,6 @@ export function isPromise(obj) {
return !!obj && (isObject(obj) || isFunction(obj)) && isFunction(obj.then);
}
BI._.extend(BI, {
inherit,
init,
has,
freeze,
isKey,
isCapitalEqual,
isWidthOrHeight,
isNotNull,
isNull,
isEmptyArray,
isNotEmptyArray,
isEmptyObject,
isNotEmptyObject,
isWindow,
isPromise,
});
export const deepClone = BI._.cloneDeep;
export const deepExtend = BI._.deepExtend;
@ -781,20 +721,6 @@ export function deepDiff(object, other) {
return result;
}
// deep方法
BI._.extend(BI, {
deepClone: BI._.cloneDeep,
deepExtend: BI._.merge,
isDeepMatch,
contains,
deepContains,
deepIndexOf,
deepRemove,
deepWithout,
deepUnique,
deepDiff,
});
// 通用方法
BI._.each(["uniqueId", "result", "chain", "iteratee", "unescape", "before", "after", "chunk"], function (name) {
BI[name] = function () {
@ -893,8 +819,6 @@ export const nextTick = (function () {
};
})();
BI._.extend(BI, { nextTick });
// 数字相关方法
BI._.each(["random"], function (name) {
BI[name] = _apply(name);
@ -985,22 +909,6 @@ export function average(array, iteratee, context) {
return sumResult / array.length;
}
BI._.extend(BI, {
parseInt,
parseSafeInt,
parseFloat,
isNaturalNumber,
isPositiveInteger,
isNegativeInteger,
isInteger,
isNumeric,
isFloat,
isOdd,
isEven,
sum,
average,
});
export function trim() {
return BI._.trim.apply(BI._, arguments);
}
@ -1126,25 +1034,6 @@ export function format(format) {
return format.replace(/\{(\d+)\}/g, (m, i) => args[i]);
}
// 字符串相关方法
BI._.extend(BI, {
trim,
toUpperCase,
toLowerCase,
isEndWithBlank,
isLiteral,
stripQuotes,
camelize,
hyphenate,
isNotEmptyString,
isEmptyString,
encrypt,
decrypt,
escape,
leftPad,
format,
});
/**
* 是否是闰年
* @param year
@ -1454,15 +1343,5 @@ export function getTime() {
return dt.getTime() - BI.timeZone - new Date().getTimezoneOffset() * 60000;
}
return dt.getTime();
}
// 日期相关方法
BI._.extend(BI, {
isLeapYear,
checkDateVoid,
checkDateLegal,
parseDateTime,
getDate,
getTime,
});

6
src/core/3.ob.js

@ -1,4 +1,4 @@
import { isFunction, isArray, isObject, isArguments, reduce, bind, extend } from "./2.base";
import { isFunction, isArray, isObject, isArguments, reduce, bind } from "./2.base";
function obExtend() {
let target = arguments[0] || {}, length = arguments.length, i = 1, name, copy;
@ -26,7 +26,7 @@ function obExtend() {
return target;
}
export default class OB {
export class OB {
// props = {};
// init = null;
@ -215,5 +215,3 @@ export default class OB {
this.purgeListeners();
}
}
extend(BI, { OB });

16
src/core/4.widget.js

@ -7,7 +7,7 @@
*/
import { isFunction, isArray, each, extend, isPlainObject, isNull, uniqueId, isWidget, isWidthOrHeight, isKey, remove, any, isNotNull } from "./2.base";
import OB from "./3.ob";
import { OB } from "./3.ob";
import { Providers, _lazyCreateWidget } from "./5.inject";
const cancelAnimationFrame =
@ -35,7 +35,7 @@ function callLifeHook(self, life) {
});
}
export default class Widget extends OB {
export class Widget extends OB {
_defaultConfig () {
return extend(super._defaultConfig(), {
root: false,
@ -1079,15 +1079,3 @@ export function mount(widget, container, predicate, hydrate) {
}
return widget._mount(true, false, false, predicate);
}
extend(BI, {
Widget,
useStore,
useContext,
watch,
onBeforeMount,
onMounted,
onBeforeUnmount,
onUnmounted,
mount,
});

26
src/core/5.inject.js

@ -1,6 +1,6 @@
import { isFunction, isNull, isNotNull, isArray, each, isWidget, extend, init, isEmpty, remove } from "./2.base";
import OB from "./3.ob";
import Widget from "./4.widget"
import { OB } from "./3.ob";
import { Widget } from "./4.widget"
let moduleInjection = {}, moduleInjectionMap = {
components: {},
@ -39,7 +39,6 @@ export function module(xtype, cls) {
return () => Modules.getModule(xtype);
}
BI.module = BI.module || module;
let constantInjection = {};
export function constant(xtype, cls) {
@ -51,7 +50,6 @@ export function constant(xtype, cls) {
return () => Constants.getConstant(xtype);
}
BI.constant = BI.constant || constant;
let modelInjection = {};
export function model(xtype, cls) {
@ -63,7 +61,6 @@ export function model(xtype, cls) {
return (config) => Models.getModel(xtype, config);
}
BI.model = BI.model || model;
let storeInjection = {};
export function store(xtype, cls) {
@ -75,7 +72,6 @@ export function store(xtype, cls) {
return (config) => Stores.getStore(xtype, config);
}
BI.store = BI.store || store;
let serviceInjection = {};
export function service(xtype, cls) {
@ -87,7 +83,6 @@ export function service(xtype, cls) {
return (config) => Services.getService(xtype, config);
}
BI.service = BI.service || service;
let providerInjection = {};
export function provider(xtype, cls) {
@ -99,7 +94,6 @@ export function provider(xtype, cls) {
return (config) => Providers.getProvider(xtype, config);
}
BI.provider = BI.provider || provider;
let configFunctions = OB.configFunctions = {};
const runConfigFunction = function (type, configFn) {
@ -200,12 +194,10 @@ export function config(type, configFn, opt) {
return runConfigFunction(type, configFn);
}
}
BI.config = BI.config || config;
export function getReference(type, fn) {
return BI.Plugin.registerObject(type, fn);
}
BI.getReference = BI.getReference || getReference;
let actions = {};
let globalAction = [];
@ -227,7 +219,6 @@ export function action(type, actionFn) {
}
};
}
BI.action = BI.action || action;
let points = {};
export function point(type, action, pointFn, after) {
@ -242,7 +233,6 @@ export function point(type, action, pointFn, after) {
}
points[type][action][after ? "after" : "before"].push(pointFn);
}
BI.point = BI.point || point;
export const Modules = {
getModule: function (type) {
@ -255,7 +245,6 @@ export const Modules = {
return moduleInjection;
}
}
BI.Modules = BI.Modules || Modules;
export const Constants = {
getConstant: function (type) {
@ -266,7 +255,6 @@ export const Constants = {
return isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type];
}
}
BI.Constants = BI.Constants || Constants;
const callPoint = function (inst, types) {
types = isArray(types) ? types : [types];
@ -319,7 +307,6 @@ export const Models = {
return inst;
}
}
BI.Models = BI.Models || Models;
let stores = {};
export const Stores = {
@ -338,7 +325,6 @@ export const Stores = {
return inst;
}
}
BI.Stores = BI.Stores || Stores;
let services = {};
export const Services = {
@ -354,7 +340,6 @@ export const Services = {
return services[type];
}
}
BI.Services = BI.Services || Services;
let providers = {},
providerInstance = {};
@ -373,7 +358,6 @@ export const Providers = {
return providerInstance[type];
}
}
BI.Providers = BI.Providers || Providers;
export const Actions = {
runAction: function (type, event, config) {
@ -396,7 +380,6 @@ export const Actions = {
});
}
}
BI.Actions = BI.Actions || Actions;
let kv = {};
export function shortcut(xtype, cls) {
@ -408,7 +391,6 @@ export function shortcut(xtype, cls) {
}
kv[xtype] = cls;
}
BI.shortcut = BI.component = BI.shortcut || shortcut;
// 根据配置属性生成widget
const createRealWidget = function (config, context, lazy) {
@ -496,18 +478,15 @@ export function createWidget(item, options, context, lazy) {
}
throw new Error("组件:无法根据item创建组件", item);
}
BI.createWidget = BI.createWidget || createWidget;
export function _lazyCreateWidget (item, options, context) {
return createWidget(item, options, context, true);
}
BI._lazyCreateWidget = BI._lazyCreateWidget || _lazyCreateWidget;
export function createElement() {
const widget = createWidget.apply(this, arguments);
return widget.element;
}
BI.createElement = BI.createElement || createElement;
export function getResource(type, config) {
if (isNotNull(constantInjection[type])) {
@ -527,4 +506,3 @@ export function getResource(type, config) {
}
throw new Error("未知类型: [" + type + "] 未定义");
}
BI.getResource = BI.getResource || getResource;

4
src/core/action/action.js

@ -5,8 +5,8 @@
* @extends BI.OB
* @abstract
*/
import OB from "../3.ob";
export default class Action extends OB {
import { OB } from "../3.ob";
export class Action extends OB {
props = {
src: null,
tar: null

4
src/core/action/action.show.js

@ -4,8 +4,8 @@
* @class BI.ShowAction
* @extends BI.Action
*/
import Action from "./action";
export default class ShowAction extends Action {
import { Action } from "./action";
export class ShowAction extends Action {
actionPerformed(src, tar, callback) {
tar = tar || this.options.tar;
tar.setVisible(true);

2
src/core/action/index.js

@ -0,0 +1,2 @@
export { Action } from "./action";
export { ShowAction } from "./action.show";

4
src/core/behavior/0.behavior.js

@ -20,8 +20,8 @@ BI.BehaviorFactory = {
* @extends BI.OB
*/
import OB from "../3.ob";
export default class Behavior extends OB {
import { OB } from "../3.ob";
export class Behavior extends OB {
_defaultConfig() {
return BI.extend(super._defaultConfig(arguments), {
rule: () => true

4
src/core/behavior/behavior.highlight.js

@ -4,8 +4,8 @@
* @class BI.HighlightBehavior
* @extends BI.Behavior
*/
import Behavior from "./0.behavior";
export default class HighlightBehavior extends Behavior {
import { Behavior } from "./0.behavior";
export class HighlightBehavior extends Behavior {
doBehavior(items) {
const args = Array.prototype.slice.call(arguments, 1),
o = this.options;

4
src/core/behavior/behavior.redmark.js

@ -4,8 +4,8 @@
* @class BI.RedMarkBehavior
* @extends BI.Behavior
*/
import Behavior from "./0.behavior";
export default class RedMarkBehavior extends Behavior {
import { Behavior } from "./0.behavior";
export class RedMarkBehavior extends Behavior {
doBehavior(items) {
const args = Array.prototype.slice.call(arguments, 1),
o = this.options;

3
src/core/behavior/index.js

@ -0,0 +1,3 @@
export { Behavior } from "./0.behavior";
export { HighlightBehavior } from "./behavior.highlight";
export { RedMarkBehavior } from "./behavior.redmark";

4
src/core/controller/0.controller.js

@ -6,7 +6,7 @@
* @extends BI.OB
* @abstract
*/
import OB from "../3.ob";
export default class Controller extends OB {
import { OB } from "../3.ob";
export class Controller extends OB {
static EVENT_CHANGE = "__EVENT_CHANGE__";
}

4
src/core/controller/controller.broadcast.js

@ -4,8 +4,8 @@
* Created by GUY on 2015/12/23.
* @class
*/
import Controller from "./0.controller";
export default class BroadcastController extends Controller {
import { Controller } from "./0.controller";
export class BroadcastController extends Controller {
init() {
this._broadcasts = {};
}

4
src/core/controller/controller.bubbles.js

@ -5,8 +5,8 @@
* Created by GUY on 2015/8/21.
* @class
*/
import Controller from "./0.controller";
export default class BubblesController extends Controller {
import { Controller } from "./0.controller";
export class BubblesController extends Controller {
init() {
this.storeBubbles = {};
this.storePoppers = {};

4
src/core/controller/controller.drawer.js

@ -4,8 +4,8 @@
* @class BI.popoverController
* @extends BI.Controller
*/
import Controller from "./0.controller";
export default class DrawerController extends Controller {
import { Controller } from "./0.controller";
export class DrawerController extends Controller {
constructor() {
super();
this._constructor();

4
src/core/controller/controller.layer.js

@ -4,8 +4,8 @@
* Created by GUY on 2015/6/24.
* @class
*/
import Controller from "./0.controller";
export default class LayerController extends Controller {
import { Controller } from "./0.controller";
export class LayerController extends Controller {
constructor() {
super();
this._constructor();

4
src/core/controller/controller.masker.js

@ -4,8 +4,8 @@
* Created by GUY on 2015/6/24.
* @class
*/
import LayerController from "./controller.layer";
export default class MaskersController extends LayerController {
import { LayerController } from "./controller.layer";
export class MaskersController extends LayerController {
init() {
super.init(arguments);
this.zindex = BI.zIndex_masker;

4
src/core/controller/controller.popover.js

@ -4,8 +4,8 @@
* @class BI.popoverController
* @extends BI.Controller
*/
import Controller from "./0.controller";
export default class PopoverController extends Controller {
import { Controller } from "./0.controller";
export class PopoverController extends Controller {
constructor() {
super();
this._constructor();

4
src/core/controller/controller.resizer.js

@ -4,8 +4,8 @@
* Created by GUY on 2015/6/24.
* @class
*/
import Controller from "./0.controller";
export default class ResizeController extends Controller {
import { Controller } from "./0.controller";
export class ResizeController extends Controller {
init() {
this.resizerManger = {};

4
src/core/controller/controller.tooltips.js

@ -6,8 +6,8 @@
* @class BI.TooltipsController
* @extends BI.Controller
*/
import Controller from "./0.controller";
export default class TooltipsController extends Controller {
import { Controller } from "./0.controller";
export class TooltipsController extends Controller {
init() {
this.tooltipsManager = {};
this.showingTips = {};// 存储正在显示的tooltip

9
src/core/controller/index.js

@ -0,0 +1,9 @@
export { Controller } from "./0.controller";
export { BroadcastController } from "./controller.broadcast";
export { BubblesController } from "./controller.bubbles";
export { DrawerController } from "./controller.drawer";
export { LayerController } from "./controller.layer";
export { MaskersController } from "./controller.masker";
export { PopoverController } from "./controller.popover";
export { ResizeController } from "./controller.resizer";
export { TooltipsController } from "./controller.tooltips";

17
src/core/func/index.js

@ -4,20 +4,3 @@ export * from "./date";
export * from "./function";
export * from "./number";
export * from "./string";
// need delete
import * as _alias from "./alias";
import * as _array from "./array";
import * as _date from "./date";
import * as _function from "./function";
import * as _number from "./number";
import * as _string from "./string";
Object.assign(BI, {
..._alias,
..._array,
..._date,
..._function,
..._number,
..._string,
});

90
src/core/index.js

@ -1,68 +1,42 @@
import {shortcut} from "./decorator";
import OB from "./3.ob";
import Widget from "./4.widget";
import Action from "./action/action";
import ShowAction from "./action/action.show";
import Behavior from "./behavior/0.behavior";
import HighlightBehavior from "./behavior/behavior.highlight";
import RedMarkBehavior from "./behavior/behavior.redmark";
import Controller from "./controller/0.controller";
import BroadcastController from "./controller/controller.broadcast";
import BubblesController from "./controller/controller.bubbles";
import DrawerController from "./controller/controller.drawer";
import LayerController from "./controller/controller.layer";
import MaskersController from "./controller/controller.masker";
import PopoverController from "./controller/controller.popover";
import ResizeController from "./controller/controller.resizer";
import TooltipsController from "./controller/controller.tooltips";
import StyleLoaderManager from "./loader/loader.style";
import "./h";
import ShowListener from "./listener/listener.show";
BI.extend(BI, {
OB,
Widget,
Action,
ShowAction,
Behavior,
HighlightBehavior,
RedMarkBehavior,
Controller,
BroadcastController,
BubblesController,
DrawerController,
LayerController,
MaskersController,
PopoverController,
ResizeController,
TooltipsController,
StyleLoaderManager,
ShowListener,
});
import * as base from "./2.base";
import * as ob from "./3.ob";
import * as widget from "./4.widget";
import * as inject from "./5.inject";
import * as action from "./action";
import * as behavior from "./behavior";
import * as controllers from "./controller";
import * as func from "./func";
import { StyleLoaderManager } from "./loader/loader.style";
import "./h";
import { ShowListener } from "./listener/listener.show";
import { shortcut } from "./decorator";
export * from "./2.base";
export * from "./3.ob";
export * from "./4.widget";
export * from "./5.inject";
export * from "./action";
export * from "./behavior";
export * from "./controller";
export * from "./func";
export {
StyleLoaderManager,
ShowListener,
shortcut,
OB,
Widget,
Action,
ShowAction,
Behavior,
HighlightBehavior,
RedMarkBehavior,
Controller,
BroadcastController,
BubblesController,
DrawerController,
LayerController,
MaskersController,
PopoverController,
ResizeController,
TooltipsController,
}
Object.assign(BI, {
...base,
...ob,
...widget,
...inject,
...behavior,
component: inject.shortcut,
...action,
...controllers,
...func,
StyleLoaderManager,
ShowListener
};
ShowListener,
});

6
src/core/listener/listener.show.js

@ -5,12 +5,12 @@
* @class BI.ShowListener
* @extends BI.OB
*/
import OB from "../3.ob";
import { OB } from "../3.ob";
import { isArray, isNull, nextTick, } from "../2.base";
import { createWidget } from "../5.inject";
import Controller from "../controller/0.controller";
import { Controller } from "../controller/0.controller";
export default class ShowListener extends OB {
export class ShowListener extends OB {
static EVENT_CHANGE = "EVENT_CHANGE";
props() {

4
src/core/loader/loader.style.js

@ -4,9 +4,9 @@
* Created by GUY on 2015/9/7.
* @class
*/
import OB from "../3.ob";
import { OB } from "../3.ob";
export default class StyleLoaderManager extends OB {
export class StyleLoaderManager extends OB {
_defaultConfig() {
return BI.extend(super._defaultConfig(arguments), {});
}

Loading…
Cancel
Save