Browse Source

BI-80409 时间类型控件全系列可设置是否显示动态日期

es6
windy 4 years ago
parent
commit
959f6d1280
  1. 1
      changelog.md
  2. 2
      src/case/linersegment/linear.segment.js
  3. 4
      src/less/widget/dynamicdatecombo/dynamicdatepopup.less
  4. 4
      src/less/widget/dynamicdatecombo/dynamicdatetimepopup.less
  5. 3
      src/less/widget/year/popup.year.less
  6. 4
      src/less/widget/yearmonth/popup.yearmonth.less
  7. 6
      src/less/widget/yearquarter/popup.yearquarter.less
  8. 33
      src/widget/date/calendar/popup.calendar.date.js
  9. 4
      src/widget/dynamicdate/dynamicdate.combo.js
  10. 13
      src/widget/dynamicdate/dynamicdate.popup.js
  11. 4
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  12. 23
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  13. 4
      src/widget/timeinterval/dateinterval.js
  14. 4
      src/widget/timeinterval/timeinterval.js
  15. 4
      src/widget/year/combo.year.js
  16. 14
      src/widget/year/popup.year.js
  17. 57
      src/widget/yearmonth/card.static.yearmonth.js
  18. 4
      src/widget/yearmonth/combo.yearmonth.js
  19. 13
      src/widget/yearmonth/popup.yearmonth.js
  20. 4
      src/widget/yearmonthinterval/yearmonthinterval.js
  21. 40
      src/widget/yearquarter/card.static.yearquarter.js
  22. 4
      src/widget/yearquarter/combo.yearquarter.js
  23. 13
      src/widget/yearquarter/popup.yearquarter.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2021-01) 2.0(2021-01)
- 日期类型控件全系列可设置是否显示动态日期
- 日期类型控件全系列可设置最大最小日期 - 日期类型控件全系列可设置最大最小日期
- 调整了combo的popup显示位置计算逻辑 - 调整了combo的popup显示位置计算逻辑

2
src/case/linersegment/linear.segment.js

@ -1,7 +1,7 @@
BI.LinearSegment = BI.inherit(BI.Widget, { BI.LinearSegment = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-linear-segment bi-split-bottom", baseCls: "bi-linear-segment",
items: [], items: [],
layouts: [{ layouts: [{
type: "bi.center" type: "bi.center"

4
src/less/widget/dynamicdatecombo/dynamicdatepopup.less

@ -1,5 +1,7 @@
@import "../../index"; @import "../../index";
.bi-dynamic-date-popup{ .bi-dynamic-date-popup{
& .dynamic-date-pane {
min-height: 290px;
}
} }

4
src/less/widget/dynamicdatecombo/dynamicdatetimepopup.less

@ -1,5 +1,7 @@
@import "../../index"; @import "../../index";
.bi-dynamic-date-time-popup{ .bi-dynamic-date-time-popup{
& .dynamic-date-pane {
min-height: 331px;
}
} }

3
src/less/widget/year/popup.year.less

@ -10,6 +10,9 @@
border-left: none; border-left: none;
} }
} }
& .dynamic-year-pane {
min-height: 186px;
}
} }
.bi-theme-dark { .bi-theme-dark {

4
src/less/widget/yearmonth/popup.yearmonth.less

@ -1,5 +1,7 @@
@import "../../index"; @import "../../index";
.bi-year-month-popup{ .bi-year-month-popup{
& .dynamic-year-month-pane {
min-height: 191px;
}
} }

6
src/less/widget/yearquarter/popup.yearquarter.less

@ -1,5 +1,7 @@
@import "../../index"; @import "../../index";
.bi-year-month-popup{ .bi-year-quarter-popup{
& .dynamic-year-quarter-pane {
min-height: 187px;
}
} }

33
src/widget/date/calendar/popup.calendar.date.js

@ -4,14 +4,12 @@
* @extends BI.Widget * @extends BI.Widget
*/ */
BI.DateCalendarPopup = BI.inherit(BI.Widget, { BI.DateCalendarPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DateCalendarPopup.superclass._defaultConfig.apply(this, arguments); props: {
return BI.extend(conf, { baseCls: "bi-date-calendar-popup",
baseCls: "bi-date-calendar-popup", min: "1900-01-01", // 最小日期
min: "1900-01-01", // 最小日期 max: "2099-12-31", // 最大日期
max: "2099-12-31", // 最大日期 selectedTime: null
selectedTime: null
});
}, },
_createNav: function (v) { _createNav: function (v) {
@ -31,8 +29,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
return calendar; return calendar;
}, },
_init: function () { render: function () {
BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, var self = this,
o = this.options; o = this.options;
this.today = BI.getDate(); this.today = BI.getDate();
@ -86,14 +83,16 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE);
}); });
BI.createWidget({ return [{
type: "bi.absolute", type: "bi.vertical",
element: this,
items: [{ items: [{
el: this.calendar, el: this.calendar,
left: 5, hgap: 5,
right: 5 bgap: 12
}, { }]
}, {
type: "bi.absolute",
items: [{
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: "bi-split-top" cls: "bi-split-top"
@ -103,7 +102,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
left: 0, left: 0,
right: 0 right: 0
}] }]
}); }]
}, },
_checkMin: function () { _checkMin: function () {

4
src/widget/dynamicdate/dynamicdate.combo.js

@ -12,7 +12,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31", maxDate: "2099-12-31",
format: "", format: "",
allowEdit: true allowEdit: true,
supportDynamic: true,
}, },
@ -134,6 +135,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
popup: { popup: {
el: { el: {
type: "bi.dynamic_date_popup", type: "bi.dynamic_date_popup",
supportDynamic: opts.supportDynamic,
behaviors: opts.behaviors, behaviors: opts.behaviors,
min: opts.minDate, min: opts.minDate,
max: opts.maxDate, max: opts.maxDate,

13
src/widget/dynamicdate/dynamicdate.popup.js

@ -7,7 +7,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-dynamic-date-popup", baseCls: "bi-dynamic-date-popup",
width: 248, width: 248,
height: 344 supportDynamic: true,
}, },
_init: function () { _init: function () {
@ -16,7 +16,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
this.storeValue = {type: BI.DynamicDateCombo.Static}; this.storeValue = {type: BI.DynamicDateCombo.Static};
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
el: this._getTabJson() el: this._getTabJson()
}, { }, {
@ -61,9 +61,9 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE);
} }
}] }]
}]] }]],
height: 24
}, },
height: 24
}] }]
}); });
this.setValue(opts.value); this.setValue(opts.value);
@ -73,11 +73,15 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
logic: {
dynamic: true
},
ref: function () { ref: function () {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment", type: "bi.linear_segment",
invisible: !o.supportDynamic,
cls: "bi-split-bottom", cls: "bi-split-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
@ -95,6 +99,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
return { return {
type: "bi.dynamic_date_card", type: "bi.dynamic_date_card",
cls: "dynamic-date-pane",
listeners: [{ listeners: [{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {

4
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -12,7 +12,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31", maxDate: "2099-12-31",
format: "", format: "",
allowEdit: true allowEdit: true,
supportDynamic: true
}, },
@ -139,6 +140,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
popup: { popup: {
el: { el: {
type: "bi.dynamic_date_time_popup", type: "bi.dynamic_date_time_popup",
supportDynamic: opts.supportDynamic,
behaviors: opts.behaviors, behaviors: opts.behaviors,
min: opts.minDate, min: opts.minDate,
max: opts.maxDate, max: opts.maxDate,

23
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -7,7 +7,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-dynamic-date-time-popup", baseCls: "bi-dynamic-date-time-popup",
width: 248, width: 248,
height: 385 supportDynamic: true,
}, },
_init: function () { _init: function () {
@ -16,7 +16,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
this.storeValue = {type: BI.DynamicDateCombo.Static}; this.storeValue = {type: BI.DynamicDateCombo.Static};
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
el: this._getTabJson() el: this._getTabJson()
}, { }, {
@ -61,9 +61,9 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE); self.fireEvent(BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE);
} }
}] }]
}]] }]],
}, height: 24
height: 24 }
}] }]
}); });
this.setValue(opts.value); this.setValue(opts.value);
@ -73,11 +73,15 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
logic: {
dynamic: true
},
ref: function () { ref: function () {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment", type: "bi.linear_segment",
invisible: !o.supportDynamic,
cls: "bi-split-bottom", cls: "bi-split-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
@ -95,6 +99,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
return { return {
type: "bi.dynamic_date_card", type: "bi.dynamic_date_card",
cls: "dynamic-date-pane",
listeners: [{ listeners: [{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
@ -110,7 +115,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
return { return {
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
type: "bi.date_calendar_popup", type: "bi.date_calendar_popup",
behaviors: o.behaviors, behaviors: o.behaviors,
@ -131,9 +136,9 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
cls: "bi-split-top", cls: "bi-split-top",
ref: function () { ref: function () {
self.timeSelect = this; self.timeSelect = this;
} },
}, height: 40
height: 40 }
}] }]
}; };
} }

4
src/widget/timeinterval/dateinterval.js

@ -15,7 +15,8 @@ BI.DateInterval = BI.inherit(BI.Single, {
extraCls: "bi-date-interval", extraCls: "bi-date-interval",
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31", maxDate: "2099-12-31",
height: 24 height: 24,
supportDynamic: true,
}); });
}, },
_init: function () { _init: function () {
@ -68,6 +69,7 @@ BI.DateInterval = BI.inherit(BI.Single, {
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",
supportDynamic: o.supportDynamic,
minDate: o.minDate, minDate: o.minDate,
maxDate: o.maxDate, maxDate: o.maxDate,
behaviors: o.behaviors, behaviors: o.behaviors,

4
src/widget/timeinterval/timeinterval.js

@ -15,7 +15,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
extraCls: "bi-time-interval", extraCls: "bi-time-interval",
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31", maxDate: "2099-12-31",
height: 24 height: 24,
supportDynamic: true
}); });
}, },
_init: function () { _init: function () {
@ -68,6 +69,7 @@ BI.TimeInterval = BI.inherit(BI.Single, {
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",
supportDynamic: o.supportDynamic,
minDate: o.minDate, minDate: o.minDate,
maxDate: o.maxDate, maxDate: o.maxDate,
behaviors: o.behaviors, behaviors: o.behaviors,

4
src/widget/year/combo.year.js

@ -5,7 +5,8 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
behaviors: {}, behaviors: {},
minDate: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
maxDate: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22,
supportDynamic: true,
}, },
_init: function () { _init: function () {
@ -62,6 +63,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
stopPropagation: false, stopPropagation: false,
el: { el: {
type: "bi.dynamic_year_popup", type: "bi.dynamic_year_popup",
supportDynamic: o.supportDynamic,
ref: function () { ref: function () {
self.popup = this; self.popup = this;
}, },

14
src/widget/year/popup.year.js

@ -17,14 +17,14 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期, max: "2099-12-31", // 最大日期,
width: 180, width: 180,
height: 240 supportDynamic: true,
}, },
render: function () { render: function () {
var self = this, opts = this.options, c = this.constants; var self = this, opts = this.options, c = this.constants;
this.storeValue = {type: BI.DynamicYearCombo.Static}; this.storeValue = {type: BI.DynamicYearCombo.Static};
return { return {
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
el: this._getTabJson() el: this._getTabJson()
}, { }, {
@ -69,9 +69,9 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DynamicYearPopup.BUTTON_OK_EVENT_CHANGE); self.fireEvent(BI.DynamicYearPopup.BUTTON_OK_EVENT_CHANGE);
} }
}] }]
}]] }]],
height: 24
}, },
height: 24
}] }]
}; };
}, },
@ -92,12 +92,15 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
logic: {
dynamic: true
},
ref: function () { ref: function () {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment", type: "bi.linear_segment",
cls: "bi-split-bottom", invisible: !o.supportDynamic,
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -114,6 +117,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
case BI.DynamicYearCombo.Dynamic: case BI.DynamicYearCombo.Dynamic:
return { return {
type: "bi.dynamic_year_card", type: "bi.dynamic_year_card",
cls: "dynamic-year-pane",
min: self.options.min, min: self.options.min,
max: self.options.max, max: self.options.max,
listeners: [{ listeners: [{

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

@ -44,6 +44,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
cls: "bi-split-bottom",
min: o.min, min: o.min,
max: o.max, max: o.max,
ref: function () { ref: function () {
@ -63,34 +64,36 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
} }
}] }]
}, { }, {
type: "bi.button_group", el: {
cls: "bi-split-top", type: "bi.button_group",
behaviors: o.behaviors, behaviors: o.behaviors,
ref: function () { ref: function () {
self.month = this; self.month = this;
},
items: this._createMonths(),
layouts: [BI.LogicFactory.createLogic("table", BI.extend({
dynamic: true
}, {
columns: 2,
rows: 6,
columnSize: [1 / 2, 1 / 2],
rowSize: 25
})), {
type: "bi.center_adapt",
vgap: 1,
hgap: 2
}],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE);
}
}]
}, },
items: this._createMonths(), vgap: 5
layouts: [BI.LogicFactory.createLogic("table", BI.extend({
dynamic: true
}, {
columns: 2,
rows: 6,
columnSize: [1 / 2, 1 / 2],
rowSize: 25
})), {
type: "bi.center_adapt",
vgap: 1,
hgap: 2
}],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE);
}
}]
}] }]
}; };
}, },

4
src/widget/yearmonth/combo.yearmonth.js

@ -5,7 +5,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
behaviors: {}, behaviors: {},
minDate: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
maxDate: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22,
supportDynamic: true
}, },
_init: function () { _init: function () {
@ -66,6 +67,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
stopPropagation: false, stopPropagation: false,
el: { el: {
type: "bi.dynamic_year_month_popup", type: "bi.dynamic_year_month_popup",
supportDynamic: o.supportDynamic,
ref: function () { ref: function () {
self.popup = this; self.popup = this;
}, },

13
src/widget/yearmonth/popup.yearmonth.js

@ -17,14 +17,14 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期, max: "2099-12-31", // 最大日期,
width: 180, width: 180,
height: 240 supportDynamic: true,
}, },
render: function () { render: function () {
var self = this, opts = this.options, c = this.constants; var self = this, opts = this.options, c = this.constants;
this.storeValue = {type: BI.DynamicYearMonthCombo.Static}; this.storeValue = {type: BI.DynamicYearMonthCombo.Static};
return { return {
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
el: this._getTabJson() el: this._getTabJson()
}, { }, {
@ -69,9 +69,9 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE); self.fireEvent(BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE);
} }
}] }]
}]] }]],
height: 24
}, },
height: 24
}] }]
}; };
}, },
@ -92,12 +92,16 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
logic: {
dynamic: true
},
ref: function () { ref: function () {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment", type: "bi.linear_segment",
cls: "bi-split-bottom", cls: "bi-split-bottom",
invisible: !o.supportDynamic,
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Month"), text: BI.i18nText("BI-Basic_Year_Month"),
@ -114,6 +118,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
case BI.DynamicYearCombo.Dynamic: case BI.DynamicYearCombo.Dynamic:
return { return {
type: "bi.dynamic_year_month_card", type: "bi.dynamic_year_month_card",
cls: "dynamic-year-month-pane",
min: self.options.min, min: self.options.min,
max: self.options.max, max: self.options.max,
listeners: [{ listeners: [{

4
src/widget/yearmonthinterval/yearmonthinterval.js

@ -10,7 +10,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
props: { props: {
extraCls: "bi-year-month-interval", extraCls: "bi-year-month-interval",
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31" maxDate: "2099-12-31",
supportDynamic: true,
}, },
_init: function () { _init: function () {
@ -64,6 +65,7 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
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",
supportDynamic: o.supportDynamic,
minDate: o.minDate, minDate: o.minDate,
maxDate: o.maxDate, maxDate: o.maxDate,
behaviors: o.behaviors, behaviors: o.behaviors,

40
src/widget/yearquarter/card.static.yearquarter.js

@ -43,6 +43,7 @@ BI.StaticYearQuarterCard = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
cls: "bi-split-bottom",
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -62,25 +63,28 @@ BI.StaticYearQuarterCard = BI.inherit(BI.Widget, {
} }
}] }]
}, { }, {
type: "bi.button_group", el: {
behaviors: o.behaviors, type: "bi.button_group",
ref: function () { behaviors: o.behaviors,
self.quarter = this; ref: function () {
self.quarter = this;
},
items: this._createQuarter(),
layouts: [{
type: "bi.vertical",
vgap: 10
}],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedQuarter = this.getValue()[0];
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE);
}
}]
}, },
items: this._createQuarter(), vgap: 5
layouts: [{
type: "bi.vertical",
vgap: 10
}],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedQuarter = this.getValue()[0];
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE);
}
}]
}] }]
}; };
}, },

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

@ -5,7 +5,8 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
behaviors: {}, behaviors: {},
minDate: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
maxDate: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22,
supportDynamic: true,
}, },
_init: function () { _init: function () {
@ -61,6 +62,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
stopPropagation: false, stopPropagation: false,
el: { el: {
type: "bi.dynamic_year_quarter_popup", type: "bi.dynamic_year_quarter_popup",
supportDynamic: o.supportDynamic,
ref: function () { ref: function () {
self.popup = this; self.popup = this;
}, },

13
src/widget/yearquarter/popup.yearquarter.js

@ -10,14 +10,14 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期, max: "2099-12-31", // 最大日期,
width: 180, width: 180,
height: 240 supportDynamic: true,
}, },
render: function () { render: function () {
var self = this, opts = this.options, c = this.constants; var self = this, opts = this.options, c = this.constants;
this.storeValue = {type: BI.DynamicYearQuarterCombo.Static}; this.storeValue = {type: BI.DynamicYearQuarterCombo.Static};
return { return {
type: "bi.vtape", type: "bi.vertical",
items: [{ items: [{
el: this._getTabJson() el: this._getTabJson()
}, { }, {
@ -62,9 +62,9 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
self.fireEvent(BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE); self.fireEvent(BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE);
} }
}] }]
}]] }]],
height: 24
}, },
height: 24
}] }]
}; };
}, },
@ -85,12 +85,16 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
return { return {
type: "bi.tab", type: "bi.tab",
logic: {
dynamic: true
},
ref: function () { ref: function () {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment", type: "bi.linear_segment",
cls: "bi-split-bottom", cls: "bi-split-bottom",
invisible: !o.supportDynamic,
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Quarter"), text: BI.i18nText("BI-Basic_Year_Quarter"),
@ -107,6 +111,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
case BI.DynamicYearQuarterCombo.Dynamic: case BI.DynamicYearQuarterCombo.Dynamic:
return { return {
type: "bi.dynamic_year_quarter_card", type: "bi.dynamic_year_quarter_card",
cls: "dynamic-year-quarter-pane",
min: self.options.min, min: self.options.min,
max: self.options.max, max: self.options.max,
listeners: [{ listeners: [{

Loading…
Cancel
Save