How to use the keycode-js.KEY_DELETE function in keycode-js

To help you get started, we’ve selected a few keycode-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cerner / terra-framework / packages / terra-time-input / src / TimeInput.jsx View on Github external
const previousStateValue = stateValue;

    if (event.keyCode === KeyCode.KEY_UP) {
      stateValue = TimeUtil.incrementMinute(stateValue);
    }

    if (event.keyCode === KeyCode.KEY_DOWN) {
      stateValue = TimeUtil.decrementMinute(stateValue);
    }

    if (previousStateValue !== stateValue) {
      this.handleValueChange(event, TimeUtil.inputType.MINUTE, stateValue, this.state.meridiem);
    }

    if (event.keyCode === KeyCode.KEY_LEFT
      || event.keyCode === KeyCode.KEY_DELETE
      || event.keyCode === KeyCode.KEY_BACK_SPACE) {
      this.focusHour(event);
    }

    if (event.keyCode === KeyCode.KEY_RIGHT && this.props.showSeconds) {
      this.focusSecondFromMinute(event);
    }
  }
github cerner / terra-framework / packages / terra-date-input / src / DateInput.jsx View on Github external
if (event.keyCode === KeyCode.KEY_UP) {
      event.preventDefault();
      stateValue = DateInputUtil.incrementYear(stateValue);
    }

    if (event.keyCode === KeyCode.KEY_DOWN) {
      event.preventDefault();
      stateValue = DateInputUtil.decrementYear(stateValue);
    }

    if (previousStateValue !== stateValue) {
      this.handleValueChange(event, DateInputUtil.inputType.YEAR, stateValue);
    }

    if (event.keyCode === KeyCode.KEY_BACK_SPACE || event.keyCode === KeyCode.KEY_DELETE) {
      if (displayFormat === 'month-day-year' && event.target.value === '') {
        this.focusDay(event);
      }

      if (displayFormat === 'day-month-year' && event.target.value === '') {
        this.focusMonth(event);
      }
    }
  }