@imperosoft/cris-webui-components 1.1.2-beta.13 → 1.1.2-beta.15
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 +143 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -30
- 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,20 +1494,37 @@ 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
|
-
/* @__PURE__ */ jsx8(
|
|
1511
|
+
useDefaults ? /* @__PURE__ */ jsx8("div", { style: defaults.itemBtn, children: /* @__PURE__ */ jsx8(
|
|
1512
|
+
CrisButton,
|
|
1513
|
+
{
|
|
1514
|
+
selected: isActive,
|
|
1515
|
+
enabled: isEnabled,
|
|
1516
|
+
onPress: onSelect,
|
|
1517
|
+
showLocalFeedback: false,
|
|
1518
|
+
children: /* @__PURE__ */ jsxs7("div", { style: defaults.itemBtnInner, children: [
|
|
1519
|
+
showChannels && /* @__PURE__ */ jsx8("span", { className: "cris-co-matrix-ch", style: defaults.channelNum, children: item.id }),
|
|
1520
|
+
/* @__PURE__ */ jsx8("span", { style: defaults.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1521
|
+
/* @__PURE__ */ jsxs7("div", { style: defaults.indicators, children: [
|
|
1522
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx8(DefaultIoIndicator, { on: item.io.on })),
|
|
1523
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx8(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1524
|
+
] })
|
|
1525
|
+
] })
|
|
1526
|
+
}
|
|
1527
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
1430
1528
|
CrisButton,
|
|
1431
1529
|
{
|
|
1432
1530
|
selected: isActive,
|
|
@@ -1434,9 +1532,9 @@ function MatrixItemRow({
|
|
|
1434
1532
|
onPress: onSelect,
|
|
1435
1533
|
className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
|
|
1436
1534
|
classActive: itemActiveClassName,
|
|
1437
|
-
children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap:
|
|
1535
|
+
children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1438
1536
|
showChannels && /* @__PURE__ */ jsx8("span", { className: "cris-co-matrix-ch", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1439
|
-
/* @__PURE__ */ jsx8("span", { style:
|
|
1537
|
+
/* @__PURE__ */ jsx8("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1440
1538
|
/* @__PURE__ */ jsxs7("div", { style: defaults.indicators, children: [
|
|
1441
1539
|
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx8(DefaultIoIndicator, { on: item.io.on })),
|
|
1442
1540
|
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx8(DefaultSignalIndicator, { on: item.sg.on }))
|
|
@@ -1444,7 +1542,21 @@ function MatrixItemRow({
|
|
|
1444
1542
|
] })
|
|
1445
1543
|
}
|
|
1446
1544
|
),
|
|
1447
|
-
item.vm.vs && /* @__PURE__ */ jsx8(
|
|
1545
|
+
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */ jsx8("div", { style: {
|
|
1546
|
+
...defaults.vmBtn,
|
|
1547
|
+
...item.vm.on ? defaults.vmBtnActive : void 0,
|
|
1548
|
+
opacity: item.vm.en ? 1 : 0.4,
|
|
1549
|
+
pointerEvents: item.vm.en ? "auto" : "none"
|
|
1550
|
+
}, children: /* @__PURE__ */ jsx8(
|
|
1551
|
+
CrisButton,
|
|
1552
|
+
{
|
|
1553
|
+
selected: item.vm.on,
|
|
1554
|
+
enabled: item.vm.en,
|
|
1555
|
+
text: vmText,
|
|
1556
|
+
onPress: onToggleVideoMute,
|
|
1557
|
+
showLocalFeedback: false
|
|
1558
|
+
}
|
|
1559
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
1448
1560
|
CrisButton,
|
|
1449
1561
|
{
|
|
1450
1562
|
selected: item.vm.on,
|
|
@@ -1454,7 +1566,7 @@ function MatrixItemRow({
|
|
|
1454
1566
|
className: vmButtonClassName,
|
|
1455
1567
|
classActive: vmButtonActiveClassName
|
|
1456
1568
|
}
|
|
1457
|
-
)
|
|
1569
|
+
))
|
|
1458
1570
|
] });
|
|
1459
1571
|
}
|
|
1460
1572
|
function CrisCoMatrixListsTie({
|
|
@@ -1481,6 +1593,7 @@ function CrisCoMatrixListsTie({
|
|
|
1481
1593
|
}) {
|
|
1482
1594
|
const matrix = useCustomObject2(oid);
|
|
1483
1595
|
const send = useCustomObjectSend2();
|
|
1596
|
+
injectScrollbarStyle();
|
|
1484
1597
|
if (!matrix) return null;
|
|
1485
1598
|
const { si, ip: inputs, op: outputs } = matrix;
|
|
1486
1599
|
const handleSelectInput = (id) => {
|
|
@@ -1512,7 +1625,7 @@ function CrisCoMatrixListsTie({
|
|
|
1512
1625
|
children: inputTitle
|
|
1513
1626
|
}
|
|
1514
1627
|
),
|
|
1515
|
-
/* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1628
|
+
/* @__PURE__ */ jsx8("div", { className: "cris-co-matrix-scroll", style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1516
1629
|
MatrixItemRow,
|
|
1517
1630
|
{
|
|
1518
1631
|
item,
|
|
@@ -1551,7 +1664,7 @@ function CrisCoMatrixListsTie({
|
|
|
1551
1664
|
children: outputTitle
|
|
1552
1665
|
}
|
|
1553
1666
|
),
|
|
1554
|
-
/* @__PURE__ */ jsx8("div", { style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1667
|
+
/* @__PURE__ */ jsx8("div", { className: "cris-co-matrix-scroll", style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx8(
|
|
1555
1668
|
MatrixItemRow,
|
|
1556
1669
|
{
|
|
1557
1670
|
item,
|