@mwater/visualization 5.3.1 → 5.3.2
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.
|
@@ -100,11 +100,10 @@ function ColorPaletteCollectionComponent(props) {
|
|
|
100
100
|
// Number of colors needed. Null doesn't count to length
|
|
101
101
|
const numColors = props.categories.filter((c) => c.value != null).length;
|
|
102
102
|
if (customColorsContext && customColorsContext.customColors.filter((c) => c != null).length > 0) {
|
|
103
|
-
const filteredCustomColors = customColorsContext.customColors.filter((c) => c != null);
|
|
104
103
|
const customPalettes = [];
|
|
105
|
-
for (let i = 0; i <
|
|
106
|
-
const customPalette =
|
|
107
|
-
customPalettes.push({ type: "custom", reversed: false, colors: customPalette });
|
|
104
|
+
for (let i = 0; i < customColorsContext.customColors.length; i += 6) {
|
|
105
|
+
const customPalette = customColorsContext.customColors.slice(i, i + 6);
|
|
106
|
+
customPalettes.push({ type: "custom", reversed: false, colors: customPalette.filter((c) => c != null) });
|
|
108
107
|
}
|
|
109
108
|
palettes.unshift(...customPalettes);
|
|
110
109
|
}
|
|
@@ -148,12 +147,13 @@ class ColorPaletteComponent extends react_1.default.Component {
|
|
|
148
147
|
return this.props.onPaletteSelected(this.props.index);
|
|
149
148
|
};
|
|
150
149
|
render() {
|
|
151
|
-
return (react_1.default.createElement("div", { onClick: this.handleSelect, className: "axis-palette" }, lodash_1.default.
|
|
150
|
+
return (react_1.default.createElement("div", { onClick: this.handleSelect, className: "axis-palette" }, lodash_1.default.range(Math.max(6, this.props.colorSet.length)).map((i) => {
|
|
151
|
+
const color = this.props.colorSet[i];
|
|
152
152
|
const cellStyle = {
|
|
153
153
|
display: "inline-block",
|
|
154
154
|
height: 20,
|
|
155
155
|
width: 20,
|
|
156
|
-
backgroundColor: color
|
|
156
|
+
backgroundColor: color ?? "transparent"
|
|
157
157
|
};
|
|
158
158
|
return react_1.default.createElement("div", { style: cellStyle, key: i }, " ");
|
|
159
159
|
})));
|
|
@@ -203,7 +203,7 @@ function CustomizeLayout(props) {
|
|
|
203
203
|
onLayoutOptionsChange({ ...layoutOptions, blockBackgroundColor: blockBackgroundColor ?? "white" });
|
|
204
204
|
} })),
|
|
205
205
|
react_1.default.createElement(bootstrap_1.FormGroup, { label: "Custom Colors" },
|
|
206
|
-
react_1.default.createElement("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '5px' } }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map((colorIndex) => (react_1.default.createElement(ColorComponent_1.default, { key: colorIndex, color: layoutOptions.customColors[colorIndex], onChange: (color) => {
|
|
206
|
+
react_1.default.createElement("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '5px' } }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17].map((colorIndex) => (react_1.default.createElement(ColorComponent_1.default, { key: colorIndex, color: layoutOptions.customColors[colorIndex], onChange: (color) => {
|
|
207
207
|
onLayoutOptionsChange((0, immer_1.default)(layoutOptions, (draft) => {
|
|
208
208
|
draft.customColors[colorIndex] = color;
|
|
209
209
|
}));
|