Browse Source

Merge pull request #210126 in DEC/fineui from release/11.0 to final/11.0

* commit '57c07d8f2dcab76ed4b67ec2d6f9c1a68af6b238': (68 commits)
  无JIRA任务 MultiLayerSelectTreeCombo部分方法修复
  Pull request #3222: REPORT-85040 fix: 日期控件时间会超
  auto upgrade version to 2.0.20221121190600
  BI-117684 视觉
  REPORT-83708 fix: worker对safari浏览器12以下版本做处理
  auto upgrade version to 2.0.20221117172352
  auto upgrade version to 2.0.20221117125408
  auto upgrade version to 2.0.20221116201501
  无JIRA refactor(base): 给findIndex加泛型
  auto upgrade version to 2.0.20221116175433
  BI-117406 fix: 动态图标无
  auto upgrade version to 2.0.20221116151511
  auto upgrade version to 2.0.20221116143350
  无JIRA configRender.call(this
  auto upgrade version to 2.0.20221115175620
  KERNEL-13158: zhenfei漏改了
  KERNEL-13523 chore: 修复下fui-cli命令
  KERNEL-13521 refactor: segment调整&行列布局的类名方法抽到layout上
  KERNEL-13521 refactor: segment使用grid布局,使其默认使用最长项宽度等分
  auto upgrade version to 2.0.20221114221310
  ...
master
superman 2 years ago
parent
commit
efe05b0058
  1. 35
      bin/cli/cli.js
  2. 4
      bin/cli/worker/cli.worker.js
  3. 24
      demo/js/case/demo.segment.js
  4. 4
      dist/fix/fix.compact.js
  5. 58
      examples/useContext.html
  6. 8
      package.json
  7. 57
      src/base/single/0.single.js
  8. 116
      src/base/single/button/buttons/button.js
  9. 5
      src/base/single/editor/editor.js
  10. 13
      src/case/calendar/calendar.js
  11. 12
      src/case/linearsegment/linear.segment.js
  12. 21
      src/case/segment/segment.js
  13. 2
      src/core/4.widget.js
  14. 12
      src/core/platform/web/function.js
  15. 21
      src/core/wrapper/layout.js
  16. 44
      src/core/wrapper/layout/layout.division.js
  17. 31
      src/core/wrapper/layout/layout.grid.js
  18. 62
      src/core/wrapper/layout/layout.table.js
  19. 4
      src/core/wrapper/layout/layout.tape.js
  20. 39
      src/core/wrapper/layout/layout.window.js
  21. 2
      src/less/base/segment/button.segment.less
  22. 15
      src/less/base/segment/segment.less
  23. 1
      src/less/base/single/button/button.less
  24. 5
      src/less/case/calendar/calendar.less
  25. 1
      src/less/lib/theme.less
  26. 4
      src/less/widget/multiselect/trigger/button.checkselected.less
  27. 1
      src/widget/date/calendar/combo.month.date.js
  28. 37
      src/widget/downlist/combo.downlist.js
  29. 4
      src/widget/editor/editor.text.js
  30. 6
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  31. 24
      src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js
  32. 2
      src/widget/year/combo.year.js
  33. 2
      src/widget/yearmonth/combo.yearmonth.js
  34. 4
      src/widget/yearquarter/combo.yearquarter.js
  35. 4
      typescript/core/base.ts
  36. 1
      typescript/core/platform/web/function.ts
  37. 3
      typescript/core/worker/controller/worker.main_thread.controller.ts

35
bin/cli/cli.js

@ -1,44 +1,21 @@
#!/usr/bin/env node #!/usr/bin/env node
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const workerCmd = require('./worker/cli.worker'); const workerCmd = require('./worker/cli.worker');
function getArgs (startIndex = 1) { const argv = yargs(hideBin(process.argv)).argv;
const args = {};
process.argv
.slice(startIndex, process.argv.length)
.forEach(arg => {
// long arg
if (arg.slice(0, 2) === '--') {
const longArg = arg.split('=');
const longArgFlag = longArg[0].slice(2, longArg[0].length);
const longArgValue = longArg.length > 1 ? longArg[1] : true;
args[longArgFlag] = longArgValue;
// flags
} else if (arg[0] === '-') {
const flags = arg.slice(1, arg.length);
args[flags] = true;
}
});
return args; const cmd = argv._[0];
}
const cmds = new Map([ const cmds = new Map([
['worker', workerCmd], ['worker', workerCmd],
]); ]);
const baseCmd = 'fui-cli'; if (!cmd) throw new Error('Command is undefined!');
const startIndex = process.argv.findIndex(argv => argv.indexOf(baseCmd) !== -1);
if (startIndex === -1) {
throw new Error(`Command ${baseCmd} not found in args`);
}
const cmd = process.argv[startIndex + 1];
if (cmds.has(cmd)) { if (cmds.has(cmd)) {
cmds.get(cmd)?.exec(getArgs(startIndex + 2)); cmds.get(cmd)?.exec(argv);
} else { } else {
throw new Error(`Command ${cmd} not supported`); throw new Error(`Command ${cmd} not supported`);
} }

4
bin/cli/worker/cli.worker.js

@ -5,7 +5,7 @@ function first2UpperCase(str) {
return str.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase()); return str.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase());
} }
function scanAndCreate(structure, workerName, root = process.env.INIT_CWD) { function scanAndCreate(structure, workerName, root) {
Object.keys(structure) Object.keys(structure)
.forEach(name => { .forEach(name => {
if (typeof structure[name] === 'object') { if (typeof structure[name] === 'object') {
@ -60,7 +60,7 @@ module.exports = {
}, },
}; };
scanAndCreate(structure, name); scanAndCreate(structure, name, args.where ? path.resolve(args.where) : process.cwd());
}, },
}; };

24
demo/js/case/demo.segment.js

@ -1,28 +1,28 @@
Demo.Func = BI.inherit(BI.Widget, { Demo.Func = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-func" baseCls: "demo-func",
}, },
render: function () { render: function () {
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.horizontal",
element: this, element: this,
vgap: 20, vgap: 20,
hgap: 30, hgap: 30,
items: [{ items: [{
type: "bi.segment", type: "bi.segment",
items: [{ items: [{
text: "1", text: "较长的选项1",
value: 1 value: 1,
}, { }, {
text: "2", text: "选项2",
value: 2 value: 2,
}, { }, {
text: "3", text: "选项3",
value: 3 value: 3,
}] }],
}] }],
}); });
} },
}); });
BI.shortcut("demo.segment", Demo.Func); BI.shortcut("demo.segment", Demo.Func);

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).call(this);
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"
}]
}]]
}] }]
}; };
}; };

8
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20221101100519", "version": "2.0.20221121190600",
"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",
@ -86,5 +86,9 @@
"registry": "https://registry.npmjs.org" "registry": "https://registry.npmjs.org"
}, },
"author": "fanruan", "author": "fanruan",
"license": "MIT" "license": "MIT",
"dependencies": {
"@types/yargs": "17.0.13",
"yargs": "17.6.2"
}
} }

57
src/base/single/0.single.js

@ -19,35 +19,37 @@ BI.Single = BI.inherit(BI.Widget, {
return BI.extend(conf, { return BI.extend(conf, {
readonly: false, readonly: false,
title: null, title: null,
warningTitle: null, warningTitle: null, // deprecated
tipType: null, // success或warning tipType: null, // deprecated success或warning
belowMouse: false, // title是否跟随鼠标 belowMouse: false, // title是否跟随鼠标
enableHover: false, enableHover: false,
}); });
}, },
_showToolTip: function (e, opt) { _showToolTip: function (e, opt) {
opt || (opt = {}); opt || (opt = {});
var self = this;
var o = this.options; var o = this.options;
var tooltipOpt = {};
var title = this.getTitle(); var title = this.getTitle();
if (BI.isPlainObject(title)) {
tooltipOpt = title; if (title instanceof Promise) {
this.requestingTitle = title;
title.then(resolvedTitle => {
// 由于是异步的,所以无法避免Promise resolve时机问题,所以设计为:鼠标移出了则不显示,并且只显示最后一次发起的查询结果
this.mouseOver && this.requestingTitle === title && showToolTip(this._getTooltipOptions(resolvedTitle));
});
} else { } else {
tooltipOpt.level = this.getTipType() || "success"; showToolTip(this._getTooltipOptions(title));
// 由于以前的用法,存在大量disabled:true搭配warningTitle的情况,所以这里做一个兼容,disabled:true的情况下,依然优先显示warningTitle,避免只设置了warningTitle而没有设置title的情况
if (BI.isNull(o.tipType) && !this.isEnabled()) {
tooltipOpt.text = (this.getWarningTitle() || title);
} else {
tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title);
}
} }
if (BI.isKey(tooltipOpt.text)) {
BI.Tooltips.show(e, this.getName(), tooltipOpt, this, opt); function showToolTip(tooltipOpt) {
if (o.action) { if (BI.isKey(tooltipOpt.text) && !BI.Tooltips.has(self.getName())) {
BI.Actions.runAction(o.action, "hover", o, this); BI.Tooltips.show(e, self.getName(), tooltipOpt, self, opt);
if (o.action) {
BI.Actions.runAction(o.action, "hover", o, self);
}
BI.Actions.runGlobalAction("hover", o, self);
} }
BI.Actions.runGlobalAction("hover", o, this);
} }
}, },
@ -91,12 +93,30 @@ BI.Single = BI.inherit(BI.Widget, {
} }
}, },
_getTooltipOptions: function (title) {
var o = this.options;
var tooltipOpt = {};
if (BI.isPlainObject(title)) {
tooltipOpt = title;
} else {
tooltipOpt.level = this.getTipType() || "success";
// 由于以前的用法,存在大量disabled:true搭配warningTitle的情况,所以这里做一个兼容,disabled:true的情况下,依然优先显示warningTitle,避免只设置了warningTitle而没有设置title的情况
if (BI.isNull(o.tipType) && !this.isEnabled()) {
tooltipOpt.text = (this.getWarningTitle() || title);
} else {
tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title);
}
}
return tooltipOpt;
},
enableHover: function (opt) { enableHover: function (opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
if (!this._hoverBinded) { if (!this._hoverBinded) {
this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) { this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) {
self._e = e; self._e = e;
self.mouseOver = true;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
delayingTooltips = self.getName(); delayingTooltips = self.getName();
self.showTimeout = BI.delay(function () { self.showTimeout = BI.delay(function () {
@ -144,6 +164,7 @@ BI.Single = BI.inherit(BI.Widget, {
}); });
this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) { this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) {
self._e = null; self._e = null;
self.mouseOver = false;
self._clearTimeOut(); self._clearTimeOut();
self._hideTooltip(); self._hideTooltip();
}); });

116
src/base/single/button/buttons/button.js

@ -71,6 +71,35 @@
render: function () { render: function () {
var o = this.options, self = this; var o = this.options, self = this;
// bi.center_adapt 作用:让 hgap 不影响 iconGap。
BI.createWidget({
type: "bi.center_adapt",
horizontalAlign: o.textAlign,
element: this,
ref: (ref) => {
self.containerRef = ref;
},
hgap: o.hgap,
vgap: o.vgap,
items: self.generateItems()
});
// 如果 options 对应的属性为 true 则给元素添加 class
var classArr = ["block", "clear", "ghost", "plain", "loading", "light"];
BI.each(classArr, function (_, clz) {
if (BI.get(o, clz) === true) {
self.element.addClass(clz);
}
});
if (o.minWidth > 0) {
this.element.css({ "min-width": BI.pixFormat(o.minWidth) });
}
},
generateItems(defaultRenderIcon) {
var o = this.options;
// 由于button默认情况下有个边框,所以要主动算行高 // 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight; var lineHeight, textHeight = o.textHeight;
var hasBorder = false var hasBorder = false
@ -90,7 +119,32 @@
} }
} }
var iconInvisible = !o.loading && !o.iconCls && !o.icon; var iconInvisible = !(o.loading || o.iconCls || o.icon || defaultRenderIcon);
var textWidth = o.textWidth;
if (BI.isNull(o.textWidth)) {
textWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width;
textWidth -= (o.hgap * 2 + o.iconGap)
textWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth
}
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
whiteSpace: o.whiteSpace,
textAlign: o.textAlign,
textWidth: textWidth,
textHeight: BI.toPix(textHeight, hasBorder ? 2 : 0),
height: BI.toPix(lineHeight, hasBorder ? 2 : 0),
value: o.value,
title: null,
});
if (iconInvisible) {
return [this.text]
}
this._iconRendered = true;
if (BI.isPlainObject(o.icon) && !o.loading) { if (BI.isPlainObject(o.icon) && !o.loading) {
this.icon = BI.createWidget(o.icon); this.icon = BI.createWidget(o.icon);
} else { } else {
@ -107,64 +161,24 @@
}); });
} }
// 用户可能设置的 width 小于按钮的最小宽度
var actualWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width;
var textWidth = iconInvisible && o.width ? actualWidth - o.hgap * 2 : null;
if (BI.isNotNull(o.textWidth)) {
// textWidth 需要减去图标
textWidth = o.textWidth - (iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth);
}
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
whiteSpace: o.whiteSpace,
textAlign: o.textAlign,
textWidth: textWidth,
textHeight: BI.toPix(textHeight, hasBorder ? 2 : 0),
height: BI.toPix(lineHeight, hasBorder ? 2 : 0),
value: o.value,
title: null,
});
var layoutType = "bi.horizontal";
var gapContainer = { var gapContainer = {
lgap: o.iconPosition === "left" && o.text ? o.iconGap : 0, lgap: o.iconPosition === "left" && o.text ? o.iconGap : 0,
rgap: o.iconPosition === "right" ? o.iconGap : 0, rgap: o.iconPosition === "right" ? o.iconGap : 0,
tgap: o.iconPosition === "top" ? o.iconGap : 0, tgap: o.iconPosition === "top" ? o.iconGap : 0,
bgap: o.iconPosition === "bottom" ? o.iconGap : 0, bgap: o.iconPosition === "bottom" ? o.iconGap : 0,
}; };
var items = [this.icon, BI.extend({el: this.text}, gapContainer)];
if (isVertical(o.iconPosition)) { var items = [this.icon, BI.extend({ el: this.text }, gapContainer)];
layoutType = "bi.vertical";
}
if (o.iconPosition === "right" || o.iconPosition === "bottom") { if (o.iconPosition === "right" || o.iconPosition === "bottom") {
items = [BI.extend({el: this.text}, gapContainer), this.icon]; items.reverse();
} }
// bi.center_adapt 作用:让 hgap 不影响 iconGap。
BI.createWidget({
type: "bi.center_adapt",
horizontalAlign: o.textAlign,
element: this,
hgap: o.hgap,
vgap: o.vgap,
items: [{
type: layoutType,
horizontalAlign: "center",
verticalAlign: "middle",
items: items,
}],
});
var classArr = ["block", "clear", "ghost", "plain", "loading", "light"];
// 如果 options 对应的属性为 true 则给元素添加 class
BI.each(classArr, function (_, clz) {
if (BI.get(o, clz) === true) {
self.element.addClass(clz);
}
});
if (o.minWidth > 0) { return [{
this.element.css({ "min-width": BI.pixFormat(o.minWidth) }); type: isVertical(o.iconPosition) ? "bi.vertical" : "bi.horizontal",
} horizontalAlign: "center",
verticalAlign: "middle",
items,
}];
}, },
doClick: function () { doClick: function () {
@ -194,6 +208,7 @@
loading: function () { loading: function () {
this._loading = true; this._loading = true;
this.element.addClass("loading"); this.element.addClass("loading");
!this._iconRendered && this.containerRef.populate(this.generateItems(true));
if (this.icon.loading) { if (this.icon.loading) {
this.icon.loading(); this.icon.loading();
} else { } else {
@ -228,6 +243,7 @@
setIcon: function (cls) { setIcon: function (cls) {
var o = this.options; var o = this.options;
!this._iconRendered && this.containerRef.populate(this.generateItems(true));
if (this.icon && o.iconCls !== cls) { if (this.icon && o.iconCls !== cls) {
this.icon.element.removeClass(o.iconCls).addClass(cls); this.icon.element.removeClass(o.iconCls).addClass(cls);
o.iconCls = cls; o.iconCls = cls;

5
src/base/single/editor/editor.js

@ -344,11 +344,6 @@ BI.Editor = BI.inherit(BI.Single, {
return this.editor.isValid(); return this.editor.isValid();
}, },
setValid: function (b) {
this.editor.setValid(b);
this._checkError();
},
destroyed: function () { destroyed: function () {
BI.Bubbles.remove(this.getName()); BI.Bubbles.remove(this.getName());
}, },

13
src/case/calendar/calendar.js

@ -156,12 +156,21 @@ BI.Calendar = BI.inherit(BI.Widget, {
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return BI.map(item, function (j, td) { return BI.map(item, function (j, td) {
var month = td.lastMonth ? o.month - 1 : (td.nextMonth ? o.month + 1 : o.month); var month = td.lastMonth ? o.month - 1 : (td.nextMonth ? o.month + 1 : o.month);
var year = o.year;
if (month > 12) {
month = 1;
year++;
} else if (month < 1) {
month = 12;
year--;
}
return BI.extend(td, { return BI.extend(td, {
type: "bi.calendar_date_item", type: "bi.calendar_date_item",
once: false, once: false,
forceSelected: true, forceSelected: true,
value: o.year + "-" + month + "-" + td.text, value: year + "-" + month + "-" + td.text,
disabled: td.lastMonth || td.nextMonth || td.disabled, disabled: td.disabled,
cls: td.lastMonth || td.nextMonth ? "not-current-month-day" : "",
lgap: 2, lgap: 2,
rgap: 2, rgap: 2,
tgap: 4, tgap: 4,

12
src/case/linearsegment/linear.segment.js

@ -3,9 +3,6 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-linear-segment", baseCls: "bi-linear-segment",
items: [], items: [],
layouts: [{
type: "bi.center"
}],
height: 30 height: 30
}, },
@ -13,11 +10,14 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.button_group", type: "bi.button_group",
items: BI.createItems(o.items, { items: [BI.createItems(o.items, {
type: "bi.linear_segment_button", type: "bi.linear_segment_button",
height: o.height height: o.height
}), })],
layouts: o.layouts, layouts: [{
type: "bi.table",
columnSize: BI.makeArrayByArray(o.items, "fill"),
}],
value: o.value, value: o.value,
listeners: [{ listeners: [{
eventName: "__EVENT_CHANGE__", eventName: "__EVENT_CHANGE__",

21
src/case/segment/segment.js

@ -10,7 +10,7 @@ BI.Segment = BI.inherit(BI.Widget, {
return BI.extend(BI.Segment.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Segment.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-segment", baseCls: "bi-segment",
items: [], items: [],
height: 24 height: 24,
}); });
}, },
_init: function () { _init: function () {
@ -20,16 +20,15 @@ BI.Segment = BI.inherit(BI.Widget, {
element: this, element: this,
type: "bi.button_group", type: "bi.button_group",
value: o.value, value: o.value,
items: BI.createItems(o.items, { items: [BI.createItems(o.items, {
type: "bi.segment_button", type: "bi.segment_button",
height: BI.toPix(o.height, 2), height: BI.toPix(o.height, 2),
whiteSpace: o.whiteSpace whiteSpace: o.whiteSpace,
}), })],
layout: [ layouts: [{
{ type: "bi.table",
type: "bi.center" columnSize: BI.makeArrayByArray(o.items, "fill"),
} }],
]
}); });
this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -58,7 +57,7 @@ BI.Segment = BI.inherit(BI.Widget, {
getValue: function () { getValue: function () {
return this.buttonGroup.getValue(); return this.buttonGroup.getValue();
} },
}); });
BI.Segment.EVENT_CHANGE = "EVENT_CHANGE"; BI.Segment.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.segment", BI.Segment); BI.shortcut("bi.segment", BI.Segment);

2
src/core/4.widget.js

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

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

@ -125,5 +125,17 @@ BI._.extend(BI, {
} }
} }
return false; return false;
},
getSafariVersion: function () {
if (!_global.navigator) {
return 0;
}
var agent = navigator.userAgent.toLowerCase();
var version = agent.match(/version\/([\d.]+)/);
if (version && version[1]) {
return version[1] * 1;
}
return 0;
} }
}); });

21
src/core/wrapper/layout.js

@ -16,7 +16,7 @@ BI.Layout = BI.inherit(BI.Widget, {
scrolly: false, // true, false scrolly: false, // true, false
items: [], items: [],
innerHgap: 0, innerHgap: 0,
innerVgap: 0 innerVgap: 0,
}; };
}, },
@ -727,6 +727,25 @@ BI.Layout = BI.inherit(BI.Widget, {
}); });
}, },
getRowColumnCls: function (rowIndex, colIndex, lastRowIndex, lastColIndex) {
var cls = "";
if (rowIndex === 0) {
cls += " first-row";
} else if (rowIndex === lastRowIndex) {
cls += " last-row";
}
if (colIndex === 0) {
cls += " first-col";
} else if (colIndex === lastColIndex) {
cls += " last-col";
}
BI.isOdd(rowIndex + 1) ? (cls += " odd-row") : (cls += " even-row");
BI.isOdd(colIndex + 1) ? (cls += " odd-col") : (cls += " even-col");
cls += " center-element";
return cls;
},
removeWidget: function (nameOrWidget) { removeWidget: function (nameOrWidget) {
var removeIndex, self = this; var removeIndex, self = this;
if (BI.isWidget(nameOrWidget)) { if (BI.isWidget(nameOrWidget)) {

44
src/core/wrapper/layout/layout.division.js

@ -28,44 +28,31 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
}, },
stroke: function (items) { stroke: function (items) {
var o = this.options; var o = this.options, self = this;
var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0); var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0);
var map = BI.makeArray(rows), widths = {}, heights = {}; var map = BI.makeArray(rows), widths = {}, heights = {};
function firstElement (item, row, col) { function firstElement (item, cls) {
if (row === 0) { item.addClass(cls);
item.addClass("first-row");
} return item;
if (col === 0) {
item.addClass("first-col");
}
item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row");
item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col");
item.addClass("center-element");
} }
function firstObject (item, row, col) { function firstObject (item, cls) {
var cls = ""; item.cls = (item.cls || "") + cls;
if (row === 0) {
cls += " first-row"; return item;
}
if (col === 0) {
cls += " first-col";
}
BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row");
BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col");
item.cls = (item.cls || "") + cls + " center-element";
} }
function first (item, row, col) { function first (item, cls) {
if (item instanceof BI.Widget) { if (item instanceof BI.Widget) {
firstElement(item.element, row, col); firstElement(item.element, cls);
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, cls);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col); firstObject(item.el, cls);
} else { } else {
firstObject(item, row, col); firstObject(item, cls);
} }
} }
@ -79,6 +66,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
heights[j] = (heights[j] || 0) + item.height; heights[j] = (heights[j] || 0) + item.height;
map[i][j] = el; map[i][j] = el;
}); });
return; return;
} }
widths[item.row] = (widths[item.row] || 0) + item.width; widths[item.row] = (widths[item.row] || 0) + item.width;
@ -106,7 +94,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
if (j == o.columns - 1) { if (j == o.columns - 1) {
w.element.css({right: "0%"}); w.element.css({right: "0%"});
} }
first(w, i, j); first(w, self.getRowColumnCls(i, j, rows - 1, columns - 1));
totalW += map[i][j].width; totalW += map[i][j].width;
} }
} }

31
src/core/wrapper/layout/layout.grid.js

@ -36,29 +36,16 @@ BI.GridLayout = BI.inherit(BI.Layout, {
els[i] = []; els[i] = [];
} }
function firstElement (item, row, col) { function firstElement (item, cls) {
if (row === 0) { item.addClass(cls);
item.addClass("first-row");
} return item;
if (col === 0) {
item.addClass("first-col");
}
item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row");
item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col");
item.addClass("center-element");
} }
function firstObject (item, row, col) { function firstObject (item, cls) {
var cls = ""; item.cls = (item.cls || "") + cls;
if (row === 0) {
cls += " first-row"; return item;
}
if (col === 0) {
cls += " first-col";
}
BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row");
BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col");
item.cls = (item.cls || "") + cls + " center-element";
} }
function first (item, row, col) { function first (item, row, col) {
@ -89,7 +76,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
type: "bi.layout" type: "bi.layout"
}); });
} }
first(els[i][j], i, j); first(els[i][j], self.getRowColumnCls(i, j, rows - 1, columns - 1));
els[i][j].element.css({ els[i][j].element.css({
position: "absolute", position: "absolute",
top: height * i + "%", top: height * i + "%",

62
src/core/wrapper/layout/layout.table.js

@ -16,7 +16,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
// rowSize: 30, // or [30,30,30] // rowSize: 30, // or [30,30,30]
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
items: [] items: [],
}); });
}, },
render: function () { render: function () {
@ -45,57 +45,43 @@ BI.TableLayout = BI.inherit(BI.Layout, {
return self._optimiseGap(size); return self._optimiseGap(size);
}).join(" ") : BI.range(o.items.length).fill(this._optimiseGap(o.rowSize)).join(" "), }).join(" ") : BI.range(o.items.length).fill(this._optimiseGap(o.rowSize)).join(" "),
"grid-row-gap": this._optimiseGap(o.vgap), "grid-row-gap": this._optimiseGap(o.vgap),
"grid-column-gap": this._optimiseGap(o.hgap) "grid-column-gap": this._optimiseGap(o.hgap),
}); });
} }
return { return {
type: "bi.default", type: "bi.default",
ref: function (_ref) { ref: function (_ref) {
self.layout = _ref; self.layout = _ref;
}, },
items: this._formatItems(items) items: this._formatItems(items),
}; };
}, },
_formatItems: function (items) { _formatItems: function (items) {
var o = this.options; var o = this.options, self = this;
function firstElement (item, cls) {
item.addClass(cls);
function firstElement (item, row, col) {
if (row === 0) {
item.addClass("first-row");
}
if (col === 0) {
item.addClass("first-col");
}
item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row");
item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col");
item.addClass("center-element");
return item; return item;
} }
function firstObject (item, row, col) { function firstObject (item, cls) {
var cls = ""; item.cls = (item.cls || "") + cls;
if (row === 0) {
cls += " first-row";
}
if (col === 0) {
cls += " first-col";
}
BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row");
BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col");
item.cls = (item.cls || "") + cls + " center-element";
return item; return item;
} }
function first (item, row, col) { function first (item, cls) {
if (item instanceof BI.Widget) { if (item instanceof BI.Widget) {
return firstElement(item.element, row, col); return firstElement(item.element, cls);
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
return firstElement(item.el.element, row, col); return firstElement(item.el.element, cls);
} else if (item.el) { } else if (item.el) {
return firstObject(item.el, row, col); return firstObject(item.el, cls);
} else { } else {
return firstObject(item, row, col); return firstObject(item, cls);
} }
} }
@ -105,18 +91,20 @@ BI.TableLayout = BI.inherit(BI.Layout, {
columnSize: ["fill"], columnSize: ["fill"],
horizontalAlign: o.horizontalAlign, horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign, verticalAlign: o.verticalAlign,
items: [BI.formatEL(item)] items: [BI.formatEL(item)],
}; };
} }
return BI.reduce(items, function (row, result, i) { return BI.reduce(items, function (rowItems, result, rowIndex) {
return result.concat(BI.map(row, function (j, item) { return result.concat(BI.map(rowItems, function (colIndex, item) {
var cls = self.getRowColumnCls(rowIndex, colIndex, items.length - 1, rowItems.length - 1);
if (BI.isEmpty(item)) { if (BI.isEmpty(item)) {
return first(wrapLayout({ return first(wrapLayout({
type: "bi.layout" type: "bi.layout",
}), i, j); }), cls);
} }
return first(wrapLayout(item), i, j);
return first(wrapLayout(item), cls);
})); }));
}, []); }, []);
}, },
@ -127,6 +115,6 @@ BI.TableLayout = BI.inherit(BI.Layout, {
populate: function (items) { populate: function (items) {
this.layout.populate(this._formatItems(items)); this.layout.populate(this._formatItems(items));
} },
}); });
BI.shortcut("bi.table", BI.TableLayout); BI.shortcut("bi.table", BI.TableLayout);

4
src/core/wrapper/layout/layout.tape.js

@ -217,7 +217,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap) top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap)
}); });
if (rowSize === "" || rowSize === "fill") { if (BI.isNull(rowSize) || rowSize === "" || rowSize === "fill") {
return true; return true;
} }
}); });
@ -235,7 +235,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap) bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap)
}); });
if (rowSize === "" || rowSize === "fill") { if (BI.isNull(rowSize) || rowSize === "" || rowSize === "fill") {
return true; return true;
} }
}); });

39
src/core/wrapper/layout/layout.window.js

@ -35,7 +35,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
}, },
stroke: function (items) { stroke: function (items) {
var o = this.options; var o = this.options, self = this;
if (BI.isNumber(o.rowSize)) { if (BI.isNumber(o.rowSize)) {
o.rowSize = BI.makeArray(o.items.length, 1 / o.items.length); o.rowSize = BI.makeArray(o.items.length, 1 / o.items.length);
} }
@ -43,29 +43,16 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length); o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length);
} }
function firstElement (item, row, col) { function firstElement (item, cls) {
if (row === 0) { item.addClass(cls);
item.addClass("first-row");
} return item;
if (col === 0) {
item.addClass("first-col");
}
item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row");
item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col");
item.addClass("center-element");
} }
function firstObject (item, row, col) { function firstObject (item, cls) {
var cls = ""; item.cls = (item.cls || "") + cls;
if (row === 0) {
cls += " first-row"; return item;
}
if (col === 0) {
cls += " first-col";
}
BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row");
BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col");
item.cls = (item.cls || "") + cls + " center-element";
} }
function first (item, row, col) { function first (item, row, col) {
@ -109,7 +96,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
h = this._optimiseGap(o.rowSize[i]); h = this._optimiseGap(o.rowSize[i]);
} }
wi.element.css({top: t, height: h}); wi.element.css({top: t, height: h});
first(wi, i, j); first(wi, self.getRowColumnCls(i, j, o.rows - 1, o.columns - 1));
} }
if (!BI.isNumber(o.rowSize[i])) { if (!BI.isNumber(o.rowSize[i])) {
break; break;
@ -127,7 +114,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
h = this._optimiseGap(o.rowSize[i]); h = this._optimiseGap(o.rowSize[i]);
} }
wi.element.css({bottom: b, height: h}); wi.element.css({bottom: b, height: h});
first(wi, i, j); first(wi, self.getRowColumnCls(i, j, o.rows - 1, o.columns - 1));
} }
if (!BI.isNumber(o.rowSize[i])) { if (!BI.isNumber(o.rowSize[i])) {
break; break;
@ -145,7 +132,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
w = this._optimiseGap(o.columnSize[j]); w = this._optimiseGap(o.columnSize[j]);
} }
wi.element.css({left: l, width: w}); wi.element.css({left: l, width: w});
first(wi, i, j); first(wi, self.getRowColumnCls(i, j, o.rows - 1, o.columns - 1));
} }
if (!BI.isNumber(o.columnSize[j])) { if (!BI.isNumber(o.columnSize[j])) {
break; break;
@ -163,7 +150,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
w = this._optimiseGap(o.columnSize[j]); w = this._optimiseGap(o.columnSize[j]);
} }
wi.element.css({right: r, width: w}); wi.element.css({right: r, width: w});
first(wi, i, j); first(wi, self.getRowColumnCls(i, j, o.rows - 1, o.columns - 1));
} }
if (!BI.isNumber(o.columnSize[j])) { if (!BI.isNumber(o.columnSize[j])) {
break; break;

2
src/less/base/segment/button.segment.less

@ -10,7 +10,7 @@
.line-segment-button-line { .line-segment-button-line {
.transition(background 0.3s); .transition(background 0.3s);
} }
&.active, &:active { &.active, &:active:not(.disabled) {
font-weight: bold; font-weight: bold;
} }
} }

15
src/less/base/segment/segment.less

@ -7,17 +7,24 @@
border-top: 1px solid @color-bi-split-segment; border-top: 1px solid @color-bi-split-segment;
border-bottom: 1px solid @color-bi-split-segment; border-bottom: 1px solid @color-bi-split-segment;
} }
& > .first-element{ & > .first-col{
border-left: 1px solid @color-bi-split-segment; border-left: 1px solid @color-bi-split-segment;
.border-corner-radius(2px,0px,0px,2px) .border-corner-radius(2px,0px,0px,2px)
} }
& > .last-element{ & > .last-col{
.border-corner-radius(0px,2px,2px,0px) .border-corner-radius(0px,2px,2px,0px)
} }
&.disabled > .center-element, &.disabled > .first-element{ &.disabled > .center-element, &.disabled > .first-col{
border-color: @color-bi-split-disabled-segment; border-color: @color-bi-split-disabled-segment;
} }
} }
.bi-linear-segment {
&.disabled {
.bi-high-light-background {
background-color: @color-bi-background-dark-gray !important;
}
}
}
.bi-theme-dark { .bi-theme-dark {
.bi-segment { .bi-segment {
@ -27,7 +34,7 @@
border-top: 1px solid @color-bi-split-segment-theme-dark; border-top: 1px solid @color-bi-split-segment-theme-dark;
border-bottom: 1px solid @color-bi-split-segment-theme-dark; border-bottom: 1px solid @color-bi-split-segment-theme-dark;
} }
& > .first-element{ & > .first-col{
border-left: 1px solid @color-bi-split-segment-theme-dark; border-left: 1px solid @color-bi-split-segment-theme-dark;
} }
} }

1
src/less/base/single/button/button.less

@ -502,6 +502,7 @@ body .bi-button, #body .bi-button {
&.button-error.disabled, &.button-error.disabled,
&.button-warning.disabled { &.button-warning.disabled {
&, &.base-disabled { &, &.base-disabled {
color: @color-bi-text-disabled-button-theme-dark !important;
border-color: @color-bi-border-dark-gray-line-theme-dark !important; border-color: @color-bi-border-dark-gray-line-theme-dark !important;
background-color: fade(@color-bi-background-disabled-button-theme-dark, 20%) !important; background-color: fade(@color-bi-background-disabled-button-theme-dark, 20%) !important;
@ieColor: argb(fade(@color-bi-background-disabled-button-theme-dark, 20%)); @ieColor: argb(fade(@color-bi-background-disabled-button-theme-dark, 20%));

5
src/less/case/calendar/calendar.less

@ -0,0 +1,5 @@
@import "../../index.less";
.bi-calendar-date-item.not-current-month-day {
color: @color-bi-text-disabled-button !important;
}

1
src/less/lib/theme.less

@ -125,6 +125,7 @@
@color-bi-text-error-clear-button: @color-bi-text-failure; @color-bi-text-error-clear-button: @color-bi-text-failure;
@color-bi-text-error-ghost-button: @color-bi-text-failure; @color-bi-text-error-ghost-button: @color-bi-text-failure;
@color-bi-text-disabled-button: @color-bi-text-disabled; @color-bi-text-disabled-button: @color-bi-text-disabled;
@color-bi-text-disabled-button-theme-dark: @color-bi-text-disabled-theme-dark;
@color-bi-background-disabled-button: @color-bi-background-light-disabled; @color-bi-background-disabled-button: @color-bi-background-light-disabled;
@color-bi-border-disabled-button: @color-bi-border-disabled; @color-bi-border-disabled-button: @color-bi-border-disabled;
@color-bi-text-disabled-ignore-button: @color-bi-text-disabled; @color-bi-text-disabled-ignore-button: @color-bi-text-disabled;

4
src/less/widget/multiselect/trigger/button.checkselected.less

@ -2,8 +2,8 @@
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px; .border-radius(50%);
.border-radius(8px);
&:active { &:active {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;
background-color: @color-bi-background-multi-select-trigger-check-selected; background-color: @color-bi-background-multi-select-trigger-check-selected;

1
src/widget/date/calendar/combo.month.date.js

@ -48,6 +48,7 @@ BI.MonthDateCombo = BI.inherit(BI.Trigger, {
el: { el: {
type: "bi.vertical", type: "bi.vertical",
hgap: 6, hgap: 6,
vgap: 5,
items: [this.popup] items: [this.popup]
} }
} }

37
src/widget/downlist/combo.downlist.js

@ -17,7 +17,7 @@
text: item.text, text: item.text,
icon: item.icon, icon: item.icon,
cls: item.cls, cls: item.cls,
iconCls1: item.iconCls1, iconCls1: item.iconCls1,
value: item.value value: item.value
}; };
} }
@ -25,7 +25,7 @@
}); });
return result; return result;
} }
/** /**
* Created by roy on 15/8/14. * Created by roy on 15/8/14.
*/ */
@ -41,16 +41,17 @@
container: null, container: null,
stopPropagation: false, stopPropagation: false,
el: {}, el: {},
popup: {},
minWidth: 140, minWidth: 140,
maxHeight: 1000, maxHeight: 1000,
destroyWhenHide: false destroyWhenHide: false
}); });
}, },
_init: function () { _init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments); BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.downlistcombo = BI.createWidget({ this.downlistcombo = BI.createWidget({
element: this, element: this,
type: "bi.combo", type: "bi.combo",
@ -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,39 +96,40 @@
}, },
stopPropagation: o.stopPropagation, stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight, maxHeight: o.maxHeight,
minWidth: o.minWidth minWidth: o.minWidth,
...o.popup
} }
}); });
this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW);
}); });
}, },
hideView: function () { hideView: function () {
this.downlistcombo.hideView(); this.downlistcombo.hideView();
}, },
showView: function (e) { showView: function (e) {
this.downlistcombo.showView(e); this.downlistcombo.showView(e);
}, },
populate: function (items) { populate: function (items) {
this.popupView.populate(items); this.popupView.populate(items);
}, },
setValue: function (v) { setValue: function (v) {
this.popupView.setValue(v); this.popupView.setValue(v);
}, },
getValue: function () { getValue: function () {
return this.popupView.getValue(); return this.popupView.getValue();
}, },
adjustWidth: function () { adjustWidth: function () {
this.downlistcombo.adjustWidth(); this.downlistcombo.adjustWidth();
}, },
adjustHeight: function () { adjustHeight: function () {
this.downlistcombo.adjustHeight(); this.downlistcombo.adjustHeight();
} }
@ -134,6 +137,6 @@
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo); BI.shortcut("bi.down_list_combo", BI.DownListCombo);
}()); }());

4
src/widget/editor/editor.text.js

@ -138,10 +138,6 @@ BI.TextEditor = BI.inherit(BI.Widget, {
return this.editor.isValid(); return this.editor.isValid();
}, },
setValid: function (b) {
this.editor.setValid(b);
},
setValue: function (v) { setValue: function (v) {
this.editor.setValue(v); this.editor.setValue(v);
}, },

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);
} }
}); });

24
src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js

@ -19,14 +19,6 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
if(BI.isNotNull(o.value)) { if(BI.isNotNull(o.value)) {
value = this._digest(o.value); value = this._digest(o.value);
} }
this.trigger = BI.createWidget({
type: "bi.down_list_select_text_trigger",
cls: "text-value-down-list-trigger",
height: BI.toPix(o.height, 2),
items: o.items,
text: o.text,
value: value
});
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.down_list_combo", type: "bi.down_list_combo",
@ -35,7 +27,17 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
adjustLength: 2, adjustLength: 2,
width: BI.toPix(o.width, 2), width: BI.toPix(o.width, 2),
height: BI.toPix(o.height, 2), height: BI.toPix(o.height, 2),
el: this.trigger, el: {
type: "bi.down_list_select_text_trigger",
ref: function (_ref) {
self.trigger = _ref;
},
cls: "text-value-down-list-trigger",
height: BI.toPix(o.height, 2),
items: o.items,
text: o.text,
value: value
},
value: BI.isNull(value) ? [] : [value], value: BI.isNull(value) ? [] : [value],
items: BI.deepClone(o.items) items: BI.deepClone(o.items)
}); });
@ -79,7 +81,7 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
v = this._digest(v); v = this._digest(v);
this.combo.setValue([v]); this.combo.setValue([v]);
this.trigger.setValue(v); this.trigger?.setValue(v);
}, },
getValue: function () { getValue: function () {
@ -94,4 +96,4 @@ BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo); BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo);

2
src/widget/year/combo.year.js

@ -141,7 +141,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button", cls: "bi-trigger-icon-button date-change-h-font",
width: this._const.iconWidth, width: this._const.iconWidth,
height: BI.toPix(o.height, border), height: BI.toPix(o.height, border),
ref: function () { ref: function () {

2
src/widget/yearmonth/combo.yearmonth.js

@ -141,7 +141,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button", cls: "bi-trigger-icon-button date-change-h-font",
width: BI.toPix(o.height, border), width: BI.toPix(o.height, border),
height: BI.toPix(o.height, border), height: BI.toPix(o.height, border),
ref: function () { ref: function () {

4
src/widget/yearquarter/combo.yearquarter.js

@ -144,7 +144,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button", cls: "bi-trigger-icon-button date-change-h-font",
width: this._consts.iconWidth, width: this._consts.iconWidth,
height: BI.toPix(o.height, border), height: BI.toPix(o.height, border),
ref: function () { ref: function () {
@ -169,7 +169,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
} }
switch (type) { switch (type) {
case BI.DynamicYearQuarterCombo.Dynamic: case BI.DynamicYearQuarterCombo.Dynamic:
this.comboWrapper.resize(); this.changeIcon.setVisible(true);
break; break;
default: default:
this.changeIcon.setVisible(false); this.changeIcon.setVisible(false);

4
typescript/core/base.ts

@ -148,9 +148,9 @@ export interface _base {
takeRight: <T>(array: T[], n: number) => T[]; takeRight: <T>(array: T[], n: number) => T[];
findIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number; findIndex: <T>(array: T[], predicate?: ((index: number, item: T, array: T[]) => any) | object | string, thisArg?: any) => number;
findLastIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number; findLastIndex: <T>(array: T[], predicate?: ((index: number, item: T, array: T[]) => any) | object | string, thisArg?: any) => number;
makeArray: <T>(length: number, value?: T) => number[] | T[]; makeArray: <T>(length: number, value?: T) => number[] | T[];

1
typescript/core/platform/web/function.ts

@ -9,4 +9,5 @@ export type _function = {
isMac: () => boolean; isMac: () => boolean;
isWindows: () => boolean; isWindows: () => boolean;
isSupportCss3: (style: any) => boolean; isSupportCss3: (style: any) => boolean;
getSafariVersion: () => number;
} }

3
typescript/core/worker/controller/worker.main_thread.controller.ts

@ -10,9 +10,10 @@ export class WorkerMainThreadController extends WorkerBaseController {
/** /**
* new Worker, Wroker Class * new Worker, Wroker Class
* Blob url支持度问题 Safari 12
*/ */
public canNewWorker: boolean = WorkerMainThreadController.hasWorkerClass; public canNewWorker: boolean = WorkerMainThreadController.hasWorkerClass && !(BI.isSafari() && BI.getSafariVersion() < 12);
/** /**
* 线 new Worker * 线 new Worker

Loading…
Cancel
Save