Browse Source

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

es6
iapyang 2 years ago
parent
commit
6676cce38b
  1. 45
      demo/js/widget/numbereditor/demo.number_editor.js
  2. BIN
      dist/font/iconfont.eot
  3. BIN
      dist/font/iconfont.ttf
  4. BIN
      dist/font/iconfont.woff
  5. BIN
      dist/font/iconfont.woff2
  6. 2
      package.json
  7. 1
      src/base/pager/pager.js
  8. 5
      src/base/single/button/button.basic.js
  9. 5
      src/case/button/icon/icon.change.js
  10. 9
      src/case/colorchooser/colorchooser.js
  11. 30
      src/case/combo/textvaluecombo/combo.textvalue.js
  12. 70
      src/case/combo/textvaluecombo/combo.textvaluesmall.js
  13. 2
      src/case/combo/textvaluecombo/popup.textvalue.js
  14. 1
      src/case/pager/pager.detail.js
  15. 10
      src/case/trigger/trigger.text.select.js
  16. 1
      src/core/4.widget.js
  17. 71
      src/core/platform/web/jquery/_jquery.js
  18. 2
      src/less/base/trigger/trigger.less
  19. 25
      src/less/core/utils/common.less
  20. 10
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  21. 8
      src/widget/dynamicdate/dynamicdate.trigger.js
  22. 4
      src/widget/multilayerdownlist/popup.downlist.js
  23. 3
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  24. 97
      src/widget/multilayersingletree/multilayersingletree.combo.js
  25. 11
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  26. 14
      src/widget/numbereditor/number.editor.js
  27. 9
      src/widget/time/time.trigger.js
  28. 8
      src/widget/timeinterval/dateinterval.js
  29. 8
      src/widget/timeinterval/timeinterval.js
  30. 7
      src/widget/timeinterval/timeperiods.js
  31. 7
      src/widget/yearinterval/yearinterval.js
  32. 3
      src/widget/yearmonth/combo.yearmonth.js
  33. 10
      src/widget/yearmonth/trigger.yearmonth.js
  34. 7
      src/widget/yearmonthinterval/yearmonthinterval.js
  35. 3
      src/widget/yearquarter/combo.yearquarter.js
  36. 10
      src/widget/yearquarter/trigger.yearquarter.js
  37. 7
      src/widget/yearquarterinterval/yearquarterinterval.js
  38. 2
      webpack/attachments.js

45
demo/js/widget/numbereditor/demo.number_editor.js

@ -7,7 +7,7 @@ Demo.FileManager = BI.inherit(BI.Widget, {
},
render: function () {
var editor = BI.createWidget({
var editor1 = BI.createWidget({
type: "bi.number_editor",
validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
@ -16,20 +16,49 @@ Demo.FileManager = BI.inherit(BI.Widget, {
width: 150,
errorText: "hahah"
});
editor.on(BI.NumberEditor.EVENT_CHANGE, function () {
editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {
editor.setDownEnable(false);
editor1.setDownEnable(false);
} else {
editor.setDownEnable(true);
editor1.setDownEnable(true);
}
BI.Msg.toast(editor.getValue());
BI.Msg.toast(editor1.getValue());
});
var editor2 = BI.createWidget({
type: "bi.number_editor",
validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
},
valueFormatter: (v) => `${v}$`,
valueParser: (v) => v.replace(/\$\s?|(,*)/g, ''),
height: 24,
width: 150,
errorText: "hahah"
});
editor2.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {
editor2.setDownEnable(false);
} else {
editor2.setDownEnable(true);
}
BI.Msg.toast(editor2.getValue());
});
return {
type: "bi.vertical",
items: [{
el: editor,
hgap: 20,
vgap: 20,
items: [
{
el: editor1,
height: 24
}]
}, {
el: editor2,
height: 24
}
]
};
}
});

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

2
package.json

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

1
src/base/pager/pager.js

@ -235,6 +235,7 @@ BI.Pager = BI.inherit(BI.Widget, {
setAllPages: function (pages) {
this.options.pages = pages;
this._populate();
},
hasPrev: function (v) {

5
src/base/single/button/button.basic.js

@ -26,6 +26,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
trigger: null,
handler: BI.emptyFn,
bubble: null,
debounce: true
});
},
@ -222,10 +223,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
});
// 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
var onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false,
});
}) : this._doClick;
function ev(e) {
if (o.stopEvent) {

5
src/case/button/icon/icon.change.js

@ -31,8 +31,11 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
},
_init: function () {
BI.IconChangeButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.iconCls = BI.isFunction(o.iconCls) ? this.__watch(o.iconCls, function (context, newValue) {
self.setIcon(newValue);
}) : o.iconCls;
BI.IconChangeButton.superclass._init.apply(this, arguments);
this.button = BI.createWidget({
type: "bi.icon_button",
element: this,

9
src/case/colorchooser/colorchooser.js

@ -39,7 +39,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
width: o.el.type ? o.width : o.width - 2,
height: o.el.type ? o.height : o.height - 2
}, o.el),
popup: {
popup: () => ({
el: BI.extend({
type: "bi.hex_color_chooser_popup",
recommendColorsGetter: o.recommendColorsGetter,
@ -64,13 +64,13 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
}, o.popup),
value: o.value,
width: 300
},
}),
value: o.value
});
var fn = function () {
var color = self.colorPicker.getValue();
self.trigger.setValue(color);
self.setValue(color);
};
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
@ -98,7 +98,8 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
},
setValue: function (color) {
this.combo.setValue((color || "").toLowerCase());
this.options.value = (color || "").toLowerCase();
this.combo.setValue(this.options.value);
},
getValue: function () {

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

@ -13,6 +13,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
text: "",
value: "",
defaultText: "",
el: {},
allowClear: false,
status: "success", // success | warning | error,
title: null,
@ -71,21 +72,25 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
}
}
],
...o.el
};
let changeTag = false;
const popup = {
type: "bi.text_value_combo_popup",
ref: ref => this.popup = ref,
chooseType: o.chooseType,
value: o.value,
items: o.items,
listeners: [
{
eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: (...args) => {
changeTag = true;
this.setValue(this.popup.getValue());
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) {
this.combo.hideView();
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args);
}
}
}, {
eventName: BI.Controller.EVENT_CHANGE,
action: (...args) => {
@ -102,6 +107,21 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
direction: o.direction,
adjustLength: 2,
el: trigger,
listeners: [
{
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: (...args) => {
changeTag = false;
}
}, {
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: (...args) => {
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_SINGLE && changeTag) {
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args);
}
}
}
],
popup: {
el: popup,
value: o.value,
@ -113,7 +133,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
mounted: function () {
const o = this.options;
if (BI.isKey(o.value)) {
if (BI.isKey(o.value) || BI.isObject(o.value)) {
this._checkError(o.value);
}
},
@ -132,11 +152,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
var vals = BI.isArray(v) ? v : [v];
var result = BI.find(this.options.items, function (idx, item) {
return BI.contains(vals, item.value);
});
var result = BI.intersection(BI.map(this.options.items, (i, item) => item.value), vals);
if (BI.isNull(result)) {
if (result.length !== vals.length) {
this.setStatus("error");
} else {
this.setStatus("success");

70
src/case/combo/textvaluecombo/combo.textvaluesmall.js

@ -15,64 +15,44 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, {
});
},
_init: function () {
var self = this, o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
self.populate(newValue);
}) : o.items;
BI.SmallTextValueCombo.superclass._init.apply(this, arguments);
this.trigger = BI.createWidget(o.el, {
type: "bi.small_select_text_trigger",
items: o.items,
render: function () {
var o = this.options;
return {
type: "bi.text_value_combo",
ref: (_ref) => {
this.combo = _ref;
},
height: o.height,
text: o.text
});
this.popup = BI.createWidget({
type: "bi.text_value_combo_popup",
chooseType: o.chooseType,
items: o.items
});
this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.SmallTextValueCombo.hideView();
self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE);
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.SmallTextValueCombo = BI.createWidget({
type: "bi.combo",
element: this,
container: o.container,
adjustLength: 2,
el: this.trigger,
popup: {
el: this.popup,
maxHeight: 240,
minHeight: 25
el: {
type: "bi.small_select_text_trigger",
...o.el
},
text: o.text,
value: o.value,
defaultText: o.defaultText,
allowClear: o.allowClear,
status: o.status,
title: o.title,
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: (...args) => {
this.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE, ...args);
}
});
if(BI.isKey(o.value)){
this.setValue(o.value);
}]
}
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.options.items = items;
this.SmallTextValueCombo.populate(items);
this.combo.populate(items);
}
});
BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";

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

@ -39,7 +39,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
var o = this.options;
return BI.map(items, function (i, item) {
return BI.extend({
type: "bi.single_select_item",
type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item",
textAlign: o.textAlign,
title: item.title || item.text
}, item);

1
src/case/pager/pager.js → src/case/pager/pager.detail.js

@ -223,6 +223,7 @@ BI.DetailPager = BI.inherit(BI.Widget, {
setAllPages: function (pages) {
this.options.pages = pages;
this._populate();
},
hasPrev: function (v) {

10
src/case/trigger/trigger.text.select.js

@ -52,7 +52,6 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_digest: function (val, items) {
var o = this.options;
val = BI.isArray(val) ? val[0] : val;
// 提升valueFormatter的优先级
if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) {
@ -61,16 +60,19 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
};
}
val = BI.isArray(val) ? val.slice() : [val];
var result = [];
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (val === item.value && !BI.contains(result, item.text || item.value)) {
if (BI.contains(val, item.value) && !BI.contains(result, item.text || item.value)) {
result.push(item.text || item.value);
BI.remove(val, item.value);
}
});
if (result.length > 0) {
if (result.length > 0 && val.length === 0) {
return {
textCls: "",
text: result.join(","),
@ -84,7 +86,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
};
}
return {
text: o.text
text,
};
}
},

1
src/core/4.widget.js

@ -743,6 +743,7 @@
},
_unMount: function () {
this._assetMounted();
this.__destroy();
this.fireEvent(BI.Events.UNMOUNT);
this.purgeListeners();

71
src/core/platform/web/jquery/_jquery.js vendored

@ -1,5 +1,5 @@
/*!
* jQuery JavaScript Library v1.12.4
* jQuery JavaScript Library v3.6.1
* http://jquery.com/
*
* Includes Sizzle.js
@ -63,16 +63,15 @@
var support = {};
var
version = "1.12.4",
version = "3.6.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
jQuery = function (selector, context) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
return new jQuery.fn.init(selector, context);
},
// Support: Android<4.1, IE<9
@ -10537,54 +10536,82 @@
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
oldCallbacks.push(callbackName);
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
if (responseContainer && jQuery.isFunction(overwritten)) {
overwritten(responseContainer[0]);
}
responseContainer = overwritten = undefined;
} );
});
// Delegate to script
return "script";
}
} );
});
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = (function () {
var body = document.implementation.createHTMLDocument("").body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
})();
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
jQuery.parseHTML = function (data, context, keepScripts) {
if (!data || typeof data !== "string") {
return null;
}
if ( typeof context === "boolean" ) {
if (typeof context === "boolean") {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
var base, parsed, scripts;
if (!context) {
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if (support.createHTMLDocument) {
context = document.implementation.createHTMLDocument("");
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement("base");
base.href = document.location.href;
context.head.appendChild(base);
} else {
context = document;
}
}
parsed = rsingleTag.exec(data);
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
if (parsed) {
return [context.createElement(parsed[1])];
}
parsed = buildFragment( [ data ], context, scripts );
parsed = buildFragment([data], context, scripts);
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
if (scripts && scripts.length) {
jQuery(scripts).remove();
}
return jQuery.merge( [], parsed.childNodes );
return jQuery.merge([], parsed.childNodes);
};

2
src/less/base/trigger/trigger.less

@ -1,7 +1,7 @@
@import "../../index.less";
.bi-trigger{
& .bi-trigger-icon-button{
& .bi-trigger-icon-button, &.bi-trigger-icon-button {
font-size: @font-size-16;
}
}

25
src/less/core/utils/common.less

@ -2,6 +2,19 @@
.base-disabled {
cursor: not-allowed !important;
.cursor-pointer {
cursor: not-allowed !important;
}
.cursor-default {
cursor: not-allowed !important;
}
.cursor-move {
cursor: not-allowed !important;
}
.cursor-text{
cursor: not-allowed !important;
}
color: @color-bi-text-disabled !important;
& .bi-input {
@ -41,6 +54,18 @@
.base-invalid {
cursor: default !important;
.cursor-pointer {
cursor: default !important;
}
.cursor-default {
cursor: default !important;
}
.cursor-move {
cursor: default !important;
}
.cursor-text{
cursor: default !important;
}
}
//focus时边框高亮

10
src/less/widget/multilayersingletree/multilayersingletree.combo.less

@ -1,6 +1,16 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-multilayer-single-tree-combo {
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
}
}
&.status-error {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;

8
src/widget/dynamicdate/dynamicdate.trigger.js

@ -9,7 +9,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
@ -17,8 +17,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24,
format: "", // 显示的日期格式化方式
allowEdit: true, // 是否允许编辑
watermark: ""
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
}),
_init: function () {
BI.DynamicDateTrigger.superclass._init.apply(this, arguments);
@ -44,7 +44,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
hgap: c.hgap,
vgap: c.vgap,
allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"),
watermark: o.watermark,
errorText: function (v) {
var str = "";
if (!BI.isKey(o.format)) {

4
src/widget/multilayerdownlist/popup.downlist.js

@ -99,7 +99,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
item.el.logic = {
dynamic: true
};
item.el.height = sourceItem.el.height || self.constants.height;
item.el.height = sourceItem.el.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT;
item.el.iconCls2 = self.constants.nextIcon;
item.popup = {
lgap: 1,
@ -183,7 +183,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
if (BI.isNotEmptyArray(child.children)) {
item.type = "bi.down_list_group_item";
item.iconCls2 = self.constants.nextIcon;
item.height = child.height || self.constants.height;
item.height = child.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT;
self._createChildren(item, child);
}
targetItem.items.push(item);

3
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -35,7 +35,6 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var baseConfig = this._getBaseConfig();
if (o.allowEdit) {
return {
type: "bi.absolute",
@ -210,7 +209,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options;
return {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
cls: "bi-trigger trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},

97
src/widget/multilayersingletree/multilayersingletree.combo.js

@ -33,14 +33,48 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
var cls = (o.simple ? "bi-border-bottom " : "bi-border bi-border-radius ") + (BI.isKey(o.status) ? ("status-" + o.status) : "");
var baseConfig = this._getBaseConfig();
if (o.allowEdit) {
return {
type: "bi.absolute",
cls,
items: [
{
el: BI.extend(baseConfig, this._getSearchConfig()),
top: 0, bottom: 0, right: 0, left: 0
}, {
el: self._getTriggerIconButton(),
top: 0, bottom: 0, right: 0,
},
]
};
}
return BI.extend(baseConfig, {
el: {
type: "bi.single_tree_trigger",
ref: function (_ref) {
self.textTrigger = _ref;
},
text: o.text,
defaultText: o.defaultText,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
}, { cls });
},
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius ") + (BI.isKey(o.status) ? ("status-" + o.status) : ""),
container: o.container,
destroyWhenHide: o.destroyWhenHide,
adjustLength: 2,
@ -152,7 +186,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
// IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿
// 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以
// 卡顿不明显, 先在此做尝试, 并在FineUI特殊处理待解决文档中标记跟踪
return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0);
return (o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0) ? false : self.triggerBtn?.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
@ -168,46 +202,29 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
};
},
_getSyncConfig: function () {
var o = this.options, self = this;
var baseConfig = this._getBaseConfig();
return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : {
el: {
type: "bi.single_tree_trigger",
ref: function (_ref) {
self.textTrigger = _ref;
},
text: o.text,
defaultText: o.defaultText,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
});
},
_getAsyncConfig: function () {
var o = this.options, self = this;
var baseConfig = this._getBaseConfig();
return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : {
el: {
type: "bi.single_tree_trigger",
_getTriggerIconButton: function () {
var self = this, o = this.options;
return {
type: "bi.trigger_icon_button",
cls: "bi-trigger trigger-icon-button",
ref: function (_ref) {
self.textTrigger = _ref;
self.triggerBtn = _ref;
},
text: o.text,
defaultText: o.defaultText,
width: o.height,
height: o.height,
items: o.items,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
},
});
listeners: [
{
eventName: BI.TriggerIconButton.EVENT_CHANGE,
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
}
]
};
},
getSearcher: function () {

11
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -102,17 +102,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
}]
},
width: "fill",
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
rgap: 24,
},
width: 24,
},
width: 24
}
]
};
},

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

@ -10,6 +10,9 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
valueFormatter: function (v) {
return v;
},
valueParser: function (v) {
return v;
},
value: 0,
allowBlank: false,
errorText: "",
@ -30,14 +33,19 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
value: o.valueFormatter(o.value),
validationChecker: function (v) {
// 不设置validationChecker就自动检测
if(o.validationChecker === BI.emptyFn && !self._checkValueInRange(v)) {
var parsedValue = o.valueParser(v);
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) {
return false;
}
return o.validationChecker(v);
return o.validationChecker(parsedValue);
},
errorText: o.errorText
});
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
// 大多数时候valueFormatter往往需要配合valueParser一起使用
var value = this.getValue();
var parsedValue = o.valueParser(value);
this.setValue(o.valueFormatter(parsedValue));
self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
});
this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
@ -57,6 +65,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button",
forceNotSelected: true,
trigger: "lclick,",
debounce: false,
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 () {
@ -68,6 +77,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button",
trigger: "lclick,",
forceNotSelected: true,
debounce: false,
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 () {

9
src/widget/time/time.trigger.js

@ -23,12 +23,13 @@
DEFAULT_HOUR: "00"
},
props: {
props: () => ({
extraCls: "bi-time-trigger",
value: {},
format: "",
allowEdit: false
},
allowEdit: false,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
}),
render: function () {
var self = this, o = this.options;
@ -52,7 +53,7 @@
value: this._formatValue(o.value),
hgap: 4,
allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"),
watermark: o.watermark,
title: BI.bind(this._getTitle, this),
listeners: [{
eventName: "EVENT_KEY_DOWN",

8
src/widget/timeinterval/dateinterval.js

@ -24,8 +24,8 @@ BI.DateInterval = BI.inherit(BI.Single, {
BI.DateInterval.superclass._init.apply(this, arguments);
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
type: "bi.label",
height: o.height,
@ -65,7 +65,7 @@ BI.DateInterval = BI.inherit(BI.Single, {
});
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_date_combo",
@ -74,7 +74,7 @@ BI.DateInterval = BI.inherit(BI.Single, {
maxDate: o.maxDate,
simple: o.simple,
behaviors: o.behaviors,
watermark: o.watermark,
watermark: watermark,
value: v,
height: o.height,
listeners: [{

8
src/widget/timeinterval/timeinterval.js

@ -24,8 +24,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.superclass._init.apply(this, arguments);
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
type: "bi.label",
height: o.height,
@ -65,7 +65,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
});
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_date_time_combo",
@ -74,7 +74,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
minDate: o.minDate,
maxDate: o.maxDate,
behaviors: o.behaviors,
watermark: o.watermark,
watermark: watermark,
value: v,
height: o.height,
});

7
src/widget/timeinterval/timeperiods.js

@ -51,7 +51,7 @@
ref: function (_ref) {
self.left = _ref;
}
}, this._createCombo(o.value.start)),
}, this._createCombo(o.value.start, o.watermark?.start)),
left: this.constants.offset,
right: 0,
top: 0,
@ -64,7 +64,7 @@
ref: function (_ref) {
self.right = _ref;
}
}, this._createCombo(o.value.end)),
}, this._createCombo(o.value.end, o.watermark?.end)),
left: 0,
right: this.constants.offset,
top: 0,
@ -80,13 +80,14 @@
};
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this;
var o = this.options;
return {
type: "bi.time_combo",
value: v,
height: o.height,
watermark: watermark,
listeners: [{
eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {

7
src/widget/yearinterval/yearinterval.js

@ -23,8 +23,8 @@ BI.YearInterval = BI.inherit(BI.Single, {
var self = this, o = this.options;
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
type: "bi.center",
@ -63,7 +63,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
}]
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_year_combo",
@ -73,6 +73,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
height: o.height,
behaviors: o.behaviors,
value: v,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {

3
src/widget/yearmonth/combo.yearmonth.js

@ -23,7 +23,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
min: o.minDate,
max: o.maxDate,
height: o.height - border,
value: o.value || ""
value: o.value || "",
watermark: o.watermark,
});
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () {
self.combo.isViewVisible() && self.combo.hideView();

10
src/widget/yearmonth/trigger.yearmonth.js

@ -5,12 +5,16 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
month: BI.i18nText("BI-Basic_Unrestricted"),
},
}),
beforeInit: function (callback) {
var o = this.options;
@ -80,7 +84,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
quitChecker: function () {
return false;
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
watermark: isYear ? o.watermark?.year : o.watermark.month,
errorText: function (v) {
var year = isYear ? v : self.yearEditor.getValue();
var month = isYear ? self.monthEditor.getValue() : v;

7
src/widget/yearmonthinterval/yearmonthinterval.js

@ -19,8 +19,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
BI.YearMonthInterval.superclass._init.apply(this, arguments);
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
type: "bi.label",
height: o.height,
@ -61,7 +61,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
});
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_year_month_combo",
@ -71,6 +71,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
maxDate: o.maxDate,
behaviors: o.behaviors,
value: v,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {

3
src/widget/yearquarter/combo.yearquarter.js

@ -26,7 +26,8 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
min: o.minDate,
max: o.maxDate,
height: o.height - border,
value: o.value || ""
value: o.value || "",
watermark: o.watermark,
});
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN, function () {
self.combo.isViewVisible() && self.combo.hideView();

10
src/widget/yearquarter/trigger.yearquarter.js

@ -5,12 +5,16 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
watermark: {
year: BI.i18nText("BI-Basic_Unrestricted"),
quarter: BI.i18nText("BI-Basic_Unrestricted"),
},
}),
_init: function () {
BI.DynamicYearQuarterTrigger.superclass._init.apply(this, arguments);
@ -96,7 +100,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
BI.getQuarter(end)
);
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
watermark: isYear ? o.watermark?.year : o.watermark?.quarter,
hgap: c.hgap,
vgap: c.vgap,
allowBlank: true

7
src/widget/yearquarterinterval/yearquarterinterval.js

@ -23,8 +23,8 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
var self = this, o = this.options;
o.value = o.value || {};
this.left = this._createCombo(o.value.start);
this.right = this._createCombo(o.value.end);
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
type: "bi.center",
@ -63,7 +63,7 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
}]
},
_createCombo: function (v) {
_createCombo: function (v, watermark) {
var self = this, o = this.options;
var combo = BI.createWidget({
type: "bi.dynamic_year_quarter_combo",
@ -73,6 +73,7 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
behaviors: o.behaviors,
value: v,
height: o.height,
watermark: watermark,
listeners: [{
eventName: BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW,
action: function () {

2
webpack/attachments.js

@ -233,13 +233,13 @@ const demo = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core,
basicAttachmentMap.fix,
basicAttachmentMap.config,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
sync(["public/less/app.less", "public/less/**/*.less"]),
[fixCompact, workerCompact],
basicAttachmentMap.config,
basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),
);

Loading…
Cancel
Save