Skip to content

Commit

Permalink
Update: Add showInput option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Sep 24, 2024
1 parent 89a449a commit 9eef10a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Example:
showMaxLabel: true
minLabel: null
maxLabel: null
showInput: true
min: 1
max: 6
step: 1
Expand Down
24 changes: 14 additions & 10 deletions Resources/Private/RangeEditor/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Editor(props) {
const styleWidth = Math.max(numLength(options.min), numLength(options.max)) + additionalStepLength + "ch";
const unit = options.unit ? i18nRegistry.translate(options.unit) : "";

const { valueLabels, valueLabelsFile } = options;
const { valueLabels, valueLabelsFile, showInput } = options;
let showMiddle = between(value, options.min, options.max);
if (!options.showMinLabel) {
showMiddle = showMiddle || value === options.min;
Expand Down Expand Up @@ -124,15 +124,19 @@ function Editor(props) {
{currentLabel && showMiddle && <span className={style.valueLabel}>{currentLabel}</span>}
{!currentLabel && showMiddle && (
<span>
<input
title={i18nRegistry.translate("Neos.Neos.Ui:Main:rangeEditorCurrentValue")}
type="text"
onKeyPress={onKeyPress}
onChange={handleChange}
value={valueAsString}
style={{ width: styleWidth }}
disabled={options.disabled}
/>
{showInput ? (
<input
title={i18nRegistry.translate("Neos.Neos.Ui:Main:rangeEditorCurrentValue")}
type="text"
onKeyPress={onKeyPress}
onChange={handleChange}
value={valueAsString}
style={{ width: styleWidth }}
disabled={options.disabled}
/>
) : (
valueAsString
)}
{unit}
</span>
)}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/Plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9eef10a

Please sign in to comment.