Guyi 3 years ago
parent
commit
9df1ada1a2
  1. 2
      package.json
  2. 13
      src/base/combination/group.button.js
  3. 46
      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", "name": "fineui",
"version": "2.0.20211116211231", "version": "2.0.20211119174324",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts", "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.behaviors = behaviors;
this.populate(o.items); 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); this.setValue(o.value);
} }
}, },
@ -77,11 +77,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
_packageBtns: function (btns) { _packageBtns: function (btns) {
var o = this.options; 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) { btns = BI.map(btns, function (k, it) {
return BI.extend({}, o.layouts[i], { return BI.extend({}, layouts[i], {
items: [ items: [
BI.extend({}, o.layouts[i].el, { BI.extend({}, layouts[i].el, {
el: it el: it
}) })
] ]
@ -108,7 +109,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}, },
_packageLayout: function (items) { _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; var lay = BI.formatEL(layout).el;
while (lay && lay.items && !BI.isEmpty(lay.items)) { while (lay && lay.items && !BI.isEmpty(lay.items)) {
@ -121,7 +122,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
// 如果是一个简单的layout // 如果是一个简单的layout
_isSimpleLayout: function () { _isSimpleLayout: function () {
var o = this.options; 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 () { doBehavior: function () {

46
src/base/layer/layer.drawer.js

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

17
src/core/6.inject.js

@ -39,6 +39,9 @@
_global.console && console.error("constant: [" + xtype + "]已经注册过了"); _global.console && console.error("constant: [" + xtype + "]已经注册过了");
} }
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
return function () {
return BI.Constants.getConstant(xtype);
}
}; };
var modelInjection = {}; var modelInjection = {};
@ -47,6 +50,9 @@
_global.console && console.error("model: [" + xtype + "] 已经注册过了"); _global.console && console.error("model: [" + xtype + "] 已经注册过了");
} }
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
return function (xtype, config) {
return BI.Models.getModel(xtype, config);
};
}; };
var storeInjection = {}; var storeInjection = {};
@ -55,6 +61,9 @@
_global.console && console.error("store: [" + xtype + "] 已经注册过了"); _global.console && console.error("store: [" + xtype + "] 已经注册过了");
} }
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
return function (xtype, config) {
return BI.Stores.getStore(xtype, config);
}
}; };
var serviceInjection = {}; var serviceInjection = {};
@ -63,6 +72,9 @@
_global.console && console.error("service: [" + xtype + "] 已经注册过了"); _global.console && console.error("service: [" + xtype + "] 已经注册过了");
} }
serviceInjection[xtype] = cls; serviceInjection[xtype] = cls;
return function (xtype, config) {
return BI.Services.getService(xtype, config);
}
}; };
var providerInjection = {}; var providerInjection = {};
@ -71,6 +83,9 @@
_global.console && console.error("provider: [" + xtype + "] 已经注册过了"); _global.console && console.error("provider: [" + xtype + "] 已经注册过了");
} }
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
return function (xtype, config) {
return BI.Providers.getProvider(xtype, config);
}
}; };
var configFunctions = {}; var configFunctions = {};
@ -294,7 +309,7 @@
_global.console && console.error("constant: [" + type + "] 未定义"); _global.console && console.error("constant: [" + type + "] 未定义");
} }
runConfigFunction(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.floatLayer = {};
this.floatContainer = {}; this.floatContainer = {};
this.floatOpened = {}; this.floatOpened = {};
this.zindex = BI.zIndex_popover;
this.zindexMap = {}; this.zindexMap = {};
}, },
@ -41,17 +40,18 @@ BI.DrawerController = BI.inherit(BI.Controller, {
if (!this.floatOpened[name]) { if (!this.floatOpened[name]) {
this.floatOpened[name] = true; this.floatOpened[name] = true;
var container = this.floatContainer[name]; 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.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) { if (this.modal) {
var mask = container.element.__buildZIndexMask__(this.zindex++); var mask = container.element.__buildZIndexMask__(BI.Popovers._getZIndex());
mask.click(function () { mask.click(function () {
mask.destroy(); mask.destroy();
self.get(name).close(); self.get(name).close();
}); });
} }
this.get(name).setZindex(this.zindex++); this.get(name).setZindex(BI.Popovers._getZIndex());
this.floatContainer[name].visible(); this.floatContainer[name].visible();
var popover = this.get(name); var popover = this.get(name);
popover.show && popover.show(); 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(); this.floatContainer[name].visible();
var popover = this.get(name); var popover = this.get(name);
popover.show && popover.show(); 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 w = popover.element.width(), h = popover.element.height();
var left = (W - w) / 2, top = (H - h) / 2; var left = (W - w) / 2, top = (H - h) / 2;
if (left < 0) { if (left < 0) {
@ -163,5 +164,9 @@ BI.PopoverController = BI.inherit(BI.Controller, {
this.floatOpened = {}; this.floatOpened = {};
this.zindexMap = {}; this.zindexMap = {};
return this; return this;
},
_getZIndex: function () {
return this.zindex++;
} }
}); });

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

@ -1,6 +1,6 @@
@import "../../index"; @import "../../index";
.bi-drawer { .bi-drawer {
.box-shadow(-6px 0 16px -8px #00000014, -9px 0 28px #0000000d, -12px 0 48px 16px #00000008); .box-shadows(-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)); .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; transition: @transition;
} }
.transitions(@transition1, @transition2) {
-webkit-transition: @transition1, @transition2;
-moz-transition: @transition1, @transition2;
-o-transition: @transition1, @transition2;
transition: @transition1, @transition2;
}
.rotate(@rotate) { .rotate(@rotate) {
-webkit-transform: rotate(@rotate); -webkit-transform: rotate(@rotate);
-moz-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 container?: any; // popupview放置的容器,默认为this.element
isDefaultInit?: boolean; isDefaultInit?: boolean;
destroyWhenHide?: boolean; destroyWhenHide?: boolean;
hideWhenBlur?: boolean;
hideWhenAnotherComboOpen?: boolean; hideWhenAnotherComboOpen?: boolean;
isNeedAdjustHeight?: boolean; // 是否需要高度调整 isNeedAdjustHeight?: boolean; // 是否需要高度调整
isNeedAdjustWidth?: boolean; isNeedAdjustWidth?: boolean;

12
typescript/core/inject.ts

@ -1,9 +1,9 @@
type _module = (xtype: string, cls: any) => void; type _module = (xtype: string, cls: any) => void | Function;
type _constant = (xtype: string, cls: any) => void; type _constant = (xtype: string, cls: any) => void | Function;
type _model = (xtype: string, cls: any) => void; type _model = (xtype: string, cls: any) => void | Function;
type _store = (xtype: string, cls: any) => void; type _store = (xtype: string, cls: any) => void | Function;
type _service = (xtype: string, cls: any) => void; type _service = (xtype: string, cls: any) => void | Function;
type _provider = (xtype: string, cls: any) => void; type _provider = (xtype: string, cls: any) => void | Function;
interface _modules { interface _modules {
getModule: (type: string) => any; 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 { Layout } from "./core/wrapper/layout";
import { AbsoluteLayout } from "./core/wrapper/layout/layout.absolute"; import { AbsoluteLayout } from "./core/wrapper/layout/layout.absolute";
import { HTapeLayout, VTapeLayout } from "./core/wrapper/layout/layout.tape"; 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 { VerticalLayout } from "./core/wrapper/layout/layout.vertical";
import { DefaultLayout } from "./core/wrapper/layout/layout.default"; import { DefaultLayout } from "./core/wrapper/layout/layout.default";
import { DownListCombo } from "./widget/downlist/combo.downlist"; 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; DownListCombo: typeof DownListCombo;
Iframe: typeof Iframe; Iframe: typeof Iframe;
AbsoluteLayout: typeof AbsoluteLayout; AbsoluteLayout: typeof AbsoluteLayout;
HorizontalFillLayout: typeof HorizontalFillLayout;
VerticalFillLayout: typeof VerticalFillLayout;
VerticalLayout: typeof VerticalLayout; VerticalLayout: typeof VerticalLayout;
DefaultLayout: typeof DefaultLayout; DefaultLayout: typeof DefaultLayout;
Input: typeof Input; Input: typeof Input;
@ -389,6 +393,8 @@ export {
HorizontalAdaptLayout, HorizontalAdaptLayout,
FloatLeftLayout, FloatLeftLayout,
FloatRightLayout, FloatRightLayout,
HorizontalFillLayout,
VerticalFillLayout,
VerticalLayout, VerticalLayout,
AbsoluteLayout, AbsoluteLayout,
DefaultLayout, DefaultLayout,

Loading…
Cancel
Save