@emerson-eps/color-tables 0.4.100 → 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 +8 -7
|
@@ -1,23 +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
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
1
|
import * as React from "react";
|
|
22
2
|
import { useRef } from "react";
|
|
23
3
|
import { IconButton } from "@mui/material";
|
|
@@ -30,119 +10,102 @@ import ColorizeIcon from "@mui/icons-material/Colorize";
|
|
|
30
10
|
import { styled } from "@mui/system";
|
|
31
11
|
import { getColorArrayFromBreakPoints } from "../Utils/legendCommonFunction";
|
|
32
12
|
import { ColorScale } from "../BreakPoint/ColorScale";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
const RAIL_HEIGHT = 16;
|
|
14
|
+
const pointer_width = 12;
|
|
15
|
+
const StyledControllersContainer = styled("div")({
|
|
36
16
|
display: "flex",
|
|
37
17
|
flexDirection: "row",
|
|
38
18
|
marginTop: "18px",
|
|
39
19
|
marginLeft: "30px",
|
|
40
20
|
});
|
|
41
|
-
|
|
21
|
+
const StyledRail = styled("div")({
|
|
42
22
|
position: "absolute",
|
|
43
23
|
width: "100%",
|
|
44
24
|
height: "100%",
|
|
45
25
|
});
|
|
46
|
-
|
|
26
|
+
const StyledPointerContainer = styled("div")({
|
|
47
27
|
userSelect: "none",
|
|
48
28
|
cursor: "pointer",
|
|
49
29
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
top: 20,
|
|
89
|
-
width: pointer_width,
|
|
90
|
-
height: RAIL_HEIGHT,
|
|
91
|
-
borderWidth: "thin",
|
|
92
|
-
borderStyle: "solid",
|
|
93
|
-
borderColor: "white",
|
|
94
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
95
|
-
borderTopRightRadius: theme.shape.borderRadius,
|
|
96
|
-
boxSizing: "border-box",
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
var StyledPointerArrow = styled("div")({
|
|
30
|
+
const StyledRoot = styled("div")(({ theme }) => ({
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexDirection: "column",
|
|
33
|
+
gap: theme.spacing(2),
|
|
34
|
+
marginTop: "17px",
|
|
35
|
+
marginLeft: "37px",
|
|
36
|
+
height: "140px",
|
|
37
|
+
width: "240px",
|
|
38
|
+
}));
|
|
39
|
+
const StyledColorScaleContainer = styled("div")(({ theme }) => ({
|
|
40
|
+
height: RAIL_HEIGHT,
|
|
41
|
+
borderRadius: theme.shape.borderRadius,
|
|
42
|
+
overflow: "visible",
|
|
43
|
+
position: "relative",
|
|
44
|
+
marginTop: "9px",
|
|
45
|
+
}));
|
|
46
|
+
const StyledTextureContainer = styled("div")(({ theme }) => ({
|
|
47
|
+
position: "absolute",
|
|
48
|
+
width: "100%",
|
|
49
|
+
height: "100%",
|
|
50
|
+
borderRadius: theme.shape.borderRadius,
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
overflow: "hidden",
|
|
53
|
+
zIndex: 999,
|
|
54
|
+
}));
|
|
55
|
+
const StyledPointer = styled("div")(({ theme }) => ({
|
|
56
|
+
position: "absolute",
|
|
57
|
+
top: 20,
|
|
58
|
+
width: pointer_width,
|
|
59
|
+
height: RAIL_HEIGHT,
|
|
60
|
+
borderWidth: "thin",
|
|
61
|
+
borderStyle: "solid",
|
|
62
|
+
borderColor: "white",
|
|
63
|
+
borderTopLeftRadius: theme.shape.borderRadius,
|
|
64
|
+
borderTopRightRadius: theme.shape.borderRadius,
|
|
65
|
+
boxSizing: "border-box",
|
|
66
|
+
}));
|
|
67
|
+
const StyledPointerArrow = styled("div")({
|
|
100
68
|
position: "absolute",
|
|
101
69
|
top: 16,
|
|
102
70
|
width: 0,
|
|
103
71
|
height: 0,
|
|
104
|
-
borderLeft:
|
|
105
|
-
borderRight:
|
|
72
|
+
borderLeft: `${pointer_width / 2}px solid transparent`,
|
|
73
|
+
borderRight: `${pointer_width / 2}px solid transparent`,
|
|
106
74
|
borderTop: "4px solid black",
|
|
107
75
|
transform: "rotate(180deg)",
|
|
108
76
|
});
|
|
109
|
-
|
|
77
|
+
const StyledSketchPicker = styled("div")({
|
|
110
78
|
marginTop: "120px",
|
|
111
79
|
position: "fixed",
|
|
112
80
|
});
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var _b = React.useState({
|
|
81
|
+
export const BreakPointComp = ({ colorScaleBreakpoints, setColorScaleBreakpoints, editedBreakpoint, customScalesName, }) => {
|
|
82
|
+
const divRef = useRef(null);
|
|
83
|
+
const pointer_width = 12;
|
|
84
|
+
const [rectBox, setRectBox] = React.useState({
|
|
118
85
|
width: 0,
|
|
119
86
|
left: 0,
|
|
120
|
-
})
|
|
121
|
-
|
|
87
|
+
});
|
|
88
|
+
const setBoundingClientRect = React.useCallback((node) => {
|
|
122
89
|
node && setRectBox(node.getBoundingClientRect());
|
|
123
90
|
}, []);
|
|
124
|
-
|
|
91
|
+
const onMouseUp = React.useCallback(() => {
|
|
125
92
|
isBreakpointMovingRef.current = false;
|
|
126
93
|
}, []);
|
|
127
|
-
|
|
128
|
-
|
|
94
|
+
const [getIndex, setIndex] = React.useState(0);
|
|
95
|
+
const onMouseMove = React.useCallback((e) => {
|
|
129
96
|
var _a, _b, _c;
|
|
130
97
|
if (!isBreakpointMovingRef.current) {
|
|
131
98
|
return;
|
|
132
99
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
100
|
+
const offset = (_c = (_b = (_a = e.touches) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.clientX) !== null && _c !== void 0 ? _c : e.clientX;
|
|
101
|
+
const clampedNewWidth = clamp(offset, rectBox.left, rectBox.right) - rectBox.left;
|
|
102
|
+
const normalizer = scaleLinear().domain([0, rectBox.width]);
|
|
103
|
+
const normalizedPosition = normalizer(clampedNewWidth);
|
|
104
|
+
const firstItemIndex = 0;
|
|
105
|
+
const lastItemIndex = colorScaleBreakpoints.length - 1;
|
|
139
106
|
if (getIndex !== firstItemIndex && getIndex !== lastItemIndex) {
|
|
140
|
-
setColorScaleBreakpoints(
|
|
141
|
-
|
|
142
|
-
return index === selectedIndexRef.current
|
|
143
|
-
? __assign(__assign({}, item), { position: normalizedPosition }) : item;
|
|
144
|
-
});
|
|
145
|
-
});
|
|
107
|
+
setColorScaleBreakpoints((items) => items.map((item, index) => index === selectedIndexRef.current
|
|
108
|
+
? Object.assign(Object.assign({}, item), { position: normalizedPosition }) : item));
|
|
146
109
|
}
|
|
147
110
|
}, [
|
|
148
111
|
rectBox.left,
|
|
@@ -152,17 +115,17 @@ export var BreakPointComp = function (_a) {
|
|
|
152
115
|
getIndex,
|
|
153
116
|
setColorScaleBreakpoints,
|
|
154
117
|
]);
|
|
155
|
-
|
|
156
|
-
return Object.values(colorScaleBreakpoints).sort(
|
|
118
|
+
const orderedSelectedColors = React.useMemo(() => {
|
|
119
|
+
return Object.values(colorScaleBreakpoints).sort((a, b) => a.position - b.position);
|
|
157
120
|
}, [colorScaleBreakpoints]);
|
|
158
|
-
|
|
159
|
-
React.useEffect(
|
|
121
|
+
const arrayOfColors = React.useMemo(() => getColorArrayFromBreakPoints(orderedSelectedColors), [orderedSelectedColors]);
|
|
122
|
+
React.useEffect(() => {
|
|
160
123
|
document.addEventListener("mousemove", onMouseMove);
|
|
161
124
|
document.addEventListener("mouseup", onMouseUp);
|
|
162
125
|
if (editedBreakpoint) {
|
|
163
126
|
editedBreakpoint(colorScaleBreakpoints);
|
|
164
127
|
}
|
|
165
|
-
return
|
|
128
|
+
return () => {
|
|
166
129
|
document.removeEventListener("mousemove", onMouseMove);
|
|
167
130
|
document.removeEventListener("mouseup", onMouseUp);
|
|
168
131
|
};
|
|
@@ -173,49 +136,46 @@ export var BreakPointComp = function (_a) {
|
|
|
173
136
|
onMouseUp,
|
|
174
137
|
editedBreakpoint,
|
|
175
138
|
]);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
139
|
+
const isBreakpointMovingRef = React.useRef(false);
|
|
140
|
+
const selectedIndexRef = React.useRef(0);
|
|
141
|
+
const [selectedIndex, setSelectedIndex] = React.useState(1);
|
|
142
|
+
const onMouseDown = React.useCallback((index) => {
|
|
180
143
|
isBreakpointMovingRef.current = true;
|
|
181
144
|
selectedIndexRef.current = index;
|
|
182
145
|
setIndex(index);
|
|
183
146
|
setSelectedIndex(index);
|
|
184
147
|
}, []);
|
|
185
|
-
|
|
148
|
+
const selectedPointerArrowStyle = {
|
|
186
149
|
borderTopColor: "black",
|
|
187
150
|
};
|
|
188
|
-
|
|
151
|
+
const selectedPointerStyle = {
|
|
189
152
|
borderColor: "black",
|
|
190
153
|
borderWidth: 2,
|
|
191
154
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
setColorScaleBreakpoints(
|
|
195
|
-
|
|
196
|
-
return index === selectedIndexRef.current
|
|
197
|
-
? __assign(__assign({}, item), { color: color.hex }) : item;
|
|
198
|
-
});
|
|
199
|
-
});
|
|
155
|
+
const width = 200;
|
|
156
|
+
const onChangeComplete = React.useCallback((color) => {
|
|
157
|
+
setColorScaleBreakpoints((items) => items.map((item, index) => index === selectedIndexRef.current
|
|
158
|
+
? Object.assign(Object.assign({}, item), { color: color.hex }) : item));
|
|
200
159
|
}, [setColorScaleBreakpoints]);
|
|
201
|
-
|
|
202
|
-
|
|
160
|
+
const [popUpState, setPopUpState] = React.useState(false);
|
|
161
|
+
const launchPicker = React.useCallback(() => {
|
|
203
162
|
setPopUpState(true);
|
|
204
163
|
}, []);
|
|
205
|
-
|
|
206
|
-
setColorScaleBreakpoints(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
164
|
+
const addBreakpoint = React.useCallback(() => {
|
|
165
|
+
setColorScaleBreakpoints((items) => [
|
|
166
|
+
...items.splice(colorScaleBreakpoints.length - 1, 0, {
|
|
167
|
+
position: 0.5,
|
|
168
|
+
color: "#FF69B4",
|
|
169
|
+
}),
|
|
170
|
+
...items,
|
|
171
|
+
]);
|
|
210
172
|
setSelectedIndex(colorScaleBreakpoints.length);
|
|
211
173
|
selectedIndexRef.current = colorScaleBreakpoints.length;
|
|
212
174
|
}, [colorScaleBreakpoints, setColorScaleBreakpoints]);
|
|
213
|
-
|
|
175
|
+
const deleteBreakPoint = React.useCallback((indexToDelete) => {
|
|
214
176
|
if (indexToDelete !== 0 &&
|
|
215
177
|
indexToDelete !== colorScaleBreakpoints.length - 1) {
|
|
216
|
-
setColorScaleBreakpoints(
|
|
217
|
-
return items.filter(function (_, index) { return index !== indexToDelete; });
|
|
218
|
-
});
|
|
178
|
+
setColorScaleBreakpoints((items) => items.filter((_, index) => index !== indexToDelete));
|
|
219
179
|
if (selectedIndexRef.current === indexToDelete) {
|
|
220
180
|
setSelectedIndex(1);
|
|
221
181
|
selectedIndexRef.current = 1;
|
|
@@ -226,25 +186,24 @@ export var BreakPointComp = function (_a) {
|
|
|
226
186
|
React.createElement("label", { style: { fontWeight: "bold" } },
|
|
227
187
|
"Edit : ",
|
|
228
188
|
customScalesName + " Copy"),
|
|
229
|
-
React.createElement(StyledColorScaleContainer, { style: { width
|
|
189
|
+
React.createElement(StyledColorScaleContainer, { style: { width } },
|
|
230
190
|
React.createElement(StyledTextureContainer, null,
|
|
231
191
|
React.createElement(ColorScale, { arrayOfColors: arrayOfColors })),
|
|
232
192
|
React.createElement(StyledRail, { ref: setBoundingClientRect },
|
|
233
|
-
colorScaleBreakpoints.map(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var pointerStyle = selectedIndex === index ? selectedPointerStyle : {};
|
|
193
|
+
colorScaleBreakpoints.map(({ color, position }, index) => {
|
|
194
|
+
const left = position * rectBox.width - pointer_width / 2;
|
|
195
|
+
const onMoveStart = () => onMouseDown(index);
|
|
196
|
+
const pointerArrowStyle = selectedIndex === index ? selectedPointerArrowStyle : {};
|
|
197
|
+
const pointerStyle = selectedIndex === index ? selectedPointerStyle : {};
|
|
239
198
|
return (React.createElement(StyledPointerContainer, { key: index, onMouseDown: onMoveStart },
|
|
240
|
-
React.createElement(StyledPointerArrow, { sx: pointerArrowStyle, style: { left
|
|
241
|
-
React.createElement(StyledPointer, { sx: pointerStyle, style: { left
|
|
199
|
+
React.createElement(StyledPointerArrow, { sx: pointerArrowStyle, style: { left } }),
|
|
200
|
+
React.createElement(StyledPointer, { sx: pointerStyle, style: { left, backgroundColor: color } })));
|
|
242
201
|
}),
|
|
243
202
|
React.createElement(StyledSketchPicker, { ref: divRef }, popUpState ? (React.createElement(SketchPicker, { color: "red", onChangeComplete: onChangeComplete })) : null))),
|
|
244
203
|
React.createElement(StyledControllersContainer, null,
|
|
245
204
|
React.createElement(IconButton, { size: "medium", color: "primary", onClick: addBreakpoint },
|
|
246
205
|
React.createElement(AddCircleOutlineSharpIcon, { fontSize: "medium" })),
|
|
247
|
-
React.createElement(IconButton, { size: "medium", color: "secondary", onClick:
|
|
206
|
+
React.createElement(IconButton, { size: "medium", color: "secondary", onClick: () => deleteBreakPoint(selectedIndexRef.current), disabled: colorScaleBreakpoints.length === 1 },
|
|
248
207
|
React.createElement(RemoveCircleOutlineSharpIcon, { fontSize: "medium" })),
|
|
249
208
|
React.createElement(IconButton, { color: "primary", size: "medium", onClick: launchPicker },
|
|
250
209
|
React.createElement(ColorizeIcon, { fontSize: "medium" })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakPointModule.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/BreakPointModule.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BreakPointModule.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/BreakPointModule.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,yBAAyB,MAAM,2CAA2C,CAAC;AAClF,OAAO,4BAA4B,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAetD,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,0BAA0B,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO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,IAAI,CACW,CACV,CACa;QAC5B,oBAAC,0BAA0B;YACzB,oBAAC,UAAU,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAE,aAAa;gBAC9D,oBAAC,yBAAyB,IAAC,QAAQ,EAAC,QAAQ,GAAG,CACpC;YACb,oBAAC,UAAU,IACT,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACzD,QAAQ,EAAE,qBAAqB,CAAC,MAAM,KAAK,CAAC;gBAE5C,oBAAC,4BAA4B,IAAC,QAAQ,EAAC,QAAQ,GAAG,CACvC;YACb,oBAAC,UAAU,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,YAAY;gBAC7D,oBAAC,YAAY,IAAC,QAAQ,EAAC,QAAQ,GAAG,CACvB,CACc,CAClB,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -8,59 +8,56 @@ import { LegendComp } from "../BreakPoint/Legend";
|
|
|
8
8
|
import defaultColorTables from "../color-tables.json";
|
|
9
9
|
import { RGBToHex } from "../Utils/legendCommonFunction";
|
|
10
10
|
import { getColorSelectorPosition } from "../Utils/legendCommonFunction";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const StyledBox = styled(Box)(({ theme }) => ({
|
|
12
|
+
margin: theme.spacing(3),
|
|
13
|
+
width: theme.spacing(38),
|
|
14
|
+
border: "1px solid #dadada",
|
|
15
|
+
"& .MuiButtonBase-root.MuiAccordionSummary-root": {
|
|
16
|
+
minHeight: 30,
|
|
17
|
+
marginLeft: -15,
|
|
18
|
+
},
|
|
19
|
+
"& .MuiAccordionSummary-content": {
|
|
20
|
+
height: 0,
|
|
21
|
+
marginTop: 0,
|
|
22
|
+
},
|
|
23
|
+
"& .expandMoreIcon": {
|
|
24
|
+
marginRight: 8,
|
|
25
|
+
marginTop: -4,
|
|
26
|
+
},
|
|
27
|
+
"& .MuiPaper-root.MuiAccordion-root.Mui-expanded.MuiAccordion-rounded.MuiPaper-elevation1.MuiPaper-rounded": {
|
|
16
28
|
border: "1px solid #dadada",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
},
|
|
30
|
+
"& .makeStyles-accordion-1 .MuiAccordionDetails-root": {
|
|
31
|
+
marginTop: -15,
|
|
32
|
+
},
|
|
33
|
+
"& .MuiAccordionDetails-root": {
|
|
34
|
+
display: "block",
|
|
35
|
+
"& .colorScalesDetails": {
|
|
36
|
+
marginLeft: -27,
|
|
20
37
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"& .makeStyles-accordion-1 .MuiAccordionDetails-root": {
|
|
33
|
-
marginTop: -15,
|
|
34
|
-
},
|
|
35
|
-
"& .MuiAccordionDetails-root": {
|
|
36
|
-
display: "block",
|
|
37
|
-
"& .colorScalesDetails": {
|
|
38
|
-
marginLeft: -27,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
"& .MuiAccordion-root.Mui-expanded": {
|
|
42
|
-
margin: "auto",
|
|
43
|
-
},
|
|
44
|
-
"& h5": {
|
|
45
|
-
marginTop: 0,
|
|
46
|
-
marginLeft: -7,
|
|
47
|
-
height: 0,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
export var ColorSelectorAccordion = function (props) {
|
|
38
|
+
},
|
|
39
|
+
"& .MuiAccordion-root.Mui-expanded": {
|
|
40
|
+
margin: "auto",
|
|
41
|
+
},
|
|
42
|
+
"& h5": {
|
|
43
|
+
marginTop: 0,
|
|
44
|
+
marginLeft: -7,
|
|
45
|
+
height: 0,
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
export const ColorSelectorAccordion = (props) => {
|
|
52
49
|
var _a, _b;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
const containerRef = React.useRef(null);
|
|
51
|
+
const colorScaleBreakpoints = [];
|
|
52
|
+
const [customScalesName, setCustomScalesName] = React.useState("");
|
|
53
|
+
const [duplicatedData, setDuplicatedData] = React.useState([]);
|
|
54
|
+
let getColorScaleArray;
|
|
58
55
|
if (customScalesName) {
|
|
59
|
-
getColorScaleArray = defaultColorTables.find(
|
|
56
|
+
getColorScaleArray = defaultColorTables.find((value) => {
|
|
60
57
|
return value.name === customScalesName;
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
|
-
getColorScaleArray === null || getColorScaleArray === void 0 ? void 0 : getColorScaleArray.colors.forEach(
|
|
60
|
+
getColorScaleArray === null || getColorScaleArray === void 0 ? void 0 : getColorScaleArray.colors.forEach((value) => {
|
|
64
61
|
// return the color and breakPoint needed to draw the legend
|
|
65
62
|
colorScaleBreakpoints.push({
|
|
66
63
|
// to support discrete color for continous data
|
|
@@ -68,29 +65,27 @@ export var ColorSelectorAccordion = function (props) {
|
|
|
68
65
|
color: RGBToHex(value).color,
|
|
69
66
|
});
|
|
70
67
|
});
|
|
71
|
-
|
|
68
|
+
const breakpointValues = ((_a = props.breakPointFlag) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
72
69
|
? props.breakPointFlag
|
|
73
70
|
: colorScaleBreakpoints;
|
|
74
|
-
|
|
71
|
+
const editedData = React.useCallback((data) => {
|
|
75
72
|
props.getEditedBreakPoint({
|
|
76
73
|
colorArray: data.colorArray,
|
|
77
74
|
customizeFlag: data.customizeFlag,
|
|
78
75
|
});
|
|
79
76
|
}, [props]);
|
|
80
|
-
|
|
77
|
+
const isCustomScale = React.useCallback((data) => {
|
|
81
78
|
setCustomScalesName(data);
|
|
82
79
|
}, []);
|
|
83
|
-
|
|
80
|
+
const getDuplicatedLegendData = React.useCallback((data) => {
|
|
84
81
|
setDuplicatedData(data);
|
|
85
82
|
}, []);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
setExpanded(newExpanded ? panel : false);
|
|
90
|
-
};
|
|
83
|
+
const [expanded, setExpanded] = React.useState("panel1");
|
|
84
|
+
const handleChange = (panel) => (_event_, newExpanded) => {
|
|
85
|
+
setExpanded(newExpanded ? panel : false);
|
|
91
86
|
};
|
|
92
87
|
if ((duplicatedData === null || duplicatedData === void 0 ? void 0 : duplicatedData.length) > 0) {
|
|
93
|
-
var testComponent = duplicatedData === null || duplicatedData === void 0 ? void 0 : duplicatedData.map(
|
|
88
|
+
var testComponent = duplicatedData === null || duplicatedData === void 0 ? void 0 : duplicatedData.map((val, index) => {
|
|
94
89
|
return (React.createElement(LegendComp, { colorScaleBreakpoints: val, editedData: editedData, isModal: props.isModal, handleModalClick: props.handleModalClick, customScalesName: val[0].name, key: index }));
|
|
95
90
|
});
|
|
96
91
|
}
|
|
@@ -110,12 +105,12 @@ export var ColorSelectorAccordion = function (props) {
|
|
|
110
105
|
right: "-10px",
|
|
111
106
|
cursor: "pointer",
|
|
112
107
|
color: "#007079",
|
|
113
|
-
}, onMouseOver:
|
|
108
|
+
}, onMouseOver: (e) => {
|
|
114
109
|
e.preventDefault();
|
|
115
|
-
|
|
110
|
+
const target = e.target;
|
|
116
111
|
target.style.color = "#1099a5";
|
|
117
|
-
}, onMouseOut:
|
|
118
|
-
|
|
112
|
+
}, onMouseOut: (e) => {
|
|
113
|
+
const target = e.target;
|
|
119
114
|
target.style.color = "#007079";
|
|
120
115
|
}, onClick: props.setIsOpen }))),
|
|
121
116
|
React.createElement(StyledBox, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSelectorAccordion.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CA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L,KAAK,CAAE,yBAAyB,GAC3D,CACe,CACT,CACF,CACR,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
export type ColorSelectorProps = {
|
|
3
3
|
colorsObject?: any;
|
|
4
4
|
legendColor?: any;
|
|
5
5
|
legendColorName?: string;
|
|
@@ -9,5 +9,4 @@ declare type legendProps = {
|
|
|
9
9
|
colorScaleData: any;
|
|
10
10
|
currentLegendName?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const ColorSelectorComponent: React.FC<
|
|
13
|
-
export {};
|
|
12
|
+
export declare const ColorSelectorComponent: React.FC<ColorSelectorProps>;
|