|
|
@ -23,19 +23,17 @@ import { Single, Editor } from "@/base"; |
|
|
|
import { AccurateCalculationModel } from "./model.accuratecalculation"; |
|
|
|
import { AccurateCalculationModel } from "./model.accuratecalculation"; |
|
|
|
import { SignTextEditor, SliderIconButton } from "../singleslider"; |
|
|
|
import { SignTextEditor, SliderIconButton } from "../singleslider"; |
|
|
|
|
|
|
|
|
|
|
|
@shortcut() |
|
|
|
const CONSTANTS = { |
|
|
|
export class IntervalSlider extends Single { |
|
|
|
|
|
|
|
static xtype = "bi.interval_slider"; |
|
|
|
|
|
|
|
_constant = { |
|
|
|
|
|
|
|
EDITOR_WIDTH: 58, |
|
|
|
EDITOR_WIDTH: 58, |
|
|
|
EDITOR_R_GAP: 60, |
|
|
|
|
|
|
|
EDITOR_HEIGHT: 20, |
|
|
|
EDITOR_HEIGHT: 20, |
|
|
|
SLIDER_WIDTH_HALF: 15, |
|
|
|
|
|
|
|
LABEL_HEIGHT: 30, |
|
|
|
LABEL_HEIGHT: 30, |
|
|
|
SLIDER_WIDTH: 30, |
|
|
|
|
|
|
|
SLIDER_HEIGHT: 30, |
|
|
|
SLIDER_HEIGHT: 30, |
|
|
|
TRACK_HEIGHT: 24, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@shortcut() |
|
|
|
|
|
|
|
export class IntervalSlider extends Single { |
|
|
|
|
|
|
|
static xtype = "bi.interval_slider"; |
|
|
|
|
|
|
|
|
|
|
|
props = { |
|
|
|
props = { |
|
|
|
baseCls: "bi-interval-slider bi-slider-track", |
|
|
|
baseCls: "bi-interval-slider bi-slider-track", |
|
|
|
digit: false, |
|
|
|
digit: false, |
|
|
@ -45,6 +43,8 @@ export class IntervalSlider extends Single { |
|
|
|
value: { min: "", max: "" }, |
|
|
|
value: { min: "", max: "" }, |
|
|
|
lAlign: "center", |
|
|
|
lAlign: "center", |
|
|
|
rAlign: "center", |
|
|
|
rAlign: "center", |
|
|
|
|
|
|
|
labelHeight: CONSTANTS.LABEL_HEIGHT, |
|
|
|
|
|
|
|
sliderHeight: CONSTANTS.SLIDER_HEIGHT, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
@ -60,7 +60,6 @@ export class IntervalSlider extends Single { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const c = this._constant; |
|
|
|
|
|
|
|
const o = this.options; |
|
|
|
const o = this.options; |
|
|
|
this.enable = false; |
|
|
|
this.enable = false; |
|
|
|
this.valueOne = ""; |
|
|
|
this.valueOne = ""; |
|
|
@ -86,8 +85,8 @@ export class IntervalSlider extends Single { |
|
|
|
text: unit, |
|
|
|
text: unit, |
|
|
|
allowBlank: false, |
|
|
|
allowBlank: false, |
|
|
|
textAlign: lAlign, |
|
|
|
textAlign: lAlign, |
|
|
|
width: BI.isNull(editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), |
|
|
|
width: BI.isNull(editorWidth) ? BI.toPix(CONSTANTS.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), |
|
|
|
height: toPix(c.EDITOR_HEIGHT, 2), |
|
|
|
height: toPix(CONSTANTS.EDITOR_HEIGHT, 2), |
|
|
|
validationChecker: v => this._checkValidation(v), |
|
|
|
validationChecker: v => this._checkValidation(v), |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.labelOne.element.hover( |
|
|
|
this.labelOne.element.hover( |
|
|
@ -116,8 +115,8 @@ export class IntervalSlider extends Single { |
|
|
|
text: unit, |
|
|
|
text: unit, |
|
|
|
allowBlank: false, |
|
|
|
allowBlank: false, |
|
|
|
textAlign: rAlign, |
|
|
|
textAlign: rAlign, |
|
|
|
width: BI.isNull(editorWidth) ? BI.toPix(c.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), |
|
|
|
width: BI.isNull(editorWidth) ? BI.toPix(CONSTANTS.EDITOR_WIDTH, 2) : BI.toPix(editorWidth, 2), |
|
|
|
height: toPix(c.EDITOR_HEIGHT, 2), |
|
|
|
height: toPix(CONSTANTS.EDITOR_HEIGHT, 2), |
|
|
|
validationChecker: v => this._checkValidation(v), |
|
|
|
validationChecker: v => this._checkValidation(v), |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.labelTwo.element.hover( |
|
|
|
this.labelTwo.element.hover( |
|
|
@ -152,7 +151,7 @@ export class IntervalSlider extends Single { |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: VerticalFillLayout.xtype, |
|
|
|
type: VerticalFillLayout.xtype, |
|
|
|
rowSize: [o.labelHeight || c.LABEL_HEIGHT, o.sliderHeight || c.SLIDER_HEIGHT], |
|
|
|
rowSize: [o.labelHeight, o.sliderHeight], |
|
|
|
items: [ |
|
|
|
items: [ |
|
|
|
this._createLabelWrapper(), |
|
|
|
this._createLabelWrapper(), |
|
|
|
{ |
|
|
|
{ |
|
|
@ -253,7 +252,6 @@ export class IntervalSlider extends Single { |
|
|
|
|
|
|
|
|
|
|
|
_createLabelWrapper() { |
|
|
|
_createLabelWrapper() { |
|
|
|
const o = this.options; |
|
|
|
const o = this.options; |
|
|
|
const c = this._constant; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
el: { |
|
|
|
el: { |
|
|
@ -275,7 +273,7 @@ export class IntervalSlider extends Single { |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
height: o.labelHeight || c.LABEL_HEIGHT, |
|
|
|
height: o.labelHeight, |
|
|
|
}, |
|
|
|
}, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
@ -372,24 +370,6 @@ export class IntervalSlider extends Single { |
|
|
|
return valid; |
|
|
|
return valid; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_checkOverlap() { |
|
|
|
|
|
|
|
const labelOneLeft = this.labelOne.element[0].offsetLeft; |
|
|
|
|
|
|
|
const labelTwoLeft = this.labelTwo.element[0].offsetLeft; |
|
|
|
|
|
|
|
if (labelOneLeft <= labelTwoLeft) { |
|
|
|
|
|
|
|
if (labelTwoLeft - labelOneLeft < 90) { |
|
|
|
|
|
|
|
this.labelTwo.element.css({ top: 40 }); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.labelTwo.element.css({ top: 0 }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (labelOneLeft - labelTwoLeft < 90) { |
|
|
|
|
|
|
|
this.labelTwo.element.css({ top: 40 }); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.labelTwo.element.css({ top: 0 }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_checkLabelPosition(oldValueOne, oldValueTwo, valueOne, valueTwo, isLeft) { |
|
|
|
_checkLabelPosition(oldValueOne, oldValueTwo, valueOne, valueTwo, isLeft) { |
|
|
|
oldValueOne = parseFloat(oldValueOne); |
|
|
|
oldValueOne = parseFloat(oldValueOne); |
|
|
|
oldValueTwo = parseFloat(oldValueTwo); |
|
|
|
oldValueTwo = parseFloat(oldValueTwo); |
|
|
|