@imperosoft/cris-webui-components 1.1.2-beta.13 → 1.1.2-beta.14
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.js +135 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1310,12 +1310,25 @@ function CrisCoDebug({
|
|
|
1310
1310
|
// src/components/CrisCoMatrixListsTie.tsx
|
|
1311
1311
|
import { useCustomObject as useCustomObject2, useCustomObjectSend as useCustomObjectSend2 } from "@imperosoft/cris-webui-ch5-core";
|
|
1312
1312
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1313
|
+
var colors = {
|
|
1314
|
+
itemBg: "#4f5152",
|
|
1315
|
+
itemActiveBg: "#007ca0",
|
|
1316
|
+
vmActiveBg: "#dc2626",
|
|
1317
|
+
text: "#ffffff",
|
|
1318
|
+
headerText: "#6b7280",
|
|
1319
|
+
ioOn: "#4caf50",
|
|
1320
|
+
ioOff: "#f44336",
|
|
1321
|
+
sgOn: "#2196f3",
|
|
1322
|
+
sgOff: "#666666"
|
|
1323
|
+
};
|
|
1313
1324
|
var defaults = {
|
|
1314
1325
|
container: {
|
|
1315
1326
|
display: "flex",
|
|
1316
1327
|
flexDirection: "row",
|
|
1317
|
-
gap:
|
|
1318
|
-
|
|
1328
|
+
gap: "1.5rem",
|
|
1329
|
+
padding: "1rem 2rem",
|
|
1330
|
+
height: "100%",
|
|
1331
|
+
width: "100%"
|
|
1319
1332
|
},
|
|
1320
1333
|
list: {
|
|
1321
1334
|
flex: 1,
|
|
@@ -1325,57 +1338,125 @@ var defaults = {
|
|
|
1325
1338
|
minHeight: 0
|
|
1326
1339
|
},
|
|
1327
1340
|
header: {
|
|
1328
|
-
fontSize:
|
|
1329
|
-
fontWeight:
|
|
1330
|
-
padding: "
|
|
1341
|
+
fontSize: "1.5em",
|
|
1342
|
+
fontWeight: 700,
|
|
1343
|
+
padding: "0.5rem 0.75rem",
|
|
1331
1344
|
textTransform: "uppercase",
|
|
1332
|
-
|
|
1333
|
-
|
|
1345
|
+
letterSpacing: "0.05em",
|
|
1346
|
+
color: colors.headerText,
|
|
1347
|
+
flexShrink: 0,
|
|
1348
|
+
textAlign: "center"
|
|
1334
1349
|
},
|
|
1335
1350
|
scroll: {
|
|
1336
1351
|
flex: 1,
|
|
1337
1352
|
minHeight: 0,
|
|
1338
1353
|
overflow: "auto",
|
|
1354
|
+
scrollbarWidth: "none",
|
|
1339
1355
|
WebkitOverflowScrolling: "touch",
|
|
1340
1356
|
display: "flex",
|
|
1341
1357
|
flexDirection: "column",
|
|
1342
|
-
gap:
|
|
1358
|
+
gap: "0.15rem"
|
|
1343
1359
|
},
|
|
1344
1360
|
item: {
|
|
1345
1361
|
display: "flex",
|
|
1346
|
-
alignItems: "
|
|
1347
|
-
gap:
|
|
1348
|
-
padding: "
|
|
1349
|
-
minHeight:
|
|
1362
|
+
alignItems: "stretch",
|
|
1363
|
+
gap: "0.5rem",
|
|
1364
|
+
padding: "0 0.4rem 0 0",
|
|
1365
|
+
minHeight: "3.7rem",
|
|
1350
1366
|
cursor: "pointer",
|
|
1351
|
-
userSelect: "none"
|
|
1367
|
+
userSelect: "none",
|
|
1368
|
+
background: colors.itemBg,
|
|
1369
|
+
borderRadius: "0.5rem",
|
|
1370
|
+
transition: "background 0.15s"
|
|
1371
|
+
},
|
|
1372
|
+
itemActive: {
|
|
1373
|
+
background: colors.itemActiveBg
|
|
1374
|
+
},
|
|
1375
|
+
itemBtn: {
|
|
1376
|
+
flex: 1,
|
|
1377
|
+
minWidth: 0,
|
|
1378
|
+
background: "transparent",
|
|
1379
|
+
border: "none",
|
|
1380
|
+
padding: "0.5rem 0.9rem",
|
|
1381
|
+
textAlign: "left",
|
|
1382
|
+
color: colors.text,
|
|
1383
|
+
height: "100%",
|
|
1384
|
+
borderRadius: "0.5rem",
|
|
1385
|
+
cursor: "pointer"
|
|
1386
|
+
},
|
|
1387
|
+
itemBtnInner: {
|
|
1388
|
+
display: "flex",
|
|
1389
|
+
alignItems: "center",
|
|
1390
|
+
gap: "0.4rem",
|
|
1391
|
+
width: "100%"
|
|
1392
|
+
},
|
|
1393
|
+
channelNum: {
|
|
1394
|
+
flexShrink: 0,
|
|
1395
|
+
opacity: 0.6,
|
|
1396
|
+
minWidth: "1.7em",
|
|
1397
|
+
textAlign: "right",
|
|
1398
|
+
fontWeight: 400,
|
|
1399
|
+
marginRight: "0.4em"
|
|
1352
1400
|
},
|
|
1353
1401
|
itemLabel: {
|
|
1354
1402
|
flex: 1,
|
|
1355
|
-
fontSize:
|
|
1403
|
+
fontSize: "1.4em",
|
|
1404
|
+
fontWeight: 700,
|
|
1356
1405
|
whiteSpace: "nowrap",
|
|
1357
1406
|
overflow: "hidden",
|
|
1358
|
-
textOverflow: "ellipsis"
|
|
1407
|
+
textOverflow: "ellipsis",
|
|
1408
|
+
color: colors.text
|
|
1359
1409
|
},
|
|
1360
1410
|
indicators: {
|
|
1361
1411
|
display: "flex",
|
|
1362
|
-
gap:
|
|
1412
|
+
gap: "0.25rem",
|
|
1363
1413
|
alignItems: "center"
|
|
1364
1414
|
},
|
|
1365
1415
|
indicator: {
|
|
1366
|
-
width:
|
|
1367
|
-
height:
|
|
1416
|
+
width: "1rem",
|
|
1417
|
+
height: "1rem",
|
|
1368
1418
|
borderRadius: "50%",
|
|
1369
1419
|
flexShrink: 0
|
|
1420
|
+
},
|
|
1421
|
+
vmBtn: {
|
|
1422
|
+
flexShrink: 0,
|
|
1423
|
+
alignSelf: "stretch",
|
|
1424
|
+
display: "flex",
|
|
1425
|
+
alignItems: "center",
|
|
1426
|
+
background: colors.itemBg,
|
|
1427
|
+
color: colors.text,
|
|
1428
|
+
border: "none",
|
|
1429
|
+
borderRadius: "0.4rem",
|
|
1430
|
+
padding: "0 0.6rem",
|
|
1431
|
+
margin: "0.3rem 0.3rem 0.3rem 0",
|
|
1432
|
+
fontSize: "0.85em",
|
|
1433
|
+
fontWeight: 700,
|
|
1434
|
+
cursor: "pointer",
|
|
1435
|
+
transition: "background 0.15s"
|
|
1436
|
+
},
|
|
1437
|
+
vmBtnActive: {
|
|
1438
|
+
background: colors.vmActiveBg,
|
|
1439
|
+
color: colors.text
|
|
1370
1440
|
}
|
|
1371
1441
|
};
|
|
1442
|
+
var SCROLLBAR_CSS = `
|
|
1443
|
+
.cris-co-matrix-scroll::-webkit-scrollbar { display: none; }
|
|
1444
|
+
`;
|
|
1445
|
+
var scrollbarStyleInjected = false;
|
|
1446
|
+
function injectScrollbarStyle() {
|
|
1447
|
+
if (scrollbarStyleInjected) return;
|
|
1448
|
+
scrollbarStyleInjected = true;
|
|
1449
|
+
const style = document.createElement("style");
|
|
1450
|
+
style.textContent = SCROLLBAR_CSS;
|
|
1451
|
+
document.head.appendChild(style);
|
|
1452
|
+
}
|
|
1372
1453
|
function DefaultIoIndicator({ on }) {
|
|
1373
1454
|
return /* @__PURE__ */ jsx8(
|
|
1374
1455
|
"div",
|
|
1375
1456
|
{
|
|
1376
1457
|
style: {
|
|
1377
1458
|
...defaults.indicator,
|
|
1378
|
-
backgroundColor: on ?
|
|
1459
|
+
backgroundColor: on ? colors.ioOn : colors.ioOff
|
|
1379
1460
|
},
|
|
1380
1461
|
title: on ? "Online" : "Offline"
|
|
1381
1462
|
}
|
|
@@ -1387,7 +1468,7 @@ function DefaultSignalIndicator({ on }) {
|
|
|
1387
1468
|
{
|
|
1388
1469
|
style: {
|
|
1389
1470
|
...defaults.indicator,
|
|
1390
|
-
backgroundColor: on ?
|
|
1471
|
+
backgroundColor: on ? colors.sgOn : colors.sgOff
|
|
1391
1472
|
},
|
|
1392
1473
|
title: on ? "Signal detected" : "No signal"
|
|
1393
1474
|
}
|
|
@@ -1413,18 +1494,19 @@ function MatrixItemRow({
|
|
|
1413
1494
|
}) {
|
|
1414
1495
|
const isActive = active;
|
|
1415
1496
|
const isEnabled = item.sl.en;
|
|
1497
|
+
const useDefaults = !itemClassName;
|
|
1416
1498
|
const classes = [
|
|
1417
1499
|
"cris-co-matrix-item",
|
|
1418
1500
|
itemClassName,
|
|
1419
1501
|
isActive && (itemActiveClassName || "active"),
|
|
1420
1502
|
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1421
1503
|
].filter(Boolean).join(" ");
|
|
1422
|
-
const computedStyle =
|
|
1504
|
+
const computedStyle = useDefaults ? {
|
|
1423
1505
|
...defaults.item,
|
|
1424
1506
|
...itemStyleProp,
|
|
1425
|
-
...isActive ? itemActiveStyle : void 0,
|
|
1507
|
+
...isActive ? { ...defaults.itemActive, ...itemActiveStyle } : void 0,
|
|
1426
1508
|
opacity: isEnabled ? 1 : 0.4
|
|
1427
|
-
};
|
|
1509
|
+
} : { ...itemStyleProp };
|
|
1428
1510
|
return /* @__PURE__ */ jsxs7("div", { className: classes, style: computedStyle, children: [
|
|
1429
1511
|
/* @__PURE__ */ jsx8(
|
|
1430
1512
|
CrisButton,
|
|
@@ -1432,19 +1514,40 @@ function MatrixItemRow({
|
|
|
1432
1514
|
selected: isActive,
|
|
1433
1515
|
enabled: isEnabled,
|
|
1434
1516
|
onPress: onSelect,
|
|
1435
|
-
className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}
|
|
1436
|
-
classActive: itemActiveClassName,
|
|
1437
|
-
children: /* @__PURE__ */ jsxs7("div", { style:
|
|
1438
|
-
showChannels && /* @__PURE__ */ jsx8("span", { className: "cris-co-matrix-ch", style:
|
|
1517
|
+
className: itemClassName ? `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}` : void 0,
|
|
1518
|
+
classActive: itemClassName ? itemActiveClassName : void 0,
|
|
1519
|
+
children: useDefaults ? /* @__PURE__ */ jsxs7("div", { style: defaults.itemBtnInner, children: [
|
|
1520
|
+
showChannels && /* @__PURE__ */ jsx8("span", { className: "cris-co-matrix-ch", style: defaults.channelNum, children: item.id }),
|
|
1439
1521
|
/* @__PURE__ */ jsx8("span", { style: defaults.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1440
1522
|
/* @__PURE__ */ jsxs7("div", { style: defaults.indicators, children: [
|
|
1441
1523
|
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx8(DefaultIoIndicator, { on: item.io.on })),
|
|
1442
1524
|
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx8(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1443
1525
|
] })
|
|
1526
|
+
] }) : /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1527
|
+
showChannels && /* @__PURE__ */ jsx8("span", { className: "cris-co-matrix-ch", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1528
|
+
/* @__PURE__ */ jsx8("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1529
|
+
/* @__PURE__ */ jsxs7("div", { style: defaults.indicators, children: [
|
|
1530
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx8(DefaultIoIndicator, { on: item.io.on })),
|
|
1531
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx8(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1532
|
+
] })
|
|
1444
1533
|
] })
|
|
1445
1534
|
}
|
|
1446
1535
|
),
|
|
1447
|
-
item.vm.vs && /* @__PURE__ */ jsx8(
|
|
1536
|
+
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */ jsx8("div", { style: {
|
|
1537
|
+
...defaults.vmBtn,
|
|
1538
|
+
...item.vm.on ? defaults.vmBtnActive : void 0,
|
|
1539
|
+
opacity: item.vm.en ? 1 : 0.4,
|
|
1540
|
+
pointerEvents: item.vm.en ? "auto" : "none"
|
|
1541
|
+
}, children: /* @__PURE__ */ jsx8(
|
|
1542
|
+
CrisButton,
|
|
1543
|
+
{
|
|
1544
|
+
selected: item.vm.on,
|
|
1545
|
+
enabled: item.vm.en,
|
|
1546
|
+
text: vmText,
|
|
1547
|
+
onPress: onToggleVideoMute,
|
|
1548
|
+
showLocalFeedback: false
|
|
1549
|
+
}
|
|
1550
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
1448
1551
|
CrisButton,
|
|
1449
1552
|
{
|
|
1450
1553
|
selected: item.vm.on,
|
|
@@ -1454,7 +1557,7 @@ function MatrixItemRow({
|
|
|
1454
1557
|
className: vmButtonClassName,
|
|
1455
1558
|
classActive: vmButtonActiveClassName
|
|
1456
1559
|
}
|
|
1457
|
-
)
|
|
1560
|
+
))
|
|
1458
1561
|
] });
|
|
1459
1562
|
}
|
|
1460
1563
|
function CrisCoMatrixListsTie({
|
|
@@ -1481,6 +1584,7 @@ function CrisCoMatrixListsTie({
|
|
|
1481
1584
|
}) {
|
|
1482
1585
|
const matrix = useCustomObject2(oid);
|
|
1483
1586
|
const send = useCustomObjectSend2();
|
|
1587
|
+
injectScrollbarStyle();
|
|
1484
1588
|
if (!matrix) return null;
|
|
1485
1589
|
const { si, ip: inputs, op: outputs } = matrix;
|
|
1486
1590
|
const handleSelectInput = (id) => {
|
|
@@ -1512,7 +1616,7 @@ function CrisCoMatrixListsTie({
|
|
|
1512
1616
|
children: inputTitle
|
|
1513
1617
|
}
|
|
1514
1618
|
),
|
|
1515
|
-
/* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1619
|
+
/* @__PURE__ */ jsx8("div", { className: "cris-co-matrix-scroll", style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1516
1620
|
MatrixItemRow,
|
|
1517
1621
|
{
|
|
1518
1622
|
item,
|
|
@@ -1551,7 +1655,7 @@ function CrisCoMatrixListsTie({
|
|
|
1551
1655
|
children: outputTitle
|
|
1552
1656
|
}
|
|
1553
1657
|
),
|
|
1554
|
-
/* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1658
|
+
/* @__PURE__ */ jsx8("div", { className: "cris-co-matrix-scroll", style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1555
1659
|
MatrixItemRow,
|
|
1556
1660
|
{
|
|
1557
1661
|
item,
|