Browse Source

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

es6
zsmj 2 years ago
parent
commit
ff4b936ef5
  1. 10
      bi.lessconfig.json
  2. 18
      demo/js/widget/downlist/demo.downlist.js
  3. 2
      package.json
  4. 6
      src/base/grid/grid.js
  5. 1
      src/core/4.widget.js
  6. 223
      src/widget/downlist/combo.downlist.js

10
bi.lessconfig.json

@ -22,6 +22,9 @@
"@color-bi-border-radio": "rgba(9, 30, 64, 0.37)",
"@color-bi-border-disabled-radio": "rgba(9, 30, 64, 0.19)",
"@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-border-checkbox-theme-dark": "rgba(255, 255, 255, 0.37)",
"@color-bi-border-hover-active-radio-theme-dark": "#3869DC",
"@color-bi-background-active-radio-content-theme-dark": "#3869DC",
"@color-bi-background-disabled-active-radio-content": "#FFFFFF",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
@ -39,7 +42,10 @@
"@color-bi-color-toast-text": "#000A19",
"@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)",
"@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)",
"@font-down-triangle": "e70b",
"@font-date": "e733",
"@font-trigger-triangle": "e924"
"@font-trigger-triangle": "e924",
"@font-solid-bottom": "e905",
"@font-solid-right": "e906",
"@font-dot": "e762",
"@font-down-triangle": "e70b"
}

18
demo/js/widget/downlist/demo.downlist.js

@ -47,11 +47,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
width: 100,
items: [
[{
el: {
text: "column 1111",
iconCls1: "dot-e-font",
value: 12
},
text: "column 1111",
iconCls1: "dot-e-font",
value: 12,
children: [{
text: "column 1.1",
value: 21,
@ -166,12 +164,10 @@ Demo.Downlist = BI.inherit(BI.Widget, {
}],
items: [
[{
el: {
text: "选项一",
value: 1,
icon: {
type: "demo.downlist.icon",
},
text: "选项一",
value: 1,
icon: {
type: "demo.downlist.icon",
},
children: [{
text: "选项一",

2
package.json

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

6
src/base/grid/grid.js

@ -97,6 +97,12 @@ BI.GridView = BI.inherit(BI.Widget, {
}
},
destroyed: function () {
BI.each(this.renderedCells, function(i, cell) {
cell.el._destroy();
})
},
_calculateSizeAndPositionData: function () {
var o = this.options;
this.rowCount = 0;

1
src/core/4.widget.js

@ -360,6 +360,7 @@
var workerMode = BI.Providers.getProvider("bi.provider.system").getWorkerMode();
var render = BI.isFunction(this.options.render) ? this.options.render : (workerMode ? (this.$render || this.render) : this.render);
var els = render && render.call(this);
els = this.options.configRender ? this.options.configRender(els) : els;
els = BI.Plugin.getRender(this.options.type, els);
if (BI.isPlainObject(els)) {
els = [els];

223
src/widget/downlist/combo.downlist.js

@ -1,110 +1,139 @@
/**
* Created by roy on 15/8/14.
*/
BI.DownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-down-list-combo",
height: 24,
items: [],
adjustLength: 0,
direction: "bottom",
trigger: "click",
container: null,
stopPropagation: false,
el: {},
minWidth: 140,
maxHeight: 1000,
destroyWhenHide: false
(function() {
function transformItems(items) {
if (!items) return items;
var result = BI.cloneDeep(items);
var isComplexItmes = BI.some(items, function (_, item) {
return BI.isArray(item);
});
},
// 传一维数组,帮转二维
if (!isComplexItmes) {
result = [result];
}
// 帮转 el
BI.each(result, function (_, arr) {
BI.each(arr, function (_, item) {
if (item.children && !item.el) {
item.el = {
text: item.text,
icon: item.icon,
cls: item.cls,
iconCls1: item.iconCls1,
value: item.value
};
}
});
});
return result;
}
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
/**
* Created by roy on 15/8/14.
*/
BI.DownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-down-list-combo",
height: 24,
items: [],
adjustLength: 0,
direction: "bottom",
trigger: "click",
container: null,
stopPropagation: false,
el: {},
minWidth: 140,
maxHeight: 1000,
destroyWhenHide: false
});
},
this.downlistcombo = BI.createWidget({
element: this,
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,
belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide,
el: BI.createWidget(o.el, {
type: "bi.icon_trigger",
extraCls: o.iconCls,
width: o.width,
height: o.height
}),
popup: {
el: {
type: "bi.down_list_popup",
ref: function (ref) {
self.popupView = ref;
},
items: o.items,
chooseType: o.chooseType,
value: o.value,
listeners: [{
eventName: BI.DownListPopup.EVENT_CHANGE,
action: function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
}
}, {
eventName: BI.DownListPopup.EVENT_SON_VALUE_CHANGE,
action: function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
}
}]
},
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.downlistcombo = BI.createWidget({
element: this,
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,
belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight,
minWidth: o.minWidth
}
});
destroyWhenHide: o.destroyWhenHide,
el: BI.createWidget(o.el, {
type: "bi.icon_trigger",
extraCls: o.iconCls,
width: o.width,
height: o.height
}),
popup: {
el: {
type: "bi.down_list_popup",
ref: function (ref) {
self.popupView = ref;
},
items: transformItems(o.items),
chooseType: o.chooseType,
value: o.value,
listeners: [{
eventName: BI.DownListPopup.EVENT_CHANGE,
action: function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
}
}, {
eventName: BI.DownListPopup.EVENT_SON_VALUE_CHANGE,
action: function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
}
}]
},
stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight,
minWidth: o.minWidth
}
});
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
});
},
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
});
},
hideView: function () {
this.downlistcombo.hideView();
},
hideView: function () {
this.downlistcombo.hideView();
},
showView: function (e) {
this.downlistcombo.showView(e);
},
showView: function (e) {
this.downlistcombo.showView(e);
},
populate: function (items) {
this.popupView.populate(items);
},
populate: function (items) {
this.popupView.populate(items);
},
setValue: function (v) {
this.popupView.setValue(v);
},
setValue: function (v) {
this.popupView.setValue(v);
},
getValue: function () {
return this.popupView.getValue();
},
getValue: function () {
return this.popupView.getValue();
},
adjustWidth: function () {
this.downlistcombo.adjustWidth();
},
adjustWidth: function () {
this.downlistcombo.adjustWidth();
},
adjustHeight: function () {
this.downlistcombo.adjustHeight();
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
adjustHeight: function () {
this.downlistcombo.adjustHeight();
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo);
BI.shortcut("bi.down_list_combo", BI.DownListCombo);
}());

Loading…
Cancel
Save