Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~xavier.meng/fineui

es6
Xavier.Meng 2 years ago
parent
commit
52dd730941
  1. 53
      demo/js/case/combo/demo.text_value_combo.js
  2. 2
      package.json
  3. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  4. 187
      src/case/combo/textvaluecombo/popup.textvalue.js
  5. 9
      src/core/platform/web/function.js
  6. 6
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  7. 1
      src/widget/multiselect/multiselect.combo.nobar.js
  8. 6
      src/widget/singleselect/singleselectlist.insert.js

53
demo/js/case/combo/demo.text_value_combo.js

@ -8,19 +8,21 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
render: function () { render: function () {
var combo1, combo2; var combo1, combo2;
var items = [{ var items = [
text: "MVC-1", {
iconCls: "date-font", text: "MVC-1",
value: 1 iconCls: "date-font",
}, { value: 1
text: "MVC-2", }, {
iconCls: "search-font", text: "MVC-2",
value: 2 iconCls: "search-font",
}, { value: 2
text: "MVC-3", }, {
iconCls: "pull-right-font", text: "MVC-3",
value: 3 iconCls: "pull-right-font",
}]; value: 3
}
];
// 创建下拉框各种场景用例 // 创建下拉框各种场景用例
return { return {
@ -195,6 +197,31 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: BI.Selection.Multi,
value: [1],
// allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
}),
this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
value: [1],
allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: BI.TextValueCombo.EVENT_CHANGE,

2
package.json

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

4
src/case/combo/textvaluecombo/combo.textvalue.js

@ -16,7 +16,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {}, el: {},
allowClear: false, allowClear: false,
status: "success", // success | warning | error, status: "success", // success | warning | error,
title: null title: null,
allowSelectAll: true,
}); });
}, },
@ -78,6 +79,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
ref: ref => this.popup = ref, ref: ref => this.popup = ref,
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items, items: o.items,
allowSelectAll: o.allowSelectAll,
listeners: [ listeners: [
{ {
eventName: BI.TextValueComboPopup.EVENT_CHANGE, eventName: BI.TextValueComboPopup.EVENT_CHANGE,

187
src/case/combo/textvaluecombo/popup.textvalue.js

@ -2,92 +2,132 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
allowSelectAll: true,
}); });
}, },
render () { render() {
var o = this.options, self = this; var o = this.options, self = this;
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 5, vgap: 5,
items: [{ items: [
type: "bi.button_group", {
ref: (_ref) => { type: "bi.button_group",
this.popup = _ref; ref: (_ref) => {
}, this.popup = _ref;
items: this._formatItems(o.items), },
chooseType: o.chooseType, items: this._formatItems(o.items),
layouts: [{ chooseType: o.chooseType,
type: "bi.vertical" layouts: [
}], {
value: o.value, type: "bi.vertical"
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
} }
} ],
}] value: o.value,
}] listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
}
}
]
}
]
}; };
} }
return { return {
type: "bi.vertical", type: "bi.vertical",
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""], items: o.allowSelectAll ? [
items: [{ {
type: "bi.select_list", type: "bi.select_list",
logic: { logic: {
dynamic: true, dynamic: true,
innerVgap: 5, innerVgap: 5,
rowSize: ["", "fill"], rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch verticalAlign: BI.VerticalAlign.Stretch
}, },
ref: (_ref) => { ref: (_ref) => {
this.popup = _ref; this.popup = _ref;
}, },
el: {
el: { el: {
chooseType: o.chooseType el: {
} chooseType: o.chooseType,
}, }
items: this._formatItems(o.items), },
value: { items: this._formatItems(o.items),
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, value: {
value: o.value type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
}, value: o.value
listeners: [{ },
eventName: BI.SelectList.EVENT_CHANGE, height: "fill",
action: function (val) { listeners: [
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val); {
} eventName: BI.SelectList.EVENT_CHANGE,
}] action: function (val) {
}, { self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
type: "bi.center", }
cls: "list-view-toolbar bi-high-light bi-split-top", }
height: 24, ]
items: BI.createItems([{
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}
}, { }, {
type: "bi.text_button", type: "bi.center",
text: BI.i18nText("BI-Basic_OK"), cls: "list-view-toolbar bi-high-light bi-split-top",
handler: function () { height: 24,
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM); items: BI.createItems([
} {
}], { type: "bi.text_button",
once: false, text: BI.i18nText("BI-Basic_Clears"),
shadow: true, handler: function () {
isShadowShowingOnSelected: true self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}) }
}] }, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
}
}
], {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
}
] : [
{
type: "bi.list_pane",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
chooseType: o.chooseType,
},
items: this._formatItems(o.items),
value: o.value,
height: "fill",
listeners: [
{
eventName: BI.ListPane.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}
]
}
],
}; };
}, },
@ -117,6 +157,9 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return this.popup.getValue(); return this.popup.getValue();
} }
var val = this.popup.getValue(); var val = this.popup.getValue();
if (!this.options.allowSelectAll) {
return val;
}
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value; return val.value;
} else { } else {
@ -128,6 +171,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return this.popup.setValue(v); return this.popup.setValue(v);
} }
if (!this.options.allowSelectAll) {
this.popup.setValue(v);
return;
}
this.popup.setValue({ this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v value: v

9
src/core/platform/web/function.js

@ -137,5 +137,14 @@ BI._.extend(BI, {
return version[1] * 1; return version[1] * 1;
} }
return 0; return 0;
},
getMinimumFontSize: function () {
const el = document.createElement('div');
el.style.fontSize = "0px";
document.body.appendChild(el);
const size = getComputedStyle(el).fontSize;
el.remove();
return parseInt(size);
} }
}); });

6
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -260,11 +260,11 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
}, },
focus: function () { focus: function () {
this.trigger.focus(); this.trigger ? this.trigger.focus() : this.textTrigger.focus();
}, },
blur: function () { blur: function () {
this.trigger.blur(); this.trigger ? this.trigger.blur() : this.textTrigger.blur();
}, },
showView: function () { showView: function () {
@ -272,7 +272,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
}, },
setWaterMark: function (v) { setWaterMark: function (v) {
this.trigger.setWaterMark(v); this.trigger ? this.trigger.setWaterMark(v) : this.textTrigger.setWaterMark(v);
} }
}); });

1
src/widget/multiselect/multiselect.combo.nobar.js

@ -160,6 +160,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
self.combo.adjustWidth(); self.combo.adjustWidth();

6
src/widget/singleselect/singleselectlist.insert.js

@ -55,8 +55,10 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
}, },
itemsCreator: function (op, callback) { itemsCreator: function (op, callback) {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); if (BI.isNotEmptyString(op.keywords[0])) {
o.itemsCreator(op, callback); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback);
}
}, },
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);

Loading…
Cancel
Save