@imperosoft/cris-webui-components 1.1.2-beta.2 → 1.1.2-beta.4

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.mjs CHANGED
@@ -1291,9 +1291,270 @@ function CrisCoDebug({
1291
1291
  }
1292
1292
  );
1293
1293
  }
1294
+
1295
+ // src/components/CrisCoMatrixListsTie.tsx
1296
+ import { useCustomObject as useCustomObject2, useCustomObjectSend as useCustomObjectSend2 } from "@imperosoft/cris-webui-ch5-core";
1297
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1298
+ var defaults = {
1299
+ container: {
1300
+ display: "flex",
1301
+ flexDirection: "row",
1302
+ gap: 8,
1303
+ height: "100%"
1304
+ },
1305
+ list: {
1306
+ flex: 1,
1307
+ display: "flex",
1308
+ flexDirection: "column",
1309
+ overflow: "hidden",
1310
+ minHeight: 0
1311
+ },
1312
+ header: {
1313
+ fontSize: 13,
1314
+ fontWeight: 600,
1315
+ padding: "6px 10px",
1316
+ textTransform: "uppercase",
1317
+ opacity: 0.6,
1318
+ flexShrink: 0
1319
+ },
1320
+ scroll: {
1321
+ flex: 1,
1322
+ overflow: "auto",
1323
+ display: "flex",
1324
+ flexDirection: "column",
1325
+ gap: 2
1326
+ },
1327
+ item: {
1328
+ display: "flex",
1329
+ alignItems: "center",
1330
+ gap: 6,
1331
+ padding: "6px 10px",
1332
+ minHeight: 40,
1333
+ cursor: "pointer",
1334
+ userSelect: "none"
1335
+ },
1336
+ itemLabel: {
1337
+ flex: 1,
1338
+ fontSize: 13,
1339
+ whiteSpace: "nowrap",
1340
+ overflow: "hidden",
1341
+ textOverflow: "ellipsis"
1342
+ },
1343
+ indicators: {
1344
+ display: "flex",
1345
+ gap: 4,
1346
+ alignItems: "center"
1347
+ },
1348
+ indicator: {
1349
+ width: 8,
1350
+ height: 8,
1351
+ borderRadius: "50%",
1352
+ flexShrink: 0
1353
+ }
1354
+ };
1355
+ function DefaultIoIndicator({ on }) {
1356
+ return /* @__PURE__ */ jsx8(
1357
+ "div",
1358
+ {
1359
+ style: {
1360
+ ...defaults.indicator,
1361
+ backgroundColor: on ? "#4caf50" : "#f44336"
1362
+ },
1363
+ title: on ? "Online" : "Offline"
1364
+ }
1365
+ );
1366
+ }
1367
+ function DefaultSignalIndicator({ on }) {
1368
+ return /* @__PURE__ */ jsx8(
1369
+ "div",
1370
+ {
1371
+ style: {
1372
+ ...defaults.indicator,
1373
+ backgroundColor: on ? "#2196f3" : "#666"
1374
+ },
1375
+ title: on ? "Signal detected" : "No signal"
1376
+ }
1377
+ );
1378
+ }
1379
+ function MatrixItemRow({
1380
+ item,
1381
+ type,
1382
+ onSelect,
1383
+ onToggleVideoMute,
1384
+ itemClassName,
1385
+ itemStyle: itemStyleProp,
1386
+ itemActiveClassName,
1387
+ itemActiveStyle,
1388
+ itemDisabledClassName,
1389
+ vmButtonClassName,
1390
+ vmButtonActiveClassName,
1391
+ renderIoIndicator,
1392
+ renderSignalIndicator
1393
+ }) {
1394
+ const isActive = item.sl.on;
1395
+ const isEnabled = item.sl.en;
1396
+ const classes = [
1397
+ "cris-co-matrix-item",
1398
+ itemClassName,
1399
+ isActive && (itemActiveClassName || "active"),
1400
+ !isEnabled && (itemDisabledClassName || "disabled")
1401
+ ].filter(Boolean).join(" ");
1402
+ const computedStyle = itemClassName ? { ...itemStyleProp } : {
1403
+ ...defaults.item,
1404
+ ...itemStyleProp,
1405
+ ...isActive ? itemActiveStyle : void 0,
1406
+ opacity: isEnabled ? 1 : 0.4
1407
+ };
1408
+ return /* @__PURE__ */ jsxs7("div", { className: classes, style: computedStyle, children: [
1409
+ /* @__PURE__ */ jsx8(
1410
+ CrisButton,
1411
+ {
1412
+ selected: isActive,
1413
+ enabled: isEnabled,
1414
+ onPress: onSelect,
1415
+ className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
1416
+ classActive: itemActiveClassName,
1417
+ children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: 6, width: "100%" }, children: [
1418
+ /* @__PURE__ */ jsx8("span", { style: defaults.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.ch}` }),
1419
+ /* @__PURE__ */ jsxs7("div", { style: defaults.indicators, children: [
1420
+ item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx8(DefaultIoIndicator, { on: item.io.on })),
1421
+ item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx8(DefaultSignalIndicator, { on: item.sg.on }))
1422
+ ] })
1423
+ ] })
1424
+ }
1425
+ ),
1426
+ item.vm.vs && /* @__PURE__ */ jsx8(
1427
+ CrisButton,
1428
+ {
1429
+ selected: item.vm.on,
1430
+ enabled: item.vm.en,
1431
+ text: "VM",
1432
+ onPress: onToggleVideoMute,
1433
+ className: vmButtonClassName,
1434
+ classActive: vmButtonActiveClassName
1435
+ }
1436
+ )
1437
+ ] });
1438
+ }
1439
+ function CrisCoMatrixListsTie({
1440
+ oid,
1441
+ inputTitle = "Inputs",
1442
+ outputTitle = "Outputs",
1443
+ className,
1444
+ style,
1445
+ listClassName,
1446
+ listStyle,
1447
+ headerClassName,
1448
+ headerStyle,
1449
+ itemClassName,
1450
+ itemStyle,
1451
+ itemActiveClassName,
1452
+ itemActiveStyle,
1453
+ itemDisabledClassName,
1454
+ vmButtonClassName,
1455
+ vmButtonActiveClassName,
1456
+ renderIoIndicator,
1457
+ renderSignalIndicator
1458
+ }) {
1459
+ const matrix = useCustomObject2(oid);
1460
+ const send = useCustomObjectSend2();
1461
+ if (!matrix) return null;
1462
+ const { ip: inputs, op: outputs } = matrix;
1463
+ const handleSelectInput = (ch) => {
1464
+ send(oid, { action: "selectInput", ch });
1465
+ };
1466
+ const handleTie = (ch) => {
1467
+ send(oid, { action: "tie", ch });
1468
+ };
1469
+ const handleToggleVideoMute = (type, ch) => {
1470
+ send(oid, { action: "toggleVideoMute", type, ch });
1471
+ };
1472
+ return /* @__PURE__ */ jsxs7(
1473
+ "div",
1474
+ {
1475
+ className,
1476
+ style: className ? style : { ...defaults.container, ...style },
1477
+ children: [
1478
+ /* @__PURE__ */ jsxs7(
1479
+ "div",
1480
+ {
1481
+ className: listClassName,
1482
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1483
+ children: [
1484
+ /* @__PURE__ */ jsx8(
1485
+ "div",
1486
+ {
1487
+ className: headerClassName,
1488
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1489
+ children: inputTitle
1490
+ }
1491
+ ),
1492
+ /* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx8(
1493
+ MatrixItemRow,
1494
+ {
1495
+ item,
1496
+ type: "input",
1497
+ onSelect: () => handleSelectInput(item.ch),
1498
+ onToggleVideoMute: () => handleToggleVideoMute("input", item.ch),
1499
+ itemClassName,
1500
+ itemStyle,
1501
+ itemActiveClassName,
1502
+ itemActiveStyle,
1503
+ itemDisabledClassName,
1504
+ vmButtonClassName,
1505
+ vmButtonActiveClassName,
1506
+ renderIoIndicator,
1507
+ renderSignalIndicator
1508
+ },
1509
+ item.ch
1510
+ )) })
1511
+ ]
1512
+ }
1513
+ ),
1514
+ /* @__PURE__ */ jsxs7(
1515
+ "div",
1516
+ {
1517
+ className: listClassName,
1518
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1519
+ children: [
1520
+ /* @__PURE__ */ jsx8(
1521
+ "div",
1522
+ {
1523
+ className: headerClassName,
1524
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1525
+ children: outputTitle
1526
+ }
1527
+ ),
1528
+ /* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx8(
1529
+ MatrixItemRow,
1530
+ {
1531
+ item,
1532
+ type: "output",
1533
+ onSelect: () => handleTie(item.ch),
1534
+ onToggleVideoMute: () => handleToggleVideoMute("output", item.ch),
1535
+ itemClassName,
1536
+ itemStyle,
1537
+ itemActiveClassName,
1538
+ itemActiveStyle,
1539
+ itemDisabledClassName,
1540
+ vmButtonClassName,
1541
+ vmButtonActiveClassName,
1542
+ renderIoIndicator,
1543
+ renderSignalIndicator
1544
+ },
1545
+ item.ch
1546
+ )) })
1547
+ ]
1548
+ }
1549
+ )
1550
+ ]
1551
+ }
1552
+ );
1553
+ }
1294
1554
  export {
1295
1555
  CrisButton,
1296
1556
  CrisCoDebug,
1557
+ CrisCoMatrixListsTie,
1297
1558
  CrisGauge,
1298
1559
  CrisOfflinePage,
1299
1560
  CrisSlider,