|
|
|
@ -67,21 +67,21 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
const value = this.switcher.getValue()[0]; |
|
|
|
|
this.dateTab.setSelect(value); |
|
|
|
|
switch (value) { |
|
|
|
|
case DynamicDatePane.Static: |
|
|
|
|
date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); |
|
|
|
|
this.ymd.setValue({ |
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
month: date.getMonth() + 1, |
|
|
|
|
day: date.getDate(), |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case DynamicDatePane.Dynamic: |
|
|
|
|
this.dynamicPane.setValue({ |
|
|
|
|
year: 0, |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
case DynamicDatePane.Static: |
|
|
|
|
date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); |
|
|
|
|
this.ymd.setValue({ |
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
month: date.getMonth() + 1, |
|
|
|
|
day: date.getDate(), |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case DynamicDatePane.Dynamic: |
|
|
|
|
this.dynamicPane.setValue({ |
|
|
|
|
year: 0, |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
}, |
|
|
|
@ -101,92 +101,92 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
showIndex: DynamicDatePane.Static, |
|
|
|
|
cardCreator: v => { |
|
|
|
|
switch (v) { |
|
|
|
|
case DynamicDatePane.Static: |
|
|
|
|
return { |
|
|
|
|
type: StaticDatePaneCard.xtype, |
|
|
|
|
min: o.minDate, |
|
|
|
|
max: o.maxDate, |
|
|
|
|
behaviors: o.behaviors, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: () => { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
case DynamicDatePane.Static: |
|
|
|
|
return { |
|
|
|
|
type: StaticDatePaneCard.xtype, |
|
|
|
|
min: o.minDate, |
|
|
|
|
max: o.maxDate, |
|
|
|
|
behaviors: o.behaviors, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: () => { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", |
|
|
|
|
action: () => { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.ymd = _ref; |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", |
|
|
|
|
action: () => { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
|
|
|
|
}; |
|
|
|
|
case DynamicDatePane.Dynamic: |
|
|
|
|
default: |
|
|
|
|
return { |
|
|
|
|
type: VTapeLayout.xtype, |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
type: DynamicDateCard.xtype, |
|
|
|
|
min: o.minDate, |
|
|
|
|
max: o.maxDate, |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.dynamicPane = _ref; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.ymd = _ref; |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
case DynamicDatePane.Dynamic: |
|
|
|
|
default: |
|
|
|
|
return { |
|
|
|
|
type: VTapeLayout.xtype, |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
type: DynamicDateCard.xtype, |
|
|
|
|
min: o.minDate, |
|
|
|
|
max: o.maxDate, |
|
|
|
|
ref: _ref => { |
|
|
|
|
this.dynamicPane = _ref; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
el: { |
|
|
|
|
type: CenterLayout.xtype, |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
type: TextButton.xtype, |
|
|
|
|
cls: "bi-high-light bi-border-top", |
|
|
|
|
shadow: true, |
|
|
|
|
text: i18nText("BI-Basic_Clear"), |
|
|
|
|
textHeight: 23, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: TextButton.EVENT_CHANGE, |
|
|
|
|
action: () => { |
|
|
|
|
this.setValue(); |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: TextButton.xtype, |
|
|
|
|
cls: "bi-border-left bi-high-light bi-border-top", |
|
|
|
|
textHeight: 23, |
|
|
|
|
shadow: true, |
|
|
|
|
text: i18nText("BI-Basic_OK"), |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: TextButton.EVENT_CHANGE, |
|
|
|
|
action: () => { |
|
|
|
|
const type = this.dateTab.getSelect(); |
|
|
|
|
if (type === DynamicDateCombo.Dynamic) { |
|
|
|
|
this.dynamicPane.checkValidation(true) && |
|
|
|
|
{ |
|
|
|
|
el: { |
|
|
|
|
type: CenterLayout.xtype, |
|
|
|
|
items: [ |
|
|
|
|
{ |
|
|
|
|
type: TextButton.xtype, |
|
|
|
|
cls: "bi-high-light bi-border-top", |
|
|
|
|
shadow: true, |
|
|
|
|
text: i18nText("BI-Basic_Clear"), |
|
|
|
|
textHeight: 23, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: TextButton.EVENT_CHANGE, |
|
|
|
|
action: () => { |
|
|
|
|
this.setValue(); |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: TextButton.xtype, |
|
|
|
|
cls: "bi-border-left bi-high-light bi-border-top", |
|
|
|
|
textHeight: 23, |
|
|
|
|
shadow: true, |
|
|
|
|
text: i18nText("BI-Basic_OK"), |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: TextButton.EVENT_CHANGE, |
|
|
|
|
action: () => { |
|
|
|
|
const type = this.dateTab.getSelect(); |
|
|
|
|
if (type === DynamicDateCombo.Dynamic) { |
|
|
|
|
this.dynamicPane.checkValidation(true) && |
|
|
|
|
this.fireEvent( |
|
|
|
|
DynamicDatePopup.EVENT_CHANGE |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
height: 24, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
} else { |
|
|
|
|
this.fireEvent(DynamicDatePane.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
height: 24, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
@ -204,11 +204,11 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
|
|
|
|
|
_checkValue(v) { |
|
|
|
|
switch (v.type) { |
|
|
|
|
case DynamicDateCombo.Dynamic: |
|
|
|
|
return isNotEmptyObject(v.value); |
|
|
|
|
case DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
return true; |
|
|
|
|
case DynamicDateCombo.Dynamic: |
|
|
|
|
return isNotEmptyObject(v.value); |
|
|
|
|
case DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -233,21 +233,21 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
this.switcher.setValue(type); |
|
|
|
|
this.dateTab.setSelect(type); |
|
|
|
|
switch (type) { |
|
|
|
|
case DynamicDateCombo.Dynamic: |
|
|
|
|
this.dynamicPane.setValue(value); |
|
|
|
|
break; |
|
|
|
|
case DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (this._checkValueValid(value)) { |
|
|
|
|
const date = getDate(); |
|
|
|
|
this.ymd.setValue({ |
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
month: date.getMonth() + 1, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.ymd.setValue(value); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case DynamicDateCombo.Dynamic: |
|
|
|
|
this.dynamicPane.setValue(value); |
|
|
|
|
break; |
|
|
|
|
case DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (this._checkValueValid(value)) { |
|
|
|
|
const date = getDate(); |
|
|
|
|
this.ymd.setValue({ |
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
month: date.getMonth() + 1, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.ymd.setValue(value); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|