Browse Source

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

es6
iapyang 2 years ago
parent
commit
6676cce38b
  1. 49
      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. 7
      src/case/button/icon/icon.change.js
  10. 9
      src/case/colorchooser/colorchooser.js
  11. 34
      src/case/combo/textvaluecombo/combo.textvalue.js
  12. 74
      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. 73
      src/core/platform/web/jquery/_jquery.js
  18. 4
      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. 101
      src/widget/multilayersingletree/multilayersingletree.combo.js
  25. 13
      src/widget/multilayersingletree/multilayersingletree.trigger.js
  26. 16
      src/widget/numbereditor/number.editor.js
  27. 13
      src/widget/time/time.trigger.js
  28. 8
      src/widget/timeinterval/dateinterval.js
  29. 10
      src/widget/timeinterval/timeinterval.js
  30. 9
      src/widget/timeinterval/timeperiods.js
  31. 9
      src/widget/yearinterval/yearinterval.js
  32. 3
      src/widget/yearmonth/combo.yearmonth.js
  33. 14
      src/widget/yearmonth/trigger.yearmonth.js
  34. 7
      src/widget/yearmonthinterval/yearmonthinterval.js
  35. 3
      src/widget/yearquarter/combo.yearquarter.js
  36. 14
      src/widget/yearquarter/trigger.yearquarter.js
  37. 9
      src/widget/yearquarterinterval/yearquarterinterval.js
  38. 2
      webpack/attachments.js

49
demo/js/widget/numbereditor/demo.number_editor.js

@ -7,7 +7,7 @@ Demo.FileManager = BI.inherit(BI.Widget, {
}, },
render: function () { render: function () {
var editor = BI.createWidget({ var editor1 = BI.createWidget({
type: "bi.number_editor", type: "bi.number_editor",
validationChecker: function (v) { validationChecker: function (v) {
return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0; return BI.parseFloat(v) <= 100 && BI.parseFloat(v) >= 0;
@ -16,21 +16,50 @@ Demo.FileManager = BI.inherit(BI.Widget, {
width: 150, width: 150,
errorText: "hahah" errorText: "hahah"
}); });
editor.on(BI.NumberEditor.EVENT_CHANGE, function () { editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) { if (BI.parseFloat(this.getValue()) < 1) {
editor.setDownEnable(false); editor1.setDownEnable(false);
} else { } 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 { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ hgap: 20,
el: editor, vgap: 20,
height: 24 items: [
}] {
el: editor1,
height: 24
}, {
el: editor2,
height: 24
}
]
}; };
} }
}); });
BI.shortcut("demo.number_editor", Demo.FileManager); BI.shortcut("demo.number_editor", Demo.FileManager);

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", "name": "fineui",
"version": "2.0.20220906163624", "version": "2.0.20220916093936",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

1
src/base/pager/pager.js

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

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

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

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

@ -31,8 +31,11 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
}, },
_init: function () { _init: function () {
BI.IconChangeButton.superclass._init.apply(this, arguments);
var self = this, o = this.options; 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({ this.button = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
element: this, element: this,
@ -80,4 +83,4 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
} }
}); });
BI.IconChangeButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.IconChangeButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_change_button", BI.IconChangeButton); BI.shortcut("bi.icon_change_button", BI.IconChangeButton);

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

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

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

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

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

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

@ -39,7 +39,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
var o = this.options; var o = this.options;
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return BI.extend({ 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, textAlign: o.textAlign,
title: item.title || item.text title: item.title || item.text
}, item); }, 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) { setAllPages: function (pages) {
this.options.pages = pages; this.options.pages = pages;
this._populate();
}, },
hasPrev: function (v) { 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) { _digest: function (val, items) {
var o = this.options; var o = this.options;
val = BI.isArray(val) ? val[0] : val;
// 提升valueFormatter的优先级 // 提升valueFormatter的优先级
if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.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 result = [];
var formatItems = BI.Tree.transformToArrayFormat(items); var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) { 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); result.push(item.text || item.value);
BI.remove(val, item.value);
} }
}); });
if (result.length > 0) { if (result.length > 0 && val.length === 0) {
return { return {
textCls: "", textCls: "",
text: result.join(","), text: result.join(","),
@ -84,7 +86,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}; };
} }
return { return {
text: o.text text,
}; };
} }
}, },

1
src/core/4.widget.js

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

73
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/ * http://jquery.com/
* *
* Includes Sizzle.js * Includes Sizzle.js
@ -63,16 +63,15 @@
var support = {}; var support = {};
var var
version = "1.12.4", version = "3.6.1",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function (selector, context) {
// The jQuery object is actually just the init constructor 'enhanced' // 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) // 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 // Support: Android<4.1, IE<9
@ -10537,54 +10536,82 @@
s.jsonpCallback = originalSettings.jsonpCallback; s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use // save the callback name for future use
oldCallbacks.push( callbackName ); oldCallbacks.push(callbackName);
} }
// Call if it was a function and we have a response // Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) { if (responseContainer && jQuery.isFunction(overwritten)) {
overwritten( responseContainer[ 0 ] ); overwritten(responseContainer[0]);
} }
responseContainer = overwritten = undefined; responseContainer = overwritten = undefined;
} ); });
// Delegate to script // Delegate to script
return "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 // data: string of html
// context (optional): If specified, the fragment will be created in this context, // context (optional): If specified, the fragment will be created in this context,
// defaults to document // defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string // keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) { jQuery.parseHTML = function (data, context, keepScripts) {
if ( !data || typeof data !== "string" ) { if (!data || typeof data !== "string") {
return null; return null;
} }
if ( typeof context === "boolean" ) { if (typeof context === "boolean") {
keepScripts = context; keepScripts = context;
context = false; context = false;
} }
context = context || document;
var parsed = rsingleTag.exec( data ), var base, parsed, scripts;
scripts = !keepScripts && [];
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 // Single tag
if ( parsed ) { if (parsed) {
return [ context.createElement( parsed[ 1 ] ) ]; return [context.createElement(parsed[1])];
} }
parsed = buildFragment( [ data ], context, scripts ); parsed = buildFragment([data], context, scripts);
if ( scripts && scripts.length ) { if (scripts && scripts.length) {
jQuery( scripts ).remove(); jQuery(scripts).remove();
} }
return jQuery.merge( [], parsed.childNodes ); return jQuery.merge([], parsed.childNodes);
}; };

4
src/less/base/trigger/trigger.less

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

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

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

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

@ -1,6 +1,16 @@
@import "../../index.less"; @import "../../index.less";
@val: transform .3s ease;
.bi-multilayer-single-tree-combo { .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 { &.status-error {
&.bi-border, &.bi-border-bottom { &.bi-border, &.bi-border-bottom {
border-color: @border-color-negative; border-color: @border-color-negative;

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

@ -9,7 +9,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24 iconWidth: 24
}, },
props: { props: () => ({
extraCls: "bi-date-trigger", extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -17,8 +17,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24, iconWidth: 24,
format: "", // 显示的日期格式化方式 format: "", // 显示的日期格式化方式
allowEdit: true, // 是否允许编辑 allowEdit: true, // 是否允许编辑
watermark: "" watermark: BI.i18nText("BI-Basic_Unrestricted"),
}, }),
_init: function () { _init: function () {
BI.DynamicDateTrigger.superclass._init.apply(this, arguments); BI.DynamicDateTrigger.superclass._init.apply(this, arguments);
@ -44,7 +44,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true, allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), watermark: o.watermark,
errorText: function (v) { errorText: function (v) {
var str = ""; var str = "";
if (!BI.isKey(o.format)) { 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 = { item.el.logic = {
dynamic: true 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.el.iconCls2 = self.constants.nextIcon;
item.popup = { item.popup = {
lgap: 1, lgap: 1,
@ -183,7 +183,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
if (BI.isNotEmptyArray(child.children)) { if (BI.isNotEmptyArray(child.children)) {
item.type = "bi.down_list_group_item"; item.type = "bi.down_list_group_item";
item.iconCls2 = self.constants.nextIcon; 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); self._createChildren(item, child);
} }
targetItem.items.push(item); 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(); var baseConfig = this._getBaseConfig();
if (o.allowEdit) { if (o.allowEdit) {
return { return {
type: "bi.absolute", type: "bi.absolute",
@ -210,7 +209,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.trigger_icon_button", type: "bi.trigger_icon_button",
cls: "trigger-icon-button", cls: "bi-trigger trigger-icon-button",
ref: function (_ref) { ref: function (_ref) {
self.triggerBtn = _ref; self.triggerBtn = _ref;
}, },

101
src/widget/multilayersingletree/multilayersingletree.combo.js

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

13
src/widget/multilayersingletree/multilayersingletree.trigger.js

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

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

@ -10,6 +10,9 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
valueFormatter: function (v) { valueFormatter: function (v) {
return v; return v;
}, },
valueParser: function (v) {
return v;
},
value: 0, value: 0,
allowBlank: false, allowBlank: false,
errorText: "", errorText: "",
@ -30,14 +33,19 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
value: o.valueFormatter(o.value), value: o.valueFormatter(o.value),
validationChecker: function (v) { validationChecker: function (v) {
// 不设置validationChecker就自动检测 // 不设置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 false;
} }
return o.validationChecker(v); return o.validationChecker(parsedValue);
}, },
errorText: o.errorText errorText: o.errorText
}); });
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { 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); self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
}); });
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
@ -57,6 +65,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
forceNotSelected: true, forceNotSelected: true,
trigger: "lclick,", 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" 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 () {
@ -68,6 +77,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
trigger: "lclick,", trigger: "lclick,",
forceNotSelected: true, 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" 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 () {
@ -154,4 +164,4 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
}); });
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE"; BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.number_editor", BI.NumberEditor); BI.shortcut("bi.number_editor", BI.NumberEditor);

13
src/widget/time/time.trigger.js

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

8
src/widget/timeinterval/dateinterval.js

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

10
src/widget/timeinterval/timeinterval.js

@ -24,8 +24,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.superclass._init.apply(this, arguments); BI.TimeInterval.superclass._init.apply(this, arguments);
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({ this.label = BI.createWidget({
type: "bi.label", type: "bi.label",
height: o.height, 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 self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_date_time_combo", type: "bi.dynamic_date_time_combo",
@ -74,7 +74,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
minDate: o.minDate, minDate: o.minDate,
maxDate: o.maxDate, maxDate: o.maxDate,
behaviors: o.behaviors, behaviors: o.behaviors,
watermark: o.watermark, watermark: watermark,
value: v, value: v,
height: o.height, height: o.height,
}); });
@ -202,4 +202,4 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_VALID = "EVENT_VALID";
BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR";
BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.time_interval", BI.TimeInterval); BI.shortcut("bi.time_interval", BI.TimeInterval);

9
src/widget/timeinterval/timeperiods.js

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

9
src/widget/yearinterval/yearinterval.js

@ -23,8 +23,8 @@ BI.YearInterval = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{ return [{
type: "bi.center", 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 self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_year_combo", type: "bi.dynamic_year_combo",
@ -73,6 +73,7 @@ BI.YearInterval = BI.inherit(BI.Single, {
height: o.height, height: o.height,
behaviors: o.behaviors, behaviors: o.behaviors,
value: v, value: v,
watermark: watermark,
listeners: [{ listeners: [{
eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW, eventName: BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {
@ -206,4 +207,4 @@ BI.YearInterval.EVENT_VALID = "EVENT_VALID";
BI.YearInterval.EVENT_ERROR = "EVENT_ERROR"; BI.YearInterval.EVENT_ERROR = "EVENT_ERROR";
BI.YearInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.YearInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.YearInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.YearInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.year_interval", BI.YearInterval); BI.shortcut("bi.year_interval", BI.YearInterval);

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

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

14
src/widget/yearmonth/trigger.yearmonth.js

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

7
src/widget/yearmonthinterval/yearmonthinterval.js

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

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

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

14
src/widget/yearquarter/trigger.yearquarter.js

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

9
src/widget/yearquarterinterval/yearquarterinterval.js

@ -23,8 +23,8 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
o.value = o.value || {}; o.value = o.value || {};
this.left = this._createCombo(o.value.start); this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end); this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{ return [{
type: "bi.center", 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 self = this, o = this.options;
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.dynamic_year_quarter_combo", type: "bi.dynamic_year_quarter_combo",
@ -73,6 +73,7 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
behaviors: o.behaviors, behaviors: o.behaviors,
value: v, value: v,
height: o.height, height: o.height,
watermark: watermark,
listeners: [{ listeners: [{
eventName: BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW, eventName: BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {
@ -204,4 +205,4 @@ BI.YearQuarterInterval.EVENT_VALID = "EVENT_VALID";
BI.YearQuarterInterval.EVENT_ERROR = "EVENT_ERROR"; BI.YearQuarterInterval.EVENT_ERROR = "EVENT_ERROR";
BI.YearQuarterInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.YearQuarterInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.YearQuarterInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.YearQuarterInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.year_quarter_interval", BI.YearQuarterInterval); BI.shortcut("bi.year_quarter_interval", BI.YearQuarterInterval);

2
webpack/attachments.js

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

Loading…
Cancel
Save