Browse Source

BI-133648 fix:日期过滤控件加预览模式

research/test
chenzeyu 11 months ago
parent
commit
b4fc3d7098
  1. 25
      packages/fineui/src/widget/datepane/datepane.js
  2. 2
      packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js
  3. 18
      packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js
  4. 2
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js
  5. 19
      packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js
  6. 2
      packages/fineui/src/widget/timeinterval/dateinterval.js
  7. 2
      packages/fineui/src/widget/timeinterval/timeinterval.js
  8. 2
      packages/fineui/src/widget/year/combo.year.js
  9. 10
      packages/fineui/src/widget/year/popup.year.js
  10. 2
      packages/fineui/src/widget/yearmonth/combo.yearmonth.js
  11. 16
      packages/fineui/src/widget/yearmonth/popup.yearmonth.js
  12. 2
      packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js
  13. 2
      packages/fineui/src/widget/yearquarter/combo.yearquarter.js
  14. 27
      packages/fineui/src/widget/yearquarter/popup.yearquarter.js

25
packages/fineui/src/widget/datepane/datepane.js

@ -30,6 +30,7 @@ export class DynamicDatePane extends Widget {
minDate: "1900-01-01",
maxDate: "2099-12-31",
supportDynamic: true,
isShow: false, // 是否是预览状态
};
render() {
@ -195,7 +196,7 @@ export class DynamicDatePane extends Widget {
}
created() {
this.setValue(this.options.value);
this.setValue(this.options.value, true);
}
_checkValueValid(value) {
@ -226,15 +227,29 @@ export class DynamicDatePane extends Widget {
}
}
setValue(v) {
setValue(v, isCreated = false) {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
this.switcher.setValue(type);
this.dateTab.setSelect(type);
const { isShow } = this.options;
let date;
// 如果是初始化且是预览状态 直接打开静态页面
this.switcher.setValue(isShow && isCreated ? DynamicDateCombo.Static : type);
this.dateTab.setSelect(isShow && isCreated ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
if (isShow && isCreated) {
date = DynamicDateHelper.getCalculation(value);
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
});
} else {
this.dynamicPane.setValue(value);
}
break;
case DynamicDateCombo.Static:
default:

2
packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js

@ -53,6 +53,7 @@ export class DynamicDateCombo extends Single {
},
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
isShow: false, // 是否是预览状态
};
_init() {
@ -200,6 +201,7 @@ export class DynamicDateCombo extends Single {
popup: {
el: {
type: DynamicDatePopup.xtype,
isShow: opts.isShow,
width: opts.isNeedAdjustWidth ? opts.width : undefined,
supportDynamic: opts.supportDynamic,
behaviors: opts.behaviors,

18
packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js

@ -34,6 +34,7 @@ export class DynamicDatePopup extends Widget {
baseCls: "bi-dynamic-date-popup",
width: 272,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
static EVENT_CHANGE = "EVENT_CHANGE";
@ -282,10 +283,23 @@ export class DynamicDatePopup extends Widget {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
this.dateTab.setSelect(type);
const { isShow } = this.options;
let date;
// 如果是预览状态 直接打开静态页面
this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
if (isShow) {
date = DynamicDateHelper.getCalculation(value);
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
});
} else {
this.dynamicPane.setValue(value);
}
this._setInnerValue();
break;
case DynamicDateCombo.Static:

2
packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -44,6 +44,7 @@ export class DynamicDateTimeCombo extends Single {
},
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
isShow: false, // 是否是预览状态
};
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
@ -207,6 +208,7 @@ export class DynamicDateTimeCombo extends Single {
popup: {
el: {
type: DynamicDateTimePopup.xtype,
isShow: opts.isShow,
timeSelectTypes: opts.timeSelectTypes,
width: opts.isNeedAdjustWidth ? opts.width : undefined,
supportDynamic: opts.supportDynamic,

19
packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -36,6 +36,7 @@ export class DynamicDateTimePopup extends Widget {
baseCls: "bi-dynamic-date-time-popup",
width: 272,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
static EVENT_CHANGE = "EVENT_CHANGE";
@ -292,10 +293,24 @@ export class DynamicDateTimePopup extends Widget {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
this.dateTab.setSelect(type);
const { isShow } = this.options;
let date;
// 如果是预览状态 直接打开静态页面
this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
if (isShow) {
date = DynamicDateHelper.getCalculation(value);
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
});
this.timeSelect.setValue();
} else {
this.dynamicPane.setValue(value);
}
this._setInnerValue();
break;
case DynamicDateCombo.Static:

2
packages/fineui/src/widget/timeinterval/dateinterval.js

@ -23,6 +23,7 @@ export class DateInterval extends Single {
lgap: 15,
offset: 0,
timeErrorCls: "time-error",
isShow: false, // 是否是预览状态
};
static EVENT_VALID = "EVENT_VALID";
@ -78,6 +79,7 @@ export class DateInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicDateCombo.xtype,
isShow: o.isShow,
supportDynamic: o.supportDynamic,
minDate: o.minDate,
maxDate: o.maxDate,

2
packages/fineui/src/widget/timeinterval/timeinterval.js

@ -23,6 +23,7 @@ export class TimeInterval extends Single {
lgap: 15,
offset: 0,
timeErrorCls: "time-error",
isShow: false, // 是否是预览状态
};
static EVENT_VALID = "EVENT_VALID";
@ -76,6 +77,7 @@ export class TimeInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicDateTimeCombo.xtype,
isShow: o.isShow,
timeSelectTypes: o.timeSelectTypes,
simple: o.simple,
supportDynamic: o.supportDynamic,

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

@ -27,6 +27,7 @@ export class DynamicYearCombo extends Widget {
maxDate: "2099-12-31", // 最大日期
height: 24,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
_init() {
@ -95,6 +96,7 @@ export class DynamicYearCombo extends Widget {
el: {
type: DynamicYearPopup.xtype,
supportDynamic: o.supportDynamic,
isShow: o.isShow,
ref: _ref => {
this.popup = _ref;
},

10
packages/fineui/src/widget/year/popup.year.js

@ -30,6 +30,7 @@ export class DynamicYearPopup extends Widget {
max: "2099-12-31",
width: 180,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
constants = {
tabHeight: 40,
@ -266,10 +267,15 @@ export class DynamicYearPopup extends Widget {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
this.dateTab.setSelect(type);
const { isShow } = this.options;
// 如果是预览状态 直接打开静态页面
this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
isShow
? this.year.setValue({ year: DynamicDateHelper.getCalculation(value).getFullYear() })
: this.dynamicPane.setValue(value);
this._setInnerValue();
break;
case DynamicDateCombo.Static:

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

@ -38,6 +38,7 @@ export class DynamicYearMonthCombo extends Single {
supportDynamic: true,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
isShow: false, // 是否是预览状态
};
_init() {
@ -106,6 +107,7 @@ export class DynamicYearMonthCombo extends Single {
type: DynamicYearMonthPopup.xtype,
width: o.isNeedAdjustWidth ? o.width : undefined,
supportDynamic: o.supportDynamic,
isShow: o.isShow,
ref: _ref => {
this.popup = _ref;
},

16
packages/fineui/src/widget/yearmonth/popup.yearmonth.js

@ -31,6 +31,7 @@ export class DynamicYearMonthPopup extends Widget {
max: "2099-12-31",
width: 180,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE";
@ -262,11 +263,22 @@ export class DynamicYearMonthPopup extends Widget {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
const { isShow } = this.options;
let date;
this.dateTab.setSelect(type);
// 如果是预览状态 直接打开静态页面
this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
if (isShow) {
date = DynamicDateHelper.getCalculation(value);
this.year.setValue({
year: date.getFullYear(),
month: date.getMonth() + 1,
});
} else {
this.dynamicPane.setValue(value);
}
this._setInnerValue();
break;
case DynamicDateCombo.Static:

2
packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js

@ -34,6 +34,7 @@ export class YearMonthInterval extends Single {
supportDynamic: true,
height: 24,
simple: false,
isShow: false, // 是否是预览状态
};
render() {
@ -71,6 +72,7 @@ export class YearMonthInterval extends Single {
const o = this.options;
const combo = createWidget({
type: DynamicYearMonthCombo.xtype,
isShow: o.isShow,
simple: o.simple,
supportDynamic: o.supportDynamic,
height: o.height,

2
packages/fineui/src/widget/yearquarter/combo.yearquarter.js

@ -33,6 +33,7 @@ export class DynamicYearQuarterCombo extends Widget {
supportDynamic: true,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
isShow: false, // 是否是预览状态
};
static EVENT_CONFIRM = "EVENT_CONFIRM";
@ -109,6 +110,7 @@ export class DynamicYearQuarterCombo extends Widget {
type: DynamicYearQuarterPopup.xtype,
width: o.isNeedAdjustWidth ? o.width : undefined,
supportDynamic: o.supportDynamic,
isShow: o.isShow,
ref: _ref => {
this.popup = _ref;
},

27
packages/fineui/src/widget/yearquarter/popup.yearquarter.js

@ -32,6 +32,7 @@ export class DynamicYearQuarterPopup extends Widget {
max: "2099-12-31",
width: 180,
supportDynamic: true,
isShow: false, // 是否是预览状态
};
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE";
@ -41,7 +42,7 @@ export class DynamicYearQuarterPopup extends Widget {
render() {
this.storeValue = { type: DynamicYearQuarterCombo.Static };
return {
type: VerticalLayout.xtype,
items: [
@ -157,7 +158,7 @@ export class DynamicYearQuarterPopup extends Widget {
_checkTodayValid() {
const o = this.options;
const today = getDate();
return !!checkDateVoid(
today.getFullYear(),
today.getMonth() + 1,
@ -169,7 +170,7 @@ export class DynamicYearQuarterPopup extends Widget {
_getTabJson() {
const o = this.options;
return {
type: Tab.xtype,
logic: {
@ -263,8 +264,8 @@ export class DynamicYearQuarterPopup extends Widget {
default:
if (
this.storeValue &&
this.storeValue.type ===
DynamicYearQuarterCombo.Dynamic
this.storeValue.type ===
DynamicYearQuarterCombo.Dynamic
) {
this.dynamicPane.setValue(
this.storeValue.value
@ -304,10 +305,22 @@ export class DynamicYearQuarterPopup extends Widget {
v = v || {};
const type = v.type || DynamicDateCombo.Static;
const value = v.value || v;
this.dateTab.setSelect(type);
const { isShow } = this.options;
let date;
// 如果是预览状态 直接打开静态页面
this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type);
switch (type) {
case DynamicDateCombo.Dynamic:
this.dynamicPane.setValue(value);
if (isShow) {
date = DynamicDateHelper.getCalculation(value);
this.year.setValue({
year: date.getFullYear(),
quarter: getQuarter(date),
});
} else {
this.dynamicPane.setValue(value);
}
this._setInnerValue();
break;
case DynamicDateCombo.Static:

Loading…
Cancel
Save