How to use the rc-util/lib/KeyCode.PAGE_UP function in rc-util

To help you get started, we’ve selected a few rc-util 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 react-component / calendar / tests / RangeCalendar.spec.jsx View on Github external
keySimulateCheck(keyCode.LEFT, 'Sep', 9);

    // 09-09 right 09-10
    keySimulateCheck(keyCode.RIGHT, 'Sep', 10);

    // 09-10 right 09-03
    keySimulateCheck(keyCode.UP, 'Sep', 3);

    // 09-10 home 09-01
    keySimulateCheck(keyCode.HOME, 'Sep', 1);

    // 09-10 end 09-30
    keySimulateCheck(keyCode.END, 'Sep', 30);

    // 09-30 page up 08-30
    keySimulateCheck(keyCode.PAGE_UP, 'Aug', 30);

    // 08-30 page down 09-30
    keySimulateCheck(keyCode.PAGE_DOWN, 'Sep', 30);

    keyDown(keyCode.BACKSLASH);
    expect(keyDownEvent).toEqual(1);

    keyDown(keyCode.ENTER);

    expect(onChange.mock.calls[0][0][0].format(format)).toEqual('2000-09-30');

    // 2000-09-30 ctrl+right 2001-09-30
    keySimulateCheck(keyCode.RIGHT, 'Sep', 30, {
      ctrlKey: true,
    });
    expect(wrapper.find('.rc-calendar-range-right .rc-calendar-year-select').text()).toEqual(
github react-component / calendar / src / RangeCalendar.tsx View on Github external
if (ctrlKey) {
          updateHoverPoint(time => goTime(time, 1, 'years'));
        } else {
          updateHoverPoint(time => goTime(time, 1, 'days'));
        }
        return;
      case KeyCode.HOME:
        updateHoverPoint(time => goStartMonth(time));
        return;
      case KeyCode.END:
        updateHoverPoint(time => goEndMonth(time));
        return;
      case KeyCode.PAGE_DOWN:
        updateHoverPoint(time => goTime(time, 1, 'month'));
        return;
      case KeyCode.PAGE_UP:
        updateHoverPoint(time => goTime(time, -1, 'month'));
        return;
      case KeyCode.ENTER: {
        let lastValue: Moment;
        if (hoverValue.length === 0) {
          lastValue = updateHoverPoint(time => time);
        } else if (hoverValue.length === 1) {
          // eslint-disable-next-line prefer-destructuring
          lastValue = hoverValue[0];
        } else {
          lastValue = hoverValue[0].isSame(firstSelectedValue, 'day')
            ? hoverValue[1]
            : hoverValue[0];
        }
        if (lastValue && (!disabledDate || !disabledDate(lastValue))) {
          this.onSelect(lastValue);
github react-component / calendar / tests / Calendar.spec.jsx View on Github external
it('pageUp works', () => {
        const original = calendar.state().value;
        const expected = original.clone();
        expected.add(-1, 'month');
        calendar.simulate('keyDown', { keyCode: keyCode.PAGE_UP });
        expect(calendar.state().value.month()).toBe(expected.month());
        expect(input.getDOMNode().value).toBe('');
      });
github iuap-design / bee.tinper.org / tinper-bee / bee-datepicker / src / rc-calendar / RangeCalendar.js View on Github external
if (ctrlKey) {
          updateHoverPoint((time) => goTime(time, 1, 'years'));
        } else {
          updateHoverPoint((time) => goTime(time, 1, 'days'));
        }
        return;
      case KeyCode.HOME:
        updateHoverPoint((time) => goStartMonth(time));
        return;
      case KeyCode.END:
        updateHoverPoint((time) => goEndMonth(time));
        return;
      case KeyCode.PAGE_DOWN:
        updateHoverPoint((time) => goTime(time, 1, 'month'));
        return;
      case KeyCode.PAGE_UP:
        updateHoverPoint((time) => goTime(time, -1, 'month'));
        return;
      case KeyCode.ENTER: {
        let lastValue;
        if (hoverValue.length === 0) {
          lastValue = updateHoverPoint(time => time);
        } else if (hoverValue.length === 1) {
          lastValue = hoverValue[0];
        } else {
          lastValue = hoverValue[0].isSame(firstSelectedValue, 'day') ?
            hoverValue[1] : hoverValue[0];
        }
        if (lastValue && (!disabledDate || !disabledDate(lastValue))) {
          this.onSelect(lastValue);
        }
        event.preventDefault();
github react-component / slider / src / utils.js View on Github external
const increase = 'increase';
  const decrease = 'decrease';
  let  method = increase;
  switch (e.keyCode) {
    case keyCode.UP:
      method = vertical && reverse ? decrease: increase; break;
    case keyCode.RIGHT:
      method = !vertical && reverse ? decrease: increase; break;
    case keyCode.DOWN:
      method = vertical && reverse ? increase: decrease; break;
    case keyCode.LEFT:
      method = !vertical && reverse ? increase: decrease; break;

    case keyCode.END: return (value, props) => props.max;
    case keyCode.HOME: return (value, props) => props.min;
    case keyCode.PAGE_UP: return (value, props) => value + props.step * 2;
    case keyCode.PAGE_DOWN: return (value, props) => value - props.step * 2;

    default: return undefined;
  }
  return (value, props) => calculateNextValue(method, value, props);
}
github antvis / x6 / packages / x6-components / src / scrollbar / index.tsx View on Github external
break

        case keys.HOME:
          direction = -1
          distance = contentSize
          break

        case keys.UP:
          direction = -1
          break

        case keys.DOWN:
          direction = 1
          break

        case keys.PAGE_UP:
          direction = -1
          distance = containerSize
          break

        case keys.PAGE_DOWN:
          direction = 1
          distance = containerSize
          break

        default:
          return
      }
    }

    e.preventDefault()
github iuap-design / bee.tinper.org / tinper-bee / bee-datepicker / src / rc-calendar / Calendar.jsx View on Github external
this.setValue(
          goStartMonth(this.state.value),
        );
        event.preventDefault();
        return 1;
      case KeyCode.END:
        this.setValue(
          goEndMonth(this.state.value),
        );
        event.preventDefault();
        return 1;
      case KeyCode.PAGE_DOWN:
        this.goTime(1, 'month');
        event.preventDefault();
        return 1;
      case KeyCode.PAGE_UP:
        this.goTime(-1, 'month');
        event.preventDefault();
        return 1;
      case KeyCode.ENTER:
        if (!disabledDate || !disabledDate(value)) {
          this.onSelect(value, {
            source: 'keyboard',
          });
        }
        event.preventDefault();
        return 1;
    }
  }
github priceline / design-system / packages / slider / src / rc-slider / utils.js View on Github external
export function getKeyboardValueMutator(e) {
  switch (e.keyCode) {
    case keyCode.UP:
    case keyCode.RIGHT:
      return (value, props) => calculateNextValue('increase', value, props)

    case keyCode.DOWN:
    case keyCode.LEFT:
      return (value, props) => calculateNextValue('decrease', value, props)

    case keyCode.END:
      return (value, props) => props.max
    case keyCode.HOME:
      return (value, props) => props.min
    case keyCode.PAGE_UP:
      return (value, props) => value + props.step * 2
    case keyCode.PAGE_DOWN:
      return (value, props) => value - props.step * 2

    default:
      return undefined
  }
}
github react-component / calendar / src / Calendar.jsx View on Github external
this.setValue(
          goStartMonth(this.state.value),
        );
        event.preventDefault();
        return 1;
      case KeyCode.END:
        this.setValue(
          goEndMonth(this.state.value),
        );
        event.preventDefault();
        return 1;
      case KeyCode.PAGE_DOWN:
        this.goTime(1, 'month');
        event.preventDefault();
        return 1;
      case KeyCode.PAGE_UP:
        this.goTime(-1, 'month');
        event.preventDefault();
        return 1;
      case KeyCode.ENTER:
        if (!disabledDate || !disabledDate(value)) {
          this.onSelect(value, {
            source: 'keyboard',
          });
        }
        event.preventDefault();
        return 1;
      default:
        this.props.onKeyDown(event);
        return 1;
    }
  }