Skip to content

Commit 330c14a

Browse files
authored
Merge pull request #3748 from ag-grid/imoses/deprecated-validate-decorator
Set TempValidator in series & axes properties to flush out missing validations
2 parents a844afc + c473736 commit 330c14a

File tree

88 files changed

+1303
-1254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1303
-1254
lines changed

packages/ag-charts-community/src/chart/axis/axis.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { createId } from '../../util/id';
3131
import { findMinMax, findRangeExtent } from '../../util/number';
3232
import { mergeDefaults } from '../../util/object';
3333
import { ObserveChanges } from '../../util/proxy';
34-
import { BOOLEAN, OBJECT, STRING_ARRAY, Validate } from '../../util/validation';
34+
import { BOOLEAN, OBJECT, STRING_ARRAY, TempValidate } from '../../util/validation';
3535
import { Caption } from '../caption';
3636
import type { ChartAnimationPhase } from '../chartAnimationPhase';
3737
import type { AxisGroups, ChartAxis, ChartAxisLabelFlipFlag } from '../chartAxis';
@@ -107,17 +107,17 @@ export abstract class Axis<
107107
// user pass-through option: no validation required.
108108
context?: unknown;
109109

110-
@Validate(BOOLEAN)
110+
@TempValidate(BOOLEAN)
111111
nice: boolean = true;
112112

113113
/** Reverse the axis scale domain. */
114-
@Validate(BOOLEAN)
114+
@TempValidate(BOOLEAN)
115115
reverse: boolean = false;
116116

117-
@Validate(STRING_ARRAY)
117+
@TempValidate(STRING_ARRAY)
118118
keys: string[] = [];
119119

120-
@Validate(OBJECT)
120+
@TempValidate(OBJECT)
121121
readonly interval = new AxisInterval();
122122

123123
dataDomain: { domain: D[]; clipped: boolean } = { domain: [], clipped: false };
@@ -339,7 +339,7 @@ export abstract class Axis<
339339
return formatValue(datum, fractionDigits);
340340
}
341341

342-
@Validate(OBJECT)
342+
@TempValidate(OBJECT)
343343
readonly title = new AxisTitle();
344344

345345
/**

packages/ag-charts-community/src/chart/axis/axisGridLine.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { isObject } from 'ag-charts-core';
22
import type { AgAxisGridStyle } from 'ag-charts-types';
33

4-
import { ARRAY_OF, BOOLEAN, POSITIVE_NUMBER, Validate } from '../../util/validation';
4+
import { ARRAY_OF, BOOLEAN, POSITIVE_NUMBER, TempValidate } from '../../util/validation';
55

66
const GRID_STYLE_KEYS = ['stroke', 'lineDash'];
77
const GRID_STYLE = ARRAY_OF(
@@ -10,13 +10,13 @@ const GRID_STYLE = ARRAY_OF(
1010
);
1111

1212
export class AxisGridLine {
13-
@Validate(BOOLEAN)
13+
@TempValidate(BOOLEAN)
1414
enabled = true;
1515

16-
@Validate(POSITIVE_NUMBER)
16+
@TempValidate(POSITIVE_NUMBER)
1717
width: number = 1;
1818

19-
@Validate(GRID_STYLE)
19+
@TempValidate(GRID_STYLE)
2020
style: AgAxisGridStyle[] = [
2121
{
2222
stroke: undefined,

packages/ag-charts-community/src/chart/axis/axisInterval.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isFiniteNumber } from 'ag-charts-core';
33
import { Default } from '../../util/default';
44
import { BaseProperties } from '../../util/properties';
55
import { TimeInterval } from '../../util/time';
6-
import { ARRAY, MAX_SPACING, MIN_SPACING, Validate, predicateWithMessage } from '../../util/validation';
6+
import { ARRAY, MAX_SPACING, MIN_SPACING, TempValidate, predicateWithMessage } from '../../util/validation';
77
import type { TickInterval } from './axisTick';
88

99
export const TICK_INTERVAL = predicateWithMessage(
@@ -12,17 +12,17 @@ export const TICK_INTERVAL = predicateWithMessage(
1212
);
1313

1414
export class AxisInterval<S> extends BaseProperties {
15-
@Validate(TICK_INTERVAL, { optional: true })
15+
@TempValidate(TICK_INTERVAL, { optional: true })
1616
step?: TickInterval<S>;
1717

18-
@Validate(ARRAY, { optional: true })
18+
@TempValidate(ARRAY, { optional: true })
1919
values?: any[];
2020

21-
@Validate(MIN_SPACING)
21+
@TempValidate(MIN_SPACING)
2222
@Default(NaN)
2323
minSpacing: number = NaN;
2424

25-
@Validate(MAX_SPACING)
25+
@TempValidate(MAX_SPACING)
2626
@Default(NaN)
2727
maxSpacing: number = NaN;
2828
}

packages/ag-charts-community/src/chart/axis/axisLabel.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,44 @@ import {
2121
NUMBER_OR_NAN,
2222
POSITIVE_NUMBER,
2323
STRING,
24-
Validate,
24+
TempValidate,
2525
} from '../../util/validation';
2626
import type { ChartAxisLabel, ChartAxisLabelFlipFlag } from '../chartAxis';
2727

2828
export class AxisLabel extends BaseProperties implements ChartAxisLabel {
29-
@Validate(BOOLEAN)
29+
@TempValidate(BOOLEAN)
3030
enabled = true;
3131

32-
@Validate(FONT_STYLE, { optional: true })
32+
@TempValidate(FONT_STYLE, { optional: true })
3333
fontStyle?: FontStyle;
3434

35-
@Validate(FONT_WEIGHT, { optional: true })
35+
@TempValidate(FONT_WEIGHT, { optional: true })
3636
fontWeight?: FontWeight;
3737

38-
@Validate(NUMBER.restrict({ min: 1 }))
38+
@TempValidate(NUMBER.restrict({ min: 1 }))
3939
fontSize!: number;
4040

41-
@Validate(STRING)
41+
@TempValidate(STRING)
4242
fontFamily!: string;
4343

4444
/**
4545
* The padding between the labels and the ticks.
4646
*/
47-
@Validate(POSITIVE_NUMBER)
47+
@TempValidate(POSITIVE_NUMBER)
4848
spacing: number = 5;
4949

5050
/**
5151
* Minimum gap in pixels between the axis labels before being removed to avoid collisions.
5252
*/
53-
@Validate(NUMBER_OR_NAN)
53+
@TempValidate(NUMBER_OR_NAN)
5454
@Default(NaN)
5555
minSpacing: number = NaN;
5656

5757
/**
5858
* The color of the labels.
5959
* Use `undefined` rather than `rgba(0, 0, 0, 0)` to make labels invisible.
6060
*/
61-
@Validate(COLOR_STRING, { optional: true })
61+
@TempValidate(COLOR_STRING, { optional: true })
6262
color?: string = '#575757';
6363

6464
/**
@@ -68,13 +68,13 @@ export class AxisLabel extends BaseProperties implements ChartAxisLabel {
6868
* The value of this config is used as the angular offset/deflection
6969
* from the default rotation.
7070
*/
71-
@Validate(NUMBER, { optional: true })
71+
@TempValidate(NUMBER, { optional: true })
7272
rotation?: number;
7373

7474
/**
7575
* Avoid axis label collision by automatically reducing the number of ticks displayed. If set to `false`, axis labels may collide.
7676
*/
77-
@Validate(BOOLEAN)
77+
@TempValidate(BOOLEAN)
7878
avoidCollisions: boolean = true;
7979

8080
/**
@@ -90,7 +90,7 @@ export class AxisLabel extends BaseProperties implements ChartAxisLabel {
9090
* from north-west to south-east, _starting_ at the tick to the right
9191
* of the axis line.
9292
*/
93-
@Validate(BOOLEAN)
93+
@TempValidate(BOOLEAN)
9494
mirrored: boolean = false;
9595

9696
/**
@@ -107,10 +107,10 @@ export class AxisLabel extends BaseProperties implements ChartAxisLabel {
107107
* Setting this config to `true` makes labels render parallel to the axis line
108108
* and center aligns labels' text at the ticks.
109109
*/
110-
@Validate(BOOLEAN)
110+
@TempValidate(BOOLEAN)
111111
parallel: boolean = false;
112112

113-
@Validate(FUNCTION, { optional: true })
113+
@TempValidate(FUNCTION, { optional: true })
114114
itemStyler?: Styler<AgAxisLabelStylerParams, AgBaseAxisLabelStyleOptions>;
115115

116116
/**
@@ -119,10 +119,10 @@ export class AxisLabel extends BaseProperties implements ChartAxisLabel {
119119
* digits used by the tick step. For example, if the tick step is `0.0005`,
120120
* the `fractionDigits` is 4.
121121
*/
122-
@Validate(FUNCTION, { optional: true })
122+
@TempValidate(FUNCTION, { optional: true })
123123
formatter?: Formatter<AgAxisLabelFormatterParams>;
124124

125-
@Validate(STRING, { optional: true })
125+
@TempValidate(STRING, { optional: true })
126126
format?: string;
127127

128128
getFont(): string {
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { BOOLEAN, COLOR_STRING, POSITIVE_NUMBER, Validate } from '../../util/validation';
1+
import { BOOLEAN, COLOR_STRING, POSITIVE_NUMBER, TempValidate } from '../../util/validation';
22

33
export class AxisLine {
4-
@Validate(BOOLEAN)
4+
@TempValidate(BOOLEAN)
55
enabled = true;
66

7-
@Validate(POSITIVE_NUMBER)
7+
@TempValidate(POSITIVE_NUMBER)
88
width: number = 1;
99

10-
@Validate(COLOR_STRING, { optional: true })
10+
@TempValidate(COLOR_STRING, { optional: true })
1111
stroke?: string = undefined;
1212
}

packages/ag-charts-community/src/chart/axis/axisTick.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import type { OrdinalTimeScale } from '../../scale/ordinalTimeScale';
22
import type { TimeScale } from '../../scale/timeScale';
33
import { BaseProperties } from '../../util/properties';
44
import { TimeInterval } from '../../util/time';
5-
import { BOOLEAN, COLOR_STRING, POSITIVE_NUMBER, Validate } from '../../util/validation';
5+
import { BOOLEAN, COLOR_STRING, POSITIVE_NUMBER, TempValidate } from '../../util/validation';
66

77
export type TickInterval<S> = S extends TimeScale | OrdinalTimeScale ? number | TimeInterval : number;
88

99
export class AxisTick extends BaseProperties {
10-
@Validate(BOOLEAN)
10+
@TempValidate(BOOLEAN)
1111
enabled = true;
1212

1313
/** The line width to be used by axis ticks. */
14-
@Validate(POSITIVE_NUMBER)
14+
@TempValidate(POSITIVE_NUMBER)
1515
width: number = 1;
1616

1717
/** The line length to be used by axis ticks. */
18-
@Validate(POSITIVE_NUMBER)
18+
@TempValidate(POSITIVE_NUMBER)
1919
size: number = 6;
2020

2121
/** The color of the axis ticks. */
22-
@Validate(COLOR_STRING, { optional: true })
22+
@TempValidate(COLOR_STRING, { optional: true })
2323
stroke?: string;
2424
}

packages/ag-charts-community/src/chart/axis/axisTitle.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@ import {
1717
POSITIVE_NUMBER,
1818
STRING,
1919
TEXT_WRAP,
20-
Validate,
20+
TempValidate,
2121
} from '../../util/validation';
2222
import { Caption } from '../caption';
2323

2424
export class AxisTitle extends BaseProperties implements AgAxisCaptionOptions {
2525
readonly caption = new Caption();
2626

27-
@Validate(BOOLEAN)
27+
@TempValidate(BOOLEAN)
2828
enabled: boolean = false;
2929

30-
@Validate(STRING, { optional: true })
30+
@TempValidate(STRING, { optional: true })
3131
text?: string;
3232

33-
@Validate(POSITIVE_NUMBER, { optional: true })
33+
@TempValidate(POSITIVE_NUMBER, { optional: true })
3434
spacing?: number = Caption.SMALL_PADDING;
3535

36-
@Validate(FONT_STYLE, { optional: true })
36+
@TempValidate(FONT_STYLE, { optional: true })
3737
fontStyle?: FontStyle;
3838

39-
@Validate(FONT_WEIGHT, { optional: true })
39+
@TempValidate(FONT_WEIGHT, { optional: true })
4040
fontWeight?: FontWeight;
4141

42-
@Validate(POSITIVE_NUMBER)
42+
@TempValidate(POSITIVE_NUMBER)
4343
fontSize: number = 10;
4444

45-
@Validate(STRING)
45+
@TempValidate(STRING)
4646
fontFamily: string = 'sans-serif';
4747

48-
@Validate(COLOR_STRING, { optional: true })
48+
@TempValidate(COLOR_STRING, { optional: true })
4949
color?: string;
5050

51-
@Validate(TEXT_WRAP)
51+
@TempValidate(TEXT_WRAP)
5252
wrapping: TextWrap = 'always';
5353

54-
@Validate(FUNCTION, { optional: true })
54+
@TempValidate(FUNCTION, { optional: true })
5555
formatter?: Formatter<AgAxisCaptionFormatterParams>;
5656
}

packages/ag-charts-community/src/chart/axis/cartesianAxis.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { BBox } from '../../scene/bbox';
1010
import { Group } from '../../scene/group';
1111
import { TransformableText } from '../../scene/shape/text';
1212
import { StateMachine } from '../../util/stateMachine';
13-
import { POSITION, POSITIVE_NUMBER, Validate } from '../../util/validation';
13+
import { POSITION, POSITIVE_NUMBER, TempValidate } from '../../util/validation';
1414
import { Caption } from '../caption';
1515
import type { ChartAnimationPhase } from '../chartAnimationPhase';
1616
import { ChartAxisDirection } from '../chartAxisDirection';
@@ -46,10 +46,10 @@ export abstract class CartesianAxis<S extends Scale<D, number, any> = Scale<any,
4646
return value instanceof CartesianAxis;
4747
}
4848

49-
@Validate(POSITIVE_NUMBER, { optional: true })
49+
@TempValidate(POSITIVE_NUMBER, { optional: true })
5050
thickness?: number;
5151

52-
@Validate(POSITION)
52+
@TempValidate(POSITION)
5353
position!: AgCartesianAxisPosition;
5454

5555
protected animationManager: AnimationManager;
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { BOOLEAN, NUMBER, Validate } from '../../util/validation';
1+
import { BOOLEAN, NUMBER, TempValidate } from '../../util/validation';
22
import { AxisLabel } from './axisLabel';
33

44
export class CartesianAxisLabel extends AxisLabel {
55
/**
66
* If specified and axis labels may collide, they are rotated to reduce collisions. If the
77
* `rotation` property is specified, it takes precedence.
88
*/
9-
@Validate(BOOLEAN, { optional: true })
9+
@TempValidate(BOOLEAN, { optional: true })
1010
autoRotate?: boolean;
1111

1212
/**
1313
* Rotation angle to use when autoRotate is applied.
1414
*/
15-
@Validate(NUMBER)
15+
@TempValidate(NUMBER)
1616
autoRotateAngle: number = 335;
1717
}

packages/ag-charts-community/src/chart/axis/categoryAxis.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isFiniteNumber } from 'ag-charts-core';
33
import type { ModuleContext } from '../../module/moduleContext';
44
import { CategoryScale } from '../../scale/categoryScale';
55
import type { OrdinalTimeScale } from '../../scale/ordinalTimeScale';
6-
import { RATIO, Validate } from '../../util/validation';
6+
import { RATIO, TempValidate } from '../../util/validation';
77
import { CartesianAxis } from './cartesianAxis';
88

99
export class CategoryAxis<
@@ -24,13 +24,13 @@ export class CategoryAxis<
2424
this.nice = false;
2525
}
2626

27-
@Validate(RATIO)
27+
@TempValidate(RATIO)
2828
groupPaddingInner: number = 0.1;
2929

30-
@Validate(RATIO, { optional: true })
30+
@TempValidate(RATIO, { optional: true })
3131
paddingInner?: number;
3232

33-
@Validate(RATIO, { optional: true })
33+
@TempValidate(RATIO, { optional: true })
3434
paddingOuter?: number;
3535

3636
override normaliseDataDomain(domain: Array<string | object>) {

0 commit comments

Comments
 (0)