Beispiel #1
0
      value: function leave(leavingNode) {
        this._entered = without(this._entered.filter(function (node) {
          return document.body.contains(node);
        }), leavingNode);

        return this._entered.length === 0;
      },
Beispiel #2
0
function getTestDataFor(types = ''){
  var typesArr = [];
  if(isString(types)){
    typesArr = [types];
  } else {
    typesArr = types;
  }

  var data = {
    array: ['a', 'b', 'c'],
    obj: {a:'b'},
    int: 1,
    bool: true,
    fn: () => {},
    str: 'some',
    zero: 0,
    nl: null,
    undef: undefined
  };

  var testDataTypes = Object.values(data);
  for(let type of typesArr){
    if(Object.keys(data).indexOf(type) > -1){
      testDataTypes = without(testDataTypes, data[type]);
    }
  }
  return testDataTypes;

}
Beispiel #3
0
function stopTrapFocusForComponent( component ) {
	components = without( components, component );

	if ( components.length < 1 ) {
		removeFocusListener();
	}
}
module.exports.connectRectangles = function(source, target, start, end, hints) {

  var preferredLayouts = hints && hints.preferredLayouts || [];

  var preferredLayout = without(preferredLayouts, 'straight')[0] || 'h:h';

  var threshold = ORIENTATION_THRESHOLD[preferredLayout] || 0;

  var orientation = getOrientation(source, target, threshold);

  var directions = getDirections(orientation, preferredLayout);

  start = start || getMid(source);
  end = end || getMid(target);

  // overlapping elements
  if (!directions) {
    return;
  }

  if (directions === 'h:h') {

    switch (orientation) {
      case 'top-right':
      case 'right':
      case 'bottom-right':
        start = { original: start, x: source.x, y: start.y };
        end = { original: end, x: target.x + target.width, y: end.y };
        break;
      case 'top-left':
      case 'left':
      case 'bottom-left':
        start = { original: start, x: source.x + source.width, y: start.y };
        end = { original: end, x: target.x, y: end.y };
        break;
    }
  }

  if (directions === 'v:v') {

    switch (orientation) {
      case 'top-left':
      case 'top':
      case 'top-right':
        start = { original: start, x: start.x, y: source.y + source.height };
        end = { original: end, x: end.x, y: target.y };
        break;
      case 'bottom-left':
      case 'bottom':
      case 'bottom-right':
        start = { original: start, x: start.x, y: source.y };
        end = { original: end, x: end.x, y: target.y + target.height };
        break;
    }
  }

  return this.connectPoints(start, end, directions);
};
Beispiel #5
0
  /*
   * Removes a model from the collection.
   * @param {Model} model
   * @emits remove
   * @return {Collection}
   */
  remove(model) {
    // model can be a model object or the model's ID.
    if (typeof model == 'string') model = this.get(model);

    model.removeListener('change', this.handleChange_);

    this.models_ = without(this.models_, model);
    this.emit('remove', model);
    return this;
  }
  leave(leavingNode) {
    const previousLength = this.entered.length;

    this.entered = without(
      this.entered.filter(node =>
        document.documentElement.contains(node)
      ),
      leavingNode
    );

    return previousLength > 0 && this.entered.length === 0;
  }
    const domain = this.getDomain(props) || scale.domain();
    scale.range(Helpers.getRange(props, axis));
    scale.domain(domain);
    return scale;
  },

  getTicks(props, scale) {
    if (props.tickValues) {
      if (Axis.stringTicks(props)) {
        return range(1, props.tickValues.length + 1);
      }
      return props.tickValues;
    } else if (scale.ticks && isFunction(scale.ticks)) {
      const ticks = scale.ticks(props.tickCount);
      if (props.crossAxis) {
        return includes(ticks, 0) ? without(ticks, 0) : ticks;
      }
      return ticks;
    }
    return scale.domain();
  },

  getTickFormat(props, tickProps) {
    const {scale, ticks} = tickProps;
    if (props.tickFormat && isFunction(props.tickFormat)) {
      return props.tickFormat;
    } else if (props.tickFormat && Array.isArray(props.tickFormat)) {
      return (x, index) => props.tickFormat[index];
    } else if (Axis.stringTicks(props)) {
      return (x, index) => props.tickValues[index];
    } else if (scale.tickFormat && isFunction(scale.tickFormat)) {
Beispiel #8
0
      return function (event) {
        event.preventDefault();

        context.item[context.fieldName] = without(context.item[context.fieldName], value);
      };
function withFirst(frontItems, items) {
  return frontItems.concat(without(items, ...frontItems));
}