Browse Source

KERNEL-9882 提供simple风格编辑框和下拉框 && 提供form

es6
windy 3 years ago
parent
commit
beb6df7c96
  1. 100
      demo/js/component/demo.form.js
  2. 4
      demo/js/config/component.js
  3. 4
      src/base/single/editor/editor.js
  4. 8
      src/base/single/editor/editor.textarea.js
  5. 14
      src/case/calendar/calendar.js
  6. 9
      src/case/calendar/calendar.year.js
  7. 4
      src/case/colorchooser/colorchooser.trigger.js
  8. 4
      src/case/colorchooser/colorchooser.trigger.long.js
  9. 4
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  10. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  11. 4
      src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
  12. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  13. 1
      src/case/editor/editor.clear.js
  14. 1
      src/case/editor/editor.shelter.js
  15. 1
      src/case/editor/editor.sign.js
  16. 1
      src/case/editor/editor.state.js
  17. 1
      src/case/editor/editor.state.simple.js
  18. 1
      src/component/allvaluechooser/combo.allvaluechooser.js
  19. 1
      src/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.js
  20. 85
      src/component/form/form.field.js
  21. 89
      src/component/form/form.js
  22. 1
      src/component/treevaluechooser/combo.listtreevaluechooser.js
  23. 1
      src/component/treevaluechooser/combo.treevaluechooser.insert.js
  24. 3
      src/component/treevaluechooser/combo.treevaluechooser.js
  25. 1
      src/component/valuechooser/combo.valuechooser.insert.js
  26. 1
      src/component/valuechooser/combo.valuechooser.js
  27. 1
      src/component/valuechooser/combo.valuechooser.nobar.js
  28. 8
      src/core/system.js
  29. 6
      src/less/base/combo/combo.less
  30. 3
      src/less/base/combo/combo.searchtextvalue.less
  31. 3
      src/less/base/combo/combo.textvalue.icon.less
  32. 3
      src/less/base/combo/combo.textvalue.less
  33. 2
      src/less/base/combo/combo.textvaluecheck.less
  34. 2
      src/less/base/combo/combo.textvaluedownlist.less
  35. 14
      src/less/component/form/form.less
  36. 15
      src/less/core/utils/common.less
  37. 3
      src/less/lib/theme.less
  38. 4
      src/less/widget/multiselect/trigger/button.checkselected.less
  39. 3
      src/less/widget/multitree/trigger/multi.tree.button.checkselected.less
  40. 17
      src/less/widget/singleslider/slider/widget.slider.less
  41. 3
      src/widget/date/calendar/combo.year.date.js
  42. 4
      src/widget/date/calendar/popup.month.js
  43. 20
      src/widget/dynamicdate/dynamicdate.combo.js
  44. 2
      src/widget/dynamicdate/dynamicdate.popup.js
  45. 1
      src/widget/dynamicdate/dynamicdate.trigger.js
  46. 20
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  47. 2
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  48. 1
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  49. 7
      src/widget/editor/editor.search.js
  50. 12
      src/widget/editor/editor.text.js
  51. 8
      src/widget/intervalslider/intervalslider.js
  52. 2
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  53. 2
      src/widget/multilayersingletree/multilayersingletree.combo.js
  54. 2
      src/widget/multiselect/multiselect.combo.js
  55. 2
      src/widget/multiselect/multiselect.combo.nobar.js
  56. 2
      src/widget/multiselect/multiselect.insert.combo.js
  57. 2
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  58. 2
      src/widget/multitree/multi.tree.combo.js
  59. 2
      src/widget/multitree/multi.tree.insert.combo.js
  60. 2
      src/widget/multitree/multi.tree.list.combo.js
  61. 11
      src/widget/numbereditor/number.editor.js
  62. 1
      src/widget/numberinterval/singleeditor/single.editor.js
  63. 2
      src/widget/singleselect/singleselect.combo.js
  64. 2
      src/widget/singleselect/singleselect.insert.combo.js
  65. 1
      src/widget/singleslider/button/editor.sign.text.js
  66. 5
      src/widget/singleslider/singleslider.js
  67. 4
      src/widget/singletree/singletree.combo.js
  68. 4
      src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js
  69. 18
      src/widget/year/combo.year.js
  70. 1
      src/widget/year/trigger.year.js
  71. 4
      src/widget/yearmonth/card.static.yearmonth.js
  72. 18
      src/widget/yearmonth/combo.yearmonth.js
  73. 1
      src/widget/yearmonth/trigger.yearmonth.js
  74. 18
      src/widget/yearquarter/combo.yearquarter.js
  75. 1
      src/widget/yearquarter/trigger.yearquarter.js
  76. 3
      webpack/attachments.js

100
demo/js/component/demo.form.js

@ -0,0 +1,100 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2022/1/11
*/
Demo.Form = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-form"
},
render: function () {
var widget = BI.createWidget({
type: "bi.custom_form",
width: 300,
labelWidth: 100,
items: [{
validate: function (v) {
return v !== "a" && v !== "";
},
tip: function (v) {
if (BI.isEmpty(v)) {
return "不能为空";
}
return "不合法格式"
},
label: "E-mail",
el: {
type: 'bi.text_editor',
watermark: "输入a报错",
allowBlank: true,
}
}, {
validate: function (v) {
return BI.isNotEmptyArray(v);
},
tip: function () {
return "不能为空";
},
label: "性别",
el: {
type: 'bi.text_value_combo',
text: "请选择",
items: [{
text: "男",
value: 1
}, {
text: "女",
value: 2
}]
}
}, {
validate: function (v) {
return v !== "";
},
tip: function () {
return "不能为空";
},
label: "姓名",
el: {
type: 'bi.text_editor',
watermark: "输入姓名",
allowBlank: true,
}
}, {
validate: function (v) {
return v !== "";
},
tip: function () {
return "不能为空";
},
label: "姓名",
el: {
type: 'bi.textarea_editor',
cls: 'bi-border',
watermark: "输入简介",
allowBlank: true,
height: 200,
}
}],
layout: {
type: "bi.vertical",
vgap: 30
}
});
return {
type: "bi.vertical",
hgap: 200,
vgap: 10,
items: [widget, {
type: "bi.button",
text: "提交",
handler: function () {
widget.validate();
console.log(widget.getValue());
}
}]
};
}
});
BI.shortcut("demo.form", Demo.Form);

4
demo/js/config/component.js

@ -20,4 +20,8 @@ Demo.COMPONENT_CONFIG = [{
pId: 5, pId: 5,
text: "bi.tree_value_chooser_pane", text: "bi.tree_value_chooser_pane",
value: "demo.tree_value_chooser_pane" value: "demo.tree_value_chooser_pane"
}, {
pId: 5,
text: "demo.form",
value: "demo.form"
}]; }];

4
src/base/single/editor/editor.js

@ -109,12 +109,14 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_VALID, function () { this.editor.on(BI.Input.EVENT_VALID, function () {
self._checkWaterMark(); self._checkWaterMark();
self._setErrorVisible(false); self._setErrorVisible(false);
self.element.removeClass("error");
self.fireEvent(BI.Editor.EVENT_VALID, arguments); self.fireEvent(BI.Editor.EVENT_VALID, arguments);
}); });
this.editor.on(BI.Input.EVENT_ERROR, function () { this.editor.on(BI.Input.EVENT_ERROR, function () {
self._checkWaterMark(); self._checkWaterMark();
self.fireEvent(BI.Editor.EVENT_ERROR, arguments); self.fireEvent(BI.Editor.EVENT_ERROR, arguments);
self._setErrorVisible(self.isEditing()); self._setErrorVisible(self.isEditing());
self.element.addClass("error");
}); });
this.editor.on(BI.Input.EVENT_RESTRICT, function () { this.editor.on(BI.Input.EVENT_RESTRICT, function () {
self._checkWaterMark(); self._checkWaterMark();
@ -269,7 +271,7 @@ BI.Editor = BI.inherit(BI.Single, {
} }
if (!this.disabledError && BI.isKey(errorText)) { if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, { BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, {
adjustYOffset: 2 adjustYOffset: o.simple ? 1 : 2
}); });
this._checkToolTip(); this._checkToolTip();
} }

8
src/base/single/editor/editor.textarea.js

@ -5,12 +5,12 @@
* @extends BI.Single * @extends BI.Single
*/ */
BI.TextAreaEditor = BI.inherit(BI.Single, { BI.TextAreaEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function (conf) {
return BI.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), { return BI.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), {
baseCls: "bi-textarea-editor", baseCls: "bi-textarea-editor",
value: "", value: "",
errorText: "", errorText: "",
adjustYOffset: 2, adjustYOffset: conf.simple ? 0 : 2,
adjustXOffset: 0, adjustXOffset: 0,
offsetStyle: "left", offsetStyle: "left",
validationChecker: function () { validationChecker: function () {
@ -156,7 +156,9 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
}, },
_checkError: function () { _checkError: function () {
this._setErrorVisible(this._isError()); var isError = this._isError();
this._setErrorVisible(isError);
this.element[isError ? "addClass" : "removeClass"]("error");
}, },
_focus: function () { _focus: function () {

14
src/case/calendar/calendar.js

@ -78,7 +78,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
var items = BI.map(this._getWeekLabel(), function (i, value) { var items = BI.map(this._getWeekLabel(), function (i, value) {
return { return {
type: "bi.label", type: "bi.label",
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT,
text: value text: value
}; };
}); });
@ -101,7 +101,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
columns: 7, columns: 7,
rows: 6, rows: 6,
columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7], columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7],
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10 rowSize: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT + 10
}))] }))]
}); });
this.days.on(BI.Controller.EVENT_CHANGE, function () { this.days.on(BI.Controller.EVENT_CHANGE, function () {
@ -162,13 +162,13 @@ BI.Calendar = BI.inherit(BI.Widget, {
whiteSpace: "normal", whiteSpace: "normal",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10, height: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT + 10,
value: o.year + "-" + month + "-" + td.text, value: o.year + "-" + month + "-" + td.text,
disabled: td.lastMonth || td.nextMonth || td.disabled, disabled: td.lastMonth || td.nextMonth || td.disabled,
lgap: 5, lgap: 2,
rgap: 5, rgap: 2,
tgap: 5, tgap: 4,
bgap: 5 bgap: 4
// selected: td.currentDay // selected: td.currentDay
}); });
}); });

9
src/case/calendar/calendar.year.js

@ -51,10 +51,10 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
columns: 2, columns: 2,
rows: 6, rows: 6,
columnSize: [1 / 2, 1 / 2], columnSize: [1 / 2, 1 / 2],
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, rowSize: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT,
})), { })), {
type: "bi.center_adapt", type: "bi.center_adapt",
vgap: 1 vgap: 2
}] }]
}); });
this.years.on(BI.Controller.EVENT_CHANGE, function () { this.years.on(BI.Controller.EVENT_CHANGE, function () {
@ -65,6 +65,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
}, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, { }, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, {
scrolly: true, scrolly: true,
vgap: 5, vgap: 5,
hgap: 6,
items: BI.LogicFactory.createLogicItemsByDirection("top", this.years) items: BI.LogicFactory.createLogicItemsByDirection("top", this.years)
})))); }))));
}, },
@ -106,12 +107,12 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
return BI.map(item, function (j, td) { return BI.map(item, function (j, td) {
return BI.extend(td, { return BI.extend(td, {
type: "bi.text_item", type: "bi.text_item",
cls: "bi-list-item-select", cls: "bi-list-item-select bi-border-radius",
textAlign: "center", textAlign: "center",
whiteSpace: "normal", whiteSpace: "normal",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT,
width: 45, width: 45,
value: td.text, value: td.text,
disabled: td.disabled disabled: td.disabled

4
src/case/colorchooser/colorchooser.trigger.js

@ -7,10 +7,10 @@
*/ */
BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow", baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 22 height: 22
}); });
}, },

4
src/case/colorchooser/colorchooser.trigger.long.js

@ -7,10 +7,10 @@
*/ */
BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-border bi-focus-shadow", baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24 height: 24
}); });
}, },

4
src/case/combo/icontextvaluecombo/combo.icontextvalue.js

@ -3,9 +3,9 @@
* combo : icon + text + icon, popup : icon + text * combo : icon + text + icon, popup : icon + text
*/ */
BI.IconTextValueCombo = BI.inherit(BI.Widget, { BI.IconTextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-icon-text-value-combo bi-border bi-border-radius", baseCls: "bi-icon-text-value-combo bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24, height: 24,
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,

2
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -20,7 +20,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-focus-shadow", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow",
container: o.container, container: o.container,
adjustLength: 2, adjustLength: 2,
toggle: false, toggle: false,

4
src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js

@ -4,9 +4,9 @@
* combo : text + icon, popup : check + text * combo : text + icon, popup : check + text
*/ */
BI.TextValueCheckCombo = BI.inherit(BI.Widget, { BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-value-check-combo bi-border", baseCls: "bi-text-value-check-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
width: 100, width: 100,
height: 24, height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,

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

@ -5,9 +5,9 @@
* 参见场景dashboard布局方式选择 * 参见场景dashboard布局方式选择
*/ */
BI.TextValueCombo = BI.inherit(BI.Widget, { BI.TextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-value-combo bi-border", baseCls: "bi-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24, height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
text: "", text: "",

1
src/case/editor/editor.clear.js

@ -21,6 +21,7 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
watermark: o.watermark, watermark: o.watermark,
allowBlank: true, allowBlank: true,

1
src/case/editor/editor.shelter.js

@ -30,6 +30,7 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,

1
src/case/editor/editor.sign.js

@ -30,6 +30,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,

1
src/case/editor/editor.state.js

@ -32,6 +32,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget(o.el, { this.editor = BI.createWidget(o.el, {
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,

1
src/case/editor/editor.state.simple.js

@ -31,6 +31,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,

1
src/component/allvaluechooser/combo.allvaluechooser.js

@ -27,6 +27,7 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
simple: o.simple,
text: o.text, text: o.text,
element: this, element: this,
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),

1
src/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.js

@ -12,6 +12,7 @@ BI.AllValueMultiTextValueCombo = BI.inherit(BI.Widget, {
var value = this._digestValue(o.value); var value = this._digestValue(o.value);
return { return {
type: "bi.search_multi_text_value_combo", type: "bi.search_multi_text_value_combo",
simple: o.simple,
text: o.text, text: o.text,
height: o.height, height: o.height,
items: o.items, items: o.items,

85
src/component/form/form.field.js

@ -0,0 +1,85 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2022/1/11
*/
BI.FormField = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-form-field",
label: "",
el: {},
validate: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var field = {
type: "bi.absolute",
items: [{
el: BI.extend({}, o.el, {
ref: function (_ref) {
self.field = _ref;
o.el.ref && o.el.ref.call(this, _ref);
},
height: o.el.height || 28,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}]
}),
left: 0,
bottom: 0,
right: 0,
top: 0
}, {
el: {
type: "bi.label",
cls: "error-tip bi-error",
ref: function (_ref) {
self.error = _ref;
},
invisible: true
},
bottom: -20,
left: 0,
right: 0,
height: 20
}]
};
return {
type: "bi.vertical_adapt",
columnSize: ["auto", "fill"],
verticalAlign: BI.VerticalAlign.Stretch,
hgap: 5,
items: BI.isKey(o.label) ? [{
type: "bi.label",
text: o.label + ":",
width: o.labelWidth
}, field] : [field]
};
},
getValue: function () {
return this.field.getValue();
},
validate: function () {
var isValid = this.validateWithNoTip();
!isValid && this.error.setText(this.options.tip(this.field.getValue(), this.field));
this.error.setVisible(!isValid);
this.element[isValid ? "removeClass" : "addClass"]("error");
return isValid;
},
validateWithNoTip: function () {
return this.options.validate(this.field.getValue(), this.field);
}
});
BI.shortcut("bi.form_field", BI.FormField);

89
src/component/form/form.js

@ -0,0 +1,89 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2022/1/11
*/
BI.Form = BI.inherit(BI.Widget, {
props: {
baseCls: "bi-form",
layout: {
type: "bi.vertical",
vgap: 20
},
items: [{
validate: BI.emptyFn,
tip: BI.emptyFn,
label: "",
el: {}
}],
labelWidth: ""
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.button_group",
items: this._createItems(),
layouts: [o.layout],
ref: function (ref) {
self.group = ref;
}
};
},
_createItems: function () {
var o = this.options;
return BI.map(o.items, function (idx, item) {
return {
type: "bi.form_field",
height: item.el.height || 28,
labelWidth: o.labelWidth,
el: item.el,
label: item.label,
tip: item.tip,
validate: item.validate,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
this.validate();
}
}]
};
});
},
isAllValid: function () {
return !BI.some(this.validateWithNoTip(), function (idx, v) {
return !v;
});
},
validateWithNoTip: function () {
var validInfo = [];
BI.each(this.group.getAllButtons(), function (idx, button) {
validInfo.push(button.validateWithNoTip());
});
return validInfo;
},
validate: function () {
var validInfo = [];
BI.each(this.group.getAllButtons(), function (idx, button) {
validInfo.push(button.validate());
});
return validInfo;
},
getValue: function () {
return !this.isAllValid() ? null : BI.map(this.group.getAllButtons(), function (idx, button) {
return button.getValue();
});
}
});
BI.shortcut("bi.custom_form", BI.Form);

1
src/component/treevaluechooser/combo.listtreevaluechooser.js

@ -26,6 +26,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_list_combo", type: "bi.multi_tree_list_combo",
simple: o.simple,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
element: this, element: this,
text: o.text, text: o.text,

1
src/component/treevaluechooser/combo.treevaluechooser.insert.js

@ -26,6 +26,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_insert_combo", type: "bi.multi_tree_insert_combo",
simple: o.simple,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,

3
src/component/treevaluechooser/combo.treevaluechooser.js

@ -25,7 +25,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
this._initData(o.items); this._initData(o.items);
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_tree_combo", type: "bi.multi_tree_list_combo",
simple: o.simple,
text: o.text, text: o.text,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
value: o.value, value: o.value,

1
src/component/valuechooser/combo.valuechooser.insert.js

@ -23,6 +23,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_combo",
simple: o.simple,
element: this, element: this,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,

1
src/component/valuechooser/combo.valuechooser.js

@ -27,6 +27,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
} }
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.multi_select_combo", type: "bi.multi_select_combo",
simple: o.simple,
element: this, element: this,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,

1
src/component/valuechooser/combo.valuechooser.nobar.js

@ -22,6 +22,7 @@ BI.ValueChooserNoBarCombo = BI.inherit(BI.AbstractValueChooser, {
return { return {
type: "bi.multi_select_no_bar_combo", type: "bi.multi_select_no_bar_combo",
simple: o.simple,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,
value: this._assertValue(o.value), value: this._assertValue(o.value),

8
src/core/system.js

@ -9,11 +9,15 @@
dependencies: {}, dependencies: {},
responsiveMode: false, responsiveMode: false,
workerMode: false, workerMode: false,
size: { // 尺寸 size: {
// 尺寸
// 通用尺寸
TOOL_BAR_HEIGHT: 24, TOOL_BAR_HEIGHT: 24,
LIST_ITEM_HEIGHT: 24, LIST_ITEM_HEIGHT: 24,
TRIGGER_HEIGHT: 24, TRIGGER_HEIGHT: 24,
TOAST_TOP: 10 TOAST_TOP: 10,
// 根据控件类型特化尺寸
DATE_LIST_ITEM_HEIGHT: 24
} }
}; };

6
src/less/base/combo/combo.less

@ -22,13 +22,13 @@
} }
} }
&.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-combo-popup, &.bi-combo-hover, &:hover {
&.bi-border { &.bi-border, &.bi-border-bottom {
border-color: @color-bi-border-hover-combo; border-color: @color-bi-border-hover-combo;
} }
} }
&.disabled { &.disabled {
&.bi-combo-hover, &:hover { &.bi-combo-hover, &:hover {
&.bi-border { &.bi-border, &.bi-border-bottom {
border-color: @color-bi-border-hover-disabled-combo; border-color: @color-bi-border-hover-disabled-combo;
} }
} }
@ -39,7 +39,7 @@
.bi-combo { .bi-combo {
&.disabled { &.disabled {
&.bi-combo-hover, &:hover { &.bi-combo-hover, &:hover {
&.bi-border { &.bi-border, &.bi-border-bottom {
border-color: @color-bi-border-hover-disabled-combo-theme-dark; border-color: @color-bi-border-hover-disabled-combo-theme-dark;
} }
} }

3
src/less/base/combo/combo.searchtextvalue.less

@ -13,6 +13,9 @@
color: @color-bi-text-error-hover-search-text-value-combo; color: @color-bi-text-error-hover-search-text-value-combo;
} }
} }
&>.bi-border, &>.bi-border-bottom {
border-color: @border-color-negative;
}
} }
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button { & .bi-combo.bi-combo-popup + .bi-trigger-icon-button {

3
src/less/base/combo/combo.textvalue.icon.less

@ -7,5 +7,8 @@
color: @color-bi-text-error-hover-text-value-icon-combo; color: @color-bi-text-error-hover-text-value-icon-combo;
} }
} }
&>.bi-border, &>.bi-border-bottom {
border-color: @border-color-negative;
}
} }
} }

3
src/less/base/combo/combo.textvalue.less

@ -7,5 +7,8 @@
color: @color-bi-text-error-hover-text-value-combo; color: @color-bi-text-error-hover-text-value-combo;
} }
} }
&>.bi-border, &>.bi-border-bottom {
border-color: @border-color-negative;
}
} }
} }

2
src/less/base/combo/combo.textvaluecheck.less

@ -2,7 +2,7 @@
.bi-text-value-check-combo { .bi-text-value-check-combo {
&.bi-combo-popup, &:hover { &.bi-combo-popup, &:hover {
& > .bi-border { & > .bi-border, & > .bi-border-bottom {
border-color: @color-bi-border-hover-text-value-check-combo; border-color: @color-bi-border-hover-text-value-check-combo;
} }
} }

2
src/less/base/combo/combo.textvaluedownlist.less

@ -2,7 +2,7 @@
.bi-text-value-down-list-combo { .bi-text-value-down-list-combo {
&.bi-combo-popup, &:hover { &.bi-combo-popup, &:hover {
& > .bi-border { & > .bi-border, & > .bi-border-bottom {
border-color: @color-bi-border-hover-text-value-down-list-combo; border-color: @color-bi-border-hover-text-value-down-list-combo;
} }
} }

14
src/less/component/form/form.less

@ -0,0 +1,14 @@
@import "../../index";
.bi-form {
& .bi-form-field.error {
& .bi-border, & .bi-border-bottom {
border-color: @border-color-negative;
}
}
& .bi-form-field {
& .error-tip {
background-color: @color-bi-background-error-form;
}
}
}

15
src/less/core/utils/common.less

@ -177,6 +177,9 @@
&.disabled { &.disabled {
border-color: @color-bi-border-disabled !important; border-color: @color-bi-border-disabled !important;
} }
&.error {
border-color: @border-color-negative;
}
} }
.bi-border-top { .bi-border-top {
@ -184,6 +187,9 @@
&.disabled { &.disabled {
border-color: @color-bi-border-disabled !important; border-color: @color-bi-border-disabled !important;
} }
&.error {
border-color: @border-color-negative;
}
} }
.bi-border-right { .bi-border-right {
@ -191,6 +197,9 @@
&.disabled { &.disabled {
border-color: @color-bi-border-disabled !important; border-color: @color-bi-border-disabled !important;
} }
&.error {
border-color: @border-color-negative;
}
} }
.bi-border-bottom { .bi-border-bottom {
@ -198,6 +207,9 @@
&.disabled { &.disabled {
border-color: @color-bi-border-disabled !important; border-color: @color-bi-border-disabled !important;
} }
&.error {
border-color: @border-color-negative;
}
} }
.bi-border-left { .bi-border-left {
@ -205,6 +217,9 @@
&.disabled { &.disabled {
border-color: @color-bi-border-disabled !important; border-color: @color-bi-border-disabled !important;
} }
&.error {
border-color: @border-color-negative;
}
} }
.bi-theme-dark { .bi-theme-dark {

3
src/less/lib/theme.less

@ -206,6 +206,7 @@
// 复选下拉 // 复选下拉
@color-bi-text-multi-select-search-pane-toolbar: @color-bi-text-redmark; @color-bi-text-multi-select-search-pane-toolbar: @color-bi-text-redmark;
@color-bi-text-error-multi-select-trigger: @color-bi-text-failure; @color-bi-text-error-multi-select-trigger: @color-bi-text-failure;
@color-bi-background-multi-select-trigger-check-selected: @color-bi-blue-10;
// 复选树 // 复选树
@color-bi-text-multi-tree-check-pane-check-button: @color-bi-text-highlight; @color-bi-text-multi-tree-check-pane-check-button: @color-bi-text-highlight;
// 单选下拉 // 单选下拉
@ -218,3 +219,5 @@
@color-bi-text-error-year-interval: @color-bi-text-failure; @color-bi-text-error-year-interval: @color-bi-text-failure;
@color-bi-text-error-year-month-interval: @color-bi-text-failure; @color-bi-text-error-year-month-interval: @color-bi-text-failure;
@color-bi-text-error-year-quarter-interval: @color-bi-text-failure; @color-bi-text-error-year-quarter-interval: @color-bi-text-failure;
// 表单
@color-bi-background-error-form: @color-bi-red-5;

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

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

3
src/less/widget/multitree/trigger/multi.tree.button.checkselected.less

@ -8,5 +8,8 @@
.trigger-check-text { .trigger-check-text {
.border-radius(8px); .border-radius(8px);
z-index: 1; z-index: 1;
&:active {
background-color: @color-bi-background-multi-select-trigger-check-selected;
}
} }
} }

17
src/less/widget/singleslider/slider/widget.slider.less

@ -7,17 +7,18 @@
border-style: solid; border-style: solid;
.border-radius(8px); .border-radius(8px);
background-color: @color-bi-background-slider-button; background-color: @color-bi-background-slider-button;
height: 12px; height: 8px;
width: 12px; width: 8px;
top: 6px; top: 8px;
left: -8px; left: -6px;
&:hover, &.hover { &:hover, &.hover {
.border-radius(10px); .border-radius(10px);
background-color: @color-bi-background-hover-slider-button; background-color: @color-bi-background-hover-slider-button;
width: 16px; width: 12px;
height: 16px; height: 12px;
top: 4px; top: 6px;
left: -10px; left: -8px;
.box-shadow(0 2px 4px 1px,rgba(0, 35, 11, 20%));
} }
&.disabled { &.disabled {
border-color: @color-bi-border-disabled-slider-button; border-color: @color-bi-border-disabled-slider-button;

3
src/widget/date/calendar/combo.year.date.js

@ -28,7 +28,8 @@ BI.YearDateCombo = BI.inherit(BI.Trigger, {
type: "bi.year_popup", type: "bi.year_popup",
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.min,
max: o.max max: o.max,
width: 122
}); });
this.popup.on(BI.YearPopup.EVENT_CHANGE, function () { this.popup.on(BI.YearPopup.EVENT_CHANGE, function () {

4
src/widget/date/calendar/popup.month.js

@ -31,7 +31,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
columns: 2, columns: 2,
rows: 6, rows: 6,
columnSize: [1 / 2, 1 / 2], columnSize: [1 / 2, 1 / 2],
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1 rowSize: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT + 1
})), { })), {
type: "bi.center_adapt", type: "bi.center_adapt",
vgap: 1, vgap: 1,
@ -68,7 +68,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
whiteSpace: "nowrap", whiteSpace: "nowrap",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT - 1, height: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT - 1,
width: 38, width: 38,
value: td, value: td,
text: td, text: td,

20
src/widget/dynamicdate/dynamicdate.combo.js

@ -30,24 +30,25 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = BI.getDate(); var date = BI.getDate();
this.storeValue = opts.value; this.storeValue = opts.value;
var border = opts.simple ? 1 : 2;
return { return {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.htape", type: "bi.htape",
cls: "bi-border bi-border-radius bi-focus-shadow", cls: (opts.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow",
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font", cls: "bi-trigger-icon-button date-change-h-font",
width: opts.height - 2, width: opts.height - border,
height: opts.height - 2, height: opts.height - border,
ref: function () { ref: function () {
self.changeIcon = this; self.changeIcon = this;
} }
}, },
width: opts.height - 2 width: opts.height - border
}, { }, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -63,12 +64,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
destroyWhenHide: true, destroyWhenHide: true,
el: { el: {
type: "bi.dynamic_date_trigger", type: "bi.dynamic_date_trigger",
simple: opts.simple,
min: opts.minDate, min: opts.minDate,
max: opts.maxDate, max: opts.maxDate,
format: opts.format, format: opts.format,
allowEdit: opts.allowEdit, allowEdit: opts.allowEdit,
watermark: opts.watermark, watermark: opts.watermark,
height: opts.height - 2, height: opts.height - border,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
self.trigger = this; self.trigger = this;
@ -112,11 +114,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
month: date.getMonth() + 1 month: date.getMonth() + 1
} }
}; };
self.comboWrapper.element.addClass("error");
self.fireEvent(BI.DynamicDateCombo.EVENT_ERROR); self.fireEvent(BI.DynamicDateCombo.EVENT_ERROR);
} }
}, { }, {
eventName: BI.DynamicDateTrigger.EVENT_VALID, eventName: BI.DynamicDateTrigger.EVENT_VALID,
action: function () { action: function () {
self.comboWrapper.element.removeClass("error");
self.fireEvent(BI.DynamicDateCombo.EVENT_VALID); self.fireEvent(BI.DynamicDateCombo.EVENT_VALID);
} }
}, { }, {
@ -226,8 +230,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font", cls: "bi-trigger-icon-button date-font",
width: opts.height - 2, width: opts.height - border,
height: opts.height - 2, height: opts.height - border,
listeners: [{ listeners: [{
eventName: BI.IconButton.EVENT_CHANGE, eventName: BI.IconButton.EVENT_CHANGE,
action: function () { action: function () {
@ -271,7 +275,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
switch (type) { switch (type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = o.height - 2; this.comboWrapper.attr("items")[0].width = o.height - this.options.simple ? 1 : 2;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:

2
src/widget/dynamicdate/dynamicdate.popup.js

@ -5,7 +5,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-dynamic-date-popup", baseCls: "bi-dynamic-date-popup",
width: 248, width: 272,
supportDynamic: true, supportDynamic: true,
}, },

1
src/widget/dynamicdate/dynamicdate.trigger.js

@ -24,6 +24,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
simple: o.simple,
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
var formatStr = self._getStandardDateStr(v); var formatStr = self._getStandardDateStr(v);

20
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -30,24 +30,25 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = BI.getDate(); var date = BI.getDate();
this.storeValue = opts.value; this.storeValue = opts.value;
var border = opts.simple ? 1 : 2;
return { return {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: "bi.htape", type: "bi.htape",
cls: "bi-border bi-border-radius bi-focus-shadow", cls: (opts.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow",
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font", cls: "bi-trigger-icon-button date-change-h-font",
width: opts.height - 2, width: opts.height - border,
height: opts.height - 2, height: opts.height - border,
ref: function () { ref: function () {
self.changeIcon = this; self.changeIcon = this;
} }
}, },
width: opts.height - 2 width: opts.height - border
}, { }, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -64,12 +65,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: opts.isNeedAdjustWidth, isNeedAdjustWidth: opts.isNeedAdjustWidth,
el: { el: {
type: "bi.dynamic_date_time_trigger", type: "bi.dynamic_date_time_trigger",
simple: opts.simple,
min: opts.minDate, min: opts.minDate,
max: opts.maxDate, max: opts.maxDate,
allowEdit: opts.allowEdit, allowEdit: opts.allowEdit,
watermark: opts.watermark, watermark: opts.watermark,
format: opts.format, format: opts.format,
height: opts.height - 2, height: opts.height - border,
value: opts.value, value: opts.value,
ref: function () { ref: function () {
self.trigger = this; self.trigger = this;
@ -118,11 +120,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
month: date.getMonth() + 1 month: date.getMonth() + 1
} }
}; };
self.comboWrapper.element.addClass("error");
self.fireEvent(BI.DynamicDateTimeCombo.EVENT_ERROR); self.fireEvent(BI.DynamicDateTimeCombo.EVENT_ERROR);
} }
}, { }, {
eventName: BI.DynamicDateTimeTrigger.EVENT_VALID, eventName: BI.DynamicDateTimeTrigger.EVENT_VALID,
action: function () { action: function () {
self.comboWrapper.element.removeClass("error");
self.fireEvent(BI.DynamicDateTimeCombo.EVENT_VALID); self.fireEvent(BI.DynamicDateTimeCombo.EVENT_VALID);
} }
}, { }, {
@ -235,8 +239,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font", cls: "bi-trigger-icon-button date-font",
width: opts.height - 2, width: opts.height - border,
height: opts.height - 2, height: opts.height - border,
listeners: [{ listeners: [{
eventName: BI.IconButton.EVENT_CHANGE, eventName: BI.IconButton.EVENT_CHANGE,
action: function () { action: function () {
@ -280,7 +284,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
switch (type) { switch (type) {
case BI.DynamicDateTimeCombo.Dynamic: case BI.DynamicDateTimeCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = o.height - 2; this.comboWrapper.attr("items")[0].width = o.height - this.options.simple ? 1 : 2;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:

2
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -6,7 +6,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-dynamic-date-time-popup", baseCls: "bi-dynamic-date-time-popup",
width: 248, width: 272,
supportDynamic: true, supportDynamic: true,
}, },

1
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -24,6 +24,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
simple: o.simple,
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
var formatStr = self._getStandardDateStr(v); var formatStr = self._getStandardDateStr(v);

7
src/widget/editor/editor.search.js

@ -2,10 +2,10 @@
* Created by roy on 15/9/14. * Created by roy on 15/9/14.
*/ */
BI.SearchEditor = BI.inherit(BI.Widget, { BI.SearchEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments); var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: "bi-search-editor bi-border bi-focus-shadow", baseCls: "bi-search-editor bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24, height: 24,
errorText: "", errorText: "",
watermark: BI.i18nText("BI-Basic_Search"), watermark: BI.i18nText("BI-Basic_Search"),
@ -14,11 +14,12 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
}); });
}, },
_init: function () { _init: function () {
this.options.height -= 2; this.options.height -= this.options.simple ? 1 : 2;
BI.SearchEditor.superclass._init.apply(this, arguments); BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget(o.el, { this.editor = BI.createWidget(o.el, {
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
watermark: o.watermark, watermark: o.watermark,
allowBlank: true, allowBlank: true,

12
src/widget/editor/editor.text.js

@ -4,10 +4,10 @@
* @extends BI.Single * @extends BI.Single
*/ */
BI.TextEditor = BI.inherit(BI.Widget, { BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-text-editor bi-border bi-focus-shadow", extraCls: "bi-text-editor bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
hgap: 4, hgap: 4,
vgap: 2, vgap: 2,
lgap: 0, lgap: 0,
@ -26,15 +26,17 @@ BI.TextEditor = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.TextEditor.superclass._init.apply(this, arguments); BI.TextEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var border = o.simple ? 1 : 2;
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
this.element.css({height: o.height - 2}); this.element.css({height: o.height - border});
} }
if (BI.isNumber(o.width)) { if (BI.isNumber(o.width)) {
this.element.css({width: o.width - 2}); this.element.css({width: o.width - border});
} }
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
height: o.height - 2, simple: o.simple,
height: o.height - border,
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
lgap: o.lgap, lgap: o.lgap,

8
src/widget/intervalslider/intervalslider.js

@ -5,7 +5,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
_constant: { _constant: {
EDITOR_WIDTH: 58, EDITOR_WIDTH: 58,
EDITOR_R_GAP: 60, EDITOR_R_GAP: 60,
EDITOR_HEIGHT: 30, EDITOR_HEIGHT: 20,
SLIDER_WIDTH_HALF: 15, SLIDER_WIDTH_HALF: 15,
SLIDER_WIDTH: 30, SLIDER_WIDTH: 30,
SLIDER_HEIGHT: 30, SLIDER_HEIGHT: 30,
@ -49,7 +49,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
cls: "slider-editor-button", cls: "slider-editor-button",
text: this.options.unit, text: this.options.unit,
allowBlank: false, allowBlank: false,
width: c.EDITOR_WIDTH, width: c.EDITOR_WIDTH - 2,
height: c.EDITOR_HEIGHT - 2,
validationChecker: function (v) { validationChecker: function (v) {
return self._checkValidation(v); return self._checkValidation(v);
} }
@ -76,7 +77,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
cls: "slider-editor-button", cls: "slider-editor-button",
text: this.options.unit, text: this.options.unit,
allowBlank: false, allowBlank: false,
width: c.EDITOR_WIDTH, width: c.EDITOR_WIDTH - 2,
height: c.EDITOR_HEIGHT - 2,
validationChecker: function (v) { validationChecker: function (v) {
return self._checkValidation(v); return self._checkValidation(v);
} }

2
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -75,7 +75,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
container: o.container, container: o.container,
destroyWhenHide: o.destroyWhenHide, destroyWhenHide: o.destroyWhenHide,
adjustLength: 2, adjustLength: 2,

2
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -79,7 +79,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
container: o.container, container: o.container,
destroyWhenHide: o.destroyWhenHide, destroyWhenHide: o.destroyWhenHide,
adjustLength: 2, adjustLength: 2,

2
src/widget/multiselect/multiselect.combo.js

@ -123,7 +123,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: !o.allowEdit, toggle: !o.allowEdit,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

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

@ -122,7 +122,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: false, toggle: false,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

2
src/widget/multiselect/multiselect.insert.combo.js

@ -125,7 +125,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: !o.allowEdit, toggle: !o.allowEdit,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,

2
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -117,7 +117,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: false, toggle: false,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

2
src/widget/multitree/multi.tree.combo.js

@ -49,7 +49,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: !o.allowEdit, toggle: !o.allowEdit,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

2
src/widget/multitree/multi.tree.insert.combo.js

@ -65,7 +65,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: !o.allowEdit, toggle: !o.allowEdit,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

2
src/widget/multitree/multi.tree.list.combo.js

@ -80,7 +80,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
toggle: !o.allowEdit, toggle: !o.allowEdit,
container: o.container, container: o.container,
el: this.trigger, el: this.trigger,

11
src/widget/numbereditor/number.editor.js

@ -3,9 +3,9 @@
* 数值微调器 * 数值微调器
*/ */
BI.NumberEditor = BI.inherit(BI.Widget, { BI.NumberEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (conf) {
return BI.extend(BI.NumberEditor.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.NumberEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-number-editor bi-border bi-focus-shadow", baseCls: "bi-number-editor bi-focus-shadow " + (conf.simple ? "bi-border-bottom" : "bi-border"),
validationChecker: BI.emptyFn, validationChecker: BI.emptyFn,
valueFormatter: function (v) { valueFormatter: function (v) {
return v; return v;
@ -25,6 +25,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height - 2, height: o.height - 2,
simple: o.simple,
allowBlank: o.allowBlank, allowBlank: o.allowBlank,
value: o.valueFormatter(o.value), value: o.valueFormatter(o.value),
validationChecker: function (v) { validationChecker: function (v) {
@ -42,10 +43,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
o.value = BI.parseFloat(this.getLastValidValue()); o.value = BI.parseFloat(this.getLastValidValue());
self._checkAdjustDisabled(o.value); self._checkAdjustDisabled(o.value);
self.element.addClass("error");
}); });
this.editor.on(BI.TextEditor.EVENT_VALID, function () { this.editor.on(BI.TextEditor.EVENT_VALID, function () {
o.value = BI.parseFloat(this.getValue()); o.value = BI.parseFloat(this.getValue());
self._checkAdjustDisabled(o.value); self._checkAdjustDisabled(o.value);
self.element.removeClass("error");
}); });
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
@ -54,7 +57,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
forceNotSelected: true, forceNotSelected: true,
trigger: "lclick,", trigger: "lclick,",
cls: "add-up-font top-button bi-border-left bi-list-item-active2 icon-size-12" cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12"
}); });
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(o.step); self._finetuning(o.step);
@ -65,7 +68,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
trigger: "lclick,", trigger: "lclick,",
forceNotSelected: true, forceNotSelected: true,
cls: "minus-down-font bottom-button bi-border-left bi-list-item-active2 icon-size-12" cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12"
}); });
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(-o.step); self._finetuning(-o.step);

1
src/widget/numberinterval/singleeditor/single.editor.js

@ -12,6 +12,7 @@ BI.NumberIntervalSingleEidtor = BI.inherit(BI.Single, {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.editor", type: "bi.editor",
simple: o.simple,
ref: function (_ref) { ref: function (_ref) {
self.editor = _ref; self.editor = _ref;
}, },

2
src/widget/singleselect/singleselect.combo.js

@ -82,7 +82,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
container: o.container, container: o.container,
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,

2
src/widget/singleselect/singleselect.insert.combo.js

@ -93,7 +93,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
cls: "bi-border bi-border-radius", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius",
container: o.container, container: o.container,
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,

1
src/widget/singleslider/button/editor.sign.text.js

@ -14,6 +14,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.editor", type: "bi.editor",
simple: o.simple,
height: o.height, height: o.height,
hgap: 4, hgap: 4,
vgap: 2, vgap: 2,

5
src/widget/singleslider/singleslider.js

@ -4,7 +4,7 @@
BI.SingleSlider = BI.inherit(BI.Single, { BI.SingleSlider = BI.inherit(BI.Single, {
_constant: { _constant: {
EDITOR_WIDTH: 90, EDITOR_WIDTH: 90,
EDITOR_HEIGHT: 30, EDITOR_HEIGHT: 20,
SLIDER_WIDTH_HALF: 15, SLIDER_WIDTH_HALF: 15,
SLIDER_WIDTH: 30, SLIDER_WIDTH: 30,
SLIDER_HEIGHT: 30, SLIDER_HEIGHT: 30,
@ -79,6 +79,7 @@ BI.SingleSlider = BI.inherit(BI.Single, {
cls: "slider-editor-button", cls: "slider-editor-button",
text: o.unit, text: o.unit,
width: c.EDITOR_WIDTH - 2, width: c.EDITOR_WIDTH - 2,
height: c.EDITOR_HEIGHT - 2,
allowBlank: false, allowBlank: false,
textAlign: "center", textAlign: "center",
validationChecker: function (v) { validationChecker: function (v) {
@ -126,7 +127,7 @@ BI.SingleSlider = BI.inherit(BI.Single, {
width: "100%" width: "100%"
}, { }, {
el: { el: {
type: "bi.vertical", type: "bi.vertical_adapt",
items: [{ items: [{
type: "bi.horizontal_auto", type: "bi.horizontal_auto",
items: [this.label] items: [this.label]

4
src/widget/singletree/singletree.combo.js

@ -4,9 +4,9 @@
*/ */
BI.SingleTreeCombo = BI.inherit(BI.Widget, { BI.SingleTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
return BI.extend(BI.SingleTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-tree-combo bi-border bi-border-radius", baseCls: "bi-single-tree-combo bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"),
trigger: {}, trigger: {},
height: 24, height: 24,
text: "", text: "",

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

@ -3,9 +3,9 @@
* @extend BI.Widget * @extend BI.Widget
*/ */
BI.TextValueDownListCombo = BI.inherit(BI.Widget, { BI.TextValueDownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function (config) {
return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-value-down-list-combo bi-border", baseCls: "bi-text-value-down-list-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24, height: 24,
}); });
}, },

18
src/widget/year/combo.year.js

@ -13,11 +13,13 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
BI.DynamicYearCombo.superclass._init.apply(this, arguments); BI.DynamicYearCombo.superclass._init.apply(this, arguments);
this.storeValue = o.value; this.storeValue = o.value;
var border = o.simple ? 1 : 2;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_trigger", type: "bi.dynamic_year_trigger",
simple: o.simple,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
height: o.height - 2, height: o.height - border,
value: o.value || "" value: o.value || ""
}); });
this.trigger.on(BI.DynamicYearTrigger.EVENT_KEY_DOWN, function () { this.trigger.on(BI.DynamicYearTrigger.EVENT_KEY_DOWN, function () {
@ -37,9 +39,11 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
}); });
this.trigger.on(BI.DynamicYearTrigger.EVENT_ERROR, function () { this.trigger.on(BI.DynamicYearTrigger.EVENT_ERROR, function () {
self.combo.isViewVisible() && self.combo.hideView(); self.combo.isViewVisible() && self.combo.hideView();
self.comboWrapper.element.addClass("error");
self.fireEvent(BI.DynamicYearCombo.EVENT_ERROR); self.fireEvent(BI.DynamicYearCombo.EVENT_ERROR);
}); });
this.trigger.on(BI.DynamicYearTrigger.EVENT_VALID, function () { this.trigger.on(BI.DynamicYearTrigger.EVENT_VALID, function () {
self.comboWrapper.element.removeClass("error");
self.fireEvent(BI.DynamicYearCombo.EVENT_VALID); self.fireEvent(BI.DynamicYearCombo.EVENT_VALID);
}); });
this.trigger.on(BI.DynamicYearTrigger.EVENT_CONFIRM, function () { this.trigger.on(BI.DynamicYearTrigger.EVENT_CONFIRM, function () {
@ -124,21 +128,21 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.htape", type: "bi.htape",
cls: "bi-border bi-border-radius bi-focus-shadow", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow",
ref: function () { ref: function () {
self.comboWrapper = this; self.comboWrapper = this;
}, },
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font", cls: "bi-trigger-icon-button",
width: o.height - 2, width: o.height - border,
height: o.height - 2, height: o.height - border,
ref: function () { ref: function () {
self.changeIcon = this; self.changeIcon = this;
} }
}, },
width: o.height - 2 width: o.height - border
}, this.combo] }, this.combo]
}, },
top: 0, top: 0,
@ -158,7 +162,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
switch (type) { switch (type) {
case BI.DynamicYearCombo.Dynamic: case BI.DynamicYearCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = this.options.height - 2, this.comboWrapper.attr("items")[0].width = this.options.height - this.options.simple ? 1 : 2;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:

1
src/widget/year/trigger.year.js

@ -24,6 +24,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
simple: o.simple,
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);

4
src/widget/yearmonth/card.static.yearmonth.js

@ -25,7 +25,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
whiteSpace: "nowrap", whiteSpace: "nowrap",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT - 1, height: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT - 1,
width: 38, width: 38,
value: td, value: td,
text: td, text: td,
@ -77,7 +77,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
columns: 2, columns: 2,
rows: 6, rows: 6,
columnSize: [1 / 2, 1 / 2], columnSize: [1 / 2, 1 / 2],
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1 rowSize: BI.SIZE_CONSANTS.DATE_LIST_ITEM_HEIGHT + 1
})), { })), {
type: "bi.center_adapt", type: "bi.center_adapt",
vgap: 1, vgap: 1,

18
src/widget/yearmonth/combo.yearmonth.js

@ -16,11 +16,13 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments); BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments);
this.storeValue = o.value; this.storeValue = o.value;
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var border = o.simple ? 1 : 2;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
simple: o.simple,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
height: o.height - 2, height: o.height - border,
value: o.value || "" value: o.value || ""
}); });
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () {
@ -34,9 +36,11 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_ERROR, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_ERROR, function () {
self.combo.isViewVisible() && self.combo.hideView(); self.combo.isViewVisible() && self.combo.hideView();
self.comboWrapper.element.addClass("error");
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_ERROR); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_ERROR);
}); });
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_VALID, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_VALID, function () {
self.comboWrapper.element.removeClass("error");
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_VALID); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_VALID);
}); });
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_CONFIRM, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_CONFIRM, function () {
@ -128,21 +132,21 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
items: [{ items: [{
el: { el: {
type: "bi.htape", type: "bi.htape",
cls: "bi-border bi-border-radius bi-focus-shadow", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow",
ref: function () { ref: function () {
self.comboWrapper = this; self.comboWrapper = this;
}, },
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font", cls: "bi-trigger-icon-button",
width: o.height - 2, width: o.height - border,
height: o.height - 2, height: o.height - border,
ref: function () { ref: function () {
self.changeIcon = this; self.changeIcon = this;
} }
}, },
width: o.height - 2 width: o.height - border
}, this.combo] }, this.combo]
}, },
top: 0, top: 0,
@ -162,7 +166,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
switch (type) { switch (type) {
case BI.DynamicYearMonthCombo.Dynamic: case BI.DynamicYearMonthCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = this.options.height - 2, this.comboWrapper.attr("items")[0].width = this.options.height - this.options.simple ? 1 : 2;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:

1
src/widget/yearmonth/trigger.yearmonth.js

@ -64,6 +64,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
simple: o.simple,
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if (isYear) { if (isYear) {

18
src/widget/yearquarter/combo.yearquarter.js

@ -15,12 +15,14 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments); BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments);
this.storeValue = o.value; this.storeValue = o.value;
var border = o.simple ? 1 : 2;
self.storeTriggerValue = ""; self.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_quarter_trigger", type: "bi.dynamic_year_quarter_trigger",
simple: o.simple,
min: o.minDate, min: o.minDate,
max: o.maxDate, max: o.maxDate,
height: o.height - 2, height: o.height - border,
value: o.value || "" value: o.value || ""
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN, function () { this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN, function () {
@ -34,9 +36,11 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_ERROR, function () { this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_ERROR, function () {
self.combo.isViewVisible() && self.combo.hideView(); self.combo.isViewVisible() && self.combo.hideView();
self.comboWrapper.element.addClass("error");
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_ERROR); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_ERROR);
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_VALID, function () { this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_VALID, function () {
self.comboWrapper.element.removeClass("error");
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_VALID); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_VALID);
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_CONFIRM, function () { this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_CONFIRM, function () {
@ -128,21 +132,21 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.htape", type: "bi.htape",
cls: "bi-border bi-border-radius bi-focus-shadow", cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius bi-focus-shadow",
ref: function () { ref: function () {
self.comboWrapper = this; self.comboWrapper = this;
}, },
items: [{ items: [{
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font", cls: "bi-trigger-icon-button",
width: o.height - 2, width: o.height - border,
height: o.height - 2, height: o.height - border,
ref: function () { ref: function () {
self.changeIcon = this; self.changeIcon = this;
} }
}, },
width: o.height - 2 width: o.height - border
}, this.combo] }, this.combo]
}, },
top: 0, top: 0,
@ -162,7 +166,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
switch (type) { switch (type) {
case BI.DynamicYearQuarterCombo.Dynamic: case BI.DynamicYearQuarterCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = this.options.height - 2; this.comboWrapper.attr("items")[0].width = this.options.height - this.options.simple ? 1 : 2;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:

1
src/widget/yearquarter/trigger.yearquarter.js

@ -62,6 +62,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
simple: o.simple,
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { if(isYear) {

3
webpack/attachments.js

@ -35,6 +35,7 @@ const basicAttachmentMap = {
]), ]),
widget: sync([ widget: sync([
"src/less/widget/**/*.less", "src/less/widget/**/*.less",
"src/less/component/**/*.less",
"src/widget/**/*.js", "src/widget/**/*.js",
"src/component/**/*.js", "src/component/**/*.js",
]), ]),
@ -118,6 +119,7 @@ const bundleWithoutNormalize = [].concat(
sync([ sync([
"src/less/base/**/*.less", "src/less/base/**/*.less",
"src/less/widget/**/*.less", "src/less/widget/**/*.less",
"src/less/component/**/*.less",
"public/less/**/*.less", "public/less/**/*.less",
"!public/less/app.less", "!public/less/app.less",
// ts的less // ts的less
@ -129,6 +131,7 @@ const fineuiWithoutNormalize = [].concat(
sync([ sync([
"src/less/base/**/*.less", "src/less/base/**/*.less",
"src/less/widget/**/*.less", "src/less/widget/**/*.less",
"src/less/component/**/*.less",
'ui/less/app.less', 'ui/less/app.less',
'ui/less/**/*.less', 'ui/less/**/*.less',
]), ]),

Loading…
Cancel
Save