Browse Source

Pull request #3189: KERNEL-13158: context跳过popup

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '4c54640fee1858b4da24ce0e8d4637771fb314af':
  KERNEL-13158: context跳过popup
  KERNEL-13158: context跳过popup
  KERNEL-13158: context跳过popup
es6
guy-王川 2 years ago
parent
commit
a7518e722c
  1. 4
      dist/fix/fix.compact.js
  2. 58
      examples/useContext.html
  3. 11
      src/widget/downlist/combo.downlist.js

4
dist/fix/fix.compact.js vendored

@ -109,13 +109,13 @@
pushTarget(this.store); pushTarget(this.store);
return true; return true;
} }
if (this._store) { if (this._store || this.options._store) {
var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context); var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) { if (store) {
pushTarget(store); pushTarget(store);
needPop = true; needPop = true;
} }
this.store = this._store(); this.store = (this._store || this.options._store)();
this.store && (this.store._widget = this); this.store && (this.store._widget = this);
needPop && popTarget(); needPop && popTarget();
needPop = false; needPop = false;

58
examples/useContext.html

@ -22,10 +22,10 @@
state: function () { state: function () {
return { return {
expand: false, expand: false,
cssScale: 2.0 cssScale: true
}; };
}, },
childContext: ["text"], childContext: ["text", "cssScale"],
computed: { computed: {
text: function () { text: function () {
@ -41,10 +41,20 @@
}); });
BI.model("demo.model", Model); BI.model("demo.model", Model);
var TempModel = BI.inherit(BI.Model, {
state: function () {
return {
cssScale: false
};
},
childContext: ["cssScale"],
});
BI.model("demo.temp_model", TempModel);
var oldFormat = BI.pixFormat; var oldFormat = BI.pixFormat;
BI.pixFormat = function (pix, border) { BI.pixFormat = function (pix, border) {
var context = BI.useContext("cssScale"); var context = BI.useContext("cssScale");
if (!context) { if (!context || context.model.cssScale === false) {
return oldFormat.apply(this, arguments); return oldFormat.apply(this, arguments);
} }
if (!BI.isNumber(pix)) { if (!BI.isNumber(pix)) {
@ -59,8 +69,8 @@
var oldPix = BI.toPix; var oldPix = BI.toPix;
BI.toPix = function (pix, border) { BI.toPix = function (pix, border) {
var context = BI.useContext("cssScale"); var context = BI.useContext("cssScale");
if (!context) { if (!context || context.model.cssScale === false) {
return oldPix.apply(this, arguments); return oldFormat.apply(this, arguments);
} }
if (!BI.isNumber(pix)) { if (!BI.isNumber(pix)) {
return pix; return pix;
@ -109,7 +119,7 @@
var child; var child;
var store = BI.useStore(); var store = BI.useStore();
return function () { return function () {
this.element[0].style.setProperty('--css-scale', store.model.cssScale); this.element[0].style.setProperty('--css-scale', 2);
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 20, vgap: 20,
@ -130,6 +140,42 @@
day: 15 day: 15
} }
} }
}, {
type: "bi.down_list_combo",
cls: "bi-border",
width: 24,
height: 24,
popup: {
_store: function () {
return BI.Models.getModel("demo.temp_model");
}
},
value: [{value: 2}, {value: 3, childValue: 4}],
items: [[{
text: "属于",
value: 1,
cls: "dot-e-font"
}, {
text: "不属于",
value: 2,
cls: "dot-e-font"
}], [{
el: {
text: "大于",
value: 3,
iconCls1: "dot-e-font"
},
value: 3,
children: [{
text: "固定值",
value: 4,
cls: "dot-e-font"
}, {
text: "平均值",
value: 5,
cls: "dot-e-font"
}]
}]]
}] }]
}; };
}; };

11
src/widget/downlist/combo.downlist.js

@ -41,6 +41,7 @@
container: null, container: null,
stopPropagation: false, stopPropagation: false,
el: {}, el: {},
popup: {},
minWidth: 140, minWidth: 140,
maxHeight: 1000, maxHeight: 1000,
destroyWhenHide: false destroyWhenHide: false
@ -63,12 +64,13 @@
belowMouse: o.belowMouse, belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide, destroyWhenHide: o.destroyWhenHide,
el: BI.createWidget(o.el, { el: {
type: "bi.icon_trigger", type: "bi.icon_trigger",
extraCls: o.iconCls, extraCls: o.iconCls,
width: o.width, width: o.width,
height: o.height height: o.height,
}), ...o.el
},
popup: { popup: {
el: { el: {
type: "bi.down_list_popup", type: "bi.down_list_popup",
@ -94,7 +96,8 @@
}, },
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight, maxHeight: o.maxHeight,
minWidth: o.minWidth minWidth: o.minWidth,
...o.popup
} }
}); });

Loading…
Cancel
Save