victory-core 36.5.0 → 36.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +13817 -10827
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +7 -27
- package/es/index.js +7 -53
- package/es/{types.d.ts → types/callbacks.d.ts} +12 -8
- package/es/types/callbacks.js +2 -0
- package/es/types/prop-types.d.ts +130 -0
- package/es/types/prop-types.js +2 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +1 -0
- package/es/victory-accessible-group/victory-accessible-group.js +2 -1
- package/es/victory-animation/util.d.ts +2 -1
- package/es/victory-animation/util.js +6 -4
- package/es/victory-animation/victory-animation.d.ts +1 -0
- package/es/victory-animation/victory-animation.js +2 -1
- package/es/victory-clip-container/victory-clip-container.d.ts +6 -5
- package/es/victory-clip-container/victory-clip-container.js +2 -1
- package/es/victory-container/victory-container.d.ts +8 -7
- package/es/victory-container/victory-container.js +2 -1
- package/es/victory-label/victory-label.d.ts +3 -2
- package/es/victory-label/victory-label.js +4 -4
- package/es/victory-portal/portal-context.d.ts +1 -0
- package/es/victory-portal/portal-context.js +2 -1
- package/es/victory-portal/portal.d.ts +3 -2
- package/es/victory-portal/portal.js +2 -1
- package/es/victory-portal/victory-portal.d.ts +1 -0
- package/es/victory-portal/victory-portal.js +2 -1
- package/es/victory-primitives/arc.d.ts +31 -2
- package/es/victory-primitives/arc.js +3 -2
- package/es/victory-primitives/background.d.ts +31 -2
- package/es/victory-primitives/background.js +3 -2
- package/es/victory-primitives/border.d.ts +28 -2
- package/es/victory-primitives/border.js +3 -2
- package/es/victory-primitives/circle.d.ts +1 -0
- package/es/victory-primitives/circle.js +2 -1
- package/es/victory-primitives/clip-path.d.ts +2 -1
- package/es/victory-primitives/clip-path.js +2 -1
- package/es/victory-primitives/index.d.ts +1 -0
- package/es/victory-primitives/index.js +2 -1
- package/es/victory-primitives/line-segment.d.ts +29 -2
- package/es/victory-primitives/line-segment.js +3 -2
- package/es/victory-primitives/line.d.ts +1 -0
- package/es/victory-primitives/line.js +2 -1
- package/es/victory-primitives/path.d.ts +1 -0
- package/es/victory-primitives/path.js +2 -1
- package/es/victory-primitives/point.d.ts +30 -2
- package/es/victory-primitives/point.js +3 -2
- package/es/victory-primitives/rect.d.ts +1 -0
- package/es/victory-primitives/rect.js +2 -1
- package/es/victory-primitives/text.d.ts +2 -1
- package/es/victory-primitives/text.js +2 -1
- package/es/victory-primitives/tspan.d.ts +2 -1
- package/es/victory-primitives/tspan.js +2 -1
- package/es/victory-primitives/types.d.ts +2 -1
- package/es/victory-primitives/types.js +2 -1
- package/es/victory-primitives/whisker.d.ts +37 -2
- package/es/victory-primitives/whisker.js +3 -2
- package/es/victory-state/defaults.d.ts +3 -0
- package/es/victory-state/defaults.js +3 -0
- package/es/victory-state/helpers/get-axis-data.d.ts +3 -0
- package/es/victory-state/helpers/get-axis-data.js +15 -0
- package/es/victory-state/helpers/get-data.d.ts +15 -0
- package/es/victory-state/helpers/get-data.js +88 -0
- package/es/victory-state/helpers/get-domain.d.ts +6 -0
- package/es/victory-state/helpers/get-domain.js +68 -0
- package/es/victory-state/helpers/get-range.d.ts +6 -0
- package/es/victory-state/helpers/get-range.js +37 -0
- package/es/victory-state/helpers/get-scale.d.ts +6 -0
- package/es/victory-state/helpers/get-scale.js +59 -0
- package/es/victory-state/index.d.ts +3 -0
- package/es/victory-state/index.js +3 -0
- package/es/victory-state/types.d.ts +24 -0
- package/es/victory-state/types.js +2 -0
- package/es/victory-state/victory-provider.d.ts +19 -0
- package/es/victory-state/victory-provider.js +118 -0
- package/es/victory-theme/grayscale.d.ts +2 -1
- package/es/victory-theme/grayscale.js +2 -1
- package/es/victory-theme/material.d.ts +2 -1
- package/es/victory-theme/material.js +2 -1
- package/{lib/victory-theme/victory-theme-definition.d.ts → es/victory-theme/types.d.ts} +3 -8
- package/es/victory-theme/types.js +2 -0
- package/es/victory-theme/victory-theme.d.ts +4 -3
- package/es/victory-theme/victory-theme.js +3 -2
- package/es/victory-transition/victory-transition.d.ts +1 -0
- package/es/victory-transition/victory-transition.js +2 -1
- package/es/victory-util/add-events.d.ts +106 -0
- package/es/victory-util/add-events.js +40 -33
- package/es/victory-util/axis.d.ts +51 -0
- package/es/victory-util/axis.js +9 -7
- package/es/victory-util/collection.d.ts +9 -0
- package/es/victory-util/collection.js +6 -4
- package/es/victory-util/common-props.d.ts +84 -0
- package/es/victory-util/common-props.js +29 -12
- package/es/victory-util/data.d.ts +75 -0
- package/es/victory-util/data.js +2 -1
- package/es/victory-util/default-transitions.d.ts +5 -0
- package/es/victory-util/default-transitions.js +2 -1
- package/es/victory-util/domain.d.ts +91 -0
- package/es/victory-util/domain.js +6 -2
- package/es/victory-util/events.d.ts +65 -0
- package/es/victory-util/events.js +13 -8
- package/es/victory-util/helpers.d.ts +61 -0
- package/es/victory-util/helpers.js +8 -4
- package/es/victory-util/hooks/index.d.ts +3 -0
- package/es/victory-util/hooks/index.js +2 -1
- package/es/victory-util/hooks/use-animation-state.js +4 -3
- package/es/victory-util/hooks/use-previous-props.d.ts +2 -0
- package/es/victory-util/hooks/use-previous-props.js +4 -3
- package/es/victory-util/immutable.d.ts +12 -0
- package/es/victory-util/immutable.js +5 -4
- package/es/victory-util/index.d.ts +29 -0
- package/es/victory-util/index.js +48 -0
- package/es/victory-util/label-helpers.d.ts +27 -0
- package/es/victory-util/label-helpers.js +2 -1
- package/es/victory-util/line-helpers.d.ts +5 -0
- package/es/victory-util/line-helpers.js +24 -6
- package/es/victory-util/log.d.ts +2 -0
- package/es/victory-util/log.js +2 -1
- package/es/victory-util/point-path-helpers.d.ts +1 -0
- package/es/victory-util/point-path-helpers.js +2 -1
- package/es/victory-util/prop-types.d.ts +51 -0
- package/es/victory-util/prop-types.js +35 -44
- package/es/victory-util/scale.d.ts +10 -0
- package/es/victory-util/scale.js +14 -6
- package/es/victory-util/selection.d.ts +25 -23
- package/es/victory-util/selection.js +25 -14
- package/es/victory-util/style.d.ts +19 -0
- package/es/victory-util/style.js +2 -1
- package/es/victory-util/textsize.d.ts +37 -8
- package/es/victory-util/textsize.js +9 -6
- package/es/victory-util/timer-context.d.ts +1 -0
- package/es/victory-util/timer-context.js +2 -1
- package/es/victory-util/timer.d.ts +3 -2
- package/es/victory-util/timer.js +2 -1
- package/es/victory-util/transitions.d.ts +49 -0
- package/es/victory-util/transitions.js +5 -4
- package/es/victory-util/type-helpers.d.ts +10 -0
- package/es/victory-util/type-helpers.js +28 -0
- package/es/victory-util/user-props.d.ts +21 -0
- package/es/victory-util/user-props.js +6 -5
- package/es/victory-util/with-container.d.ts +5 -0
- package/es/victory-util/with-container.js +32 -0
- package/es/victory-util/wrapper.d.ts +38 -0
- package/es/victory-util/wrapper.js +4 -3
- package/lib/index.d.ts +7 -27
- package/lib/index.js +58 -147
- package/lib/{types.d.ts → types/callbacks.d.ts} +12 -8
- package/lib/types/callbacks.js +2 -0
- package/lib/types/prop-types.d.ts +130 -0
- package/lib/types/prop-types.js +2 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +2 -1
- package/lib/victory-animation/util.d.ts +2 -1
- package/lib/victory-animation/util.js +6 -4
- package/lib/victory-animation/victory-animation.d.ts +1 -0
- package/lib/victory-animation/victory-animation.js +2 -1
- package/lib/victory-clip-container/victory-clip-container.d.ts +6 -5
- package/lib/victory-clip-container/victory-clip-container.js +2 -1
- package/lib/victory-container/victory-container.d.ts +8 -7
- package/lib/victory-container/victory-container.js +2 -1
- package/lib/victory-label/victory-label.d.ts +3 -2
- package/lib/victory-label/victory-label.js +4 -4
- package/lib/victory-portal/portal-context.d.ts +1 -0
- package/lib/victory-portal/portal-context.js +2 -1
- package/lib/victory-portal/portal.d.ts +3 -2
- package/lib/victory-portal/portal.js +2 -1
- package/lib/victory-portal/victory-portal.d.ts +1 -0
- package/lib/victory-portal/victory-portal.js +2 -1
- package/lib/victory-primitives/arc.d.ts +31 -2
- package/lib/victory-primitives/arc.js +4 -3
- package/lib/victory-primitives/background.d.ts +31 -2
- package/lib/victory-primitives/background.js +4 -3
- package/lib/victory-primitives/border.d.ts +28 -2
- package/lib/victory-primitives/border.js +4 -3
- package/lib/victory-primitives/circle.d.ts +1 -0
- package/lib/victory-primitives/circle.js +2 -1
- package/lib/victory-primitives/clip-path.d.ts +2 -1
- package/lib/victory-primitives/clip-path.js +2 -1
- package/lib/victory-primitives/index.d.ts +1 -0
- package/lib/victory-primitives/index.js +2 -1
- package/lib/victory-primitives/line-segment.d.ts +29 -2
- package/lib/victory-primitives/line-segment.js +4 -3
- package/lib/victory-primitives/line.d.ts +1 -0
- package/lib/victory-primitives/line.js +2 -1
- package/lib/victory-primitives/path.d.ts +1 -0
- package/lib/victory-primitives/path.js +2 -1
- package/lib/victory-primitives/point.d.ts +30 -2
- package/lib/victory-primitives/point.js +4 -3
- package/lib/victory-primitives/rect.d.ts +1 -0
- package/lib/victory-primitives/rect.js +2 -1
- package/lib/victory-primitives/text.d.ts +2 -1
- package/lib/victory-primitives/text.js +2 -1
- package/lib/victory-primitives/tspan.d.ts +2 -1
- package/lib/victory-primitives/tspan.js +2 -1
- package/lib/victory-primitives/types.d.ts +2 -1
- package/lib/victory-primitives/types.js +2 -1
- package/lib/victory-primitives/whisker.d.ts +37 -2
- package/lib/victory-primitives/whisker.js +4 -3
- package/lib/victory-state/defaults.d.ts +3 -0
- package/lib/victory-state/defaults.js +11 -0
- package/lib/victory-state/helpers/get-axis-data.d.ts +3 -0
- package/lib/victory-state/helpers/get-axis-data.js +23 -0
- package/lib/victory-state/helpers/get-data.d.ts +15 -0
- package/lib/victory-state/helpers/get-data.js +99 -0
- package/lib/victory-state/helpers/get-domain.d.ts +6 -0
- package/lib/victory-state/helpers/get-domain.js +82 -0
- package/lib/victory-state/helpers/get-range.d.ts +6 -0
- package/lib/victory-state/helpers/get-range.js +46 -0
- package/lib/victory-state/helpers/get-scale.d.ts +6 -0
- package/lib/victory-state/helpers/get-scale.js +74 -0
- package/lib/victory-state/index.d.ts +3 -0
- package/lib/victory-state/index.js +32 -0
- package/lib/victory-state/types.d.ts +24 -0
- package/lib/victory-state/types.js +2 -0
- package/lib/victory-state/victory-provider.d.ts +19 -0
- package/lib/victory-state/victory-provider.js +144 -0
- package/lib/victory-theme/grayscale.d.ts +2 -1
- package/lib/victory-theme/grayscale.js +2 -1
- package/lib/victory-theme/material.d.ts +2 -1
- package/lib/victory-theme/material.js +2 -1
- package/{es/victory-theme/victory-theme-definition.d.ts → lib/victory-theme/types.d.ts} +3 -8
- package/lib/victory-theme/types.js +2 -0
- package/lib/victory-theme/victory-theme.d.ts +4 -3
- package/lib/victory-theme/victory-theme.js +6 -5
- package/lib/victory-transition/victory-transition.d.ts +1 -0
- package/lib/victory-transition/victory-transition.js +2 -1
- package/lib/victory-util/add-events.d.ts +106 -0
- package/lib/victory-util/add-events.js +40 -36
- package/lib/victory-util/axis.d.ts +51 -0
- package/lib/victory-util/axis.js +8 -6
- package/lib/victory-util/collection.d.ts +9 -0
- package/lib/victory-util/collection.js +6 -4
- package/lib/victory-util/common-props.d.ts +84 -0
- package/lib/victory-util/common-props.js +27 -12
- package/lib/victory-util/data.d.ts +75 -0
- package/lib/victory-util/data.js +2 -1
- package/lib/victory-util/default-transitions.d.ts +5 -0
- package/lib/victory-util/default-transitions.js +2 -1
- package/lib/victory-util/domain.d.ts +91 -0
- package/lib/victory-util/domain.js +6 -2
- package/lib/victory-util/events.d.ts +65 -0
- package/lib/victory-util/events.js +13 -9
- package/lib/victory-util/helpers.d.ts +61 -0
- package/lib/victory-util/helpers.js +8 -4
- package/lib/victory-util/hooks/index.d.ts +3 -0
- package/lib/victory-util/hooks/index.js +2 -1
- package/lib/victory-util/hooks/use-animation-state.js +4 -3
- package/lib/victory-util/hooks/use-previous-props.d.ts +2 -0
- package/lib/victory-util/hooks/use-previous-props.js +5 -6
- package/lib/victory-util/immutable.d.ts +12 -0
- package/lib/victory-util/immutable.js +5 -4
- package/lib/victory-util/index.d.ts +29 -0
- package/lib/victory-util/index.js +181 -0
- package/lib/victory-util/label-helpers.d.ts +27 -0
- package/lib/victory-util/label-helpers.js +2 -1
- package/lib/victory-util/line-helpers.d.ts +5 -0
- package/lib/victory-util/line-helpers.js +28 -7
- package/lib/victory-util/log.d.ts +2 -0
- package/lib/victory-util/log.js +2 -1
- package/lib/victory-util/point-path-helpers.d.ts +1 -0
- package/lib/victory-util/point-path-helpers.js +2 -1
- package/lib/victory-util/prop-types.d.ts +51 -0
- package/lib/victory-util/prop-types.js +36 -44
- package/lib/victory-util/scale.d.ts +10 -0
- package/lib/victory-util/scale.js +14 -5
- package/lib/victory-util/selection.d.ts +25 -23
- package/lib/victory-util/selection.js +25 -19
- package/lib/victory-util/style.d.ts +19 -0
- package/lib/victory-util/style.js +2 -1
- package/lib/victory-util/textsize.d.ts +37 -8
- package/lib/victory-util/textsize.js +9 -6
- package/lib/victory-util/timer-context.d.ts +1 -0
- package/lib/victory-util/timer-context.js +2 -1
- package/lib/victory-util/timer.d.ts +3 -2
- package/lib/victory-util/timer.js +2 -1
- package/lib/victory-util/transitions.d.ts +49 -0
- package/lib/victory-util/transitions.js +5 -4
- package/lib/victory-util/type-helpers.d.ts +10 -0
- package/lib/victory-util/type-helpers.js +45 -0
- package/lib/victory-util/user-props.d.ts +21 -0
- package/lib/victory-util/user-props.js +6 -5
- package/lib/victory-util/with-container.d.ts +5 -0
- package/lib/victory-util/with-container.js +44 -0
- package/lib/victory-util/wrapper.d.ts +38 -0
- package/lib/victory-util/wrapper.js +4 -3
- package/package.json +3 -3
- package/src/index.ts +9 -31
- package/src/{types.ts → types/callbacks.ts} +21 -13
- package/src/types/prop-types.ts +195 -0
- package/src/victory-accessible-group/victory-accessible-group.tsx +3 -3
- package/src/victory-animation/util.ts +3 -2
- package/src/victory-animation/victory-animation.tsx +13 -13
- package/src/victory-clip-container/victory-clip-container.tsx +23 -23
- package/src/victory-container/victory-container.tsx +19 -19
- package/src/victory-label/victory-label.tsx +41 -39
- package/src/victory-portal/portal.tsx +1 -1
- package/src/victory-portal/victory-portal.tsx +3 -3
- package/src/victory-primitives/arc.tsx +8 -6
- package/src/victory-primitives/background.tsx +8 -6
- package/src/victory-primitives/border.tsx +8 -6
- package/src/victory-primitives/clip-path.tsx +3 -3
- package/src/victory-primitives/line-segment.tsx +8 -6
- package/src/victory-primitives/point.tsx +10 -8
- package/src/victory-primitives/text.tsx +2 -2
- package/src/victory-primitives/tspan.tsx +1 -1
- package/src/victory-primitives/types.ts +1 -1
- package/src/victory-primitives/whisker.tsx +15 -13
- package/src/victory-state/defaults.ts +2 -0
- package/src/victory-state/helpers/get-axis-data.ts +14 -0
- package/src/victory-state/helpers/get-data.ts +79 -0
- package/src/victory-state/helpers/get-domain.ts +62 -0
- package/src/victory-state/helpers/get-range.ts +39 -0
- package/src/victory-state/helpers/get-scale.ts +64 -0
- package/src/victory-state/index.ts +2 -0
- package/src/victory-state/types.ts +32 -0
- package/src/victory-state/victory-provider.tsx +116 -0
- package/src/victory-theme/grayscale.tsx +62 -62
- package/src/victory-theme/material.tsx +67 -67
- package/src/victory-theme/{victory-theme-definition.ts → types.ts} +10 -14
- package/src/victory-theme/victory-theme.tsx +1 -1
- package/src/victory-transition/victory-transition.tsx +19 -19
- package/src/victory-util/{add-events.js → add-events.tsx} +136 -59
- package/src/victory-util/{axis.js → axis.tsx} +17 -18
- package/src/victory-util/{collection.js → collection.tsx} +14 -10
- package/src/victory-util/common-props.tsx +307 -0
- package/src/victory-util/{data.js → data.ts} +14 -10
- package/src/victory-util/{default-transitions.js → default-transitions.ts} +20 -18
- package/src/victory-util/{domain.js → domain.ts} +26 -23
- package/src/victory-util/{events.js → events.ts} +82 -31
- package/src/victory-util/{helpers.js → helpers.ts} +41 -22
- package/src/victory-util/hooks/{index.js → index.ts} +0 -0
- package/src/victory-util/hooks/use-animation-state.js +12 -12
- package/src/victory-util/hooks/use-previous-props.ts +9 -0
- package/src/victory-util/{immutable.js → immutable.ts} +14 -10
- package/src/victory-util/index.ts +28 -0
- package/src/victory-util/{label-helpers.js → label-helpers.ts} +7 -7
- package/src/victory-util/line-helpers.ts +104 -0
- package/src/victory-util/{log.js → log.ts} +1 -1
- package/src/victory-util/{prop-types.js → prop-types.ts} +103 -101
- package/src/victory-util/{scale.js → scale.ts} +29 -16
- package/src/victory-util/selection.ts +158 -0
- package/src/victory-util/{style.js → style.ts} +3 -3
- package/src/victory-util/{textsize.js → textsize.ts} +32 -17
- package/src/victory-util/timer-context.ts +1 -1
- package/src/victory-util/timer.ts +5 -10
- package/src/victory-util/{transitions.js → transitions.ts} +50 -22
- package/src/victory-util/type-helpers.ts +50 -0
- package/src/victory-util/{user-props.js → user-props.ts} +16 -11
- package/src/victory-util/with-container.tsx +41 -0
- package/src/victory-util/{wrapper.js → wrapper.tsx} +38 -33
- package/es/types.js +0 -1
- package/es/victory-theme/victory-theme-definition.js +0 -1
- package/es/victory-util/types.d.ts +0 -188
- package/es/victory-util/types.js +0 -1
- package/lib/types.js +0 -1
- package/lib/victory-theme/victory-theme-definition.js +0 -1
- package/lib/victory-util/types.d.ts +0 -188
- package/lib/victory-util/types.js +0 -1
- package/src/victory-util/common-props.js +0 -197
- package/src/victory-util/hooks/use-previous-props.js +0 -9
- package/src/victory-util/line-helpers.js +0 -54
- package/src/victory-util/selection.d.ts +0 -23
- package/src/victory-util/selection.js +0 -98
- package/src/victory-util/textsize.d.ts +0 -8
- package/src/victory-util/types.ts +0 -247
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import _difference from "lodash/difference";
|
|
2
|
-
import _isNil from "lodash/isNil";
|
|
3
|
-
import _isEmpty from "lodash/isEmpty";
|
|
4
1
|
import _without from "lodash/without";
|
|
5
2
|
import _pick from "lodash/pick";
|
|
6
|
-
import _isFunction from "lodash/isFunction";
|
|
7
3
|
import _keys from "lodash/keys";
|
|
8
|
-
import
|
|
4
|
+
import _isNil from "lodash/isNil";
|
|
5
|
+
import _isFunction from "lodash/isFunction";
|
|
6
|
+
import _isEmpty from "lodash/isEmpty";
|
|
7
|
+
import _difference from "lodash/difference";
|
|
9
8
|
import _defaults from "lodash/defaults";
|
|
9
|
+
import _assign from "lodash/assign";
|
|
10
10
|
|
|
11
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
12
|
|
|
@@ -44,11 +44,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
44
44
|
import React from "react";
|
|
45
45
|
import * as Events from "./events";
|
|
46
46
|
import isEqual from "react-fast-compare";
|
|
47
|
-
import { VictoryTransition } from "../victory-transition/victory-transition";
|
|
47
|
+
import { VictoryTransition } from "../victory-transition/victory-transition";
|
|
48
|
+
|
|
49
|
+
// DISCLAIMER:
|
|
48
50
|
// This file is not currently tested, and it is first on the list of files
|
|
49
51
|
// to refactor in our current refactoring effort. Please do not make changes
|
|
50
52
|
// to this file without manual testing and/or refactoring and adding tests.
|
|
51
|
-
|
|
52
53
|
var datumHasXandY = function (datum) {
|
|
53
54
|
return !_isNil(datum._x) && !_isNil(datum._y);
|
|
54
55
|
}; // used for checking state changes. Expected components can be passed in via options
|
|
@@ -62,44 +63,45 @@ var defaultComponents = [{
|
|
|
62
63
|
}, {
|
|
63
64
|
name: "labels"
|
|
64
65
|
}];
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
_inherits(addEvents, _WrappedComponent);
|
|
66
|
+
export function addEvents(WrappedComponent) {
|
|
67
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
// @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
|
|
70
|
+
var AddEventsMixin = /*#__PURE__*/function (_WrappedComponent) {
|
|
71
|
+
_inherits(AddEventsMixin, _WrappedComponent);
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
var _super = _createSuper(AddEventsMixin);
|
|
74
|
+
|
|
75
|
+
function AddEventsMixin(props) {
|
|
72
76
|
var _this;
|
|
73
77
|
|
|
74
|
-
_classCallCheck(this,
|
|
78
|
+
_classCallCheck(this, AddEventsMixin);
|
|
75
79
|
|
|
76
80
|
_this = _super.call(this, props);
|
|
77
|
-
var getScopedEvents = Events.getScopedEvents.bind(_assertThisInitialized(_this));
|
|
78
|
-
var boundGetEvents = Events.getEvents.bind(_assertThisInitialized(_this));
|
|
79
81
|
_this.state = {};
|
|
82
|
+
_this.getEventState = Events.getEventState.bind(_assertThisInitialized(_this));
|
|
83
|
+
_this.getScopedEvents = Events.getScopedEvents.bind(_assertThisInitialized(_this));
|
|
80
84
|
|
|
81
85
|
_this.getEvents = function (p, target, eventKey) {
|
|
82
|
-
return
|
|
86
|
+
return Events.getEvents.call(_assertThisInitialized(_this), p, target, eventKey, _this.getScopedEvents);
|
|
83
87
|
};
|
|
84
88
|
|
|
85
|
-
_this.
|
|
86
|
-
|
|
87
|
-
var calculatedValues = _this.getCalculatedValues(props);
|
|
88
|
-
|
|
89
|
-
_this.cacheValues(calculatedValues);
|
|
90
|
-
|
|
91
|
-
_this.externalMutations = _this.getExternalMutations(props);
|
|
92
|
-
_this.calculatedState = _this.getStateChanges(props);
|
|
89
|
+
_this.externalMutations = _this.getExternalMutations(_this.props);
|
|
90
|
+
_this.calculatedState = _this.getStateChanges(_this.props);
|
|
93
91
|
_this.globalEvents = {};
|
|
94
92
|
_this.prevGlobalEventKeys = [];
|
|
95
93
|
_this.boundGlobalEvents = {};
|
|
94
|
+
|
|
95
|
+
_this.cacheValues(_this.getCalculatedValues(props));
|
|
96
|
+
|
|
96
97
|
return _this;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
_createClass(
|
|
100
|
+
_createClass(AddEventsMixin, [{
|
|
100
101
|
key: "shouldComponentUpdate",
|
|
101
102
|
value: function shouldComponentUpdate(nextProps) {
|
|
102
|
-
var externalMutations = this.getExternalMutations(nextProps);
|
|
103
|
+
var externalMutations = this.getExternalMutations(nextProps); // @ts-expect-error "Property 'animating' does not exist on type EventMixinCommonProps"
|
|
104
|
+
|
|
103
105
|
var animating = this.props.animating || this.props.animate;
|
|
104
106
|
var newMutation = !isEqual(externalMutations, this.externalMutations);
|
|
105
107
|
|
|
@@ -203,7 +205,6 @@ export default (function (WrappedComponent, options) {
|
|
|
203
205
|
return _isEmpty(result) ? undefined : result;
|
|
204
206
|
};
|
|
205
207
|
|
|
206
|
-
options = options || {};
|
|
207
208
|
var components = options.components || defaultComponents;
|
|
208
209
|
var stateChanges = components.map(function (component) {
|
|
209
210
|
if (!props.standalone && component.name === "parent") {
|
|
@@ -278,7 +279,7 @@ export default (function (WrappedComponent, options) {
|
|
|
278
279
|
}, {
|
|
279
280
|
key: "getBaseProps",
|
|
280
281
|
value: function getBaseProps(props, getSharedEventState) {
|
|
281
|
-
getSharedEventState = getSharedEventState || this.getSharedEventState;
|
|
282
|
+
getSharedEventState = getSharedEventState || this.getSharedEventState.bind(this);
|
|
282
283
|
var sharedParentState = getSharedEventState("parent", "parent");
|
|
283
284
|
var parentState = this.getEventState("parent", "parent");
|
|
284
285
|
|
|
@@ -289,7 +290,7 @@ export default (function (WrappedComponent, options) {
|
|
|
289
290
|
|
|
290
291
|
var modifiedProps = _defaults({}, parentProps, props);
|
|
291
292
|
|
|
292
|
-
return
|
|
293
|
+
return typeof WrappedComponent.getBaseProps === "function" ? WrappedComponent.getBaseProps(modifiedProps) : {};
|
|
293
294
|
}
|
|
294
295
|
}, {
|
|
295
296
|
key: "getAllEvents",
|
|
@@ -354,11 +355,14 @@ export default (function (WrappedComponent, options) {
|
|
|
354
355
|
}, {
|
|
355
356
|
key: "animateComponent",
|
|
356
357
|
value: function animateComponent(props, defaultAnimationWhitelist) {
|
|
357
|
-
var
|
|
358
|
+
var _props$animate;
|
|
359
|
+
|
|
360
|
+
var animationWhitelist = typeof props.animate === "object" && ((_props$animate = props.animate) === null || _props$animate === void 0 ? void 0 : _props$animate.animationWhitelist) || defaultAnimationWhitelist;
|
|
361
|
+
var Comp = this.constructor;
|
|
358
362
|
return /*#__PURE__*/React.createElement(VictoryTransition, {
|
|
359
363
|
animate: props.animate,
|
|
360
364
|
animationWhitelist: animationWhitelist
|
|
361
|
-
}, /*#__PURE__*/React.createElement(
|
|
365
|
+
}, /*#__PURE__*/React.createElement(Comp, props));
|
|
362
366
|
} // Used by `VictoryLine` and `VictoryArea`
|
|
363
367
|
|
|
364
368
|
}, {
|
|
@@ -417,6 +421,9 @@ export default (function (WrappedComponent, options) {
|
|
|
417
421
|
}
|
|
418
422
|
}]);
|
|
419
423
|
|
|
420
|
-
return
|
|
424
|
+
return AddEventsMixin;
|
|
421
425
|
}(WrappedComponent);
|
|
422
|
-
|
|
426
|
+
|
|
427
|
+
return AddEventsMixin;
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=add-events.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { D3Scale } from "../types/prop-types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the axis (x or y) of a particular axis component
|
|
4
|
+
* @param {Object} props: the props object.
|
|
5
|
+
* @param {Boolean} horizontal: true for horizontal charts
|
|
6
|
+
* @returns {String} the dimension appropriate for the axis given its props
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAxis(props: any): "x" | "y";
|
|
9
|
+
/**
|
|
10
|
+
* Returns all axis components that pass a given predicate
|
|
11
|
+
* @param {Array} childComponents: an array of children
|
|
12
|
+
* @param {Function} predicate: a predicate function that will be called with each
|
|
13
|
+
* @returns {Array} all axis components that pass the given predicate or []
|
|
14
|
+
*/
|
|
15
|
+
export declare function findAxisComponents(childComponents: any, predicate?: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a single axis component of the desired axis type (x or y)
|
|
18
|
+
* @param {Array} childComponents: an array of children
|
|
19
|
+
* @param {String} axis: desired axis either "x" or "y".
|
|
20
|
+
* @returns {ReactComponent} an axis component of the desired axis or undefined
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAxisComponent(childComponents: any, axis: any): any;
|
|
23
|
+
/**
|
|
24
|
+
* Returns all axis components of the desired axis type (x or y) along with any
|
|
25
|
+
* parent components excluding VictoryChart
|
|
26
|
+
* @param {Array} childComponents: an optional array of children.
|
|
27
|
+
* @param {String} type: desired axis either "dependent" or "independent".
|
|
28
|
+
* @returns {ReactComponent} an axis component of the desired type or undefined
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAxisComponentsWithParent(childComponents: any, type: any): any;
|
|
31
|
+
export declare function getOrigin(domain: any): {
|
|
32
|
+
x: number | Date;
|
|
33
|
+
y: number | Date;
|
|
34
|
+
};
|
|
35
|
+
export declare function getOriginSign(origin: any, domain: any): "positive" | "negative";
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} props: axis component props
|
|
38
|
+
* @returns {Boolean} true when the axis is vertical
|
|
39
|
+
*/
|
|
40
|
+
export declare function isVertical(props: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* @param {Object} props: axis component props
|
|
43
|
+
* @returns {Boolean} true when tickValues contain strings
|
|
44
|
+
*/
|
|
45
|
+
export declare function stringTicks(props: any): boolean;
|
|
46
|
+
export declare function getTickFormat(props: any, scale: any): any;
|
|
47
|
+
export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[];
|
|
48
|
+
export declare function getDomain(props: any, axis?: any): any;
|
|
49
|
+
export declare function getAxisValue(props: any, axis: any): any;
|
|
50
|
+
export declare function modifyProps(props: any, fallbackProps: any): any;
|
|
51
|
+
//# sourceMappingURL=axis.d.ts.map
|
package/es/victory-util/axis.js
CHANGED
|
@@ -27,13 +27,13 @@ import React from "react";
|
|
|
27
27
|
import * as Collection from "./collection";
|
|
28
28
|
import * as Domain from "./domain";
|
|
29
29
|
import * as Helpers from "./helpers";
|
|
30
|
+
|
|
30
31
|
/**
|
|
31
32
|
* Returns the axis (x or y) of a particular axis component
|
|
32
33
|
* @param {Object} props: the props object.
|
|
33
34
|
* @param {Boolean} horizontal: true for horizontal charts
|
|
34
35
|
* @returns {String} the dimension appropriate for the axis given its props
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
37
|
export function getAxis(props) {
|
|
38
38
|
var dependentAxis = props.dependentAxis;
|
|
39
39
|
return dependentAxis ? "y" : "x";
|
|
@@ -219,7 +219,7 @@ function getTickArray(props) {
|
|
|
219
219
|
}) : _range(1, tickValues.length + 1);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
var tickArray = ticks ? _uniq(ticks) : getTicksFromFormat(
|
|
222
|
+
var tickArray = ticks ? _uniq(ticks) : getTicksFromFormat();
|
|
223
223
|
|
|
224
224
|
var buildTickArray = function (arr) {
|
|
225
225
|
var newTickArray = [];
|
|
@@ -264,11 +264,11 @@ export function getTickFormat(props, scale) {
|
|
|
264
264
|
return defaultTickFormat || scaleTickFormat;
|
|
265
265
|
} else if (tickFormat && Array.isArray(tickFormat)) {
|
|
266
266
|
var tickArray = getTickArray(props);
|
|
267
|
-
var tickArrayIndices = tickArray ? tickArray.map(function (v) {
|
|
267
|
+
var tickArrayIndices = tickArray === null || tickArray === void 0 ? void 0 : tickArray.map(function (v) {
|
|
268
268
|
return v.index;
|
|
269
|
-
})
|
|
269
|
+
});
|
|
270
270
|
var filteredTickFormat = tickFormat.filter(function (t, index) {
|
|
271
|
-
return tickArrayIndices.includes(index);
|
|
271
|
+
return tickArrayIndices === null || tickArrayIndices === void 0 ? void 0 : tickArrayIndices.includes(index);
|
|
272
272
|
});
|
|
273
273
|
return function (x, index) {
|
|
274
274
|
return filteredTickFormat[index];
|
|
@@ -302,7 +302,8 @@ function downsampleTicks(ticks, tickCount) {
|
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
export function getTicks(props, scale
|
|
305
|
+
export function getTicks(props, scale) {
|
|
306
|
+
var filterZero = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
306
307
|
var tickCount = props.tickCount;
|
|
307
308
|
var tickArray = getTickArray(props);
|
|
308
309
|
var tickValues = tickArray ? tickArray.map(function (v) {
|
|
@@ -424,4 +425,5 @@ export function modifyProps(props, fallbackProps) {
|
|
|
424
425
|
return Helpers.modifyProps(_assign({}, props, {
|
|
425
426
|
theme: theme
|
|
426
427
|
}), fallbackProps, "axis");
|
|
427
|
-
}
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=axis.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function containsStrings<T>(collection: Array<T>): boolean;
|
|
2
|
+
export declare function containsDates(collection: Array<number | Date>): boolean;
|
|
3
|
+
export declare function containsNumbers(collection: any): boolean;
|
|
4
|
+
export declare function containsOnlyStrings(collection: any): any;
|
|
5
|
+
export declare function isArrayOfArrays(collection: any): any;
|
|
6
|
+
export declare function removeUndefined(arr: any): any;
|
|
7
|
+
export declare function getMaxValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
|
|
8
|
+
export declare function getMinValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
|
|
9
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -10,7 +10,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
10
10
|
|
|
11
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
12
|
|
|
13
|
-
/* eslint-disable no-use-before-define */
|
|
14
13
|
function isNonEmptyArray(collection) {
|
|
15
14
|
return Array.isArray(collection) && collection.length > 0;
|
|
16
15
|
}
|
|
@@ -49,7 +48,8 @@ export function getMaxValue(arr) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
var array = arr.concat(values);
|
|
52
|
-
return containsDates(array) ? new Date(Math.max.apply(Math, _toConsumableArray(array)))
|
|
51
|
+
return containsDates(array) ? new Date(Math.max.apply(Math, _toConsumableArray(array))) // Dates will be coerced to numbers
|
|
52
|
+
: Math.max.apply(Math, _toConsumableArray(array));
|
|
53
53
|
}
|
|
54
54
|
export function getMinValue(arr) {
|
|
55
55
|
for (var _len2 = arguments.length, values = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
@@ -57,5 +57,7 @@ export function getMinValue(arr) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
var array = arr.concat(values);
|
|
60
|
-
return containsDates(array) ? new Date(Math.min.apply(Math, _toConsumableArray(array)))
|
|
61
|
-
|
|
60
|
+
return containsDates(array) ? new Date(Math.min.apply(Math, _toConsumableArray(array))) // Dates will be coerced to numbers
|
|
61
|
+
: Math.min.apply(Math, _toConsumableArray(array));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
3
|
+
import { PaddingProps, VictoryThemeDefinition } from "../victory-theme/types";
|
|
4
|
+
import { AnimatePropTypeInterface, CategoryPropType, ColorScalePropType, D3Scale, DataGetterPropType, DomainPaddingPropType, DomainPropType, EventCallbackInterface, RangePropType, ScalePropType, SortOrderPropType, StringOrNumberOrList } from "../types/prop-types";
|
|
5
|
+
import { NumberOrCallback, StringOrCallback } from "../types/callbacks";
|
|
6
|
+
export interface VictoryDatableProps {
|
|
7
|
+
categories?: CategoryPropType;
|
|
8
|
+
data?: readonly any[];
|
|
9
|
+
dataComponent?: React.ReactElement;
|
|
10
|
+
domain?: DomainPropType;
|
|
11
|
+
domainPadding?: DomainPaddingPropType;
|
|
12
|
+
samples?: number;
|
|
13
|
+
sortKey?: DataGetterPropType;
|
|
14
|
+
sortOrder?: SortOrderPropType;
|
|
15
|
+
x?: DataGetterPropType;
|
|
16
|
+
y?: DataGetterPropType;
|
|
17
|
+
y0?: DataGetterPropType;
|
|
18
|
+
}
|
|
19
|
+
export interface VictoryCommonThemeProps {
|
|
20
|
+
animate?: boolean | AnimatePropTypeInterface;
|
|
21
|
+
colorScale?: ColorScalePropType;
|
|
22
|
+
containerComponent?: React.ReactElement;
|
|
23
|
+
domainPadding?: DomainPaddingPropType;
|
|
24
|
+
externalEventMutations?: EventCallbackInterface<string | string[], StringOrNumberOrList>[];
|
|
25
|
+
groupComponent?: React.ReactElement;
|
|
26
|
+
height?: number;
|
|
27
|
+
horizontal?: boolean;
|
|
28
|
+
maxDomain?: number | {
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
};
|
|
32
|
+
minDomain?: number | {
|
|
33
|
+
x?: number;
|
|
34
|
+
y?: number;
|
|
35
|
+
};
|
|
36
|
+
name?: string;
|
|
37
|
+
origin?: OriginType;
|
|
38
|
+
padding?: PaddingProps;
|
|
39
|
+
polar?: boolean;
|
|
40
|
+
range?: RangePropType;
|
|
41
|
+
scale?: ScalePropType | D3Scale | {
|
|
42
|
+
x?: ScalePropType | D3Scale;
|
|
43
|
+
y?: ScalePropType | D3Scale;
|
|
44
|
+
};
|
|
45
|
+
sharedEvents?: {
|
|
46
|
+
events: any[];
|
|
47
|
+
getEventState: Function;
|
|
48
|
+
};
|
|
49
|
+
singleQuadrantDomainPadding?: boolean | {
|
|
50
|
+
x?: boolean;
|
|
51
|
+
y?: boolean;
|
|
52
|
+
};
|
|
53
|
+
standalone?: boolean;
|
|
54
|
+
width?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface VictoryCommonProps extends VictoryCommonThemeProps {
|
|
57
|
+
theme?: VictoryThemeDefinition;
|
|
58
|
+
}
|
|
59
|
+
export interface VictoryCommonPrimitiveProps {
|
|
60
|
+
active?: boolean;
|
|
61
|
+
ariaLabel?: StringOrCallback;
|
|
62
|
+
className?: string;
|
|
63
|
+
clipPath?: string;
|
|
64
|
+
data?: any;
|
|
65
|
+
desc?: string | Function;
|
|
66
|
+
disableInlineStyles?: boolean;
|
|
67
|
+
events?: object;
|
|
68
|
+
id?: number | string | Function;
|
|
69
|
+
index?: number | string;
|
|
70
|
+
origin?: OriginType;
|
|
71
|
+
polar?: boolean;
|
|
72
|
+
role?: string;
|
|
73
|
+
scale?: any;
|
|
74
|
+
shapeRendering?: string;
|
|
75
|
+
style?: any;
|
|
76
|
+
tabIndex?: NumberOrCallback;
|
|
77
|
+
transform?: string;
|
|
78
|
+
}
|
|
79
|
+
export declare const CommonProps: {
|
|
80
|
+
dataProps: React.WeakValidationMap<VictoryDatableProps>;
|
|
81
|
+
baseProps: React.WeakValidationMap<VictoryCommonProps>;
|
|
82
|
+
primitiveProps: React.WeakValidationMap<VictoryCommonPrimitiveProps>;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=common-props.d.ts.map
|
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import * as CustomPropTypes from "./prop-types";
|
|
3
|
-
|
|
3
|
+
var dataProps = {
|
|
4
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
4
5
|
categories: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.shape({
|
|
5
6
|
x: PropTypes.arrayOf(PropTypes.string),
|
|
6
7
|
y: PropTypes.arrayOf(PropTypes.string)
|
|
7
8
|
})]),
|
|
9
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
8
10
|
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
9
11
|
dataComponent: PropTypes.element,
|
|
10
12
|
disableInlineStyles: PropTypes.bool,
|
|
11
13
|
labelComponent: PropTypes.element,
|
|
12
14
|
labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array]),
|
|
13
15
|
samples: CustomPropTypes.nonNegative,
|
|
14
|
-
sortKey: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
16
|
+
sortKey: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string.isRequired)]),
|
|
15
17
|
sortOrder: PropTypes.oneOf(["ascending", "descending"]),
|
|
16
18
|
style: PropTypes.shape({
|
|
17
19
|
parent: PropTypes.object,
|
|
18
20
|
data: PropTypes.object,
|
|
19
21
|
labels: PropTypes.object
|
|
20
22
|
}),
|
|
21
|
-
x: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
22
|
-
y: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
23
|
-
y0: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string)])
|
|
23
|
+
x: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string.isRequired)]),
|
|
24
|
+
y: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string.isRequired)]),
|
|
25
|
+
y0: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string, PropTypes.arrayOf(PropTypes.string.isRequired)])
|
|
24
26
|
};
|
|
25
|
-
|
|
27
|
+
var baseProps = {
|
|
26
28
|
animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
27
29
|
containerComponent: PropTypes.element,
|
|
28
30
|
domain: PropTypes.oneOfType([CustomPropTypes.domain, PropTypes.shape({
|
|
29
31
|
x: CustomPropTypes.domain,
|
|
30
32
|
y: CustomPropTypes.domain
|
|
31
33
|
})]),
|
|
34
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
32
35
|
maxDomain: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date), PropTypes.shape({
|
|
33
36
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
34
37
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)])
|
|
35
38
|
})]),
|
|
39
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
36
40
|
minDomain: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date), PropTypes.shape({
|
|
37
41
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
38
42
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)])
|
|
39
43
|
})]),
|
|
44
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
40
45
|
domainPadding: PropTypes.oneOfType([PropTypes.shape({
|
|
41
46
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),
|
|
42
47
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)])
|
|
@@ -47,6 +52,7 @@ export var baseProps = {
|
|
|
47
52
|
eventKey: PropTypes.oneOfType([PropTypes.array, CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), PropTypes.string]),
|
|
48
53
|
eventHandlers: PropTypes.object
|
|
49
54
|
})),
|
|
55
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
50
56
|
externalEventMutations: PropTypes.arrayOf(PropTypes.shape({
|
|
51
57
|
callback: PropTypes.func,
|
|
52
58
|
childName: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
@@ -57,10 +63,12 @@ export var baseProps = {
|
|
|
57
63
|
groupComponent: PropTypes.element,
|
|
58
64
|
height: CustomPropTypes.nonNegative,
|
|
59
65
|
name: PropTypes.string,
|
|
66
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
60
67
|
origin: PropTypes.shape({
|
|
61
68
|
x: PropTypes.number,
|
|
62
69
|
y: PropTypes.number
|
|
63
70
|
}),
|
|
71
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
64
72
|
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
65
73
|
top: PropTypes.number,
|
|
66
74
|
bottom: PropTypes.number,
|
|
@@ -69,17 +77,19 @@ export var baseProps = {
|
|
|
69
77
|
})]),
|
|
70
78
|
polar: PropTypes.bool,
|
|
71
79
|
range: PropTypes.oneOfType([CustomPropTypes.domain, PropTypes.shape({
|
|
72
|
-
x: CustomPropTypes.domain,
|
|
73
|
-
y: CustomPropTypes.domain
|
|
80
|
+
x: CustomPropTypes.domain.isRequired,
|
|
81
|
+
y: CustomPropTypes.domain.isRequired
|
|
74
82
|
})]),
|
|
75
83
|
scale: PropTypes.oneOfType([CustomPropTypes.scale, PropTypes.shape({
|
|
76
|
-
x: CustomPropTypes.scale,
|
|
77
|
-
y: CustomPropTypes.scale
|
|
84
|
+
x: CustomPropTypes.scale.isRequired,
|
|
85
|
+
y: CustomPropTypes.scale.isRequired
|
|
78
86
|
})]),
|
|
87
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
79
88
|
sharedEvents: PropTypes.shape({
|
|
80
89
|
events: PropTypes.array,
|
|
81
90
|
getEventState: PropTypes.func
|
|
82
91
|
}),
|
|
92
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
83
93
|
singleQuadrantDomainPadding: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
|
84
94
|
x: PropTypes.oneOfType([PropTypes.bool]),
|
|
85
95
|
y: PropTypes.oneOfType([PropTypes.bool])
|
|
@@ -88,7 +98,7 @@ export var baseProps = {
|
|
|
88
98
|
theme: PropTypes.object,
|
|
89
99
|
width: CustomPropTypes.nonNegative
|
|
90
100
|
};
|
|
91
|
-
|
|
101
|
+
var primitiveProps = {
|
|
92
102
|
active: PropTypes.bool,
|
|
93
103
|
ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
94
104
|
className: PropTypes.string,
|
|
@@ -99,6 +109,7 @@ export var primitiveProps = {
|
|
|
99
109
|
events: PropTypes.object,
|
|
100
110
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
101
111
|
index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
112
|
+
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
102
113
|
origin: PropTypes.shape({
|
|
103
114
|
x: PropTypes.number,
|
|
104
115
|
y: PropTypes.number
|
|
@@ -113,4 +124,10 @@ export var primitiveProps = {
|
|
|
113
124
|
style: PropTypes.object,
|
|
114
125
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
115
126
|
transform: PropTypes.string
|
|
116
|
-
};
|
|
127
|
+
};
|
|
128
|
+
export var CommonProps = {
|
|
129
|
+
dataProps: dataProps,
|
|
130
|
+
baseProps: baseProps,
|
|
131
|
+
primitiveProps: primitiveProps
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=common-props.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare function formatDataFromDomain(dataset: any, domain: any, defaultBaseline: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* Returns an object mapping string data to numeric data
|
|
4
|
+
* @param {Object} props: the props object
|
|
5
|
+
* @param {String} axis: the current axis
|
|
6
|
+
* @returns {Object} an object mapping string data to numeric data
|
|
7
|
+
*/
|
|
8
|
+
export declare function createStringMap(props: any, axis: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Reduces the size of a data array, such that it is <= maxPoints.
|
|
11
|
+
* @param {Array} data: an array of data; must be sorted
|
|
12
|
+
* @param {Number} maxPoints: maximum number of data points to return
|
|
13
|
+
* @param {Number} startingIndex: the index of the data[0] *in the entire dataset*; this function
|
|
14
|
+
assumes `data` param is a subset of larger dataset that has been zoommed
|
|
15
|
+
* @returns {Array} an array of data, a subset of data param
|
|
16
|
+
*/
|
|
17
|
+
export declare function downsample(data: any, maxPoints: any, startingIndex?: number): any;
|
|
18
|
+
/**
|
|
19
|
+
* Returns formatted data. Data accessors are applied, and string values are replaced.
|
|
20
|
+
* @param {Array} dataset: the original domain
|
|
21
|
+
* @param {Object} props: the props object
|
|
22
|
+
* @param {Array} expectedKeys: an array of expected data keys
|
|
23
|
+
* @returns {Array} the formatted data
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatData(dataset: any[], props: any, expectedKeys?: string[]): any;
|
|
26
|
+
/**
|
|
27
|
+
* Returns generated x and y data based on domain and sample from props
|
|
28
|
+
* @param {Object} props: the props object
|
|
29
|
+
* @returns {Array} an array of data
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateData(props: any): {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}[];
|
|
35
|
+
/**
|
|
36
|
+
* Returns an array of categories for a given axis
|
|
37
|
+
* @param {Object} props: the props object
|
|
38
|
+
* @param {String} axis: the current axis
|
|
39
|
+
* @returns {Array} an array of categories
|
|
40
|
+
*/
|
|
41
|
+
export declare function getCategories(props: any, axis: any): any;
|
|
42
|
+
/**
|
|
43
|
+
* Returns an array of formatted data
|
|
44
|
+
* @param {Object} props: the props object
|
|
45
|
+
* @returns {Array} an array of data
|
|
46
|
+
*/
|
|
47
|
+
export declare function getData(props: any): any;
|
|
48
|
+
/**
|
|
49
|
+
* Returns an array of strings from axis tickValues for a given axis
|
|
50
|
+
* @param {Object} props: the props object
|
|
51
|
+
* @param {String} axis: the current axis
|
|
52
|
+
* @returns {Array} an array of strings
|
|
53
|
+
*/
|
|
54
|
+
export declare function getStringsFromAxes(props: any, axis: any): any;
|
|
55
|
+
/**
|
|
56
|
+
* Returns an array of strings from categories for a given axis
|
|
57
|
+
* @param {Object} props: the props object
|
|
58
|
+
* @param {String} axis: the current axis
|
|
59
|
+
* @returns {Array} an array of strings
|
|
60
|
+
*/
|
|
61
|
+
export declare function getStringsFromCategories(props: any, axis: any): any;
|
|
62
|
+
/**
|
|
63
|
+
* Returns an array of strings from data
|
|
64
|
+
* @param {Object} props: the props object
|
|
65
|
+
* @param {String} axis: the current axis
|
|
66
|
+
* @returns {Array} an array of strings
|
|
67
|
+
*/
|
|
68
|
+
export declare function getStringsFromData(props: any, axis: any): any;
|
|
69
|
+
/**
|
|
70
|
+
* Checks whether a given component can be used to calculate data
|
|
71
|
+
* @param {Component} component: a React component instance
|
|
72
|
+
* @returns {Boolean} Returns true if the given component has a role included in the whitelist
|
|
73
|
+
*/
|
|
74
|
+
export declare function isDataComponent(component: any): boolean;
|
|
75
|
+
//# sourceMappingURL=data.d.ts.map
|
package/es/victory-util/data.js
CHANGED
|
@@ -454,4 +454,5 @@ export function isDataComponent(component) {
|
|
|
454
454
|
|
|
455
455
|
var whitelist = ["area", "bar", "boxplot", "candlestick", "errorbar", "group", "histogram", "line", "pie", "scatter", "stack", "voronoi"];
|
|
456
456
|
return _includes(whitelist, role);
|
|
457
|
-
}
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AnimatePropTypeInterface } from "../types/prop-types";
|
|
2
|
+
export declare function continuousTransitions(): AnimatePropTypeInterface;
|
|
3
|
+
export declare function continuousPolarTransitions(): AnimatePropTypeInterface;
|
|
4
|
+
export declare function discreteTransitions(): AnimatePropTypeInterface;
|
|
5
|
+
//# sourceMappingURL=default-transitions.d.ts.map
|