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