@procaaso/alphinity-ui-components 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +50 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -3
- package/dist/index.d.ts +49 -3
- package/dist/index.js +48 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
CardValue: () => CardValue,
|
|
37
37
|
CircularGauge: () => CircularGauge,
|
|
38
38
|
ControlPanel: () => ControlPanel,
|
|
39
|
+
DEFAULT_STATUS_COLORS: () => DEFAULT_STATUS_COLORS,
|
|
39
40
|
DEFAULT_THRESHOLDS: () => DEFAULT_THRESHOLDS,
|
|
40
41
|
DashboardCard: () => DashboardCard,
|
|
41
42
|
DeviceConfigPanel: () => DeviceConfigPanel,
|
|
@@ -85,6 +86,7 @@ __export(index_exports, {
|
|
|
85
86
|
overlayStyles: () => overlayStyles,
|
|
86
87
|
registerSymbol: () => registerSymbol,
|
|
87
88
|
registerSymbols: () => registerSymbols,
|
|
89
|
+
resolveStatusColor: () => resolveStatusColor,
|
|
88
90
|
useDeviceConfigs: () => useDeviceConfigs,
|
|
89
91
|
useDeviceControls: () => useDeviceControls,
|
|
90
92
|
useDrag: () => useDrag,
|
|
@@ -996,6 +998,31 @@ var NodeControlsPanel = ({
|
|
|
996
998
|
|
|
997
999
|
// src/components/DeviceControlPanel/DeviceControlPanel.tsx
|
|
998
1000
|
var import_react5 = require("react");
|
|
1001
|
+
|
|
1002
|
+
// src/theme/statusColors.ts
|
|
1003
|
+
var DEFAULT_STATUS_COLORS = {
|
|
1004
|
+
normal: { fill: "#888888", stroke: "#6b6b6b", bg: "#888888", text: "#ffffff", border: "#6b6b6b" },
|
|
1005
|
+
warning: { fill: "#f59e0b", stroke: "#d97706", bg: "#FFD700", text: "#000000", border: "#d97706" },
|
|
1006
|
+
alarm: { fill: "#ef4444", stroke: "#dc2626", bg: "#FF0000", text: "#ffffff", border: "#dc2626" },
|
|
1007
|
+
fault: { fill: "#dc2626", stroke: "#b91c1c", bg: "#FF0000", text: "#ffffff", border: "#b91c1c" },
|
|
1008
|
+
off: { fill: "#edeeef", stroke: "#000000", bg: "#666666", text: "#ffffff", border: "#4b5563" },
|
|
1009
|
+
starting: { fill: "#90EE90", stroke: "#22c55e", bg: "#90EE90", text: "#000000", border: "#22c55e" },
|
|
1010
|
+
stopping: { fill: "#FFD700", stroke: "#d97706", bg: "#FFD700", text: "#000000", border: "#d97706" }
|
|
1011
|
+
};
|
|
1012
|
+
var STATUS_ALIASES = {
|
|
1013
|
+
running: "normal",
|
|
1014
|
+
stopped: "off"
|
|
1015
|
+
};
|
|
1016
|
+
function resolveStatusColor(status, customMap) {
|
|
1017
|
+
const raw = (status || "off").toLowerCase();
|
|
1018
|
+
const key = STATUS_ALIASES[raw] ?? raw;
|
|
1019
|
+
const defaults = DEFAULT_STATUS_COLORS[key] ?? DEFAULT_STATUS_COLORS.off;
|
|
1020
|
+
const overrides = customMap?.[key];
|
|
1021
|
+
if (!overrides) return defaults;
|
|
1022
|
+
return { ...defaults, ...overrides };
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// src/components/DeviceControlPanel/DeviceControlPanel.tsx
|
|
999
1026
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1000
1027
|
function DeviceControlPanel({
|
|
1001
1028
|
binding,
|
|
@@ -1070,23 +1097,8 @@ function DeviceControlPanel({
|
|
|
1070
1097
|
const textColor = binding.theme?.textColor || "#000000";
|
|
1071
1098
|
const mutedTextColor = "#666666";
|
|
1072
1099
|
const selectedColor = "#b4d0fe";
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
// Gray (no alarm)
|
|
1076
|
-
warning: binding.theme?.statusColors?.warning || "#FFD700",
|
|
1077
|
-
// Yellow
|
|
1078
|
-
alarm: binding.theme?.statusColors?.alarm || "#FF0000",
|
|
1079
|
-
// Red
|
|
1080
|
-
fault: binding.theme?.statusColors?.fault || "#FF0000",
|
|
1081
|
-
// Red
|
|
1082
|
-
off: binding.theme?.statusColors?.off || "#666666",
|
|
1083
|
-
// Dark gray
|
|
1084
|
-
starting: binding.theme?.statusColors?.starting || "#90EE90",
|
|
1085
|
-
// Light green
|
|
1086
|
-
stopping: binding.theme?.statusColors?.stopping || "#FFD700"
|
|
1087
|
-
// Yellow
|
|
1088
|
-
};
|
|
1089
|
-
const statusColor = statusColors[binding.state.status || "normal"];
|
|
1100
|
+
const statusEntry = resolveStatusColor(binding.state.status, binding.theme?.statusColors);
|
|
1101
|
+
const statusColor = statusEntry.bg;
|
|
1090
1102
|
const handleModeChange = (mode) => {
|
|
1091
1103
|
onModeChange?.(mode);
|
|
1092
1104
|
};
|
|
@@ -1373,7 +1385,10 @@ function DeviceControlPanel({
|
|
|
1373
1385
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1374
1386
|
"div",
|
|
1375
1387
|
{
|
|
1376
|
-
onClick: () =>
|
|
1388
|
+
onClick: () => {
|
|
1389
|
+
setPendingMode(currentMode);
|
|
1390
|
+
setShowModeModal(true);
|
|
1391
|
+
},
|
|
1377
1392
|
style: {
|
|
1378
1393
|
padding: "12px",
|
|
1379
1394
|
backgroundColor: surfaceColor,
|
|
@@ -4113,7 +4128,8 @@ function NodeRenderer({
|
|
|
4113
4128
|
onNodeDragStart,
|
|
4114
4129
|
draggingNodeId,
|
|
4115
4130
|
dragOffset = { x: 0, y: 0 },
|
|
4116
|
-
enableDrag = false
|
|
4131
|
+
enableDrag = false,
|
|
4132
|
+
statusColorMap
|
|
4117
4133
|
}) {
|
|
4118
4134
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { id: "layer-nodes", children: nodes2.filter((node) => node.visible !== false).map((node) => {
|
|
4119
4135
|
const symbol = getSymbolDefinition(node.symbolId);
|
|
@@ -4172,24 +4188,9 @@ function NodeRenderer({
|
|
|
4172
4188
|
`translate(${centerX}, ${centerY}) scale(${scaleX}, ${scaleY}) translate(${-centerX}, ${-centerY})`
|
|
4173
4189
|
);
|
|
4174
4190
|
}
|
|
4175
|
-
const
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
return "#22c55e";
|
|
4179
|
-
// Green
|
|
4180
|
-
case "alarm":
|
|
4181
|
-
return "#ef4444";
|
|
4182
|
-
// Red
|
|
4183
|
-
case "warning":
|
|
4184
|
-
return "#f59e0b";
|
|
4185
|
-
// Orange
|
|
4186
|
-
case "stopped":
|
|
4187
|
-
default:
|
|
4188
|
-
return "#edeeef";
|
|
4189
|
-
}
|
|
4190
|
-
};
|
|
4191
|
-
const fillColor = node.customColors?.fill ?? getStatusColor(node.status);
|
|
4192
|
-
const strokeColor = node.customColors?.stroke ?? "rgb(0, 0, 0)";
|
|
4191
|
+
const statusEntry = resolveStatusColor(node.status, statusColorMap);
|
|
4192
|
+
const fillColor = node.customColors?.fill ?? statusEntry.fill;
|
|
4193
|
+
const strokeColor = node.customColors?.stroke ?? statusEntry.stroke;
|
|
4193
4194
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
4194
4195
|
"g",
|
|
4195
4196
|
{
|
|
@@ -4453,7 +4454,8 @@ function DataOverlay({
|
|
|
4453
4454
|
x,
|
|
4454
4455
|
y,
|
|
4455
4456
|
telemetry,
|
|
4456
|
-
scale = 1
|
|
4457
|
+
scale = 1,
|
|
4458
|
+
statusColorMap
|
|
4457
4459
|
}) {
|
|
4458
4460
|
const { value, display, history } = telemetry;
|
|
4459
4461
|
const showValue = display?.showValue ?? true;
|
|
@@ -4478,21 +4480,9 @@ function DataOverlay({
|
|
|
4478
4480
|
}
|
|
4479
4481
|
return val.toString();
|
|
4480
4482
|
};
|
|
4481
|
-
const
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
alarm: { bg: "#ef4444", text: "#ffffff", border: "#dc2626" },
|
|
4485
|
-
fault: { bg: "#dc2626", text: "#ffffff", border: "#b91c1c" },
|
|
4486
|
-
off: { bg: "#6b7280", text: "#ffffff", border: "#4b5563" }
|
|
4487
|
-
};
|
|
4488
|
-
const getStatusColors = () => {
|
|
4489
|
-
const customColor = telemetry.statusColors?.[value.status];
|
|
4490
|
-
if (customColor) {
|
|
4491
|
-
return { bg: customColor, text: "#ffffff", border: customColor };
|
|
4492
|
-
}
|
|
4493
|
-
return defaultStatusColors[value.status] || defaultStatusColors.normal;
|
|
4494
|
-
};
|
|
4495
|
-
const statusColors = getStatusColors();
|
|
4483
|
+
const resolvedEntry = resolveStatusColor(value.status, statusColorMap);
|
|
4484
|
+
const customColor = telemetry.statusColors?.[value.status];
|
|
4485
|
+
const statusColors = customColor ? { bg: customColor, text: "#ffffff", border: customColor } : { bg: resolvedEntry.bg, text: resolvedEntry.text, border: resolvedEntry.border };
|
|
4496
4486
|
const colors = backgroundColor && backgroundColor !== "status" ? { bg: backgroundColor, text: textColor || "#ffffff", border: backgroundColor } : statusColors;
|
|
4497
4487
|
const finalTextColor = textColor || colors.text;
|
|
4498
4488
|
const formattedValue = formatValue(value.value);
|
|
@@ -5763,6 +5753,7 @@ function PIDCanvas({
|
|
|
5763
5753
|
onPipeCreated,
|
|
5764
5754
|
onMounted,
|
|
5765
5755
|
telemetry,
|
|
5756
|
+
statusColorMap,
|
|
5766
5757
|
...props
|
|
5767
5758
|
}) {
|
|
5768
5759
|
const [localDiagram, setLocalDiagram] = (0, import_react16.useState)(diagram);
|
|
@@ -6416,7 +6407,8 @@ function PIDCanvas({
|
|
|
6416
6407
|
enableDrag: dragEnabled && !isConnecting,
|
|
6417
6408
|
onNodeDragStart: dragEnabled && !isConnecting ? handleNodeDragStart : void 0,
|
|
6418
6409
|
draggingNodeId: dragState.draggedId,
|
|
6419
|
-
dragOffset: dragState.offset
|
|
6410
|
+
dragOffset: dragState.offset,
|
|
6411
|
+
statusColorMap
|
|
6420
6412
|
}
|
|
6421
6413
|
),
|
|
6422
6414
|
(features.editPipeRoutes ?? false) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -6450,7 +6442,8 @@ function PIDCanvas({
|
|
|
6450
6442
|
x: overlayX,
|
|
6451
6443
|
y: overlayY,
|
|
6452
6444
|
telemetry: binding,
|
|
6453
|
-
scale: features.telemetryScale ?? 1
|
|
6445
|
+
scale: features.telemetryScale ?? 1,
|
|
6446
|
+
statusColorMap
|
|
6454
6447
|
},
|
|
6455
6448
|
`telemetry-${node.id}`
|
|
6456
6449
|
);
|
|
@@ -8946,6 +8939,7 @@ function useSimulation(telemetry, updateTelemetryBatch, options = {}) {
|
|
|
8946
8939
|
CardValue,
|
|
8947
8940
|
CircularGauge,
|
|
8948
8941
|
ControlPanel,
|
|
8942
|
+
DEFAULT_STATUS_COLORS,
|
|
8949
8943
|
DEFAULT_THRESHOLDS,
|
|
8950
8944
|
DashboardCard,
|
|
8951
8945
|
DeviceConfigPanel,
|
|
@@ -8995,6 +8989,7 @@ function useSimulation(telemetry, updateTelemetryBatch, options = {}) {
|
|
|
8995
8989
|
overlayStyles,
|
|
8996
8990
|
registerSymbol,
|
|
8997
8991
|
registerSymbols,
|
|
8992
|
+
resolveStatusColor,
|
|
8998
8993
|
useDeviceConfigs,
|
|
8999
8994
|
useDeviceControls,
|
|
9000
8995
|
useDrag,
|