|
|
@ -28,22 +28,32 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
popupWidth: 270, |
|
|
|
popupWidth: 270, |
|
|
|
comboAdjustHeight: 1, |
|
|
|
comboAdjustHeight: 1, |
|
|
|
border: 1, |
|
|
|
border: 1, |
|
|
|
iconWidth: 24, |
|
|
|
iconWidth: 24 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
props = { |
|
|
|
props = () => { |
|
|
|
baseCls: "bi-dynamic-date--time-combo", |
|
|
|
const date = getDate(); |
|
|
|
height: 24, |
|
|
|
return { |
|
|
|
minDate: "1900-01-01", |
|
|
|
baseCls: "bi-dynamic-date--time-combo", |
|
|
|
maxDate: "2099-12-31", |
|
|
|
height: 24, |
|
|
|
format: "", |
|
|
|
minDate: "1900-01-01", |
|
|
|
allowEdit: true, |
|
|
|
maxDate: "2099-12-31", |
|
|
|
supportDynamic: true, |
|
|
|
format: "", |
|
|
|
attributes: { |
|
|
|
allowEdit: true, |
|
|
|
tabIndex: -1, |
|
|
|
supportDynamic: true, |
|
|
|
}, |
|
|
|
attributes: { |
|
|
|
isNeedAdjustHeight: false, |
|
|
|
tabIndex: -1 |
|
|
|
isNeedAdjustWidth: false, |
|
|
|
}, |
|
|
|
|
|
|
|
isNeedAdjustHeight: false, |
|
|
|
|
|
|
|
isNeedAdjustWidth: false, |
|
|
|
|
|
|
|
value: { |
|
|
|
|
|
|
|
type: DynamicDateTimeCombo.Static, |
|
|
|
|
|
|
|
value: { |
|
|
|
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
|
|
|
month: date.getMonth() + 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
|
|
|
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
|
|
@ -95,8 +105,8 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
height: toPix(opts.height, border), |
|
|
|
height: toPix(opts.height, border), |
|
|
|
ref: _ref => { |
|
|
|
ref: _ref => { |
|
|
|
this.changeIcon = _ref; |
|
|
|
this.changeIcon = _ref; |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: DynamicDateTimeTrigger.xtype, |
|
|
|
type: DynamicDateTimeTrigger.xtype, |
|
|
@ -120,7 +130,7 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.combo.hideView(); |
|
|
|
this.combo.hideView(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_KEY_DOWN, ...args); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_KEY_DOWN, ...args); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_STOP, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_STOP, |
|
|
@ -128,13 +138,13 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
if (!this.combo.isViewVisible()) { |
|
|
|
if (!this.combo.isViewVisible()) { |
|
|
|
this.combo.showView(); |
|
|
|
this.combo.showView(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_TRIGGER_CLICK, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_TRIGGER_CLICK, |
|
|
|
action: () => { |
|
|
|
action: () => { |
|
|
|
this.combo.toggle(); |
|
|
|
this.combo.toggle(); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_FOCUS, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_FOCUS, |
|
|
@ -144,13 +154,13 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.combo.showView(); |
|
|
|
this.combo.showView(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_FOCUS); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_FOCUS); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_BLUR, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_BLUR, |
|
|
|
action: () => { |
|
|
|
action: () => { |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BLUR); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BLUR); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_ERROR, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_ERROR, |
|
|
@ -159,12 +169,12 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
type: DynamicDateTimeCombo.Static, |
|
|
|
type: DynamicDateTimeCombo.Static, |
|
|
|
value: { |
|
|
|
value: { |
|
|
|
year: date.getFullYear(), |
|
|
|
year: date.getFullYear(), |
|
|
|
month: date.getMonth() + 1, |
|
|
|
month: date.getMonth() + 1 |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.combo.element.addClass("error"); |
|
|
|
this.combo.element.addClass("error"); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_ERROR); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_ERROR); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_VALID, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_VALID, |
|
|
@ -172,13 +182,13 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.storeValue = this.trigger.getValue(); |
|
|
|
this.storeValue = this.trigger.getValue(); |
|
|
|
this.combo.element.removeClass("error"); |
|
|
|
this.combo.element.removeClass("error"); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_VALID); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_VALID); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_CHANGE, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_CHANGE, |
|
|
|
action: () => { |
|
|
|
action: () => { |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CHANGE); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CHANGE); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_CONFIRM, |
|
|
|
eventName: DynamicDateTimeTrigger.EVENT_CONFIRM, |
|
|
@ -197,11 +207,11 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
} |
|
|
|
} |
|
|
|
this._checkDynamicValue(this.storeValue); |
|
|
|
this._checkDynamicValue(this.storeValue); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
adjustLength: this.constants.comboAdjustHeight, |
|
|
|
adjustLength: this.constants.comboAdjustHeight, |
|
|
|
popup: { |
|
|
|
popup: { |
|
|
@ -222,7 +232,7 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.setValue(); |
|
|
|
this.setValue(); |
|
|
|
this.combo.hideView(); |
|
|
|
this.combo.hideView(); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE, |
|
|
|
eventName: DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE, |
|
|
@ -236,12 +246,12 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
day: date.getDate(), |
|
|
|
day: date.getDate(), |
|
|
|
hour: 0, |
|
|
|
hour: 0, |
|
|
|
minute: 0, |
|
|
|
minute: 0, |
|
|
|
second: 0, |
|
|
|
second: 0 |
|
|
|
}, |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.combo.hideView(); |
|
|
|
this.combo.hideView(); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE, |
|
|
|
eventName: DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE, |
|
|
@ -252,7 +262,7 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
} |
|
|
|
} |
|
|
|
this.combo.hideView(); |
|
|
|
this.combo.hideView(); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimePopup.EVENT_CHANGE, |
|
|
|
eventName: DynamicDateTimePopup.EVENT_CHANGE, |
|
|
@ -260,16 +270,16 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.setValue(this.popup.getValue()); |
|
|
|
this.setValue(this.popup.getValue()); |
|
|
|
this.combo.hideView(); |
|
|
|
this.combo.hideView(); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
eventName: DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
|
|
|
eventName: DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
|
|
|
action: () => { |
|
|
|
action: () => { |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
listeners: [ |
|
|
|
listeners: [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -279,9 +289,9 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
this.popup.setMaxDate(opts.maxDate); |
|
|
|
this.popup.setMaxDate(opts.maxDate); |
|
|
|
this.popup.setValue(this.storeValue); |
|
|
|
this.popup.setValue(this.storeValue); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
// // DEC-4250 和复选下拉一样,点击不收起
|
|
|
|
// // DEC-4250 和复选下拉一样,点击不收起
|
|
|
|
// hideChecker: function (e) {
|
|
|
|
// hideChecker: function (e) {
|
|
|
|
// return self.triggerBtn.element.find(e.target).length === 0;
|
|
|
|
// return self.triggerBtn.element.find(e.target).length === 0;
|
|
|
@ -290,9 +300,9 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
right: 0, |
|
|
|
right: 0, |
|
|
|
bottom: 0, |
|
|
|
bottom: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
] |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -306,16 +316,16 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
type = v.type; |
|
|
|
type = v.type; |
|
|
|
} |
|
|
|
} |
|
|
|
switch (type) { |
|
|
|
switch (type) { |
|
|
|
case DynamicDateTimeCombo.Dynamic: |
|
|
|
case DynamicDateTimeCombo.Dynamic: |
|
|
|
this.changeIcon.setVisible(true); |
|
|
|
this.changeIcon.setVisible(true); |
|
|
|
// this.comboWrapper.attr("items")[0].width = o.height - (this.options.simple ? 1 : 2);
|
|
|
|
// this.comboWrapper.attr("items")[0].width = o.height - (this.options.simple ? 1 : 2);
|
|
|
|
// this.comboWrapper.resize();
|
|
|
|
// this.comboWrapper.resize();
|
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
// this.comboWrapper.attr("items")[0].width = 0;
|
|
|
|
// this.comboWrapper.attr("items")[0].width = 0;
|
|
|
|
// this.comboWrapper.resize();
|
|
|
|
// this.comboWrapper.resize();
|
|
|
|
this.changeIcon.setVisible(false); |
|
|
|
this.changeIcon.setVisible(false); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -323,12 +333,12 @@ export class DynamicDateTimeCombo extends Single { |
|
|
|
const o = this.options; |
|
|
|
const o = this.options; |
|
|
|
const value = v.value || {}; |
|
|
|
const value = v.value || {}; |
|
|
|
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: |
|
|
|
return !checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0]; |
|
|
|
return !checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0]; |
|
|
|
default: |
|
|
|
default: |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|