Skip to content

Commit

Permalink
Merge pull request #4286 from GordonSmith/REVERT_ARGUMENTSCHANGE
Browse files Browse the repository at this point in the history
fix: Revert arguments removal
  • Loading branch information
GordonSmith authored Nov 11, 2024
2 parents b74cffd + 20c34f1 commit ee5201f
Show file tree
Hide file tree
Showing 31 changed files with 131 additions and 218 deletions.
8 changes: 4 additions & 4 deletions packages/api/src/ITooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,17 @@ ITooltip.prototype.publish("tooltipOffset", 8, "number", "Offset from the cursor

const tooltipLabelFormat = ITooltip.prototype.tooltipLabelFormat;
ITooltip.prototype.tooltipLabelFormat = function (_?): string | ITooltip {
const retVal = tooltipLabelFormat.call(this, _);
if (_ !== undefined) {
const retVal = tooltipLabelFormat.apply(this, arguments);
if (arguments.length) {
this._labelFormatter = d3Format(_);
}
return retVal;
};

const tooltipValueFormat = ITooltip.prototype.tooltipValueFormat;
ITooltip.prototype.tooltipValueFormat = function (_?): string | ITooltip {
const retVal = tooltipValueFormat.call(this, _);
if (_ !== undefined) {
const retVal = tooltipValueFormat.apply(this, arguments);
if (arguments.length) {
this._valueFormatter = d3Format(_);
}
return retVal;
Expand Down
8 changes: 4 additions & 4 deletions packages/chart/src/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export class Axis extends SVGWidget {
}

domain(_?) {
if (_ === undefined) return this.d3Scale.domain();
if (!arguments.length) return this.d3Scale.domain();
this.d3Scale.domain(_);
return this;
}

range(_?) {
if (_ === undefined) {
if (!arguments.length) {
if (this.d3Scale.rangeRoundBands) {
return this.d3Scale.rangeExtent();
} else if (this.d3Scale.rangeRound) {
Expand Down Expand Up @@ -745,7 +745,7 @@ Axis.prototype.publish("padding", 0, "number", "Padding space at top of axis (pi

Axis.prototype._origType = Axis.prototype.type;
Axis.prototype.type = function (_?: string) {
const retVal = Axis.prototype._origType.call(this, _);
const retVal = Axis.prototype._origType.apply(this, arguments);
if (_ !== undefined) {
this._type = _;
this.updateScale();
Expand All @@ -755,7 +755,7 @@ Axis.prototype.type = function (_?: string) {

Axis.prototype._origTimePattern = Axis.prototype.timePattern;
Axis.prototype.timePattern = function (_?: string) {
const retVal = Axis.prototype._origTimePattern.call(this, _);
const retVal = Axis.prototype._origTimePattern.apply(this, arguments);
if (_ !== undefined) {
this._timePattern = _;
this.updateScale();
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/Bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class Bubble extends SVGWidget {
size(): ISize;
size(_): this;
size(_?): ISize | this {
const retVal = super.size(_);
if (_ !== undefined) {
const retVal = super.size.apply(this, arguments);
if (arguments.length) {
this.d3Pack
.size([this.width(), this.height()])
;
Expand Down
26 changes: 13 additions & 13 deletions packages/chart/src/D3Cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function d3Cloud() {
let canvas = cloudCanvas;

cloud.canvas = function (_?) {
return _ !== undefined ? (canvas = functor(_), cloud) : canvas;
return arguments.length ? (canvas = functor(_), cloud) : canvas;
};

cloud.start = function () {
Expand Down Expand Up @@ -150,51 +150,51 @@ export function d3Cloud() {
}

cloud.timeInterval = function (_?) {
return _ !== undefined ? (timeInterval = _ == null ? Infinity : _, cloud) : timeInterval;
return arguments.length ? (timeInterval = _ == null ? Infinity : _, cloud) : timeInterval;
};

cloud.words = function (_?) {
return _ !== undefined ? (words = _, cloud) : words;
return arguments.length ? (words = _, cloud) : words;
};

cloud.size = function (_?) {
return _ !== undefined ? (size = [+_[0], +_[1]], cloud) : size;
return arguments.length ? (size = [+_[0], +_[1]], cloud) : size;
};

cloud.font = function (_?) {
return _ !== undefined ? (font = functor(_), cloud) : font;
return arguments.length ? (font = functor(_), cloud) : font;
};

cloud.fontStyle = function (_?) {
return _ !== undefined ? (fontStyle = functor(_), cloud) : fontStyle;
return arguments.length ? (fontStyle = functor(_), cloud) : fontStyle;
};

cloud.fontWeight = function (_?) {
return _ !== undefined ? (fontWeight = functor(_), cloud) : fontWeight;
return arguments.length ? (fontWeight = functor(_), cloud) : fontWeight;
};

cloud.rotate = function (_?) {
return _ !== undefined ? (rotate = functor(_), cloud) : rotate;
return arguments.length ? (rotate = functor(_), cloud) : rotate;
};

cloud.text = function (_?) {
return _ !== undefined ? (text = functor(_), cloud) : text;
return arguments.length ? (text = functor(_), cloud) : text;
};

cloud.spiral = function (_?) {
return _ !== undefined ? (spiral = spirals[_] || _, cloud) : spiral;
return arguments.length ? (spiral = spirals[_] || _, cloud) : spiral;
};

cloud.fontSize = function (_?) {
return _ !== undefined ? (fontSize = functor(_), cloud) : fontSize;
return arguments.length ? (fontSize = functor(_), cloud) : fontSize;
};

cloud.padding = function (_?) {
return _ !== undefined ? (padding = functor(_), cloud) : padding;
return arguments.length ? (padding = functor(_), cloud) : padding;
};

cloud.random = function (_?) {
return _ !== undefined ? (random = _, cloud) : random;
return arguments.length ? (random = _, cloud) : random;
};

cloud.on = function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/Pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Pie extends SVGWidget {
selection(): any[]; // any[] === single row
selection(_: any[]): this;
selection(_?: any[]): any[] | this {
if (_ === undefined) {
if (!arguments.length) {
try {
return this._selection.selection2()[0]?.data;
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/StatChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class StatChart extends HTMLWidget {
data(): Data;
data(_: Data): this;
data(_?: Data): Data | this {
if (_ === undefined) return [[...this.quartiles(), this.mean(), this.standardDeviation()]];
if (!arguments.length) return [[...this.quartiles(), this.mean(), this.standardDeviation()]];
const row = _[0];
this.quartiles([row[0], row[1], row[2], row[3], row[4]]);
this.mean(row[5]);
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/Summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ Summary.prototype.publish("playInterval", null, "number", "Play Interval", null,

const playInterval = Summary.prototype.playInterval;
Summary.prototype.playInterval = function (_?: number): number | any {
const retVal = playInterval.call(this, _);
if (_ === undefined) {
const retVal = playInterval.apply(this, arguments);
if (arguments.length) {
if (this._playIntervalHandle) {
clearInterval(this._playIntervalHandle);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/SummaryC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ SummaryC.prototype.publish("iconSizeRatio", 0.9, "number", "Ratio of the height

const playInterval = SummaryC.prototype.playInterval;
SummaryC.prototype.playInterval = function (_?: number): number | any {
const retVal = playInterval.call(this, _);
if (_ !== undefined) {
const retVal = playInterval.apply(this, arguments);
if (arguments.length) {
if (this._playIntervalHandle) {
clearInterval(this._playIntervalHandle);
}
Expand Down
57 changes: 0 additions & 57 deletions packages/chart/src/WordCloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,63 +191,6 @@ WordCloud.prototype.implements(ITooltip.prototype);
WordCloud.prototype.mixin(Utility.SimpleSelectionMixin);

export interface WordCloud {
/*
paletteID: { (): string; (_: string): WordCloud };
paletteID_exists: () => boolean;
useClonedPalette: { (): boolean; (_: boolean): WordCloud };
useClonedPalette_exists: () => boolean;
fontFamily: { (): string; (_: string): WordCloud };
fontFamily_exists: () => boolean;
fontSizeFrom: { (): number; (_: number): WordCloud };
fontSizeFrom_exists: () => boolean;
fontSizeTo: { (): number; (_: number): WordCloud };
fontSizeTo_exists: () => boolean;
angleFrom: { (): number; (_: number): WordCloud };
angleFrom_exists: () => boolean;
angleTo: { (): number; (_: number): WordCloud };
angleTo_exists: () => boolean;
angleCount: { (): number; (_: number): WordCloud };
angleCount_exists: () => boolean;
padding: { (): number; (_: number): WordCloud };
padding_exists: () => boolean;
scaleMode: { (): string; (_: string): WordCloud };
scaleMode_exists: () => boolean;
spiral: { (): string; (_: string): WordCloud };
spiral_exists: () => boolean;
offsetX: { (): number; (_: number): WordCloud };
offsetX_exists: () => boolean;
offsetY: { (): number; (_: number): WordCloud };
offsetY_exists: () => boolean;
zoom: { (): number; (_: number): WordCloud };
zoom_exists: () => boolean;
// I2DChart
_palette;
click: (row, column, selected) => void;
dblclick: (row, column, selected) => void;
// ITooltip ---
tooltip;
tooltipHTML: (_?) => any;
tooltipFormat: (opts) => any;
tooltipStyle: { (): string; (_: string): WordCloud };
tooltipStyle_exists: () => boolean;
tooltipValueFormat: { (): string; (_: string): WordCloud };
tooltipValueFormat_exists: () => boolean;
tooltipSeriesColor: { (): string; (_: string): WordCloud };
tooltipSeriesColor_exists: () => boolean;
tooltipLabelColor: { (): string; (_: string): WordCloud };
tooltipLabelColor_exists: () => boolean;
tooltipValueColor: { (): string; (_: string): WordCloud };
tooltipValueColor_exists: () => boolean;
tooltipTick: { (): boolean; (_: boolean): WordCloud };
tooltipTick_exists: () => boolean;
tooltipOffset: { (): number; (_: number): WordCloud };
tooltipOffset_exists: () => boolean;
// SimpleSelectionMixin
_selection: Utility.SimpleSelection;
*/

paletteID(): string;
paletteID(_: string): this;
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/src/XYAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class XYAxis extends SVGWidget {
skipSelection(): boolean;
skipSelection(_: boolean): this;
skipSelection(_?: boolean): boolean | this {
if (_ === undefined) return this._skipSelection;
if (!arguments.length) return this._skipSelection;
this._skipSelection = _;
return this;
}
Expand Down Expand Up @@ -571,7 +571,7 @@ export class XYAxis extends SVGWidget {
}

layerData(host?: XYAxis): any[][] {
if (host !== undefined) {
if (arguments.length === 1) {
const indices = this.layerColumnIndices(host);
return host.data().map(row => {
const retVal = indices.map(idx => row[idx]);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/Class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Class {
class(): string;
class(_: string): this;
class(_?: string): string | this {
if (_ === undefined) return this._class;
if (!arguments.length) return this._class;
this._class = _;
return this;
}
Expand Down
Loading

0 comments on commit ee5201f

Please sign in to comment.