Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mapLayer(spec, _a) {
// Special handling for extended layer spec
var { parentEncoding, parentProjection } = _a, otherParams = tslib_1.__rest(_a, ["parentEncoding", "parentProjection"]);
const { encoding, projection } = spec, rest = tslib_1.__rest(spec, ["encoding", "projection"]);
const params = Object.assign({}, otherParams, { parentEncoding: mergeEncoding({ parentEncoding, encoding }), parentProjection: mergeProjection({ parentProjection, projection }) });
return super.mapLayer(rest, params);
}
}
export function assembleAxis(axisCmpt, kind, config, opt = { header: false }) {
const _a = axisCmpt.combine(), { orient, scale, title, zindex } = _a, axis = tslib_1.__rest(_a, ["orient", "scale", "title", "zindex"]);
// Remove properties that are not valid for this kind of axis
keys(axis).forEach(key => {
const propType = AXIS_PROPERTY_TYPE[key];
if (propType && propType !== kind && propType !== 'both') {
delete axis[key];
}
});
if (kind === 'grid') {
if (!axis.grid) {
return undefined;
}
// Remove unnecessary encode block
if (axis.encode) {
// Only need to keep encode block for grid
const { grid } = axis.encode;
axis.encode = Object.assign({}, (grid ? { grid } : {}));
export function errorBarParams(spec, compositeMark, config) {
// TODO: use selection
const { mark, encoding, selection, projection: _p } = spec, outerSpec = tslib_1.__rest(spec, ["mark", "encoding", "selection", "projection"]);
const markDef = isMarkDef(mark) ? mark : { type: mark };
// TODO(https://github.com/vega/vega-lite/issues/3702): add selection support
if (selection) {
log.warn(log.message.selectionNotSupported(compositeMark));
}
const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark);
const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark);
const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config);
const _a = continuousAxis, oldContinuousAxisChannelDef = encoding[_a], _b = continuousAxis === 'x' ? 'x2' : 'y2', oldContinuousAxisChannelDef2 = encoding[_b], _c = continuousAxis === 'x' ? 'xError' : 'yError', oldContinuousAxisChannelDefError = encoding[_c], _d = continuousAxis === 'x' ? 'xError2' : 'yError2', oldContinuousAxisChannelDefError2 = encoding[_d], oldEncodingWithoutContinuousAxis = tslib_1.__rest(encoding, [typeof _a === "symbol" ? _a : _a + "", typeof _b === "symbol" ? _b : _b + "", typeof _c === "symbol" ? _c : _c + "", typeof _d === "symbol" ? _d : _d + ""]);
const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);
const aggregate = [...oldAggregate, ...errorBarSpecificAggregate];
const groupby = inputType !== 'raw' ? [] : oldGroupBy;
const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName);
return {
transform: [
...(outerSpec.transform || []),
request(request, config = {}, api) {
const { observe = "body" /* Body */, skipHandleError } = config;
/** @type {?} */
const url = api || this.store.selectSnapshot(ConfigState.getApiUrl()) + request.url;
const { method } = request, options = __rest(request, ["method"]);
return this.http.request(method, url, (/** @type {?} */ (Object.assign({ observe }, options)))).pipe(observe === "body" /* Body */ ? take(1) : null, catchError((/**
* @param {?} err
* @return {?}
*/
err => {
if (skipHandleError) {
return throwError(err);
}
return this.handleError(err);
})));
}
}
export default function createClass(_a) {
var statics = _a.statics, a_spec = tslib_1.__rest(_a, ["statics"]);
// Gather all methods to pin them to `this` later.
var methods = [];
var Subclass = Component.extend(tslib_1.__assign({
// Override constructor to autobind all the methods...
constructor: function () {
Component.apply(this, arguments);
for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) {
var method = methods_1[_i];
this[method] = this[method].bind(this);
}
} }, a_spec), statics);
// Need to bind methods from mixins as well, so populate it here.
var Proto = Subclass.prototype;
for (var key in Proto) {
if (Proto.hasOwnProperty(key) && dontAutobind.indexOf(key) === -1 && typeof Proto[key] === 'function') {
methods.push(key);
const fd = replaceRepeaterInFieldDef(channelDef, repeater);
if (fd) {
return fd;
}
else if (isConditionalDef(channelDef)) {
return { condition: channelDef.condition };
}
}
else {
if (hasConditionalFieldDef(channelDef)) {
const fd = replaceRepeaterInFieldDef(channelDef.condition, repeater);
if (fd) {
return Object.assign({}, channelDef, { condition: fd });
}
else {
const { condition } = channelDef, channelDefWithoutCondition = tslib_1.__rest(channelDef, ["condition"]);
return channelDefWithoutCondition;
}
}
return channelDef;
}
return undefined;
}
function replaceRepeater(mapping, repeater) {
columns.forEach(function (column) {
if (_.isString(column)) {
var c = column;
_this.columnStyles[c] = { key: c };
}
else if (_.isObject(column)) {
var c = column;
var key = c.key, style = tslib_1.__rest(c, ["key"]);
_this.columnStyles[key] = style;
}
});
}
Query.prototype.fetchData = function (client, context) {
if (this.props.skip)
return false;
var _a = this.props, children = _a.children, ssr = _a.ssr, displayName = _a.displayName, skip = _a.skip, onCompleted = _a.onCompleted, onError = _a.onError, partialRefetch = _a.partialRefetch, opts = tslib.__rest(_a, ["children", "ssr", "displayName", "skip", "onCompleted", "onError", "partialRefetch"]);
var fetchPolicy = opts.fetchPolicy;
if (ssr === false)
return false;
if (fetchPolicy === 'network-only' || fetchPolicy === 'cache-and-network') {
fetchPolicy = 'cache-first';
}
var observable = client.watchQuery(tslib.__assign({}, opts, { fetchPolicy: fetchPolicy }));
if (context && context.renderPromises) {
context.renderPromises.registerSSRObservable(this, observable);
}
var result = this.observableQuery.getCurrentResult();
return result.loading ? observable.result() : false;
};
Query.prototype.extractOptsFromProps = function (props) {
Progress.prototype.render = function () {
var _a = this.props, isBlack = _a.isBlack, isDanger = _a.isDanger, isDark = _a.isDark, isInfo = _a.isInfo, isLarge = _a.isLarge, isLight = _a.isLight, isLink = _a.isLink, isMedium = _a.isMedium, isPrimary = _a.isPrimary, isSmall = _a.isSmall, isSuccess = _a.isSuccess, isWarning = _a.isWarning, isWhite = _a.isWhite, props = tslib_1.__rest(_a, ["isBlack", "isDanger", "isDark", "isInfo", "isLarge", "isLight", "isLink", "isMedium", "isPrimary", "isSmall", "isSuccess", "isWarning", "isWhite"]);
var className = classnames("progress", modifiers_1.mainColorsPropsToClassnames({
isDanger: isDanger,
isInfo: isInfo,
isLink: isLink,
isPrimary: isPrimary,
isSuccess: isSuccess,
isWarning: isWarning,
}), modifiers_1.shadeColorsPropsToClassnames({
isBlack: isBlack,
isDark: isDark,
isLight: isLight,
isWhite: isWhite,
}), modifiers_1.sizePropsToClassnames({
isLarge: isLarge,
isMedium: isMedium,
isSmall: isSmall,
add(exports.ERRORBAR, function (spec) {
var _m = spec.mark, encoding = spec.encoding, outerSpec = tslib_1.__rest(spec, ["mark", "encoding"]);
var _s = encoding.size, encodingWithoutSize = tslib_1.__rest(encoding, ["size"]);
var _x2 = encoding.x2, _y2 = encoding.y2, encodingWithoutX2Y2 = tslib_1.__rest(encoding, ["x2", "y2"]);
var _x = encodingWithoutX2Y2.x, _y = encodingWithoutX2Y2.y, encodingWithoutX_X2_Y_Y2 = tslib_1.__rest(encodingWithoutX2Y2, ["x", "y"]);
if (!encoding.x2 && !encoding.y2) {
throw new Error('Neither x2 or y2 provided');
}
return tslib_1.__assign({}, outerSpec, { layer: [
{
mark: 'rule',
encoding: encodingWithoutSize
}, {
mark: 'tick',
encoding: encodingWithoutX2Y2
}, {
mark: 'tick',
encoding: encoding.x2 ? tslib_1.__assign({ x: encoding.x2, y: encoding.y }, encodingWithoutX_X2_Y_Y2) : tslib_1.__assign({ x: encoding.x, y: encoding.y2 }, encodingWithoutX_X2_Y_Y2)