()
| 976 | } |
| 977 | |
| 978 | render() { |
| 979 | const { disabled, el, hasLabel, rangeId, pin, pressedKnob, labelPlacement, label, dualKnobs, min, max } = this; |
| 980 | |
| 981 | const inItem = hostContext('ion-item', el); |
| 982 | |
| 983 | /** |
| 984 | * If there is no start content then the knob at |
| 985 | * the min value will be cut off by the item margin. |
| 986 | */ |
| 987 | const hasStartContent = |
| 988 | (hasLabel && (labelPlacement === 'start' || labelPlacement === 'fixed')) || this.hasStartSlotContent; |
| 989 | |
| 990 | const needsStartAdjustment = inItem && !hasStartContent; |
| 991 | |
| 992 | /** |
| 993 | * If there is no end content then the knob at |
| 994 | * the max value will be cut off by the item margin. |
| 995 | */ |
| 996 | const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent; |
| 997 | |
| 998 | const needsEndAdjustment = inItem && !hasEndContent; |
| 999 | |
| 1000 | const mode = getIonMode(this); |
| 1001 | |
| 1002 | /** |
| 1003 | * Determine the name and position of the pressed knob to apply |
| 1004 | * Host classes for styling. |
| 1005 | */ |
| 1006 | const pressedKnobName = dualKnobs ? pressedKnob?.toLowerCase() : undefined; |
| 1007 | const pressedKnobPosition = |
| 1008 | dualKnobs && pressedKnob ? getKnobPosition(pressedKnob, this.ratioA, this.ratioB, dualKnobs) : undefined; |
| 1009 | |
| 1010 | /** |
| 1011 | * Determine if any knob is at the min or max value to |
| 1012 | * apply Host classes for styling. |
| 1013 | */ |
| 1014 | const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min; |
| 1015 | const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max; |
| 1016 | |
| 1017 | renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled); |
| 1018 | |
| 1019 | return ( |
| 1020 | <Host |
| 1021 | onFocusin={this.onFocus} |
| 1022 | onFocusout={this.onBlur} |
| 1023 | id={rangeId} |
| 1024 | class={createColorClasses(this.color, { |
| 1025 | [mode]: true, |
| 1026 | 'in-item': inItem, |
| 1027 | 'range-disabled': disabled, |
| 1028 | 'range-dual-knobs': dualKnobs, |
| 1029 | 'range-pressed': pressedKnob !== undefined, |
| 1030 | [`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined, |
| 1031 | [`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined, |
| 1032 | 'range-has-pin': pin, |
| 1033 | [`range-label-placement-${labelPlacement}`]: true, |
| 1034 | 'range-item-start-adjustment': needsStartAdjustment, |
| 1035 | 'range-item-end-adjustment': needsEndAdjustment, |
nothing calls this directly
no test coverage detected