@emerson-eps/color-tables 1.0.0 → 1.0.1
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/component/BreakPoint/Canvas.d.ts +3 -3
- package/dist/component/BreakPoint/Canvas.js +10 -21
- package/dist/component/BreakPoint/Canvas.js.map +1 -1
- package/dist/component/BreakPoint/ColorScale.d.ts +2 -3
- package/dist/component/BreakPoint/ColorScale.js +19 -20
- package/dist/component/BreakPoint/ColorScale.js.map +1 -1
- package/dist/component/BreakPoint/Legend.d.ts +2 -3
- package/dist/component/BreakPoint/Legend.js +31 -37
- package/dist/component/BreakPoint/Legend.js.map +1 -1
- package/dist/component/BreakPoint/Modal.d.ts +6 -3
- package/dist/component/BreakPoint/Modal.js +17 -21
- package/dist/component/BreakPoint/Modal.js.map +1 -1
- package/dist/component/BreakPoint/index.d.ts +4 -0
- package/dist/component/BreakPoint/index.js +6 -0
- package/dist/component/BreakPoint/index.js.map +1 -0
- package/dist/component/ColorSelector/BreakPointModule.d.ts +3 -4
- package/dist/component/ColorSelector/BreakPointModule.js +99 -140
- package/dist/component/ColorSelector/BreakPointModule.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorAccordion.js +55 -60
- package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +2 -3
- package/dist/component/ColorSelector/ColorSelectorComponent.js +83 -86
- package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorWrapper.d.ts +12 -5
- package/dist/component/ColorSelector/ColorSelectorWrapper.js +41 -51
- package/dist/component/ColorSelector/ColorSelectorWrapper.js.map +1 -1
- package/dist/component/ColorSelector/index.d.ts +4 -0
- package/dist/component/ColorSelector/index.js +6 -0
- package/dist/component/ColorSelector/index.js.map +1 -0
- package/dist/component/Legend/ColorLegend.d.ts +2 -2
- package/dist/component/Legend/ColorLegend.js +38 -39
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ColorLegend.stories.js +20 -31
- package/dist/component/Legend/ColorLegend.stories.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.d.ts +2 -2
- package/dist/component/Legend/ContinuousLegend.js +230 -276
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.stories.js +13 -24
- package/dist/component/Legend/ContinuousLegend.stories.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.d.ts +2 -2
- package/dist/component/Legend/DiscreteLegend.js +130 -180
- package/dist/component/Legend/DiscreteLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.stories.js +15 -26
- package/dist/component/Legend/DiscreteLegend.stories.js.map +1 -1
- package/dist/component/Legend/constants.js +1 -1
- package/dist/component/Legend/constants.js.map +1 -1
- package/dist/component/Legend/index.d.ts +3 -0
- package/dist/component/Legend/index.js +4 -0
- package/dist/component/Legend/index.js.map +1 -0
- package/dist/component/Utils/d3ColorScale.js +1 -1
- package/dist/component/Utils/d3ColorScale.js.map +1 -1
- package/dist/component/Utils/discreteLegend.d.ts +2 -3
- package/dist/component/Utils/discreteLegend.js.map +1 -1
- package/dist/component/Utils/index.d.ts +2 -0
- package/dist/component/Utils/index.js +4 -0
- package/dist/component/Utils/index.js.map +1 -0
- package/dist/component/Utils/legendCommonFunction.d.ts +7 -7
- package/dist/component/Utils/legendCommonFunction.js +128 -139
- package/dist/component/Utils/legendCommonFunction.js.map +1 -1
- package/dist/component/Utils/legendCommonFunction.stories.js +14 -25
- package/dist/component/Utils/legendCommonFunction.stories.js.map +1 -1
- package/dist/component/colorTableTypes.d.ts +10 -2
- package/dist/component/index.d.ts +6 -0
- package/dist/component/index.js +7 -0
- package/dist/component/index.js.map +1 -0
- package/dist/index.d.ts +1 -9
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js +36 -0
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js +34 -0
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js +39 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js +31 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js +31 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js +34 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js +45 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js +34 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js +44 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js.map +1 -0
- package/dist/stories/ColorLegends/LegendWithSelector/LegendSelector.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/LegendWithSelector/LegendSelector.stories.js +33 -0
- package/dist/stories/ColorLegends/LegendWithSelector/LegendSelector.stories.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
2
|
+
export type CanvasProps = {
|
|
3
3
|
drawCallback?: () => void;
|
|
4
4
|
onResize?: (width: number, height: number) => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const Canvas: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLCanvasElement> & React.CanvasHTMLAttributes<HTMLCanvasElement> &
|
|
7
|
-
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLCanvasElement> & React.CanvasHTMLAttributes<HTMLCanvasElement> &
|
|
6
|
+
export declare const Canvas: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLCanvasElement> & React.CanvasHTMLAttributes<HTMLCanvasElement> & CanvasProps, "ref"> & React.RefAttributes<HTMLCanvasElement>>;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLCanvasElement> & React.CanvasHTMLAttributes<HTMLCanvasElement> & CanvasProps, "ref"> & React.RefAttributes<HTMLCanvasElement>>>;
|
|
8
8
|
export default _default;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
2
|
var t = {};
|
|
14
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -23,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
12
|
import React from "react";
|
|
24
13
|
import ReactResizeDetector from "react-resize-detector";
|
|
25
14
|
import { styled } from "@mui/system";
|
|
26
|
-
|
|
15
|
+
const StyledCanvas = styled("canvas")({
|
|
27
16
|
position: "absolute",
|
|
28
17
|
left: 0,
|
|
29
18
|
right: 0,
|
|
@@ -31,27 +20,27 @@ var StyledCanvas = styled("canvas")({
|
|
|
31
20
|
width: "100%",
|
|
32
21
|
pointerEvents: "none",
|
|
33
22
|
});
|
|
34
|
-
export
|
|
35
|
-
var
|
|
23
|
+
export const Canvas = React.forwardRef((_a, ref) => {
|
|
24
|
+
var { drawCallback, onResize } = _a, props = __rest(_a, ["drawCallback", "onResize"]);
|
|
36
25
|
// State
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const [width, setWidth] = React.useState(0);
|
|
27
|
+
const [height, setHeight] = React.useState(0);
|
|
39
28
|
// Callbacks
|
|
40
|
-
|
|
29
|
+
const onResizeHandler = React.useCallback((w, h) => {
|
|
41
30
|
setWidth(w);
|
|
42
31
|
setHeight(h);
|
|
43
32
|
onResize === null || onResize === void 0 ? void 0 : onResize(w, h);
|
|
44
33
|
}, [onResize]);
|
|
45
34
|
// Effects
|
|
46
|
-
React.useLayoutEffect(
|
|
35
|
+
React.useLayoutEffect(() => {
|
|
47
36
|
if (!drawCallback) {
|
|
48
37
|
return;
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
return
|
|
39
|
+
const frameId = requestAnimationFrame(drawCallback);
|
|
40
|
+
return () => cancelAnimationFrame(frameId);
|
|
52
41
|
}, [drawCallback, width, height]);
|
|
53
42
|
return (React.createElement(ReactResizeDetector, { handleHeight: true, handleWidth: true, onResize: onResizeHandler },
|
|
54
|
-
React.createElement(StyledCanvas,
|
|
43
|
+
React.createElement(StyledCanvas, Object.assign({ ref: ref }, props))));
|
|
55
44
|
});
|
|
56
45
|
export default React.memo(Canvas);
|
|
57
46
|
//# sourceMappingURL=Canvas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/Canvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Canvas.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/Canvas.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAA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AE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAElC,OAAO,CACL,oBAAC,mBAAmB,IAAC,YAAY,QAAC,WAAW,QAAC,QAAQ,EAAE,eAAe;QACrE,oBAAC,YAAY,kBAAC,GAAG,EAAE,GAAG,IAAM,KAAK,EAAI,CACjB,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
2
|
+
export type ColorScaleProps = {
|
|
3
3
|
arrayOfColors: string[] | ((index: number) => string);
|
|
4
4
|
vertical?: boolean;
|
|
5
5
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const get2DContext: (canvas: HTMLCanvasElement, options?: CanvasRenderingContext2DSettings) => CanvasRenderingContext2D;
|
|
8
|
-
export declare const ColorScale: React.FC<
|
|
9
|
-
export {};
|
|
8
|
+
export declare const ColorScale: React.FC<ColorScaleProps>;
|
|
@@ -2,48 +2,47 @@ import * as d3 from "d3";
|
|
|
2
2
|
import React, { useCallback, useRef } from "react";
|
|
3
3
|
import { styled } from "@mui/system";
|
|
4
4
|
import Canvas from "./Canvas";
|
|
5
|
-
|
|
5
|
+
const StyledRootContainer = styled("div")({
|
|
6
6
|
height: "100%",
|
|
7
7
|
width: "100%",
|
|
8
8
|
position: "relative",
|
|
9
9
|
cursor: "pointer",
|
|
10
10
|
});
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const get2DContext = (canvas, options) => {
|
|
12
|
+
const dpi = window.devicePixelRatio || 1;
|
|
13
|
+
const rect = canvas.getBoundingClientRect();
|
|
14
14
|
canvas.width = Math.ceil(rect.width * dpi);
|
|
15
15
|
canvas.height = Math.ceil(rect.height * dpi);
|
|
16
|
-
|
|
16
|
+
const ctx = canvas.getContext("2d", options);
|
|
17
17
|
ctx === null || ctx === void 0 ? void 0 : ctx.scale(dpi, dpi);
|
|
18
18
|
return ctx;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var canvas = canvasRef.current;
|
|
20
|
+
export const ColorScale = React.memo(({ arrayOfColors, vertical }) => {
|
|
21
|
+
const canvasRef = useRef(null);
|
|
22
|
+
const drawCanvas = useCallback(() => {
|
|
23
|
+
const canvas = canvasRef.current;
|
|
25
24
|
if (!canvas) {
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
const ctx = get2DContext(canvas);
|
|
29
28
|
if (!ctx) {
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
?
|
|
37
|
-
|
|
31
|
+
const height = canvas.getBoundingClientRect().height;
|
|
32
|
+
const width = canvas.getBoundingClientRect().width;
|
|
33
|
+
const max = vertical ? height : width;
|
|
34
|
+
const pixelToColor = Array.isArray(arrayOfColors)
|
|
35
|
+
? (pixel) => {
|
|
36
|
+
const scale = d3
|
|
38
37
|
.scaleQuantize()
|
|
39
38
|
.domain([0, max - 1])
|
|
40
39
|
.range(arrayOfColors);
|
|
41
40
|
return scale(pixel);
|
|
42
41
|
}
|
|
43
|
-
:
|
|
42
|
+
: (pixel) => arrayOfColors(max > 1 ? pixel / (max - 1) : 0);
|
|
44
43
|
ctx.globalAlpha = 1;
|
|
45
|
-
for (
|
|
46
|
-
|
|
44
|
+
for (let pixel = 0; pixel < max; pixel++) {
|
|
45
|
+
const color = pixelToColor(pixel);
|
|
47
46
|
ctx.fillStyle = color;
|
|
48
47
|
if (vertical) {
|
|
49
48
|
ctx.fillRect(0, max - pixel, width, 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorScale.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/ColorScale.tsx"],"names":[],"mappings":"AAAA,OAA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,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YAClC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;YACtB,IAAI,QAAQ,EAAE,CAAC;gBACb,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,mBAAmB;QAClB,oBAAC,MAAM,IAAC,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,GAAI,CAChC,CACvB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
export type LegendCompProps = {
|
|
3
3
|
colorScaleBreakpoints?: any;
|
|
4
4
|
editedData?: any;
|
|
5
5
|
isModal?: boolean;
|
|
6
6
|
handleModalClick?: (event: MouseEvent) => void;
|
|
7
7
|
customScalesName?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const LegendComp: React.FC<
|
|
10
|
-
export {};
|
|
9
|
+
export declare const LegendComp: React.FC<LegendCompProps>;
|
|
@@ -9,15 +9,12 @@ import { styled } from "@mui/system";
|
|
|
9
9
|
import { CustomizedDialogs } from "../../component/BreakPoint/Modal";
|
|
10
10
|
import { getColorArrayFromBreakPoints } from "../Utils/legendCommonFunction";
|
|
11
11
|
import { ColorScale } from "../BreakPoint/ColorScale";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
var StyledColorScaleContainer = styled("div")({
|
|
12
|
+
const StyledRootContainer = styled("div")(({ theme }) => ({
|
|
13
|
+
display: "flex",
|
|
14
|
+
gap: theme.spacing(2),
|
|
15
|
+
height: 20,
|
|
16
|
+
}));
|
|
17
|
+
const StyledColorScaleContainer = styled("div")({
|
|
21
18
|
display: "flex",
|
|
22
19
|
marginTop: 8,
|
|
23
20
|
marginLeft: -10,
|
|
@@ -28,13 +25,13 @@ var StyledColorScaleContainer = styled("div")({
|
|
|
28
25
|
cursor: "pointer",
|
|
29
26
|
},
|
|
30
27
|
});
|
|
31
|
-
|
|
28
|
+
const StyledTextureContainer = styled("div")({
|
|
32
29
|
height: "13px",
|
|
33
30
|
width: "100px",
|
|
34
31
|
marginTop: "6px",
|
|
35
32
|
marginLeft: "5px",
|
|
36
33
|
});
|
|
37
|
-
|
|
34
|
+
const StyledEditContainer = styled("div")({
|
|
38
35
|
"&:hover": {
|
|
39
36
|
backgroundColor: "#f1f1f1",
|
|
40
37
|
},
|
|
@@ -42,62 +39,59 @@ var StyledEditContainer = styled("div")({
|
|
|
42
39
|
width: "100%",
|
|
43
40
|
cursor: "pointer",
|
|
44
41
|
});
|
|
45
|
-
|
|
42
|
+
const StyledCustomScales = styled("div")({
|
|
46
43
|
whiteSpace: "nowrap",
|
|
47
44
|
fontSize: "small",
|
|
48
45
|
fontWeight: "700",
|
|
49
46
|
margin: "6px 0px 0px 6px",
|
|
50
47
|
cursor: "pointer",
|
|
51
48
|
});
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
React.useEffect(function () {
|
|
49
|
+
export const LegendComp = ({ colorScaleBreakpoints, editedData, isModal, handleModalClick, customScalesName, }) => {
|
|
50
|
+
const [breakpointValues, setBreakPointValues] = React.useState(colorScaleBreakpoints);
|
|
51
|
+
const [customizedBreakpoints, setCustomizedBreakpoints] = React.useState();
|
|
52
|
+
React.useEffect(() => {
|
|
57
53
|
setBreakPointValues(colorScaleBreakpoints);
|
|
58
54
|
}, [colorScaleBreakpoints, colorScaleBreakpoints.length]);
|
|
59
|
-
|
|
55
|
+
const orderedSelectedColors = React.useMemo(() => {
|
|
60
56
|
return Object.values(breakpointValues.colorArray
|
|
61
57
|
? breakpointValues.colorArray
|
|
62
|
-
: breakpointValues).sort(
|
|
58
|
+
: breakpointValues).sort((a, b) => a.position - b.position);
|
|
63
59
|
}, [breakpointValues]);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
71
|
-
var handleClick = function (event) {
|
|
60
|
+
const arrayOfColors = React.useMemo(() => orderedSelectedColors.length > 0
|
|
61
|
+
? getColorArrayFromBreakPoints(orderedSelectedColors)
|
|
62
|
+
: [], [orderedSelectedColors]);
|
|
63
|
+
const [popUpState, setPopUpState] = React.useState(false);
|
|
64
|
+
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
65
|
+
const handleClick = (event) => {
|
|
72
66
|
document.removeEventListener("mousedown", handleModalClick);
|
|
73
67
|
setAnchorEl(event.currentTarget);
|
|
74
68
|
};
|
|
75
|
-
|
|
69
|
+
const handleClose = () => {
|
|
76
70
|
setAnchorEl(null);
|
|
77
71
|
};
|
|
78
|
-
|
|
72
|
+
const openEditModal = React.useCallback((data) => {
|
|
79
73
|
setPopUpState(data.bubbles);
|
|
80
74
|
setAnchorEl(null);
|
|
81
75
|
}, []);
|
|
82
|
-
|
|
76
|
+
const deleteLegend = () => {
|
|
83
77
|
setBreakPointValues([]);
|
|
84
78
|
editedData({ colorArray: colorScaleBreakpoints, customizeFlag: false });
|
|
85
79
|
};
|
|
86
|
-
React.useEffect(
|
|
80
|
+
React.useEffect(() => {
|
|
87
81
|
if (isModal) {
|
|
88
82
|
popUpState
|
|
89
83
|
? document.removeEventListener("mousedown", handleModalClick)
|
|
90
84
|
: document.addEventListener("mousedown", handleModalClick);
|
|
91
85
|
}
|
|
92
86
|
}, [handleModalClick, isModal, popUpState]);
|
|
93
|
-
|
|
87
|
+
const scaleBreakpoints = React.useCallback((value) => {
|
|
94
88
|
if (value) {
|
|
95
89
|
editedData({ colorArray: value, customizeFlag: true });
|
|
96
90
|
setBreakPointValues(value);
|
|
97
91
|
setCustomizedBreakpoints(value);
|
|
98
92
|
}
|
|
99
93
|
}, [editedData]);
|
|
100
|
-
|
|
94
|
+
const appendCustomizedBreakPoints = React.useCallback(() => {
|
|
101
95
|
// if breakpoints are editted then use customizedBreakpoints
|
|
102
96
|
editedData({
|
|
103
97
|
colorArray: customizedBreakpoints
|
|
@@ -106,10 +100,10 @@ export var LegendComp = function (_a) {
|
|
|
106
100
|
customizeFlag: true,
|
|
107
101
|
});
|
|
108
102
|
}, [breakpointValues, customizedBreakpoints, editedData]);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
const open = Boolean(anchorEl);
|
|
104
|
+
const id = open ? "simple-popover" : undefined;
|
|
105
|
+
const divRef = useRef(null);
|
|
106
|
+
const theme = useTheme();
|
|
113
107
|
return (arrayOfColors.length > 0 && (React.createElement(ThemeProvider, { theme: theme },
|
|
114
108
|
React.createElement(StyledRootContainer, { ref: divRef },
|
|
115
109
|
React.createElement(StyledColorScaleContainer, { onClick: appendCustomizedBreakPoints },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/Legend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,aAAa,MAAM,+BAA+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,IACjB,KAAK,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,EACxD,QAAQ,EAAC,OAAO,GAChB;wBAAC,GAAG;iCAEc,CAClB,CACE;YAET,UAAU,KAAK,IAAI,IAAI,CACtB,oBAAC,iBAAiB,IAChB,SAAS,EAAE,aAAa,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,qBAAqB,EAChC,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CACmB,CACR,CACjB,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
export type CustomizedDialogsProps = {
|
|
3
3
|
openModal?: any;
|
|
4
4
|
scaleBreakpoints?: any;
|
|
5
5
|
scaleData?: any;
|
|
6
6
|
customScalesName?: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use CustomizedDialogsProps instead.
|
|
10
|
+
*/
|
|
11
|
+
export type dialogProps = CustomizedDialogsProps;
|
|
12
|
+
export declare const CustomizedDialogs: React.FC<CustomizedDialogsProps>;
|
|
@@ -2,35 +2,31 @@ import * as React from "react";
|
|
|
2
2
|
import { ThemeProvider, styled, useTheme } from "@mui/material/styles";
|
|
3
3
|
import Dialog from "@mui/material/Dialog";
|
|
4
4
|
import { BreakPointComp, } from "../../component/ColorSelector/BreakPointModule";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export var CustomizedDialogs = function (_a) {
|
|
20
|
-
var openModal = _a.openModal, scaleBreakpoints = _a.scaleBreakpoints, scaleData = _a.scaleData, customScalesName = _a.customScalesName;
|
|
21
|
-
var _b = React.useState(true), openDialog = _b[0], setOpen = _b[1];
|
|
22
|
-
var handleClose = function () {
|
|
5
|
+
const BootstrapDialog = styled(Dialog)(({ theme }) => ({
|
|
6
|
+
"& .MuiDialogContent-root": {
|
|
7
|
+
padding: theme.spacing(2),
|
|
8
|
+
},
|
|
9
|
+
"& .MuiDialogActions-root": {
|
|
10
|
+
padding: theme.spacing(1),
|
|
11
|
+
},
|
|
12
|
+
"& .MuiDialog-container": {
|
|
13
|
+
height: "80% !important",
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
export const CustomizedDialogs = ({ openModal, scaleBreakpoints, scaleData, customScalesName, }) => {
|
|
17
|
+
const [openDialog, setOpen] = React.useState(true);
|
|
18
|
+
const handleClose = () => {
|
|
23
19
|
setOpen(false);
|
|
24
20
|
openModal(false);
|
|
25
21
|
};
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const [colorScaleBreakpoints, setColorScaleBreakpoints] = React.useState(scaleData);
|
|
23
|
+
const editedBreakpoint = React.useCallback((data) => {
|
|
28
24
|
setColorScaleBreakpoints(data);
|
|
29
25
|
scaleBreakpoints(data);
|
|
30
26
|
},
|
|
31
27
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
28
|
[setColorScaleBreakpoints, colorScaleBreakpoints]);
|
|
33
|
-
|
|
29
|
+
const theme = useTheme();
|
|
34
30
|
return (React.createElement("div", null, openDialog && (React.createElement(ThemeProvider, { theme: theme },
|
|
35
31
|
React.createElement(BootstrapDialog, { onClose: handleClose, "aria-labelledby": "customized-dialog-title", open: openDialog },
|
|
36
32
|
React.createElement(BreakPointComp, { colorScaleBreakpoints: colorScaleBreakpoints, setColorScaleBreakpoints: setColorScaleBreakpoints, editedBreakpoint: editedBreakpoint, customScalesName: customScalesName }))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MA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CAAC,SAAS,CAAC,CAAC;IAE5B,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACxC,CAAC,IAA4B,EAAE,EAAE;QAC/B,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC/B,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,uDAAuD;IACvD,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAClD,CAAC;IAEF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,OAAO,CACL,iCACG,UAAU,IAAI,CACb,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK;QACzB,oBAAC,eAAe,IACd,OAAO,EAAE,WAAW,qBACJ,yBAAyB,EACzC,IAAI,EAAE,UAAU;YAEhB,oBAAC,cAAc,IACb,qBAAqB,EAAE,qBAAqB,EAC5C,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,GAClC,CACc,CACJ,CACjB,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/component/BreakPoint/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAA0B,MAAM,SAAS,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export
|
|
2
|
+
export type IBreakPointArrayItem = {
|
|
3
3
|
position: number;
|
|
4
4
|
color: string;
|
|
5
5
|
name?: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
export type BreakPointCompProps = {
|
|
8
8
|
colorScaleBreakpoints?: IBreakPointArrayItem[];
|
|
9
9
|
setColorScaleBreakpoints?: any;
|
|
10
10
|
editedBreakpoint?: (colorScaleBreakpoints: IBreakPointArrayItem[]) => void;
|
|
11
11
|
customScalesName?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const BreakPointComp: React.FC<
|
|
14
|
-
export {};
|
|
13
|
+
export declare const BreakPointComp: React.FC<BreakPointCompProps>;
|