@imperosoft/cris-webui-components 1.1.2 → 1.1.3-beta.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/index.d.mts +91 -1
- package/dist/index.d.ts +91 -1
- package/dist/index.js +464 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +454 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1122,9 +1122,149 @@ function CrisOfflinePage({
|
|
|
1122
1122
|
] }) });
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
|
+
// src/components/CrisTextInput.tsx
|
|
1126
|
+
import { useState as useState4, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
1127
|
+
import { useDigital as useDigital6, useSerial as useSerial2, useJoinsStore as useJoinsStore3 } from "@imperosoft/cris-webui-ch5-core";
|
|
1128
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1129
|
+
var colors = {
|
|
1130
|
+
bg: "#4f5152",
|
|
1131
|
+
bgFocused: "#3a3c3d",
|
|
1132
|
+
text: "#ffffff",
|
|
1133
|
+
placeholder: "#9ca3af",
|
|
1134
|
+
border: "#6b7280",
|
|
1135
|
+
borderFocused: "#007ca0"
|
|
1136
|
+
};
|
|
1137
|
+
var defaults = {
|
|
1138
|
+
container: {
|
|
1139
|
+
display: "inline-flex",
|
|
1140
|
+
alignItems: "center",
|
|
1141
|
+
borderRadius: "0.5rem",
|
|
1142
|
+
background: colors.bg,
|
|
1143
|
+
border: `1px solid ${colors.border}`,
|
|
1144
|
+
transition: "border-color 0.15s, background 0.15s",
|
|
1145
|
+
overflow: "hidden"
|
|
1146
|
+
},
|
|
1147
|
+
containerFocused: {
|
|
1148
|
+
borderColor: colors.borderFocused,
|
|
1149
|
+
background: colors.bgFocused
|
|
1150
|
+
},
|
|
1151
|
+
input: {
|
|
1152
|
+
flex: 1,
|
|
1153
|
+
background: "transparent",
|
|
1154
|
+
border: "none",
|
|
1155
|
+
outline: "none",
|
|
1156
|
+
color: colors.text,
|
|
1157
|
+
fontSize: "1em",
|
|
1158
|
+
fontWeight: 500,
|
|
1159
|
+
padding: "0.6rem 0.9rem",
|
|
1160
|
+
width: "100%",
|
|
1161
|
+
fontFamily: "inherit"
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
function CrisTextInput({
|
|
1165
|
+
join,
|
|
1166
|
+
joinFeedback,
|
|
1167
|
+
joinEnable,
|
|
1168
|
+
joinVisible,
|
|
1169
|
+
placeholder = "",
|
|
1170
|
+
maxLength,
|
|
1171
|
+
type = "text",
|
|
1172
|
+
submitOnEnter = true,
|
|
1173
|
+
submitOnBlur = false,
|
|
1174
|
+
submitOnChange = false,
|
|
1175
|
+
clearOnSubmit = false,
|
|
1176
|
+
className,
|
|
1177
|
+
style,
|
|
1178
|
+
inputClassName,
|
|
1179
|
+
inputStyle,
|
|
1180
|
+
classDisabled,
|
|
1181
|
+
classFocused: classFocusedProp
|
|
1182
|
+
}) {
|
|
1183
|
+
const feedbackJoin = joinFeedback ?? join;
|
|
1184
|
+
const feedback = useSerial2(feedbackJoin);
|
|
1185
|
+
const enabled = useDigital6(joinEnable ?? 0);
|
|
1186
|
+
const visible = useDigital6(joinVisible ?? 0);
|
|
1187
|
+
const sSet = useJoinsStore3((state) => state.sSet);
|
|
1188
|
+
const isEnabled = joinEnable == null ? true : enabled;
|
|
1189
|
+
const isVisible = joinVisible == null ? true : visible;
|
|
1190
|
+
const [localValue, setLocalValue] = useState4("");
|
|
1191
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
1192
|
+
const inputRef = useRef3(null);
|
|
1193
|
+
useEffect4(() => {
|
|
1194
|
+
if (!isFocused) {
|
|
1195
|
+
setLocalValue(feedback);
|
|
1196
|
+
}
|
|
1197
|
+
}, [feedback, isFocused]);
|
|
1198
|
+
if (!isVisible) return null;
|
|
1199
|
+
const submit = (value) => {
|
|
1200
|
+
sSet(join, value);
|
|
1201
|
+
if (clearOnSubmit) {
|
|
1202
|
+
setLocalValue("");
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
const handleChange = (e) => {
|
|
1206
|
+
const val = e.target.value;
|
|
1207
|
+
setLocalValue(val);
|
|
1208
|
+
if (submitOnChange) {
|
|
1209
|
+
submit(val);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
const handleKeyDown = (e) => {
|
|
1213
|
+
if (submitOnEnter && e.key === "Enter") {
|
|
1214
|
+
submit(localValue);
|
|
1215
|
+
inputRef.current?.blur();
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
const handleFocus = () => {
|
|
1219
|
+
setIsFocused(true);
|
|
1220
|
+
};
|
|
1221
|
+
const handleBlur = () => {
|
|
1222
|
+
setIsFocused(false);
|
|
1223
|
+
if (submitOnBlur) {
|
|
1224
|
+
submit(localValue);
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
const useDefaults = !className;
|
|
1228
|
+
const containerClasses = [
|
|
1229
|
+
"cris-text-input",
|
|
1230
|
+
className,
|
|
1231
|
+
!isEnabled && (classDisabled || "disabled"),
|
|
1232
|
+
isFocused && (classFocusedProp || "focused")
|
|
1233
|
+
].filter(Boolean).join(" ");
|
|
1234
|
+
const containerStyle = useDefaults ? {
|
|
1235
|
+
...defaults.container,
|
|
1236
|
+
...isFocused ? defaults.containerFocused : void 0,
|
|
1237
|
+
...style,
|
|
1238
|
+
opacity: isEnabled ? 1 : 0.4,
|
|
1239
|
+
pointerEvents: isEnabled ? "auto" : "none"
|
|
1240
|
+
} : {
|
|
1241
|
+
...style,
|
|
1242
|
+
opacity: isEnabled ? 1 : 0.4,
|
|
1243
|
+
pointerEvents: isEnabled ? "auto" : "none"
|
|
1244
|
+
};
|
|
1245
|
+
const computedInputStyle = inputClassName ? { ...inputStyle } : { ...defaults.input, ...inputStyle };
|
|
1246
|
+
return /* @__PURE__ */ jsx7("div", { className: containerClasses, style: containerStyle, children: /* @__PURE__ */ jsx7(
|
|
1247
|
+
"input",
|
|
1248
|
+
{
|
|
1249
|
+
ref: inputRef,
|
|
1250
|
+
type,
|
|
1251
|
+
value: localValue,
|
|
1252
|
+
placeholder,
|
|
1253
|
+
maxLength,
|
|
1254
|
+
disabled: !isEnabled,
|
|
1255
|
+
className: inputClassName,
|
|
1256
|
+
style: computedInputStyle,
|
|
1257
|
+
onChange: handleChange,
|
|
1258
|
+
onKeyDown: handleKeyDown,
|
|
1259
|
+
onFocus: handleFocus,
|
|
1260
|
+
onBlur: handleBlur
|
|
1261
|
+
}
|
|
1262
|
+
) });
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1125
1265
|
// src/components/CrisCoDebug.tsx
|
|
1126
1266
|
import { useCustomObject, useCustomObjectSend } from "@imperosoft/cris-webui-ch5-core";
|
|
1127
|
-
import { Fragment as Fragment2, jsx as
|
|
1267
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1128
1268
|
var defaultStyles = {
|
|
1129
1269
|
container: {
|
|
1130
1270
|
display: "flex",
|
|
@@ -1184,7 +1324,7 @@ var defaultStyles = {
|
|
|
1184
1324
|
};
|
|
1185
1325
|
function ConnectionIcon({ on, type }) {
|
|
1186
1326
|
const label = type === "eth" ? "ETH" : "RS";
|
|
1187
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx8(
|
|
1188
1328
|
"div",
|
|
1189
1329
|
{
|
|
1190
1330
|
style: {
|
|
@@ -1193,11 +1333,11 @@ function ConnectionIcon({ on, type }) {
|
|
|
1193
1333
|
},
|
|
1194
1334
|
title: `${type === "eth" ? "Ethernet" : "RS232"}: ${on ? "Connected" : "Disconnected"}`,
|
|
1195
1335
|
children: /* @__PURE__ */ jsxs6("svg", { width: "20", height: "20", viewBox: "0 0 20 20", children: [
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
on ? /* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
-
/* @__PURE__ */
|
|
1336
|
+
/* @__PURE__ */ jsx8("rect", { x: "1", y: "4", width: "18", height: "12", rx: "2", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1337
|
+
/* @__PURE__ */ jsx8("text", { x: "10", y: "12.5", textAnchor: "middle", fontSize: "7", fontWeight: "bold", fill: "currentColor", children: label }),
|
|
1338
|
+
on ? /* @__PURE__ */ jsx8("circle", { cx: "16", cy: "5", r: "3.5", fill: "#4caf50", stroke: "none" }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1339
|
+
/* @__PURE__ */ jsx8("circle", { cx: "16", cy: "5", r: "3.5", fill: "#f44336", stroke: "none" }),
|
|
1340
|
+
/* @__PURE__ */ jsx8("line", { x1: "14", y1: "3", x2: "18", y2: "7", stroke: "white", strokeWidth: "1.5" })
|
|
1201
1341
|
] })
|
|
1202
1342
|
] })
|
|
1203
1343
|
}
|
|
@@ -1223,15 +1363,15 @@ function DebugModuleItem({
|
|
|
1223
1363
|
style: itemClassName ? itemStyle : { ...defaultStyles.item, ...itemStyle },
|
|
1224
1364
|
children: [
|
|
1225
1365
|
/* @__PURE__ */ jsxs6("div", { style: defaultStyles.info, children: [
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ jsx8("div", { style: defaultStyles.moduleName, children: name }),
|
|
1367
|
+
/* @__PURE__ */ jsx8("div", { style: defaultStyles.moduleType, children: module.tp })
|
|
1228
1368
|
] }),
|
|
1229
1369
|
/* @__PURE__ */ jsxs6("div", { style: defaultStyles.icons, children: [
|
|
1230
|
-
module.et.vs && (iconEthOn && iconEthOff ? module.et.on ? iconEthOn : iconEthOff : /* @__PURE__ */
|
|
1231
|
-
module.rs.vs && (iconRs232On && iconRs232Off ? module.rs.on ? iconRs232On : iconRs232Off : /* @__PURE__ */
|
|
1370
|
+
module.et.vs && (iconEthOn && iconEthOff ? module.et.on ? iconEthOn : iconEthOff : /* @__PURE__ */ jsx8(ConnectionIcon, { on: module.et.on, type: "eth" })),
|
|
1371
|
+
module.rs.vs && (iconRs232On && iconRs232Off ? module.rs.on ? iconRs232On : iconRs232Off : /* @__PURE__ */ jsx8(ConnectionIcon, { on: module.rs.on, type: "rs232" }))
|
|
1232
1372
|
] }),
|
|
1233
1373
|
/* @__PURE__ */ jsxs6("div", { style: defaultStyles.buttons, children: [
|
|
1234
|
-
module.md.vs && /* @__PURE__ */
|
|
1374
|
+
module.md.vs && /* @__PURE__ */ jsx8(
|
|
1235
1375
|
CrisButton,
|
|
1236
1376
|
{
|
|
1237
1377
|
selected: module.md.on,
|
|
@@ -1241,7 +1381,7 @@ function DebugModuleItem({
|
|
|
1241
1381
|
onPress: () => onAction("toggleMod", module.id)
|
|
1242
1382
|
}
|
|
1243
1383
|
),
|
|
1244
|
-
module.cm.vs && /* @__PURE__ */
|
|
1384
|
+
module.cm.vs && /* @__PURE__ */ jsx8(
|
|
1245
1385
|
CrisButton,
|
|
1246
1386
|
{
|
|
1247
1387
|
selected: module.cm.on,
|
|
@@ -1285,8 +1425,8 @@ function CrisCoDebug({
|
|
|
1285
1425
|
className,
|
|
1286
1426
|
style: className ? style : { ...defaultStyles.container, ...style },
|
|
1287
1427
|
children: [
|
|
1288
|
-
title && /* @__PURE__ */
|
|
1289
|
-
visibleModules.map((module) => /* @__PURE__ */
|
|
1428
|
+
title && /* @__PURE__ */ jsx8("div", { style: defaultStyles.title, children: title }),
|
|
1429
|
+
visibleModules.map((module) => /* @__PURE__ */ jsx8(
|
|
1290
1430
|
DebugModuleItem,
|
|
1291
1431
|
{
|
|
1292
1432
|
module,
|
|
@@ -1307,10 +1447,250 @@ function CrisCoDebug({
|
|
|
1307
1447
|
);
|
|
1308
1448
|
}
|
|
1309
1449
|
|
|
1310
|
-
// src/components/
|
|
1450
|
+
// src/components/CrisCoList.tsx
|
|
1311
1451
|
import { useCustomObject as useCustomObject2, useCustomObjectSend as useCustomObjectSend2 } from "@imperosoft/cris-webui-ch5-core";
|
|
1312
|
-
import { jsx as
|
|
1313
|
-
var
|
|
1452
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1453
|
+
var colors2 = {
|
|
1454
|
+
itemBg: "#4f5152",
|
|
1455
|
+
itemActiveBg: "#007ca0",
|
|
1456
|
+
text: "#ffffff",
|
|
1457
|
+
headerText: "#6b7280"
|
|
1458
|
+
};
|
|
1459
|
+
var defaults2 = {
|
|
1460
|
+
container: {
|
|
1461
|
+
display: "flex",
|
|
1462
|
+
flexDirection: "column",
|
|
1463
|
+
overflow: "hidden",
|
|
1464
|
+
height: "100%",
|
|
1465
|
+
width: "100%",
|
|
1466
|
+
padding: "1rem 2rem",
|
|
1467
|
+
minHeight: 0
|
|
1468
|
+
},
|
|
1469
|
+
header: {
|
|
1470
|
+
fontSize: "1.5em",
|
|
1471
|
+
fontWeight: 700,
|
|
1472
|
+
padding: "0.5rem 0.75rem",
|
|
1473
|
+
textTransform: "uppercase",
|
|
1474
|
+
letterSpacing: "0.05em",
|
|
1475
|
+
color: colors2.headerText,
|
|
1476
|
+
flexShrink: 0,
|
|
1477
|
+
textAlign: "center"
|
|
1478
|
+
},
|
|
1479
|
+
scroll: {
|
|
1480
|
+
flex: 1,
|
|
1481
|
+
minHeight: 0,
|
|
1482
|
+
overflow: "auto",
|
|
1483
|
+
scrollbarWidth: "none",
|
|
1484
|
+
WebkitOverflowScrolling: "touch",
|
|
1485
|
+
display: "flex",
|
|
1486
|
+
flexDirection: "column",
|
|
1487
|
+
gap: "0.15rem"
|
|
1488
|
+
},
|
|
1489
|
+
item: {
|
|
1490
|
+
display: "flex",
|
|
1491
|
+
alignItems: "stretch",
|
|
1492
|
+
minHeight: "3.7rem",
|
|
1493
|
+
cursor: "pointer",
|
|
1494
|
+
userSelect: "none",
|
|
1495
|
+
background: colors2.itemBg,
|
|
1496
|
+
borderRadius: "0.5rem",
|
|
1497
|
+
transition: "background 0.15s"
|
|
1498
|
+
},
|
|
1499
|
+
itemActive: {
|
|
1500
|
+
background: colors2.itemActiveBg
|
|
1501
|
+
},
|
|
1502
|
+
itemBtn: {
|
|
1503
|
+
flex: 1,
|
|
1504
|
+
minWidth: 0,
|
|
1505
|
+
display: "flex",
|
|
1506
|
+
alignItems: "stretch",
|
|
1507
|
+
background: "transparent",
|
|
1508
|
+
border: "none",
|
|
1509
|
+
textAlign: "left",
|
|
1510
|
+
color: colors2.text,
|
|
1511
|
+
height: "100%",
|
|
1512
|
+
borderRadius: "0.5rem",
|
|
1513
|
+
cursor: "pointer"
|
|
1514
|
+
},
|
|
1515
|
+
itemBtnInner: {
|
|
1516
|
+
display: "flex",
|
|
1517
|
+
alignItems: "center",
|
|
1518
|
+
gap: "0.4rem",
|
|
1519
|
+
width: "100%",
|
|
1520
|
+
flex: 1,
|
|
1521
|
+
padding: "0.5rem 0.9rem"
|
|
1522
|
+
},
|
|
1523
|
+
idNum: {
|
|
1524
|
+
flexShrink: 0,
|
|
1525
|
+
opacity: 0.6,
|
|
1526
|
+
minWidth: "1.7em",
|
|
1527
|
+
textAlign: "right",
|
|
1528
|
+
fontWeight: 400,
|
|
1529
|
+
marginRight: "0.4em"
|
|
1530
|
+
},
|
|
1531
|
+
itemLabel: {
|
|
1532
|
+
flex: 1,
|
|
1533
|
+
fontSize: "1.4em",
|
|
1534
|
+
fontWeight: 700,
|
|
1535
|
+
whiteSpace: "nowrap",
|
|
1536
|
+
overflow: "hidden",
|
|
1537
|
+
textOverflow: "ellipsis",
|
|
1538
|
+
color: colors2.text
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
1541
|
+
var INJECTED_CSS = `
|
|
1542
|
+
.cris-co-list-scroll::-webkit-scrollbar { display: none; }
|
|
1543
|
+
.cris-co-list-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1544
|
+
`;
|
|
1545
|
+
var styleInjected = false;
|
|
1546
|
+
function injectStyle() {
|
|
1547
|
+
if (styleInjected) return;
|
|
1548
|
+
styleInjected = true;
|
|
1549
|
+
const style = document.createElement("style");
|
|
1550
|
+
style.textContent = INJECTED_CSS;
|
|
1551
|
+
document.head.appendChild(style);
|
|
1552
|
+
}
|
|
1553
|
+
function ListItemRow({
|
|
1554
|
+
item,
|
|
1555
|
+
selected,
|
|
1556
|
+
showIds,
|
|
1557
|
+
settings,
|
|
1558
|
+
onSelect,
|
|
1559
|
+
renderItem,
|
|
1560
|
+
itemClassName,
|
|
1561
|
+
itemStyle: itemStyleProp,
|
|
1562
|
+
itemActiveClassName,
|
|
1563
|
+
itemActiveStyle,
|
|
1564
|
+
itemDisabledClassName
|
|
1565
|
+
}) {
|
|
1566
|
+
const isEnabled = item.en !== false;
|
|
1567
|
+
const useDefaults = !itemClassName;
|
|
1568
|
+
const classes = [
|
|
1569
|
+
"cris-co-list-item",
|
|
1570
|
+
itemClassName,
|
|
1571
|
+
selected && (itemActiveClassName || "active"),
|
|
1572
|
+
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1573
|
+
].filter(Boolean).join(" ");
|
|
1574
|
+
const computedStyle = useDefaults ? {
|
|
1575
|
+
...defaults2.item,
|
|
1576
|
+
...itemStyleProp,
|
|
1577
|
+
...selected ? { ...defaults2.itemActive, ...itemActiveStyle } : void 0,
|
|
1578
|
+
opacity: isEnabled ? 1 : 0.4
|
|
1579
|
+
} : { ...itemStyleProp };
|
|
1580
|
+
if (renderItem) {
|
|
1581
|
+
return /* @__PURE__ */ jsx9("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ jsx9("div", { style: defaults2.itemBtn, children: /* @__PURE__ */ jsx9(
|
|
1582
|
+
CrisButton,
|
|
1583
|
+
{
|
|
1584
|
+
selected,
|
|
1585
|
+
enabled: isEnabled,
|
|
1586
|
+
onPress: onSelect,
|
|
1587
|
+
showLocalFeedback: false,
|
|
1588
|
+
children: renderItem(item, selected, settings)
|
|
1589
|
+
}
|
|
1590
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
1591
|
+
CrisButton,
|
|
1592
|
+
{
|
|
1593
|
+
selected,
|
|
1594
|
+
enabled: isEnabled,
|
|
1595
|
+
onPress: onSelect,
|
|
1596
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1597
|
+
classActive: itemActiveClassName,
|
|
1598
|
+
children: renderItem(item, selected, settings)
|
|
1599
|
+
}
|
|
1600
|
+
) });
|
|
1601
|
+
}
|
|
1602
|
+
return /* @__PURE__ */ jsx9("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ jsx9("div", { style: defaults2.itemBtn, children: /* @__PURE__ */ jsx9(
|
|
1603
|
+
CrisButton,
|
|
1604
|
+
{
|
|
1605
|
+
selected,
|
|
1606
|
+
enabled: isEnabled,
|
|
1607
|
+
onPress: onSelect,
|
|
1608
|
+
showLocalFeedback: false,
|
|
1609
|
+
children: /* @__PURE__ */ jsxs7("div", { style: defaults2.itemBtnInner, children: [
|
|
1610
|
+
showIds && /* @__PURE__ */ jsx9("span", { className: "cris-co-list-id", style: defaults2.idNum, children: item.id }),
|
|
1611
|
+
/* @__PURE__ */ jsx9("span", { style: defaults2.itemLabel, children: item.lb || `Item ${item.id}` })
|
|
1612
|
+
] })
|
|
1613
|
+
}
|
|
1614
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
1615
|
+
CrisButton,
|
|
1616
|
+
{
|
|
1617
|
+
selected,
|
|
1618
|
+
enabled: isEnabled,
|
|
1619
|
+
onPress: onSelect,
|
|
1620
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1621
|
+
classActive: itemActiveClassName,
|
|
1622
|
+
children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1623
|
+
showIds && /* @__PURE__ */ jsx9("span", { className: "cris-co-list-id", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1624
|
+
/* @__PURE__ */ jsx9("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `Item ${item.id}` })
|
|
1625
|
+
] })
|
|
1626
|
+
}
|
|
1627
|
+
) });
|
|
1628
|
+
}
|
|
1629
|
+
function CrisCoList({
|
|
1630
|
+
oid,
|
|
1631
|
+
title,
|
|
1632
|
+
showIds = true,
|
|
1633
|
+
selectAction = "select",
|
|
1634
|
+
renderItem,
|
|
1635
|
+
className,
|
|
1636
|
+
style,
|
|
1637
|
+
headerClassName,
|
|
1638
|
+
headerStyle,
|
|
1639
|
+
itemClassName,
|
|
1640
|
+
itemStyle,
|
|
1641
|
+
itemActiveClassName,
|
|
1642
|
+
itemActiveStyle,
|
|
1643
|
+
itemDisabledClassName
|
|
1644
|
+
}) {
|
|
1645
|
+
const list = useCustomObject2(oid);
|
|
1646
|
+
const send = useCustomObjectSend2();
|
|
1647
|
+
injectStyle();
|
|
1648
|
+
if (!list) return null;
|
|
1649
|
+
const { st: settings, si, it: items } = list;
|
|
1650
|
+
const visibleItems = items?.filter((item) => item.vs !== false);
|
|
1651
|
+
const handleSelect = (id) => {
|
|
1652
|
+
send(oid, { action: selectAction, id });
|
|
1653
|
+
};
|
|
1654
|
+
return /* @__PURE__ */ jsxs7(
|
|
1655
|
+
"div",
|
|
1656
|
+
{
|
|
1657
|
+
className,
|
|
1658
|
+
style: className ? style : { ...defaults2.container, ...style },
|
|
1659
|
+
children: [
|
|
1660
|
+
title && /* @__PURE__ */ jsx9(
|
|
1661
|
+
"div",
|
|
1662
|
+
{
|
|
1663
|
+
className: headerClassName,
|
|
1664
|
+
style: headerClassName ? headerStyle : { ...defaults2.header, ...headerStyle },
|
|
1665
|
+
children: title
|
|
1666
|
+
}
|
|
1667
|
+
),
|
|
1668
|
+
/* @__PURE__ */ jsx9("div", { className: "cris-co-list-scroll", style: defaults2.scroll, children: visibleItems?.map((item) => /* @__PURE__ */ jsx9(
|
|
1669
|
+
ListItemRow,
|
|
1670
|
+
{
|
|
1671
|
+
item,
|
|
1672
|
+
selected: si === item.id,
|
|
1673
|
+
showIds,
|
|
1674
|
+
settings,
|
|
1675
|
+
onSelect: () => handleSelect(item.id),
|
|
1676
|
+
renderItem,
|
|
1677
|
+
itemClassName,
|
|
1678
|
+
itemStyle,
|
|
1679
|
+
itemActiveClassName,
|
|
1680
|
+
itemActiveStyle,
|
|
1681
|
+
itemDisabledClassName
|
|
1682
|
+
},
|
|
1683
|
+
item.id
|
|
1684
|
+
)) })
|
|
1685
|
+
]
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/components/CrisCoMatrixListsTie.tsx
|
|
1691
|
+
import { useCustomObject as useCustomObject3, useCustomObjectSend as useCustomObjectSend3 } from "@imperosoft/cris-webui-ch5-core";
|
|
1692
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1693
|
+
var colors3 = {
|
|
1314
1694
|
itemBg: "#4f5152",
|
|
1315
1695
|
itemActiveBg: "#007ca0",
|
|
1316
1696
|
vmActiveBg: "#dc2626",
|
|
@@ -1321,7 +1701,7 @@ var colors = {
|
|
|
1321
1701
|
sgOn: "#2196f3",
|
|
1322
1702
|
sgOff: "#666666"
|
|
1323
1703
|
};
|
|
1324
|
-
var
|
|
1704
|
+
var defaults3 = {
|
|
1325
1705
|
container: {
|
|
1326
1706
|
display: "flex",
|
|
1327
1707
|
flexDirection: "row",
|
|
@@ -1343,7 +1723,7 @@ var defaults = {
|
|
|
1343
1723
|
padding: "0.5rem 0.75rem",
|
|
1344
1724
|
textTransform: "uppercase",
|
|
1345
1725
|
letterSpacing: "0.05em",
|
|
1346
|
-
color:
|
|
1726
|
+
color: colors3.headerText,
|
|
1347
1727
|
flexShrink: 0,
|
|
1348
1728
|
textAlign: "center"
|
|
1349
1729
|
},
|
|
@@ -1365,12 +1745,12 @@ var defaults = {
|
|
|
1365
1745
|
minHeight: "3.7rem",
|
|
1366
1746
|
cursor: "pointer",
|
|
1367
1747
|
userSelect: "none",
|
|
1368
|
-
background:
|
|
1748
|
+
background: colors3.itemBg,
|
|
1369
1749
|
borderRadius: "0.5rem",
|
|
1370
1750
|
transition: "background 0.15s"
|
|
1371
1751
|
},
|
|
1372
1752
|
itemActive: {
|
|
1373
|
-
background:
|
|
1753
|
+
background: colors3.itemActiveBg
|
|
1374
1754
|
},
|
|
1375
1755
|
itemBtn: {
|
|
1376
1756
|
flex: 1,
|
|
@@ -1380,7 +1760,7 @@ var defaults = {
|
|
|
1380
1760
|
background: "transparent",
|
|
1381
1761
|
border: "none",
|
|
1382
1762
|
textAlign: "left",
|
|
1383
|
-
color:
|
|
1763
|
+
color: colors3.text,
|
|
1384
1764
|
height: "100%",
|
|
1385
1765
|
borderRadius: "0.5rem",
|
|
1386
1766
|
cursor: "pointer"
|
|
@@ -1408,7 +1788,7 @@ var defaults = {
|
|
|
1408
1788
|
whiteSpace: "nowrap",
|
|
1409
1789
|
overflow: "hidden",
|
|
1410
1790
|
textOverflow: "ellipsis",
|
|
1411
|
-
color:
|
|
1791
|
+
color: colors3.text
|
|
1412
1792
|
},
|
|
1413
1793
|
indicators: {
|
|
1414
1794
|
display: "flex",
|
|
@@ -1426,8 +1806,8 @@ var defaults = {
|
|
|
1426
1806
|
alignSelf: "stretch",
|
|
1427
1807
|
display: "flex",
|
|
1428
1808
|
alignItems: "center",
|
|
1429
|
-
background:
|
|
1430
|
-
color:
|
|
1809
|
+
background: colors3.itemBg,
|
|
1810
|
+
color: colors3.text,
|
|
1431
1811
|
border: "none",
|
|
1432
1812
|
borderRadius: "0.4rem",
|
|
1433
1813
|
padding: "0 0.6rem",
|
|
@@ -1438,11 +1818,11 @@ var defaults = {
|
|
|
1438
1818
|
transition: "background 0.15s"
|
|
1439
1819
|
},
|
|
1440
1820
|
vmBtnActive: {
|
|
1441
|
-
background:
|
|
1442
|
-
color:
|
|
1821
|
+
background: colors3.vmActiveBg,
|
|
1822
|
+
color: colors3.text
|
|
1443
1823
|
}
|
|
1444
1824
|
};
|
|
1445
|
-
var
|
|
1825
|
+
var INJECTED_CSS2 = `
|
|
1446
1826
|
.cris-co-matrix-scroll::-webkit-scrollbar { display: none; }
|
|
1447
1827
|
.cris-co-matrix-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1448
1828
|
`;
|
|
@@ -1451,28 +1831,28 @@ function injectScrollbarStyle() {
|
|
|
1451
1831
|
if (scrollbarStyleInjected) return;
|
|
1452
1832
|
scrollbarStyleInjected = true;
|
|
1453
1833
|
const style = document.createElement("style");
|
|
1454
|
-
style.textContent =
|
|
1834
|
+
style.textContent = INJECTED_CSS2;
|
|
1455
1835
|
document.head.appendChild(style);
|
|
1456
1836
|
}
|
|
1457
1837
|
function DefaultIoIndicator({ on }) {
|
|
1458
|
-
return /* @__PURE__ */
|
|
1838
|
+
return /* @__PURE__ */ jsx10(
|
|
1459
1839
|
"div",
|
|
1460
1840
|
{
|
|
1461
1841
|
style: {
|
|
1462
|
-
...
|
|
1463
|
-
backgroundColor: on ?
|
|
1842
|
+
...defaults3.indicator,
|
|
1843
|
+
backgroundColor: on ? colors3.ioOn : colors3.ioOff
|
|
1464
1844
|
},
|
|
1465
1845
|
title: on ? "Online" : "Offline"
|
|
1466
1846
|
}
|
|
1467
1847
|
);
|
|
1468
1848
|
}
|
|
1469
1849
|
function DefaultSignalIndicator({ on }) {
|
|
1470
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ jsx10(
|
|
1471
1851
|
"div",
|
|
1472
1852
|
{
|
|
1473
1853
|
style: {
|
|
1474
|
-
...
|
|
1475
|
-
backgroundColor: on ?
|
|
1854
|
+
...defaults3.indicator,
|
|
1855
|
+
backgroundColor: on ? colors3.sgOn : colors3.sgOff
|
|
1476
1856
|
},
|
|
1477
1857
|
title: on ? "Signal detected" : "No signal"
|
|
1478
1858
|
}
|
|
@@ -1506,29 +1886,29 @@ function MatrixItemRow({
|
|
|
1506
1886
|
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1507
1887
|
].filter(Boolean).join(" ");
|
|
1508
1888
|
const computedStyle = useDefaults ? {
|
|
1509
|
-
...
|
|
1889
|
+
...defaults3.item,
|
|
1510
1890
|
...itemStyleProp,
|
|
1511
|
-
...isActive ? { ...
|
|
1891
|
+
...isActive ? { ...defaults3.itemActive, ...itemActiveStyle } : void 0,
|
|
1512
1892
|
opacity: isEnabled ? 1 : 0.4
|
|
1513
1893
|
} : { ...itemStyleProp };
|
|
1514
|
-
return /* @__PURE__ */
|
|
1515
|
-
useDefaults ? /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsxs8("div", { className: classes, style: computedStyle, children: [
|
|
1895
|
+
useDefaults ? /* @__PURE__ */ jsx10("div", { style: defaults3.itemBtn, children: /* @__PURE__ */ jsx10(
|
|
1516
1896
|
CrisButton,
|
|
1517
1897
|
{
|
|
1518
1898
|
selected: isActive,
|
|
1519
1899
|
enabled: isEnabled,
|
|
1520
1900
|
onPress: onSelect,
|
|
1521
1901
|
showLocalFeedback: false,
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1523
|
-
showChannels && /* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */
|
|
1527
|
-
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */
|
|
1902
|
+
children: /* @__PURE__ */ jsxs8("div", { style: defaults3.itemBtnInner, children: [
|
|
1903
|
+
showChannels && /* @__PURE__ */ jsx10("span", { className: "cris-co-matrix-ch", style: defaults3.channelNum, children: item.id }),
|
|
1904
|
+
/* @__PURE__ */ jsx10("span", { style: defaults3.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1905
|
+
/* @__PURE__ */ jsxs8("div", { style: defaults3.indicators, children: [
|
|
1906
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx10(DefaultIoIndicator, { on: item.io.on })),
|
|
1907
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx10(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1528
1908
|
] })
|
|
1529
1909
|
] })
|
|
1530
1910
|
}
|
|
1531
|
-
) }) : /* @__PURE__ */
|
|
1911
|
+
) }) : /* @__PURE__ */ jsx10(
|
|
1532
1912
|
CrisButton,
|
|
1533
1913
|
{
|
|
1534
1914
|
selected: isActive,
|
|
@@ -1536,22 +1916,22 @@ function MatrixItemRow({
|
|
|
1536
1916
|
onPress: onSelect,
|
|
1537
1917
|
className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
|
|
1538
1918
|
classActive: itemActiveClassName,
|
|
1539
|
-
children: /* @__PURE__ */
|
|
1540
|
-
showChannels && /* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */
|
|
1544
|
-
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */
|
|
1919
|
+
children: /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1920
|
+
showChannels && /* @__PURE__ */ jsx10("span", { className: "cris-co-matrix-ch", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1921
|
+
/* @__PURE__ */ jsx10("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1922
|
+
/* @__PURE__ */ jsxs8("div", { style: defaults3.indicators, children: [
|
|
1923
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx10(DefaultIoIndicator, { on: item.io.on })),
|
|
1924
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx10(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1545
1925
|
] })
|
|
1546
1926
|
] })
|
|
1547
1927
|
}
|
|
1548
1928
|
),
|
|
1549
|
-
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */
|
|
1550
|
-
...
|
|
1551
|
-
...item.vm.on ?
|
|
1929
|
+
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */ jsx10("div", { style: {
|
|
1930
|
+
...defaults3.vmBtn,
|
|
1931
|
+
...item.vm.on ? defaults3.vmBtnActive : void 0,
|
|
1552
1932
|
opacity: item.vm.en ? 1 : 0.4,
|
|
1553
1933
|
pointerEvents: item.vm.en ? "auto" : "none"
|
|
1554
|
-
}, children: /* @__PURE__ */
|
|
1934
|
+
}, children: /* @__PURE__ */ jsx10(
|
|
1555
1935
|
CrisButton,
|
|
1556
1936
|
{
|
|
1557
1937
|
selected: item.vm.on,
|
|
@@ -1560,7 +1940,7 @@ function MatrixItemRow({
|
|
|
1560
1940
|
onPress: onToggleVideoMute,
|
|
1561
1941
|
showLocalFeedback: false
|
|
1562
1942
|
}
|
|
1563
|
-
) }) : /* @__PURE__ */
|
|
1943
|
+
) }) : /* @__PURE__ */ jsx10(
|
|
1564
1944
|
CrisButton,
|
|
1565
1945
|
{
|
|
1566
1946
|
selected: item.vm.on,
|
|
@@ -1595,8 +1975,8 @@ function CrisCoMatrixListsTie({
|
|
|
1595
1975
|
renderIoIndicator,
|
|
1596
1976
|
renderSignalIndicator
|
|
1597
1977
|
}) {
|
|
1598
|
-
const matrix =
|
|
1599
|
-
const send =
|
|
1978
|
+
const matrix = useCustomObject3(oid);
|
|
1979
|
+
const send = useCustomObjectSend3();
|
|
1600
1980
|
injectScrollbarStyle();
|
|
1601
1981
|
if (!matrix) return null;
|
|
1602
1982
|
const { si, ip: inputs, op: outputs } = matrix;
|
|
@@ -1609,27 +1989,27 @@ function CrisCoMatrixListsTie({
|
|
|
1609
1989
|
const handleToggleVideoMute = (type, id) => {
|
|
1610
1990
|
send(oid, { action: "toggleVideoMute", type, id });
|
|
1611
1991
|
};
|
|
1612
|
-
return /* @__PURE__ */
|
|
1992
|
+
return /* @__PURE__ */ jsxs8(
|
|
1613
1993
|
"div",
|
|
1614
1994
|
{
|
|
1615
1995
|
className,
|
|
1616
|
-
style: className ? style : { ...
|
|
1996
|
+
style: className ? style : { ...defaults3.container, ...style },
|
|
1617
1997
|
children: [
|
|
1618
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ jsxs8(
|
|
1619
1999
|
"div",
|
|
1620
2000
|
{
|
|
1621
2001
|
className: listClassName,
|
|
1622
|
-
style: listClassName ? listStyle : { ...
|
|
2002
|
+
style: listClassName ? listStyle : { ...defaults3.list, ...listStyle },
|
|
1623
2003
|
children: [
|
|
1624
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ jsx10(
|
|
1625
2005
|
"div",
|
|
1626
2006
|
{
|
|
1627
2007
|
className: headerClassName,
|
|
1628
|
-
style: headerClassName ? headerStyle : { ...
|
|
2008
|
+
style: headerClassName ? headerStyle : { ...defaults3.header, ...headerStyle },
|
|
1629
2009
|
children: inputTitle
|
|
1630
2010
|
}
|
|
1631
2011
|
),
|
|
1632
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsx10("div", { className: "cris-co-matrix-scroll", style: defaults3.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx10(
|
|
1633
2013
|
MatrixItemRow,
|
|
1634
2014
|
{
|
|
1635
2015
|
item,
|
|
@@ -1654,21 +2034,21 @@ function CrisCoMatrixListsTie({
|
|
|
1654
2034
|
]
|
|
1655
2035
|
}
|
|
1656
2036
|
),
|
|
1657
|
-
/* @__PURE__ */
|
|
2037
|
+
/* @__PURE__ */ jsxs8(
|
|
1658
2038
|
"div",
|
|
1659
2039
|
{
|
|
1660
2040
|
className: listClassName,
|
|
1661
|
-
style: listClassName ? listStyle : { ...
|
|
2041
|
+
style: listClassName ? listStyle : { ...defaults3.list, ...listStyle },
|
|
1662
2042
|
children: [
|
|
1663
|
-
/* @__PURE__ */
|
|
2043
|
+
/* @__PURE__ */ jsx10(
|
|
1664
2044
|
"div",
|
|
1665
2045
|
{
|
|
1666
2046
|
className: headerClassName,
|
|
1667
|
-
style: headerClassName ? headerStyle : { ...
|
|
2047
|
+
style: headerClassName ? headerStyle : { ...defaults3.header, ...headerStyle },
|
|
1668
2048
|
children: outputTitle
|
|
1669
2049
|
}
|
|
1670
2050
|
),
|
|
1671
|
-
/* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ jsx10("div", { className: "cris-co-matrix-scroll", style: defaults3.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx10(
|
|
1672
2052
|
MatrixItemRow,
|
|
1673
2053
|
{
|
|
1674
2054
|
item,
|
|
@@ -1700,12 +2080,14 @@ function CrisCoMatrixListsTie({
|
|
|
1700
2080
|
export {
|
|
1701
2081
|
CrisButton,
|
|
1702
2082
|
CrisCoDebug,
|
|
2083
|
+
CrisCoList,
|
|
1703
2084
|
CrisCoMatrixListsTie,
|
|
1704
2085
|
CrisGauge,
|
|
1705
2086
|
CrisOfflinePage,
|
|
1706
2087
|
CrisSlider,
|
|
1707
2088
|
CrisSpinner,
|
|
1708
2089
|
CrisText,
|
|
2090
|
+
CrisTextInput,
|
|
1709
2091
|
configureIcons,
|
|
1710
2092
|
getIconConfig,
|
|
1711
2093
|
getIconFilter,
|