Browse Source

KERNEL-14124 refactor: 初步调整好打包

es6
Zhenfei.Li 2 years ago
parent
commit
dcf14ed0a0
  1. 31
      src/base/combination/group.button.js
  2. 32
      src/base/index.js
  3. 4
      src/bundle.js
  4. 40
      src/case/index.js
  5. 32
      src/component/index.js
  6. 2
      src/core/5.inject.js
  7. 2
      src/core/behavior/behavior.highlight.js
  8. 2
      src/core/behavior/behavior.redmark.js
  9. 71
      src/core/index.js
  10. 34
      src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
  11. 36
      src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js
  12. 32
      src/core/wrapper/layout/responsive/responsive.inline.js
  13. 5
      src/index.js
  14. 94
      src/widget/index.js
  15. 17
      webpack/attachments.js

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

@ -1,4 +1,5 @@
import {
Selection,
CenterLayout,
shortcut,
Widget,
@ -24,14 +25,16 @@ import {
removeAt,
deepContains,
has,
any
any,
BehaviorFactory,
Events
} from "@/core";
import { TextButton } from "../single";
/**
* Created by GUY on 2015/6/26.
* @class BI.ButtonGroup
* @extends BI.Widget
* @class ButtonGroup
* @extends Widget
*/
@shortcut()
@ -39,6 +42,12 @@ export class ButtonGroup extends Widget {
static xtype = "bi.button_group";
static EVENT_CHANGE = "EVENT_CHANGE";
static CHOOSE_TYPE_SINGLE = Selection.Single;
static CHOOSE_TYPE_MULTI = Selection.Multi;
static CHOOSE_TYPE_ALL = Selection.All;
static CHOOSE_TYPE_NONE = Selection.None;
static CHOOSE_TYPE_DEFAULT = Selection.Default;
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
@ -46,7 +55,7 @@ export class ButtonGroup extends Widget {
behaviors: {},
items: [],
value: "",
chooseType: BI.Selection.Single,
chooseType: Selection.Single,
layouts: [
{
type: CenterLayout.xtype,
@ -61,7 +70,7 @@ export class ButtonGroup extends Widget {
const { behaviors: optionsBehaviors, items: optionsItems, value } = this.options;
const behaviors = {};
each(optionsBehaviors, (key, rule) => {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
behaviors[key] = BehaviorFactory.createBehavior(key, {
rule,
});
});
@ -107,7 +116,7 @@ export class ButtonGroup extends Widget {
each(buttons, (i, btn) => {
btn.on(Controller.EVENT_CHANGE, (...arg) => {
const [type, value, obj] = arg;
if (type === BI.Events.CLICK) {
if (type === Events.CLICK) {
switch (chooseType) {
case ButtonGroup.CHOOSE_TYPE_SINGLE:
this.setValue(btn.getValue());
@ -124,7 +133,7 @@ export class ButtonGroup extends Widget {
this.fireEvent(Controller.EVENT_CHANGE, ...arg);
}
});
btn.on(BI.Events.DESTROY, () => {
btn.on(Events.DESTROY, () => {
remove(this.buttons, btn);
});
});
@ -418,11 +427,3 @@ export class ButtonGroup extends Widget {
this.options.items = [];
}
}
extend(ButtonGroup, {
CHOOSE_TYPE_SINGLE: BI.Selection.Single,
CHOOSE_TYPE_MULTI: BI.Selection.Multi,
CHOOSE_TYPE_ALL: BI.Selection.All,
CHOOSE_TYPE_NONE: BI.Selection.None,
CHOOSE_TYPE_DEFAULT: BI.Selection.Default,
});

32
src/base/index.js

@ -1,32 +1,12 @@
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 * as combination from "./combination";
import { Msg } from "./foundation/message";
import * as base from "./0.base";
import { CollectionView } from "./collection/collection";
import { CustomTree } from "./tree/customtree";
Object.assign(BI, {
Pane,
...layer,
...list,
...single,
GridView,
Pager,
...combination,
Msg,
...base,
CollectionView,
CustomTree,
});
export { Pane } from "./1.pane";
export { GridView } from "./grid/grid";
export { Pager } from "./pager/pager";
export { Msg } from "./foundation/message";
export { CollectionView } from "./collection/collection";
export { CustomTree } from "./tree/customtree";
export * from "./0.base";
export * from "./combination";
export * from "./layer";
export * from "./list";
export * from "./single";
export { Pane, GridView, Pager, Msg, CollectionView, CustomTree };

4
src/bundle.js

@ -0,0 +1,4 @@
import * as fineui from "./index";
import { shortcut, provider } from "@/core/5.inject";
Object.assign(BI, fineui, { shortcut, provider });

40
src/case/index.js

@ -1,36 +1,5 @@
import * as button from "./button";
import * as calendarItem from "./calendar";
import * as pager from "./pager";
import * as editor from "./editor";
import * as tree from "./tree";
import * as ztree from "./ztree";
import * as trigger from "./trigger";
import * as loader from "./loader";
import * as segment from "./segment";
import { MultiSelectBar } from "./toolbar/toolbar.multiselect";
import * as layer from "./layer";
import * as linearSegment from "./linearsegment";
import * as colorchooser from "./colorchooser";
import { SelectList } from "./list/list.select";
import * as combo from "./combo";
Object.assign(BI, {
...combo,
...button,
...calendarItem,
...pager,
...editor,
...ztree,
...tree,
...trigger,
...loader,
...segment,
MultiSelectBar,
...layer,
...linearSegment,
...colorchooser,
SelectList,
});
export { MultiSelectBar } from "./toolbar/toolbar.multiselect";
export { SelectList } from "./list/list.select";
export * from "./combo";
export * from "./button";
@ -39,7 +8,6 @@ export * from "./pager";
export * from "./editor";
export * from "./tree";
export * from "./ztree";
export * from "./trigger";
export * from "./loader";
export * from "./segment";
@ -47,8 +15,4 @@ export * from "./layer";
export * from "./linearsegment";
export * from "./checkbox";
export * from "./colorchooser";
export {
MultiSelectBar,
SelectList
};

32
src/component/index.js

@ -1,18 +1,18 @@
import * as allvaluechooser from "./allvaluechooser";
import * as form from "./form";
import * as valueChooser from "./valuechooser";
import { AllValueMultiTextValueCombo } from "./allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
export * as allvaluechooser from "./allvaluechooser";
export * as form from "./form";
export * as valueChooser from "./valuechooser";
export { AllValueMultiTextValueCombo } from "./allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
Object.assign(BI, {
...allvaluechooser,
...form,
...valueChooser,
AllValueMultiTextValueCombo,
});
// Object.assign(BI, {
// ...allvaluechooser,
// ...form,
// ...valueChooser,
// AllValueMultiTextValueCombo,
// });
export * from "./allvaluechooser";
export * from "./form";
export * from "./valuechooser";
export {
AllValueMultiTextValueCombo
};
// export * from "./allvaluechooser";
// export * from "./form";
// export * from "./valuechooser";
// export {
// AllValueMultiTextValueCombo
// };

2
src/core/5.inject.js

@ -401,6 +401,8 @@ export function shortcut(xtype, cls) {
kv[xtype] = cls;
}
export const component = shortcut;
// 根据配置属性生成widget
const createRealWidget = (config, context, lazy) => {
const Cls = isFunction(config.type) ? config.type : kv[config.type];

2
src/core/behavior/behavior.highlight.js

@ -3,7 +3,7 @@
*/
import { Behavior } from "./0.behavior";
import { isFunction, each } from "../2.base";
import { Single } from "../../base";
import { Single } from "@/base/single/0.single";
export class HighlightBehavior extends Behavior {
doBehavior(items) {

2
src/core/behavior/behavior.redmark.js

@ -4,7 +4,7 @@
*/
import { Behavior } from "./0.behavior";
import { each } from "../2.base";
import { Single } from "../../base";
import { Single } from "@/base/single/0.single";
export class RedMarkBehavior extends Behavior {
doBehavior(items) {

71
src/core/index.js

@ -1,32 +1,29 @@
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 { Plugin } from "./6.plugin";
import * as h from "./h";
import * as action from "./action";
import * as behavior from "./behavior";
import * as controllers from "./controller";
import * as func from "./func";
import * as structure from "./structure";
import { StyleLoaderManager } from "./loader/loader.style";
import { ShowListener } from "./listener/listener.show";
import { useInWorker } from "./worker";
import * as constant from "./constant";
import * as logic from "./logic";
import { Element } from "./element";
import * as utils from "./utils";
import * as wrapper from "./wrapper";
import * as platform from "./platform/web";
export { Plugin } from "./6.plugin";
export { StyleLoaderManager } from "./loader/loader.style";
export { ShowListener } from "./listener/listener.show";
export { useInWorker } from "./worker";
export { Element } from "./element";
export { Controller } from "./controller/0.controller";
export { BroadcastController } from "./controller/controller.broadcast";
export { BubblesController } from "./controller/controller.bubbles";
export { DrawerController } from "./controller/controller.drawer";
export { LayerController } from "./controller/controller.layer";
export { MaskersController } from "./controller/controller.masker";
export { PopoverController } from "./controller/controller.popover";
export { ResizeController } from "./controller/controller.resizer";
export { TooltipsController } from "./controller/controller.tooltips";
export * from "./decorator";
export * from "./2.base";
export * from "./3.ob";
export * from "./4.widget";
export * from "./5.inject";
export * from "./6.plugin";
export * from "./system";
export * from "./action";
export * from "./behavior";
export * from "./controller";
// export * from "./controller";
export * from "./func";
export * from "./structure";
export * from "./h";
@ -35,35 +32,3 @@ export * from "./logic";
export * from "./wrapper";
export * from "./platform/web";
export * from "./utils";
export {
StyleLoaderManager,
ShowListener,
Plugin,
useInWorker,
Element
};
Object.assign(BI, {
...base,
...ob,
...widget,
...inject,
Plugin,
...behavior,
...constant,
component: inject.shortcut,
...action,
...controllers,
Element,
...func,
StyleLoaderManager,
ShowListener,
...logic,
...structure,
useInWorker,
...h,
...utils,
...wrapper,
...platform,
});

34
src/core/wrapper/layout/responsive/responsive.flex.horizontal.js

@ -1,7 +1,7 @@
import { shortcut } from "@/core/decorator";
import { each } from "@/core/2.base";
import { HorizontalAlign } from "@/core/constant";
import { Resizers } from "@/base";
// import { Resizers } from "@/base/0.base";
import { FlexHorizontalLayout } from "../flex";
/**
@ -34,22 +34,22 @@ export class ResponsiveFlexHorizontalLayout extends FlexHorizontalLayout {
}
}
};
const resize = () => {
defaultResize();
if (o.scrollable !== true && o.scrollx !== true) {
const clientWidth = document.body.clientWidth;
if (this.element.width() > 2 / 3 * clientWidth) {
if (clientWidth > 768) {
each(this._children, (i, child) => {
this._clearGap(child);
});
this.resize();
this.element.css("flex-direction", "row");
}
}
}
};
this.unResize = Resizers.add(this.getName(), resize);
// const resize = () => {
// defaultResize();
// if (o.scrollable !== true && o.scrollx !== true) {
// const clientWidth = document.body.clientWidth;
// if (this.element.width() > 2 / 3 * clientWidth) {
// if (clientWidth > 768) {
// each(this._children, (i, child) => {
// this._clearGap(child);
// });
// this.resize();
// this.element.css("flex-direction", "row");
// }
// }
// }
// };
// this.unResize = Resizers.add(this.getName(), resize);
defaultResize();
}

36
src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js

@ -1,7 +1,7 @@
import { shortcut } from "@/core/decorator";
import { each } from "@/core/2.base";
import { HorizontalAlign } from "@/core/constant";
import { Resizers } from "@/base";
// import { Resizers } from "@/base/0.base";
import { FlexWrapperHorizontalLayout } from "../flex";
/**
@ -35,23 +35,23 @@ export class ResponsiveFlexWrapperHorizontalLayout extends FlexWrapperHorizontal
}
}
};
const resize = () => {
defaultResize();
if (o.scrollable !== true && o.scrollx !== true) {
const clientWidth = document.body.clientWidth;
if (this.element.width() > 2 / 3 * clientWidth) {
if (clientWidth > 768) {
each(this._children, (i, child) => {
this._clearGap(child);
});
this.resize();
this.element.css("flex-direction", "row");
this.$wrapper.element.css("flex-direction", "row");
}
}
}
};
this.unResize = Resizers.add(this.getName(), resize);
// const resize = () => {
// defaultResize();
// if (o.scrollable !== true && o.scrollx !== true) {
// const clientWidth = document.body.clientWidth;
// if (this.element.width() > 2 / 3 * clientWidth) {
// if (clientWidth > 768) {
// each(this._children, (i, child) => {
// this._clearGap(child);
// });
// this.resize();
// this.element.css("flex-direction", "row");
// this.$wrapper.element.css("flex-direction", "row");
// }
// }
// }
// };
// this.unResize = Resizers.add(this.getName(), resize);
defaultResize();
}

32
src/core/wrapper/layout/responsive/responsive.inline.js

@ -1,7 +1,7 @@
import { shortcut } from "@/core/decorator";
import { each } from "@/core/2.base";
import { HorizontalAlign } from "@/core/constant";
import { Resizers } from "@/base";
// import { Resizers } from "@/base/0.base";
import { InlineLayout } from "../layout.inline";
/**
@ -34,21 +34,21 @@ export class ResponsiveInlineLayout extends InlineLayout {
}
}
};
const resize = () => {
defaultResize();
if (o.scrollable !== true && o.scrollx !== true) {
const clientWidth = document.body.clientWidth;
if (this.element.width() > 2 / 3 * clientWidth) {
if (clientWidth > 768) {
each(this._children, (i, child) => {
this._clearGap(child);
});
this.resize();
}
}
}
};
this.unResize = Resizers.add(this.getName(), resize);
// const resize = () => {
// defaultResize();
// if (o.scrollable !== true && o.scrollx !== true) {
// const clientWidth = document.body.clientWidth;
// if (this.element.width() > 2 / 3 * clientWidth) {
// if (clientWidth > 768) {
// each(this._children, (i, child) => {
// this._clearGap(child);
// });
// this.resize();
// }
// }
// }
// };
// this.unResize = Resizers.add(this.getName(), resize);
defaultResize();
}

5
src/index.js

@ -0,0 +1,5 @@
export * from "./core";
export * from "./base";
export * from "./case";
export * from "./widget";
export * from "./component";

94
src/widget/index.js

@ -1,72 +1,14 @@
import { Collapse } from "./collapse/collapse";
import * as calendar from "./date/calendar";
import * as dynamicdate from "./dynamicdate";
import * as datepane from "./datepane";
import * as datetime from "./datetime";
import * as datetimepane from "./datetimepane";
import * as dynamicdatetime from "./dynamicdatetime";
import * as time from "./time";
import * as editor from "./editor";
import * as downList from "./downlist";
import * as singleSliderItem from "./singleslider";
import * as intervalSliderItem from "./intervalslider";
import * as yearQuarter from "./yearquarter";
import { SelectTreeCombo } from "./selecttree/selecttree.combo";
import { SingleTreeCombo } from "./singletree/singletree.combo";
import { MultiTreeCombo } from "./multitree/multi.tree.combo";
import { MultiTreeInsertCombo } from "./multitree/multi.tree.insert.combo";
import { MultiTreeListCombo } from "./multitree/multi.tree.list.combo";
import { NumberEditor } from "./numbereditor/number.editor";
import { NumberInterval } from "./numberinterval/numberinterval";
import { YearMonthInterval } from "./yearmonthinterval/yearmonthinterval";
import { YearQuarterInterval } from "./yearquarterinterval/yearquarterinterval";
import * as yearmonth from "./yearmonth";
import * as multiselect from "./multiselect";
import * as multiselectlist from "./multiselectlist";
import * as multilayerselectree from "./multilayerselecttree";
import * as year from "./year";
import { YearInterval } from "./yearinterval/yearinterval";
import * as singleselect from "./singleselect";
import * as multilayerdownlist from "./multilayerdownlist";
import * as multilayersingletree from "./multilayersingletree";
import * as textvaluedownlistcombo from "./textvaluedownlistcombo";
import * as searchmultitextvaluecombo from "./searchmultitextvaluecombo";
Object.assign(BI, {
Collapse,
...calendar,
...dynamicdate,
...datepane,
...datetime,
...datetimepane,
...dynamicdatetime,
...time,
...year,
...editor,
...downList,
...singleSliderItem,
...intervalSliderItem,
...yearQuarter,
SelectTreeCombo,
SingleTreeCombo,
MultiTreeCombo,
MultiTreeInsertCombo,
MultiTreeListCombo,
NumberEditor,
NumberInterval,
YearInterval,
YearMonthInterval,
YearQuarterInterval,
...yearmonth,
...multiselect,
...multiselectlist,
...multilayerselectree,
...singleselect,
...multilayerdownlist,
...multilayersingletree,
...textvaluedownlistcombo,
...searchmultitextvaluecombo,
});
export { Collapse } from "./collapse/collapse";
export { SelectTreeCombo } from "./selecttree/selecttree.combo";
export { SingleTreeCombo } from "./singletree/singletree.combo";
export { MultiTreeCombo } from "./multitree/multi.tree.combo";
export { MultiTreeInsertCombo } from "./multitree/multi.tree.insert.combo";
export { MultiTreeListCombo } from "./multitree/multi.tree.list.combo";
export { NumberEditor } from "./numbereditor/number.editor";
export { NumberInterval } from "./numberinterval/numberinterval";
export { YearMonthInterval } from "./yearmonthinterval/yearmonthinterval";
export { YearQuarterInterval } from "./yearquarterinterval/yearquarterinterval";
export { YearInterval } from "./yearinterval/yearinterval";
export * from "./date/calendar";
export * from "./dynamicdate";
@ -91,17 +33,3 @@ export * from "./multilayerdownlist";
export * from "./yearquarter";
export * from "./textvaluedownlistcombo";
export * from "./searchmultitextvaluecombo";
export {
Collapse,
NumberEditor,
NumberInterval,
SelectTreeCombo,
SingleTreeCombo,
MultiTreeCombo,
MultiTreeInsertCombo,
MultiTreeListCombo,
YearInterval,
YearMonthInterval,
YearQuarterInterval
};

17
webpack/attachments.js

@ -19,25 +19,25 @@ const basicAttachmentMap = {
"src/less/theme/**/*.less",
lodashJs,
jqueryJs,
"src/core/**/*.js",
"src/data/**/*.js",
// "src/core/**/*.js",
// "src/data/**/*.js",
]),
// 最基础的控件
base: sync([
"src/less/base/**/*.less",
"src/third/**/*.js",
"src/base/**/*.js",
// "src/third/**/*.js",
// "src/base/**/*.js",
]),
// 实现好的一些基础实例
case: sync([
"src/case/**/*.js",
"case": sync([
// "src/case/**/*.js",
"src/less/case/**/*.less",
]),
widget: sync([
"src/less/widget/**/*.less",
"src/less/component/**/*.less",
"src/widget/**/*.js",
"src/component/**/*.js",
// "src/widget/**/*.js",
// "src/component/**/*.js",
]),
router: sync([
"src/router/**/*.js",
@ -238,6 +238,7 @@ const demo = [].concat(
basicAttachmentMap.core,
basicAttachmentMap.fix,
basicAttachmentMap.config,
sync(["src/bundle.js"]),
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,

Loading…
Cancel
Save