Browse Source

Merge pull request #146045 in DEC/fineui from final/11.0 to persist/11.0

* commit '3ca8bf00d6a759190a60193a8934fe19d699ffdd':
  REPORT-78514 revert: REPORT-7696组件是否异步获取数据,和组件是否支持搜索分离开
  chore: 打包加上hash
  REPORT-77246 fix: 根据review建议修改代码
  REPORT-77246 fix: 修复bi.time_combo组件内容和图标重叠的问题
master
superman 2 years ago
parent
commit
1797eca193
  1. 8
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  2. 35
      src/widget/multilayersingletree/multilayersingletree.combo.js
  3. 245
      src/widget/time/time.combo.js
  4. 15
      webpack/webpack.prod.js

8
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -132,11 +132,6 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
action: function () { action: function () {
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_SEARCHING);
} }
}, {
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_STOP,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_STOP);
}
}, { }, {
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM, eventName: BI.MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM,
action: function () { action: function () {
@ -248,7 +243,6 @@ BI.MultiLayerSelectTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiLayerSelectTreeCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiLayerSelectTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSelectTreeCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiLayerSelectTreeCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiLayerSelectTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiLayerSelectTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo); BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);

35
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -36,6 +36,11 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
}, },
_shouldWrapper: function () {
var o = this.options;
return !o.allowEdit && o.itemsCreator === BI.emptyFn;
},
_getBaseConfig: function () { _getBaseConfig: function () {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
@ -94,6 +99,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
container: o.container, container: o.container,
allowInsertValue: o.allowInsertValue, allowInsertValue: o.allowInsertValue,
allowSearchValue: o.allowSearchValue, allowSearchValue: o.allowSearchValue,
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger", cls: "multilayer-single-tree-trigger",
ref: function (_ref) { ref: function (_ref) {
self.trigger = _ref; self.trigger = _ref;
@ -130,11 +136,6 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
action: function () { action: function () {
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_SEARCHING);
} }
}, {
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_STOP,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_STOP);
}
}, { }, {
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_ADD_ITEM, eventName: BI.MultiLayerSingleTreeTrigger.EVENT_ADD_ITEM,
action: function () { action: function () {
@ -183,28 +184,13 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle, warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
}, }
}); });
}, },
_getAsyncConfig: function () { _getAsyncConfig: function () {
var o = this.options, self = this; var config = this._getBaseConfig();
var baseConfig = this._getBaseConfig(); return BI.extend(config, this._getSearchConfig());
return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : {
el: {
type: "bi.single_tree_trigger",
ref: function (_ref) {
self.textTrigger = _ref;
},
text: o.text,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
});
}, },
getSearcher: function () { getSearcher: function () {
@ -257,6 +243,5 @@ BI.MultiLayerSingleTreeCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeCombo.EVENT_BLUR = "EVENT_BLUR"; BI.MultiLayerSingleTreeCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiLayerSingleTreeCombo.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiLayerSingleTreeCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiLayerSingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiLayerSingleTreeCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo); BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);

245
src/widget/time/time.combo.js

@ -60,143 +60,136 @@
} }
}; };
return { return {
type: "bi.htape", type: "bi.horizontal_fill",
cls: "bi-border bi-border-radius",
columnSize: ["fill", this.constants.iconWidth],
height: opts.height - 2,
width: opts.width - 2,
items: [{ items: [{
type: "bi.absolute", el: {
items: [{ type: "bi.combo",
container: opts.container,
toggle: false,
isNeedAdjustHeight: opts.isNeedAdjustHeight,
isNeedAdjustWidth: opts.isNeedAdjustWidth,
el: { el: {
type: "bi.combo", type: "bi.time_trigger",
cls: "bi-border bi-border-radius", height: opts.height - 2,
container: opts.container, allowEdit: opts.allowEdit,
toggle: false, watermark: opts.watermark,
isNeedAdjustHeight: opts.isNeedAdjustHeight, format: opts.format,
isNeedAdjustWidth: opts.isNeedAdjustWidth, value: opts.value,
el: { ref: function (_ref) {
type: "bi.time_trigger", self.trigger = _ref;
height: opts.height - 2, },
allowEdit: opts.allowEdit, listeners: [{
watermark: opts.watermark, eventName: "EVENT_KEY_DOWN",
format: opts.format, action: function () {
value: opts.value, if (self.combo.isViewVisible()) {
ref: function (_ref) { self.combo.hideView();
self.trigger = _ref;
},
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
}
self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments);
}
}, {
eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.trigger.getKey();
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_BLUR",
action: function () {
self.fireEvent("EVENT_BLUR");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
var date = BI.getDate();
self.storeValue = {
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
};
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
} }
}, { self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments);
eventName: "EVENT_CHANGE", }
action: function () { }, {
self.fireEvent("EVENT_CHANGE"); eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
} }
}, { }
eventName: "EVENT_CONFIRM", }, {
action: function () { eventName: "EVENT_FOCUS",
if (self.combo.isViewVisible()) { action: function () {
return; self.storeTriggerValue = self.trigger.getKey();
} if (!self.combo.isViewVisible()) {
var dateStore = self.storeTriggerValue; self.combo.showView();
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
} }
}] self.fireEvent("EVENT_FOCUS");
}, }
adjustLength: this.constants.comboAdjustHeight, }, {
popup: { eventName: "EVENT_BLUR",
el: popup,
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth,
stopPropagation: false
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {
self.popup.setValue(self.storeValue); self.fireEvent("EVENT_BLUR");
self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW);
} }
}], }, {
ref: function (_ref) { eventName: "EVENT_ERROR",
self.combo = _ref; action: function () {
} var date = BI.getDate();
}, self.storeValue = {
top: 0, hour: date.getHours(),
left: 0, minute: date.getMinutes(),
right: 0, second: date.getSeconds()
bottom: 0 };
}, { self.fireEvent("EVENT_ERROR");
el: { }
type: "bi.icon_button", }, {
cls: "bi-trigger-icon-button time-font icon-size-16", eventName: "EVENT_VALID",
width: this.constants.iconWidth, action: function () {
height: opts.height, self.fireEvent("EVENT_VALID");
listeners: [{ }
eventName: BI.IconButton.EVENT_CHANGE, }, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () { action: function () {
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
// self.combo.hideView(); return;
} else {
self.combo.showView();
} }
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
} }
}], }]
ref: function (_ref) { },
self.triggerBtn = _ref; adjustLength: this.constants.comboAdjustHeight,
} popup: {
el: popup,
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth,
stopPropagation: false
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
}, },
top: 0, listeners: [{
right: 0 eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
}] action: function () {
self.popup.setValue(self.storeValue);
self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW);
}
}],
ref: function (_ref) {
self.combo = _ref;
}
},
}, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button time-font",
width: this.constants.iconWidth,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
if (self.combo.isViewVisible()) {
// self.combo.hideView();
} else {
self.combo.showView();
}
}
}],
ref: function (_ref) {
self.triggerBtn = _ref;
}
},
}] }]
}; };
}, },
@ -228,7 +221,7 @@
focus: function () { focus: function () {
this.trigger.focus(); this.trigger.focus();
}, },
blur: function () { blur: function () {
this.trigger.blur(); this.trigger.blur();
}, },

15
webpack/webpack.prod.js

@ -12,6 +12,15 @@ const common = require("./webpack.common.js");
const attachments = require("./attachments"); const attachments = require("./attachments");
const components = require("./components"); const components = require("./components");
const childProcess = require('child_process');
function git(command) {
return childProcess
.execSync(`git ${command}`)
.toString()
.trim();
}
module.exports = merge.smart(common, { module.exports = merge.smart(common, {
mode: "production", mode: "production",
entry: { entry: {
@ -63,7 +72,11 @@ module.exports = merge.smart(common, {
} }
}), }),
new webpack.BannerPlugin({ new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString()}` banner: `time: ${new Date().toLocaleString()}; branch: ${git(
'rev-parse --abbrev-ref HEAD'
)} commit: ${git(
'rev-parse HEAD'
)}`
}) })
] ]
}, },

Loading…
Cancel
Save