Guyi 3 years ago
parent
commit
9df1ada1a2
  1. 2
      package.json
  2. 13
      src/base/combination/group.button.js
  3. 48
      src/base/layer/layer.drawer.js
  4. 17
      src/core/6.inject.js
  5. 10
      src/core/controller/controller.drawer.js
  6. 7
      src/core/controller/controller.popover.js
  7. 4
      src/less/base/view/drawer.less
  8. 7
      src/less/visual.less
  9. 1
      typescript/base/combination/combo.ts
  10. 12
      typescript/core/inject.ts
  11. 5
      typescript/core/wrapper/layout/fill/fill.horizontal.ts
  12. 5
      typescript/core/wrapper/layout/fill/fill.vertical.ts
  13. 6
      typescript/index.ts

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20211116211231",
"version": "2.0.20211119174324",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

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

@ -30,7 +30,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
});
this.behaviors = behaviors;
this.populate(o.items);
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){
if (BI.isKey(o.value) || BI.isNotEmptyArray(o.value)) {
this.setValue(o.value);
}
},
@ -77,11 +77,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) {
var o = this.options;
for (var i = o.layouts.length - 1; i > 0; i--) {
var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts];
for (var i = layouts.length - 1; i > 0; i--) {
btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], {
return BI.extend({}, layouts[i], {
items: [
BI.extend({}, o.layouts[i].el, {
BI.extend({}, layouts[i].el, {
el: it
})
]
@ -108,7 +109,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
_packageLayout: function (items) {
var o = this.options, layout = BI.deepClone(o.layouts[0]);
var o = this.options, layout = BI.deepClone(BI.isArray(o.layouts) ? o.layouts[0] : o.layouts);
var lay = BI.formatEL(layout).el;
while (lay && lay.items && !BI.isEmpty(lay.items)) {
@ -121,7 +122,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
// 如果是一个简单的layout
_isSimpleLayout: function () {
var o = this.options;
return o.layouts.length === 1 && !BI.isArray(o.items[0]);
return BI.isArray(o.layouts) ? (o.layouts.length === 1 && !BI.isArray(o.items[0])) : true;
},
doBehavior: function () {

48
src/base/layer/layer.drawer.js

@ -4,8 +4,14 @@
* @extends BI.Widget
*/
BI.Drawer = BI.inherit(BI.Widget, {
SIZE: {
SMALL: "small",
NORMAL: "normal",
BIG: "big"
},
props: {
baseCls: "bi-drawer bi-card",
size: "normal",
placement: "right", // top/bottom/left/right
header: null,
headerHeight: 40,
@ -74,10 +80,37 @@ BI.Drawer = BI.inherit(BI.Widget, {
bgap: o.bodyBgap
}];
return {
return BI.extend({
type: "bi.vtape",
items: items
};
}, this._getSuitableSize());
},
_getSuitableSize: function () {
var o = this.options;
var size = 0;
switch (o.size) {
case "big":
size = 736;
break;
case "small":
size = 200;
break;
case "normal":
default:
size = 378;
break;
}
if (o.placement === "top" || o.placement === "bottom") {
return {
height: o.height || size
};
}
if (o.placement === "left" || o.placement === "right") {
return {
width: o.width || size
};
}
},
mounted: function () {
@ -117,25 +150,26 @@ BI.Drawer = BI.inherit(BI.Widget, {
show: function (callback) {
var self = this, o = this.options;
requestAnimationFrame(function () {
var size = self._getSuitableSize();
switch (o.placement) {
case "right":
self.element.css({
transform: "translateX(-" + self.getWidth() + "px)"
transform: "translateX(-" + size.width + "px)"
});
break;
case "left":
self.element.css({
transform: "translateX(" + self.getWidth() + "px)"
transform: "translateX(" + size.width + "px)"
});
break;
case "top":
self.element.css({
transform: "translateY(" + self.getHeight() + "px)"
transform: "translateY(" + size.height + "px)"
});
break;
case "bottom":
self.element.css({
transform: "translateY(-" + self.getHeight() + "px)"
transform: "translateY(-" + size.height + "px)"
});
break;
}
@ -160,7 +194,7 @@ BI.Drawer = BI.inherit(BI.Widget, {
});
break;
}
setTimeout(callback, 300)
setTimeout(callback, 300);
});
},

17
src/core/6.inject.js

@ -39,6 +39,9 @@
_global.console && console.error("constant: [" + xtype + "]已经注册过了");
}
constantInjection[xtype] = cls;
return function () {
return BI.Constants.getConstant(xtype);
}
};
var modelInjection = {};
@ -47,6 +50,9 @@
_global.console && console.error("model: [" + xtype + "] 已经注册过了");
}
modelInjection[xtype] = cls;
return function (xtype, config) {
return BI.Models.getModel(xtype, config);
};
};
var storeInjection = {};
@ -55,6 +61,9 @@
_global.console && console.error("store: [" + xtype + "] 已经注册过了");
}
storeInjection[xtype] = cls;
return function (xtype, config) {
return BI.Stores.getStore(xtype, config);
}
};
var serviceInjection = {};
@ -63,6 +72,9 @@
_global.console && console.error("service: [" + xtype + "] 已经注册过了");
}
serviceInjection[xtype] = cls;
return function (xtype, config) {
return BI.Services.getService(xtype, config);
}
};
var providerInjection = {};
@ -71,6 +83,9 @@
_global.console && console.error("provider: [" + xtype + "] 已经注册过了");
}
providerInjection[xtype] = cls;
return function (xtype, config) {
return BI.Providers.getProvider(xtype, config);
}
};
var configFunctions = {};
@ -294,7 +309,7 @@
_global.console && console.error("constant: [" + type + "] 未定义");
}
runConfigFunction(type);
return constantInjection[type];
return BI.isFunction(constantInjection[type]) ? constantInjection[type]() : constantInjection[type];
}
};

10
src/core/controller/controller.drawer.js

@ -18,7 +18,6 @@ BI.DrawerController = BI.inherit(BI.Controller, {
this.floatLayer = {};
this.floatContainer = {};
this.floatOpened = {};
this.zindex = BI.zIndex_popover;
this.zindexMap = {};
},
@ -41,17 +40,18 @@ BI.DrawerController = BI.inherit(BI.Controller, {
if (!this.floatOpened[name]) {
this.floatOpened[name] = true;
var container = this.floatContainer[name];
container.element.css("zIndex", this.zindex++);
var zIndex = BI.Popovers._getZIndex();
container.element.css("zIndex", zIndex);
this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]);
this.zindexMap[name] = this.zindex;
this.zindexMap[name] = zIndex;
if (this.modal) {
var mask = container.element.__buildZIndexMask__(this.zindex++);
var mask = container.element.__buildZIndexMask__(BI.Popovers._getZIndex());
mask.click(function () {
mask.destroy();
self.get(name).close();
});
}
this.get(name).setZindex(this.zindex++);
this.get(name).setZindex(BI.Popovers._getZIndex());
this.floatContainer[name].visible();
var popover = this.get(name);
popover.show && popover.show();

7
src/core/controller/controller.popover.js

@ -48,7 +48,8 @@ BI.PopoverController = BI.inherit(BI.Controller, {
this.floatContainer[name].visible();
var popover = this.get(name);
popover.show && popover.show();
var W = BI.Widget._renderEngine.createElement(this.options.render).width(), H = BI.Widget._renderEngine.createElement(this.options.render).height();
var W = BI.Widget._renderEngine.createElement(this.options.render).width(),
H = BI.Widget._renderEngine.createElement(this.options.render).height();
var w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) {
@ -163,5 +164,9 @@ BI.PopoverController = BI.inherit(BI.Controller, {
this.floatOpened = {};
this.zindexMap = {};
return this;
},
_getZIndex: function () {
return this.zindex++;
}
});

4
src/less/base/view/drawer.less

@ -1,6 +1,6 @@
@import "../../index";
.bi-drawer {
.box-shadow(-6px 0 16px -8px #00000014, -9px 0 28px #0000000d, -12px 0 48px 16px #00000008);
.transition(transform .3s cubic-bezier(.23, 1, .32, 1), box-shadow .3s cubic-bezier(.23, 1, .32, 1));
.box-shadows(-6px 0 16px -8px #00000014, -9px 0 28px #0000000d, -12px 0 48px 16px #00000008);
.transitions(transform .3s cubic-bezier(.23, 1, .32, 1), box-shadow .3s cubic-bezier(.23, 1, .32, 1));
}

7
src/less/visual.less

@ -53,6 +53,13 @@
transition: @transition;
}
.transitions(@transition1, @transition2) {
-webkit-transition: @transition1, @transition2;
-moz-transition: @transition1, @transition2;
-o-transition: @transition1, @transition2;
transition: @transition1, @transition2;
}
.rotate(@rotate) {
-webkit-transform: rotate(@rotate);
-moz-transform: rotate(@rotate);

1
typescript/base/combination/combo.ts

@ -22,6 +22,7 @@ export declare class Combo extends Widget {
container?: any; // popupview放置的容器,默认为this.element
isDefaultInit?: boolean;
destroyWhenHide?: boolean;
hideWhenBlur?: boolean;
hideWhenAnotherComboOpen?: boolean;
isNeedAdjustHeight?: boolean; // 是否需要高度调整
isNeedAdjustWidth?: boolean;

12
typescript/core/inject.ts

@ -1,9 +1,9 @@
type _module = (xtype: string, cls: any) => void;
type _constant = (xtype: string, cls: any) => void;
type _model = (xtype: string, cls: any) => void;
type _store = (xtype: string, cls: any) => void;
type _service = (xtype: string, cls: any) => void;
type _provider = (xtype: string, cls: any) => void;
type _module = (xtype: string, cls: any) => void | Function;
type _constant = (xtype: string, cls: any) => void | Function;
type _model = (xtype: string, cls: any) => void | Function;
type _store = (xtype: string, cls: any) => void | Function;
type _service = (xtype: string, cls: any) => void | Function;
type _provider = (xtype: string, cls: any) => void | Function;
interface _modules {
getModule: (type: string) => any;

5
typescript/core/wrapper/layout/fill/fill.horizontal.ts

@ -0,0 +1,5 @@
import { Layout } from "../../layout";
export declare class HorizontalFillLayout extends Layout {
static xtype: string;
}

5
typescript/core/wrapper/layout/fill/fill.vertical.ts

@ -0,0 +1,5 @@
import { Layout } from "../../layout";
export declare class VerticalFillLayout extends Layout {
static xtype: string;
}

6
typescript/index.ts

@ -44,6 +44,8 @@ import { _inject } from "./core/inject";
import { Layout } from "./core/wrapper/layout";
import { AbsoluteLayout } from "./core/wrapper/layout/layout.absolute";
import { HTapeLayout, VTapeLayout } from "./core/wrapper/layout/layout.tape";
import {HorizontalFillLayout} from "./core/wrapper/layout/fill/fill.horizontal";
import {VerticalFillLayout} from "./core/wrapper/layout/fill/fill.vertical";
import { VerticalLayout } from "./core/wrapper/layout/layout.vertical";
import { DefaultLayout } from "./core/wrapper/layout/layout.default";
import { DownListCombo } from "./widget/downlist/combo.downlist";
@ -243,6 +245,8 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
DownListCombo: typeof DownListCombo;
Iframe: typeof Iframe;
AbsoluteLayout: typeof AbsoluteLayout;
HorizontalFillLayout: typeof HorizontalFillLayout;
VerticalFillLayout: typeof VerticalFillLayout;
VerticalLayout: typeof VerticalLayout;
DefaultLayout: typeof DefaultLayout;
Input: typeof Input;
@ -389,6 +393,8 @@ export {
HorizontalAdaptLayout,
FloatLeftLayout,
FloatRightLayout,
HorizontalFillLayout,
VerticalFillLayout,
VerticalLayout,
AbsoluteLayout,
DefaultLayout,

Loading…
Cancel
Save