@pie-lib/charting 7.0.4-next.3 → 7.0.4-next.30
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/_virtual/_rolldown/runtime.js +23 -0
- package/dist/actions-button.d.ts +26 -0
- package/dist/actions-button.js +84 -0
- package/dist/autosize-input.d.ts +10 -0
- package/dist/autosize-input.js +66 -0
- package/dist/axes.d.ts +84 -0
- package/dist/axes.js +376 -0
- package/dist/bars/bar.d.ts +47 -0
- package/dist/bars/bar.js +27 -0
- package/dist/bars/common/bars.d.ts +98 -0
- package/dist/bars/common/bars.js +174 -0
- package/dist/bars/common/correct-check-icon.d.ts +18 -0
- package/dist/bars/common/correct-check-icon.js +50 -0
- package/dist/bars/histogram.d.ts +47 -0
- package/dist/bars/histogram.js +28 -0
- package/dist/chart-setup.d.ts +29 -0
- package/dist/chart-setup.js +231 -0
- package/dist/chart-type.d.ts +32 -0
- package/dist/chart-type.js +68 -0
- package/dist/chart-types.d.ts +41 -0
- package/dist/chart-types.js +17 -0
- package/dist/chart.d.ts +88 -0
- package/dist/chart.js +250 -0
- package/dist/common/correctness-indicators.d.ts +70 -0
- package/dist/common/correctness-indicators.js +106 -0
- package/dist/common/drag-handle.d.ts +129 -0
- package/dist/common/drag-handle.js +120 -0
- package/dist/common/drag-icon.d.ts +23 -0
- package/dist/common/drag-icon.js +45 -0
- package/dist/common/styles.d.ts +23 -0
- package/dist/common/styles.js +17 -0
- package/dist/grid.d.ts +45 -0
- package/dist/grid.js +56 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +6 -0
- package/dist/key-legend.d.ts +19 -0
- package/dist/key-legend.js +46 -0
- package/dist/line/common/drag-handle.d.ts +120 -0
- package/dist/line/common/drag-handle.js +92 -0
- package/dist/line/common/line.d.ts +96 -0
- package/dist/line/common/line.js +114 -0
- package/dist/line/line-cross.d.ts +47 -0
- package/dist/line/line-cross.js +133 -0
- package/dist/line/line-dot.d.ts +47 -0
- package/dist/line/line-dot.js +101 -0
- package/dist/mark-label.d.ts +55 -0
- package/dist/mark-label.js +138 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +101 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisBottom.js +46 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisLeft.js +47 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +63 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +44 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +50 -0
- package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/align.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/base.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/clamp.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/constant.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/domain.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/exponent.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/interpolate.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/nice.js +37 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/padding.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/range.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/reverse.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/round.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +58 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/unknown.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/zero.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/band.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/point.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +29 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Bar.js +29 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Circle.js +29 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +47 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +50 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +53 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-interpolate.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-scale.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-time.js +8 -0
- package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
- package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
- package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +32 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
- package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
- package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
- package/dist/plot/common/plot.d.ts +103 -0
- package/dist/plot/common/plot.js +227 -0
- package/dist/plot/dot.d.ts +47 -0
- package/dist/plot/dot.js +62 -0
- package/dist/plot/line.d.ts +47 -0
- package/dist/plot/line.js +84 -0
- package/dist/tool-menu.d.ts +31 -0
- package/dist/utils.d.ts +39 -0
- package/dist/utils.js +101 -0
- package/package.json +39 -28
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1116
- package/LICENSE.md +0 -5
- package/lib/actions-button.js +0 -145
- package/lib/actions-button.js.map +0 -1
- package/lib/axes.js +0 -643
- package/lib/axes.js.map +0 -1
- package/lib/bars/bar.js +0 -58
- package/lib/bars/bar.js.map +0 -1
- package/lib/bars/common/bars.js +0 -277
- package/lib/bars/common/bars.js.map +0 -1
- package/lib/bars/common/correct-check-icon.js +0 -54
- package/lib/bars/common/correct-check-icon.js.map +0 -1
- package/lib/bars/histogram.js +0 -59
- package/lib/bars/histogram.js.map +0 -1
- package/lib/chart-setup.js +0 -382
- package/lib/chart-setup.js.map +0 -1
- package/lib/chart-type.js +0 -80
- package/lib/chart-type.js.map +0 -1
- package/lib/chart-types.js +0 -22
- package/lib/chart-types.js.map +0 -1
- package/lib/chart.js +0 -384
- package/lib/chart.js.map +0 -1
- package/lib/common/correctness-indicators.js +0 -156
- package/lib/common/correctness-indicators.js.map +0 -1
- package/lib/common/drag-handle.js +0 -160
- package/lib/common/drag-handle.js.map +0 -1
- package/lib/common/drag-icon.js +0 -52
- package/lib/common/drag-icon.js.map +0 -1
- package/lib/common/styles.js +0 -22
- package/lib/common/styles.js.map +0 -1
- package/lib/grid.js +0 -112
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -42
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -87
- package/lib/key-legend.js.map +0 -1
- package/lib/line/common/drag-handle.js +0 -146
- package/lib/line/common/drag-handle.js.map +0 -1
- package/lib/line/common/line.js +0 -214
- package/lib/line/common/line.js.map +0 -1
- package/lib/line/line-cross.js +0 -214
- package/lib/line/line-cross.js.map +0 -1
- package/lib/line/line-dot.js +0 -158
- package/lib/line/line-dot.js.map +0 -1
- package/lib/mark-label.js +0 -237
- package/lib/mark-label.js.map +0 -1
- package/lib/plot/common/plot.js +0 -349
- package/lib/plot/common/plot.js.map +0 -1
- package/lib/plot/dot.js +0 -110
- package/lib/plot/dot.js.map +0 -1
- package/lib/plot/line.js +0 -140
- package/lib/plot/line.js.map +0 -1
- package/lib/tool-menu.js +0 -106
- package/lib/tool-menu.js.map +0 -1
- package/lib/utils.js +0 -189
- package/lib/utils.js.map +0 -1
- package/src/__tests__/actions-button.test.jsx +0 -280
- package/src/__tests__/axes.test.jsx +0 -667
- package/src/__tests__/chart-setup.test.jsx +0 -532
- package/src/__tests__/chart-type.test.jsx +0 -23
- package/src/__tests__/chart.test.jsx +0 -86
- package/src/__tests__/grid.test.jsx +0 -37
- package/src/__tests__/key-legend.test.jsx +0 -223
- package/src/__tests__/mark-label.test.jsx +0 -33
- package/src/__tests__/tool-menu.test.jsx +0 -522
- package/src/__tests__/utils.js +0 -36
- package/src/__tests__/utils.test.js +0 -100
- package/src/actions-button.jsx +0 -115
- package/src/axes.jsx +0 -594
- package/src/bars/__tests__/bar.test.jsx +0 -45
- package/src/bars/__tests__/histogram.test.jsx +0 -45
- package/src/bars/__tests__/utils.js +0 -30
- package/src/bars/bar.js +0 -28
- package/src/bars/common/__tests__/bars.test.jsx +0 -68
- package/src/bars/common/__tests__/utils.js +0 -30
- package/src/bars/common/bars.jsx +0 -249
- package/src/bars/common/correct-check-icon.jsx +0 -25
- package/src/bars/histogram.js +0 -28
- package/src/chart-setup.jsx +0 -356
- package/src/chart-type.js +0 -59
- package/src/chart-types.js +0 -8
- package/src/chart.jsx +0 -357
- package/src/common/__tests__/correctness-indicators.test.jsx +0 -720
- package/src/common/__tests__/drag-handle.test.jsx +0 -58
- package/src/common/__tests__/utils.js +0 -30
- package/src/common/correctness-indicators.jsx +0 -128
- package/src/common/drag-handle.jsx +0 -125
- package/src/common/drag-icon.jsx +0 -36
- package/src/common/styles.js +0 -19
- package/src/grid.jsx +0 -80
- package/src/index.js +0 -7
- package/src/key-legend.jsx +0 -77
- package/src/line/__tests__/line-cross.test.jsx +0 -463
- package/src/line/__tests__/line-dot.test.jsx +0 -41
- package/src/line/__tests__/utils.js +0 -36
- package/src/line/common/__tests__/drag-handle.test.jsx +0 -62
- package/src/line/common/__tests__/line.test.jsx +0 -79
- package/src/line/common/__tests__/utils.js +0 -30
- package/src/line/common/drag-handle.jsx +0 -114
- package/src/line/common/line.jsx +0 -171
- package/src/line/line-cross.js +0 -144
- package/src/line/line-dot.js +0 -111
- package/src/mark-label.jsx +0 -238
- package/src/plot/__tests__/dot.test.jsx +0 -344
- package/src/plot/__tests__/line.test.jsx +0 -375
- package/src/plot/__tests__/utils.js +0 -30
- package/src/plot/common/__tests__/plot.test.jsx +0 -69
- package/src/plot/common/__tests__/utils.js +0 -30
- package/src/plot/common/plot.jsx +0 -358
- package/src/plot/dot.js +0 -74
- package/src/plot/line.js +0 -98
- package/src/tool-menu.jsx +0 -85
- package/src/utils.js +0 -201
package/dist/chart.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import e from "./grid.js";
|
|
2
|
+
import { dataToXBand as t, getDomainAndRangeByChartType as n, getGridLinesAndAxisByChartType as r, getTopPadding as i } from "./utils.js";
|
|
3
|
+
import a from "./axes.js";
|
|
4
|
+
import o from "./chart-types.js";
|
|
5
|
+
import s from "./actions-button.js";
|
|
6
|
+
import c from "react";
|
|
7
|
+
import l from "prop-types";
|
|
8
|
+
import { styled as u } from "@mui/material/styles";
|
|
9
|
+
import d from "debug";
|
|
10
|
+
import { cloneDeep as f } from "@pie-element/shared-lodash";
|
|
11
|
+
import { Root as p, createGraphProps as m } from "@pie-lib/plot";
|
|
12
|
+
import { AlertDialog as h } from "@pie-lib/config-ui";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import v from "@pie-lib/translator";
|
|
15
|
+
//#region src/chart.tsx
|
|
16
|
+
var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({ width: "min-content" })), S = class extends c.Component {
|
|
17
|
+
constructor(e) {
|
|
18
|
+
super(e), this.state = {
|
|
19
|
+
dialog: { open: !1 },
|
|
20
|
+
actionsAnchorEl: null
|
|
21
|
+
}, this.maskUid = this.generateMaskId();
|
|
22
|
+
}
|
|
23
|
+
static propTypes = {
|
|
24
|
+
className: l.string,
|
|
25
|
+
chartType: l.string.isRequired,
|
|
26
|
+
size: l.shape({
|
|
27
|
+
width: l.number,
|
|
28
|
+
height: l.number
|
|
29
|
+
}),
|
|
30
|
+
domain: l.shape({
|
|
31
|
+
label: l.string,
|
|
32
|
+
min: l.number,
|
|
33
|
+
max: l.number,
|
|
34
|
+
axisLabel: l.string
|
|
35
|
+
}),
|
|
36
|
+
data: l.arrayOf(l.shape({
|
|
37
|
+
label: l.string,
|
|
38
|
+
value: l.number
|
|
39
|
+
})),
|
|
40
|
+
range: l.shape({
|
|
41
|
+
label: l.string,
|
|
42
|
+
min: l.number,
|
|
43
|
+
max: l.number,
|
|
44
|
+
step: l.number,
|
|
45
|
+
labelStep: l.number,
|
|
46
|
+
axisLabel: l.string
|
|
47
|
+
}),
|
|
48
|
+
charts: l.array,
|
|
49
|
+
labelsPlaceholders: l.object,
|
|
50
|
+
title: l.string,
|
|
51
|
+
titlePlaceholder: l.string,
|
|
52
|
+
onDataChange: l.func,
|
|
53
|
+
onChangeLabels: l.func,
|
|
54
|
+
onChangeTitle: l.func,
|
|
55
|
+
error: l.any,
|
|
56
|
+
addCategoryEnabled: l.bool,
|
|
57
|
+
showPixelGuides: l.bool,
|
|
58
|
+
categoryDefaultLabel: l.string,
|
|
59
|
+
categoryDefaults: l.object,
|
|
60
|
+
defineChart: l.bool,
|
|
61
|
+
theme: l.object,
|
|
62
|
+
chartingOptions: l.object,
|
|
63
|
+
changeInteractiveEnabled: l.bool,
|
|
64
|
+
changeEditableEnabled: l.bool,
|
|
65
|
+
language: l.string,
|
|
66
|
+
mathMlOptions: l.object,
|
|
67
|
+
labelsCharactersLimit: l.number,
|
|
68
|
+
correctData: l.arrayOf(l.shape({
|
|
69
|
+
label: l.string,
|
|
70
|
+
value: l.number
|
|
71
|
+
}))
|
|
72
|
+
};
|
|
73
|
+
static defaultProps = { size: {
|
|
74
|
+
width: 480,
|
|
75
|
+
height: 480
|
|
76
|
+
} };
|
|
77
|
+
state = {
|
|
78
|
+
charts: [
|
|
79
|
+
o.Bar(),
|
|
80
|
+
o.Histogram(),
|
|
81
|
+
o.LineDot(),
|
|
82
|
+
o.LineCross(),
|
|
83
|
+
o.DotPlot(),
|
|
84
|
+
o.LinePlot()
|
|
85
|
+
],
|
|
86
|
+
autoFocus: !1
|
|
87
|
+
};
|
|
88
|
+
generateMaskId() {
|
|
89
|
+
return "chart-" + (Math.random() * 1e4).toFixed();
|
|
90
|
+
}
|
|
91
|
+
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
92
|
+
getChart = () => {
|
|
93
|
+
let e = this.props.charts || this.state.charts, { chartType: t } = this.props, n = null, r = null;
|
|
94
|
+
return t ? (r = e && e.find((e) => e.type === t), n = r && r.Component) : (r = e && e[0], n = r && r.Component, t = r && r.type), {
|
|
95
|
+
type: t,
|
|
96
|
+
ChartComponent: n
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
changeData = (e) => {
|
|
100
|
+
let { onDataChange: t } = this.props;
|
|
101
|
+
t(e);
|
|
102
|
+
};
|
|
103
|
+
changeCategory = (e, t) => {
|
|
104
|
+
let n = parseInt(e, 10);
|
|
105
|
+
if (n >= 0) {
|
|
106
|
+
let { data: e, onDataChange: r } = this.props;
|
|
107
|
+
e[n] = {
|
|
108
|
+
...e[n],
|
|
109
|
+
...t
|
|
110
|
+
}, r(e);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
addCategory = () => {
|
|
114
|
+
let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props;
|
|
115
|
+
(t || []).length > 19 ? this.setState({ dialog: {
|
|
116
|
+
open: !0,
|
|
117
|
+
title: y.t("common:warning", { lng: a }),
|
|
118
|
+
text: y.t("charting.reachedLimit_other", {
|
|
119
|
+
count: 20,
|
|
120
|
+
lng: a
|
|
121
|
+
}),
|
|
122
|
+
onConfirm: () => this.handleAlertDialog(!1)
|
|
123
|
+
} }) : (this.setState({ autoFocus: !0 }), e([...t, {
|
|
124
|
+
inDefineChart: r,
|
|
125
|
+
label: n || y.t("charting.newLabel", { lng: a }),
|
|
126
|
+
value: 0,
|
|
127
|
+
deletable: !0,
|
|
128
|
+
editable: i ? i?.editable : !0,
|
|
129
|
+
interactive: i ? i?.interactive : !0
|
|
130
|
+
}]));
|
|
131
|
+
};
|
|
132
|
+
deleteCategory = (e) => {
|
|
133
|
+
let { data: t, onDataChange: n } = this.props;
|
|
134
|
+
typeof e != "number" || e < 0 || t && t.length > 0 && n(t.filter((t, n) => n !== e));
|
|
135
|
+
};
|
|
136
|
+
getFilteredCategories = () => {
|
|
137
|
+
let { data: e, defineChart: t } = this.props;
|
|
138
|
+
return e ? e.map((e) => ({
|
|
139
|
+
...e,
|
|
140
|
+
deletable: t || e.deletable
|
|
141
|
+
})) : [];
|
|
142
|
+
};
|
|
143
|
+
resetAutoFocus = () => {
|
|
144
|
+
this.setState({ autoFocus: !1 });
|
|
145
|
+
};
|
|
146
|
+
render() {
|
|
147
|
+
let { domain: o = {}, range: c = {}, chartingOptions: l, size: u, title: d, onChangeTitle: v, onChangeLabels: y, labelsPlaceholders: S, titlePlaceholder: C, addCategoryEnabled: w, changeInteractiveEnabled: T, changeEditableEnabled: E, showPixelGuides: D, error: O, mathMlOptions: k = {}, language: A, labelsCharactersLimit: j, correctData: M } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = u || {}, R = {
|
|
148
|
+
left: c?.label || "",
|
|
149
|
+
bottom: o?.label || ""
|
|
150
|
+
}, { ChartComponent: z } = this.getChart(), B = this.getFilteredCategories(), V = n(o, c, N), { verticalLines: H, horizontalLines: U, leftAxis: W } = r(V.range, N), G = { graphProps: m(V.domain, V.range, u, () => this.rootNode) };
|
|
151
|
+
b("[render] common:", G);
|
|
152
|
+
let K = {
|
|
153
|
+
x: -10,
|
|
154
|
+
y: -75,
|
|
155
|
+
width: I + 20,
|
|
156
|
+
height: L + 130
|
|
157
|
+
}, { scale: q } = G.graphProps, J = t(q.x, B, I, N), Y = J.bandwidth() || q.x(V.domain.max) / B.length, X = F ? 160 : 60, Z = i(Y), Q = f(G);
|
|
158
|
+
return Q.graphProps.size.height += Z + X, (N === "dotPlot" || N === "linePlot") && M?.length && R.bottom && (Q.graphProps.size.height += 25), /* @__PURE__ */ _(x, { children: [/* @__PURE__ */ _(p, {
|
|
159
|
+
title: d,
|
|
160
|
+
onChangeTitle: v,
|
|
161
|
+
disabledTitle: !F,
|
|
162
|
+
showTitle: !0,
|
|
163
|
+
showLabels: !0,
|
|
164
|
+
labels: R,
|
|
165
|
+
onChangeLabels: y,
|
|
166
|
+
labelsPlaceholders: S,
|
|
167
|
+
titlePlaceholder: C,
|
|
168
|
+
defineChart: F,
|
|
169
|
+
disabledLabels: !F,
|
|
170
|
+
isChart: !0,
|
|
171
|
+
showPixelGuides: D,
|
|
172
|
+
rootRef: (e) => this.rootNode = e,
|
|
173
|
+
mathMlOptions: k,
|
|
174
|
+
labelsCharactersLimit: j,
|
|
175
|
+
...Q,
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ g(e, {
|
|
178
|
+
...G,
|
|
179
|
+
xBand: J,
|
|
180
|
+
rowTickValues: U,
|
|
181
|
+
columnTickValues: H
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ g(a, {
|
|
184
|
+
autoFocus: this.state.autoFocus,
|
|
185
|
+
onAutoFocusUsed: this.resetAutoFocus,
|
|
186
|
+
...G,
|
|
187
|
+
defineChart: F,
|
|
188
|
+
categories: B,
|
|
189
|
+
xBand: J,
|
|
190
|
+
leftAxis: W,
|
|
191
|
+
onChange: this.changeData,
|
|
192
|
+
onChangeCategory: this.changeCategory,
|
|
193
|
+
chartingOptions: l,
|
|
194
|
+
changeInteractiveEnabled: T,
|
|
195
|
+
changeEditableEnabled: E,
|
|
196
|
+
top: Z,
|
|
197
|
+
error: O,
|
|
198
|
+
showCorrectness: N === "linePlot" || N === "dotPlot"
|
|
199
|
+
}),
|
|
200
|
+
w ? /* @__PURE__ */ g("foreignObject", {
|
|
201
|
+
x: I,
|
|
202
|
+
y: L - 16,
|
|
203
|
+
width: I,
|
|
204
|
+
height: L,
|
|
205
|
+
children: /* @__PURE__ */ g("div", {
|
|
206
|
+
xmlns: "http://www.w3.org/1999/xhtml",
|
|
207
|
+
style: {
|
|
208
|
+
display: "flex",
|
|
209
|
+
justifyContent: "flex-start"
|
|
210
|
+
},
|
|
211
|
+
children: /* @__PURE__ */ g(s, {
|
|
212
|
+
categories: B,
|
|
213
|
+
addCategory: this.addCategory,
|
|
214
|
+
deleteCategory: this.deleteCategory,
|
|
215
|
+
language: A
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
}) : null,
|
|
219
|
+
/* @__PURE__ */ g("mask", {
|
|
220
|
+
id: `${this.maskUid}`,
|
|
221
|
+
children: /* @__PURE__ */ g("rect", {
|
|
222
|
+
...K,
|
|
223
|
+
fill: "white"
|
|
224
|
+
})
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ g("g", {
|
|
227
|
+
id: "marks",
|
|
228
|
+
mask: `url('#${this.maskUid}')`,
|
|
229
|
+
children: z && /* @__PURE__ */ g(z, {
|
|
230
|
+
...G,
|
|
231
|
+
data: B,
|
|
232
|
+
height: Q.graphProps.size.height,
|
|
233
|
+
defineChart: F,
|
|
234
|
+
onChange: this.changeData,
|
|
235
|
+
onChangeCategory: this.changeCategory,
|
|
236
|
+
correctData: M
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
}), /* @__PURE__ */ g(h, {
|
|
241
|
+
open: P.open,
|
|
242
|
+
title: P.title,
|
|
243
|
+
text: P.text,
|
|
244
|
+
onClose: P.onClose,
|
|
245
|
+
onConfirm: P.onConfirm
|
|
246
|
+
})] });
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
//#endregion
|
|
250
|
+
export { S as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/charting/src/common/correctness-indicators.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const CorrectnessIndicator: {
|
|
12
|
+
({ scale, x, y, correctness, interactive }: {
|
|
13
|
+
scale: any;
|
|
14
|
+
x: any;
|
|
15
|
+
y: any;
|
|
16
|
+
correctness: any;
|
|
17
|
+
interactive: any;
|
|
18
|
+
}): React.JSX.Element | null;
|
|
19
|
+
propTypes: {
|
|
20
|
+
scale: PropTypes.Requireable<PropTypes.InferProps<{
|
|
21
|
+
x: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
y: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
}>>;
|
|
24
|
+
x: PropTypes.Validator<number>;
|
|
25
|
+
y: PropTypes.Validator<number>;
|
|
26
|
+
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
27
|
+
value: PropTypes.Requireable<string>;
|
|
28
|
+
label: PropTypes.Requireable<string>;
|
|
29
|
+
}>>;
|
|
30
|
+
interactive: PropTypes.Requireable<boolean>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const SmallCorrectPointIndicator: {
|
|
34
|
+
({ scale, x, correctness, correctData, label }: {
|
|
35
|
+
scale: any;
|
|
36
|
+
x: any;
|
|
37
|
+
correctness: any;
|
|
38
|
+
correctData: any;
|
|
39
|
+
label: any;
|
|
40
|
+
}): React.JSX.Element | null;
|
|
41
|
+
propTypes: {
|
|
42
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
43
|
+
x: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
+
y: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
}>>>;
|
|
46
|
+
x: PropTypes.Validator<number>;
|
|
47
|
+
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
48
|
+
value: PropTypes.Requireable<string>;
|
|
49
|
+
label: PropTypes.Requireable<string>;
|
|
50
|
+
}>>;
|
|
51
|
+
correctData: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
52
|
+
label: PropTypes.Requireable<string>;
|
|
53
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
54
|
+
}> | null | undefined)[]>;
|
|
55
|
+
label: PropTypes.Requireable<string>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const TickCorrectnessIndicator: {
|
|
59
|
+
({ correctness, interactive }: {
|
|
60
|
+
correctness: any;
|
|
61
|
+
interactive: any;
|
|
62
|
+
}): React.JSX.Element | null;
|
|
63
|
+
propTypes: {
|
|
64
|
+
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
65
|
+
value: PropTypes.Requireable<string>;
|
|
66
|
+
label: PropTypes.Requireable<string>;
|
|
67
|
+
}>>;
|
|
68
|
+
interactive: PropTypes.Requireable<boolean>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import { color as n } from "@pie-lib/render-ui";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import i from "@mui/icons-material/Check";
|
|
7
|
+
import a from "@mui/icons-material/Close";
|
|
8
|
+
//#region src/common/correctness-indicators.tsx
|
|
9
|
+
var o = t(i)(({ theme: e }) => ({
|
|
10
|
+
borderRadius: e.spacing(2),
|
|
11
|
+
color: n.defaults.WHITE,
|
|
12
|
+
fontSize: "16px",
|
|
13
|
+
width: "16px",
|
|
14
|
+
height: "16px",
|
|
15
|
+
padding: "2px",
|
|
16
|
+
border: `1px solid ${n.defaults.WHITE}`,
|
|
17
|
+
stroke: "initial",
|
|
18
|
+
boxSizing: "unset",
|
|
19
|
+
backgroundColor: n.correct(),
|
|
20
|
+
display: "block",
|
|
21
|
+
"&.small": {
|
|
22
|
+
fontSize: "10px",
|
|
23
|
+
width: "10px",
|
|
24
|
+
height: "10px"
|
|
25
|
+
}
|
|
26
|
+
})), s = t(a)(({ theme: e }) => ({
|
|
27
|
+
borderRadius: e.spacing(2),
|
|
28
|
+
color: n.defaults.WHITE,
|
|
29
|
+
fontSize: "16px",
|
|
30
|
+
width: "16px",
|
|
31
|
+
height: "16px",
|
|
32
|
+
padding: "2px",
|
|
33
|
+
border: `1px solid ${n.defaults.WHITE}`,
|
|
34
|
+
stroke: "initial",
|
|
35
|
+
boxSizing: "unset",
|
|
36
|
+
backgroundColor: n.incorrectWithIcon(),
|
|
37
|
+
display: "block",
|
|
38
|
+
"&.small": {
|
|
39
|
+
fontSize: "10px",
|
|
40
|
+
width: "10px",
|
|
41
|
+
height: "10px"
|
|
42
|
+
}
|
|
43
|
+
})), c = ({ scale: e, x: t, y: n, correctness: i, interactive: a }) => {
|
|
44
|
+
if (!i || !a) return null;
|
|
45
|
+
let c = e ? e.x(t) : t, l = e ? e.y(n) : n, u = i.value === "correct";
|
|
46
|
+
return /* @__PURE__ */ r("foreignObject", {
|
|
47
|
+
x: c - 11,
|
|
48
|
+
y: l - 11,
|
|
49
|
+
width: 22,
|
|
50
|
+
height: 22,
|
|
51
|
+
children: r(u ? o : s, { title: i.label })
|
|
52
|
+
});
|
|
53
|
+
}, l = ({ scale: e, x: t, correctness: n, correctData: i, label: a }) => {
|
|
54
|
+
if (n && n.value === "incorrect") {
|
|
55
|
+
let s = parseFloat(i.find((e) => e.label === a)?.value);
|
|
56
|
+
if (isNaN(s)) return null;
|
|
57
|
+
let c = e.y(s) - 7.5;
|
|
58
|
+
return /* @__PURE__ */ r("foreignObject", {
|
|
59
|
+
x: e.x(t) - 7.5,
|
|
60
|
+
y: c,
|
|
61
|
+
width: 15,
|
|
62
|
+
height: 15,
|
|
63
|
+
children: /* @__PURE__ */ r(o, {
|
|
64
|
+
className: "small",
|
|
65
|
+
title: n.label
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}, u = ({ correctness: e, interactive: t }) => !e || !t ? null : e.value === "correct" ? /* @__PURE__ */ r(o, { title: e.label }) : /* @__PURE__ */ r(s, { title: e.label });
|
|
71
|
+
c.propTypes = {
|
|
72
|
+
scale: e.shape({
|
|
73
|
+
x: e.func,
|
|
74
|
+
y: e.func
|
|
75
|
+
}),
|
|
76
|
+
x: e.number.isRequired,
|
|
77
|
+
y: e.number.isRequired,
|
|
78
|
+
correctness: e.shape({
|
|
79
|
+
value: e.string,
|
|
80
|
+
label: e.string
|
|
81
|
+
}),
|
|
82
|
+
interactive: e.bool
|
|
83
|
+
}, l.propTypes = {
|
|
84
|
+
scale: e.shape({
|
|
85
|
+
x: e.func,
|
|
86
|
+
y: e.func
|
|
87
|
+
}).isRequired,
|
|
88
|
+
x: e.number.isRequired,
|
|
89
|
+
correctness: e.shape({
|
|
90
|
+
value: e.string,
|
|
91
|
+
label: e.string
|
|
92
|
+
}),
|
|
93
|
+
correctData: e.arrayOf(e.shape({
|
|
94
|
+
label: e.string,
|
|
95
|
+
value: e.oneOfType([e.string, e.number])
|
|
96
|
+
})),
|
|
97
|
+
label: e.string
|
|
98
|
+
}, u.propTypes = {
|
|
99
|
+
correctness: e.shape({
|
|
100
|
+
value: e.string,
|
|
101
|
+
label: e.string
|
|
102
|
+
}),
|
|
103
|
+
interactive: e.bool
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { c as CorrectnessIndicator, l as SmallCorrectPointIndicator, u as TickCorrectnessIndicator };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/charting/src/common/drag-handle.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const DragHandle: {
|
|
12
|
+
({ x, y, width, graphProps, interactive, isHovered, correctness, isPlot, ...rest }: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
x: any;
|
|
15
|
+
y: any;
|
|
16
|
+
width: any;
|
|
17
|
+
graphProps: any;
|
|
18
|
+
interactive: any;
|
|
19
|
+
isHovered: any;
|
|
20
|
+
correctness: any;
|
|
21
|
+
isPlot: any;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
propTypes: {
|
|
24
|
+
x: PropTypes.Validator<number>;
|
|
25
|
+
y: PropTypes.Validator<number>;
|
|
26
|
+
width: PropTypes.Requireable<number>;
|
|
27
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
28
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
29
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
30
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
31
|
+
}>>>;
|
|
32
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
33
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
34
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
35
|
+
}>>>;
|
|
36
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
37
|
+
min: PropTypes.Validator<number>;
|
|
38
|
+
max: PropTypes.Validator<number>;
|
|
39
|
+
step: PropTypes.Requireable<number>;
|
|
40
|
+
}>>>;
|
|
41
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
42
|
+
min: PropTypes.Validator<number>;
|
|
43
|
+
max: PropTypes.Validator<number>;
|
|
44
|
+
step: PropTypes.Requireable<number>;
|
|
45
|
+
}>>>;
|
|
46
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
47
|
+
width: PropTypes.Validator<number>;
|
|
48
|
+
height: PropTypes.Validator<number>;
|
|
49
|
+
}>>>;
|
|
50
|
+
}>>>;
|
|
51
|
+
interactive: PropTypes.Requireable<boolean>;
|
|
52
|
+
isHovered: PropTypes.Requireable<boolean>;
|
|
53
|
+
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
54
|
+
value: PropTypes.Requireable<string>;
|
|
55
|
+
label: PropTypes.Requireable<string>;
|
|
56
|
+
}>>;
|
|
57
|
+
isPlot: PropTypes.Requireable<boolean>;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const D: {
|
|
61
|
+
new (props: any): {
|
|
62
|
+
grid: any;
|
|
63
|
+
onStart: any;
|
|
64
|
+
position: any;
|
|
65
|
+
tiny: any;
|
|
66
|
+
getScaledBounds: any;
|
|
67
|
+
getClientPoint: any;
|
|
68
|
+
skipDragOutsideOfBounds: any;
|
|
69
|
+
onDrag: any;
|
|
70
|
+
getDelta: any;
|
|
71
|
+
applyDelta: any;
|
|
72
|
+
onStop: any;
|
|
73
|
+
render(): React.JSX.Element;
|
|
74
|
+
context: unknown;
|
|
75
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
76
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
77
|
+
readonly props: Readonly<{}>;
|
|
78
|
+
state: Readonly<{}>;
|
|
79
|
+
refs: {
|
|
80
|
+
[key: string]: React.ReactInstance;
|
|
81
|
+
};
|
|
82
|
+
componentDidMount?(): void;
|
|
83
|
+
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
84
|
+
componentWillUnmount?(): void;
|
|
85
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
86
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
87
|
+
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
88
|
+
componentWillMount?(): void;
|
|
89
|
+
UNSAFE_componentWillMount?(): void;
|
|
90
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
91
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
92
|
+
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
93
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
94
|
+
};
|
|
95
|
+
propTypes: {
|
|
96
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
97
|
+
onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
98
|
+
onDrag: PropTypes.Requireable<(...args: any[]) => any>;
|
|
99
|
+
onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
100
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
101
|
+
onMove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
102
|
+
graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
103
|
+
scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
104
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
105
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
106
|
+
}>>>;
|
|
107
|
+
snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
108
|
+
x: PropTypes.Validator<(...args: any[]) => any>;
|
|
109
|
+
y: PropTypes.Validator<(...args: any[]) => any>;
|
|
110
|
+
}>>>;
|
|
111
|
+
domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
112
|
+
min: PropTypes.Validator<number>;
|
|
113
|
+
max: PropTypes.Validator<number>;
|
|
114
|
+
step: PropTypes.Requireable<number>;
|
|
115
|
+
}>>>;
|
|
116
|
+
range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
117
|
+
min: PropTypes.Validator<number>;
|
|
118
|
+
max: PropTypes.Validator<number>;
|
|
119
|
+
step: PropTypes.Requireable<number>;
|
|
120
|
+
}>>>;
|
|
121
|
+
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
122
|
+
width: PropTypes.Validator<number>;
|
|
123
|
+
height: PropTypes.Validator<number>;
|
|
124
|
+
}>>>;
|
|
125
|
+
}>>>;
|
|
126
|
+
};
|
|
127
|
+
contextType?: React.Context<any> | undefined;
|
|
128
|
+
};
|
|
129
|
+
export default D;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { getScale as e } from "../utils.js";
|
|
2
|
+
import t from "./drag-icon.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { styled as r } from "@mui/material/styles";
|
|
6
|
+
import { gridDraggable as i, types as a, utils as o } from "@pie-lib/plot";
|
|
7
|
+
import { color as s } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import u from "@mui/icons-material/Check";
|
|
10
|
+
import d from "@mui/icons-material/Close";
|
|
11
|
+
//#region src/common/drag-handle.tsx
|
|
12
|
+
var f = r("svg")(() => ({ overflow: "visible !important" })), p = r("ellipse")(() => ({
|
|
13
|
+
fill: "transparent",
|
|
14
|
+
clipPath: "polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)"
|
|
15
|
+
})), m = r(u)(() => ({
|
|
16
|
+
backgroundColor: s.correct(),
|
|
17
|
+
borderRadius: "16px",
|
|
18
|
+
color: s.defaults.WHITE,
|
|
19
|
+
fontSize: "16px",
|
|
20
|
+
padding: "2px",
|
|
21
|
+
border: `4px solid ${s.defaults.WHITE}`,
|
|
22
|
+
width: "16px",
|
|
23
|
+
height: "16px",
|
|
24
|
+
boxSizing: "unset"
|
|
25
|
+
})), h = r(d)(() => ({
|
|
26
|
+
backgroundColor: s.incorrectWithIcon(),
|
|
27
|
+
borderRadius: "16px",
|
|
28
|
+
color: s.defaults.WHITE,
|
|
29
|
+
fontSize: "16px",
|
|
30
|
+
padding: "2px",
|
|
31
|
+
border: `4px solid ${s.defaults.WHITE}`,
|
|
32
|
+
width: "16px",
|
|
33
|
+
height: "16px",
|
|
34
|
+
boxSizing: "unset"
|
|
35
|
+
})), g = ({ x: n, y: r, width: i, graphProps: a, interactive: o, isHovered: u, correctness: d, isPlot: g, ..._ }) => {
|
|
36
|
+
let { scale: v } = a, y = e(i)?.scale;
|
|
37
|
+
return /* @__PURE__ */ l(f, {
|
|
38
|
+
x: n,
|
|
39
|
+
y: v.y(r) - 10,
|
|
40
|
+
width: i,
|
|
41
|
+
overflow: "visible",
|
|
42
|
+
children: [
|
|
43
|
+
u && !d && o && /* @__PURE__ */ c(t, {
|
|
44
|
+
width: i,
|
|
45
|
+
scaleValue: y,
|
|
46
|
+
color: s.defaults.BORDER_GRAY
|
|
47
|
+
}),
|
|
48
|
+
o && !d && /* @__PURE__ */ c(p, {
|
|
49
|
+
cx: i / 2,
|
|
50
|
+
cy: 10,
|
|
51
|
+
rx: i / 2,
|
|
52
|
+
ry: 66,
|
|
53
|
+
..._
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ c("defs", { children: /* @__PURE__ */ l("filter", {
|
|
56
|
+
id: "bottomShadow",
|
|
57
|
+
x: "0",
|
|
58
|
+
y: "0",
|
|
59
|
+
width: "140%",
|
|
60
|
+
height: "140%",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ c("feGaussianBlur", {
|
|
63
|
+
in: "SourceAlpha",
|
|
64
|
+
stdDeviation: "3"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ c("feOffset", {
|
|
67
|
+
dx: "0",
|
|
68
|
+
dy: "5",
|
|
69
|
+
result: "offsetblur"
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ c("feFlood", { floodColor: "#00000033" }),
|
|
72
|
+
/* @__PURE__ */ c("feComposite", {
|
|
73
|
+
in2: "offsetblur",
|
|
74
|
+
operator: "in"
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ l("feMerge", { children: [/* @__PURE__ */ c("feMergeNode", {}), /* @__PURE__ */ c("feMergeNode", { in: "SourceGraphic" })] })
|
|
77
|
+
]
|
|
78
|
+
}) }),
|
|
79
|
+
d && o && !g && /* @__PURE__ */ c("foreignObject", {
|
|
80
|
+
x: i / 2 - 14,
|
|
81
|
+
y: 0,
|
|
82
|
+
width: 40,
|
|
83
|
+
height: 40,
|
|
84
|
+
children: d.value === "correct" ? /* @__PURE__ */ c(m, { title: d.label }) : /* @__PURE__ */ c(h, { title: d.label })
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
g.propTypes = {
|
|
90
|
+
x: n.number.isRequired,
|
|
91
|
+
y: n.number.isRequired,
|
|
92
|
+
width: n.number,
|
|
93
|
+
graphProps: a.GraphPropsType.isRequired,
|
|
94
|
+
interactive: n.bool,
|
|
95
|
+
isHovered: n.bool,
|
|
96
|
+
correctness: n.shape({
|
|
97
|
+
value: n.string,
|
|
98
|
+
label: n.string
|
|
99
|
+
}),
|
|
100
|
+
isPlot: n.bool
|
|
101
|
+
};
|
|
102
|
+
var _ = g, v = i({
|
|
103
|
+
axis: "y",
|
|
104
|
+
fromDelta: (e, t) => (t.x = 0, o.point(e).add(o.point(t)).y),
|
|
105
|
+
bounds: (e, { domain: t, range: n }) => {
|
|
106
|
+
let r = {
|
|
107
|
+
left: 0,
|
|
108
|
+
top: e.y,
|
|
109
|
+
bottom: e.y,
|
|
110
|
+
right: 0
|
|
111
|
+
};
|
|
112
|
+
return o.bounds(r, t, n);
|
|
113
|
+
},
|
|
114
|
+
anchorPoint: (e) => ({
|
|
115
|
+
x: e.x,
|
|
116
|
+
y: e.y
|
|
117
|
+
})
|
|
118
|
+
})(_);
|
|
119
|
+
//#endregion
|
|
120
|
+
export { _ as DragHandle, v as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/charting/src/common/drag-icon.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare const DragIcon: {
|
|
12
|
+
({ width, scaleValue, color }: {
|
|
13
|
+
width: any;
|
|
14
|
+
scaleValue: any;
|
|
15
|
+
color: any;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
propTypes: {
|
|
18
|
+
width: PropTypes.Validator<number>;
|
|
19
|
+
scaleValue: PropTypes.Validator<number>;
|
|
20
|
+
color: PropTypes.Requireable<string>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default DragIcon;
|