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