@imperosoft/cris-webui-components 1.1.2-beta.9 → 1.1.3-beta.0
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 +59 -3
- package/dist/index.d.ts +59 -3
- package/dist/index.js +441 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +440 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
CrisButton: () => CrisButton,
|
|
24
24
|
CrisCoDebug: () => CrisCoDebug,
|
|
25
|
+
CrisCoList: () => CrisCoList,
|
|
25
26
|
CrisCoMatrixListsTie: () => CrisCoMatrixListsTie,
|
|
26
27
|
CrisGauge: () => CrisGauge,
|
|
27
28
|
CrisOfflinePage: () => CrisOfflinePage,
|
|
@@ -137,6 +138,8 @@ function CrisButton({
|
|
|
137
138
|
const pressedRef = (0, import_react.useRef)(false);
|
|
138
139
|
const touchingRef = (0, import_react.useRef)(false);
|
|
139
140
|
const touchStartedHereRef = (0, import_react.useRef)(false);
|
|
141
|
+
const touchStartYRef = (0, import_react.useRef)(0);
|
|
142
|
+
const touchMovedRef = (0, import_react.useRef)(false);
|
|
140
143
|
const feedbackJoin = joinFeedback ?? join;
|
|
141
144
|
const feedback = (0, import_cris_webui_ch5_core.useDigital)(feedbackJoin ?? 0);
|
|
142
145
|
const enabledJoin = (0, import_cris_webui_ch5_core.useDigital)(joinEnable ?? 0);
|
|
@@ -219,30 +222,42 @@ function CrisButton({
|
|
|
219
222
|
dSet(join, false);
|
|
220
223
|
}
|
|
221
224
|
};
|
|
222
|
-
const
|
|
225
|
+
const SCROLL_THRESHOLD = 8;
|
|
226
|
+
const handleTouchStart = (e) => {
|
|
223
227
|
log("handleTouchStart");
|
|
224
228
|
touchStart();
|
|
225
229
|
touchingRef.current = true;
|
|
226
230
|
touchStartedHereRef.current = true;
|
|
227
|
-
|
|
231
|
+
touchMovedRef.current = false;
|
|
232
|
+
touchStartYRef.current = e.touches[0]?.clientY ?? 0;
|
|
233
|
+
};
|
|
234
|
+
const handleTouchMove = (e) => {
|
|
235
|
+
if (touchMovedRef.current) return;
|
|
236
|
+
const dy = Math.abs((e.touches[0]?.clientY ?? 0) - touchStartYRef.current);
|
|
237
|
+
if (dy > SCROLL_THRESHOLD) {
|
|
238
|
+
touchMovedRef.current = true;
|
|
239
|
+
log("touchMove: scroll detected, dy:", dy);
|
|
240
|
+
}
|
|
228
241
|
};
|
|
229
242
|
const handleTouchEnd = () => {
|
|
230
|
-
log("handleTouchEnd", {
|
|
243
|
+
log("handleTouchEnd", { touchStartedHere: touchStartedHereRef.current, moved: touchMovedRef.current });
|
|
231
244
|
touchEnd();
|
|
232
245
|
touchingRef.current = true;
|
|
233
|
-
if (touchStartedHereRef.current) {
|
|
246
|
+
if (touchStartedHereRef.current && !touchMovedRef.current) {
|
|
234
247
|
touchStartedHereRef.current = false;
|
|
248
|
+
handlePress();
|
|
235
249
|
handleRelease();
|
|
236
250
|
} else {
|
|
237
|
-
|
|
251
|
+
touchStartedHereRef.current = false;
|
|
252
|
+
log("SKIPPED: touch moved or did not start here");
|
|
238
253
|
}
|
|
239
254
|
};
|
|
240
255
|
const handleTouchCancel = () => {
|
|
241
|
-
log("handleTouchCancel");
|
|
256
|
+
log("handleTouchCancel (scroll detected)");
|
|
242
257
|
touchEnd();
|
|
243
258
|
touchingRef.current = true;
|
|
244
259
|
touchStartedHereRef.current = false;
|
|
245
|
-
|
|
260
|
+
touchMovedRef.current = false;
|
|
246
261
|
};
|
|
247
262
|
const handleMouseDown = () => {
|
|
248
263
|
if (isTouchActive() || touchingRef.current) return;
|
|
@@ -343,7 +358,7 @@ function CrisButton({
|
|
|
343
358
|
cursor: suppressKeyClicks ? "default" : "pointer",
|
|
344
359
|
position: isFreePositioned ? void 0 : "relative",
|
|
345
360
|
overflow: isFreePositioned ? void 0 : "hidden",
|
|
346
|
-
touchAction: "
|
|
361
|
+
touchAction: "pan-x pan-y",
|
|
347
362
|
userSelect: "none",
|
|
348
363
|
WebkitUserSelect: "none"
|
|
349
364
|
},
|
|
@@ -351,6 +366,7 @@ function CrisButton({
|
|
|
351
366
|
onMouseUp: handleMouseUp,
|
|
352
367
|
onMouseLeave: handleMouseLeave,
|
|
353
368
|
onTouchStart: handleTouchStart,
|
|
369
|
+
onTouchMove: handleTouchMove,
|
|
354
370
|
onTouchEnd: handleTouchEnd,
|
|
355
371
|
onTouchCancel: handleTouchCancel,
|
|
356
372
|
children: [
|
|
@@ -1329,15 +1345,268 @@ function CrisCoDebug({
|
|
|
1329
1345
|
);
|
|
1330
1346
|
}
|
|
1331
1347
|
|
|
1332
|
-
// src/components/
|
|
1348
|
+
// src/components/CrisCoList.tsx
|
|
1333
1349
|
var import_cris_webui_ch5_core8 = require("@imperosoft/cris-webui-ch5-core");
|
|
1334
1350
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1351
|
+
var colors = {
|
|
1352
|
+
itemBg: "#4f5152",
|
|
1353
|
+
itemActiveBg: "#007ca0",
|
|
1354
|
+
text: "#ffffff",
|
|
1355
|
+
headerText: "#6b7280"
|
|
1356
|
+
};
|
|
1335
1357
|
var defaults = {
|
|
1358
|
+
container: {
|
|
1359
|
+
display: "flex",
|
|
1360
|
+
flexDirection: "column",
|
|
1361
|
+
overflow: "hidden",
|
|
1362
|
+
height: "100%",
|
|
1363
|
+
width: "100%",
|
|
1364
|
+
padding: "1rem 2rem",
|
|
1365
|
+
minHeight: 0
|
|
1366
|
+
},
|
|
1367
|
+
header: {
|
|
1368
|
+
fontSize: "1.5em",
|
|
1369
|
+
fontWeight: 700,
|
|
1370
|
+
padding: "0.5rem 0.75rem",
|
|
1371
|
+
textTransform: "uppercase",
|
|
1372
|
+
letterSpacing: "0.05em",
|
|
1373
|
+
color: colors.headerText,
|
|
1374
|
+
flexShrink: 0,
|
|
1375
|
+
textAlign: "center"
|
|
1376
|
+
},
|
|
1377
|
+
scroll: {
|
|
1378
|
+
flex: 1,
|
|
1379
|
+
minHeight: 0,
|
|
1380
|
+
overflow: "auto",
|
|
1381
|
+
scrollbarWidth: "none",
|
|
1382
|
+
WebkitOverflowScrolling: "touch",
|
|
1383
|
+
display: "flex",
|
|
1384
|
+
flexDirection: "column",
|
|
1385
|
+
gap: "0.15rem"
|
|
1386
|
+
},
|
|
1387
|
+
item: {
|
|
1388
|
+
display: "flex",
|
|
1389
|
+
alignItems: "stretch",
|
|
1390
|
+
minHeight: "3.7rem",
|
|
1391
|
+
cursor: "pointer",
|
|
1392
|
+
userSelect: "none",
|
|
1393
|
+
background: colors.itemBg,
|
|
1394
|
+
borderRadius: "0.5rem",
|
|
1395
|
+
transition: "background 0.15s"
|
|
1396
|
+
},
|
|
1397
|
+
itemActive: {
|
|
1398
|
+
background: colors.itemActiveBg
|
|
1399
|
+
},
|
|
1400
|
+
itemBtn: {
|
|
1401
|
+
flex: 1,
|
|
1402
|
+
minWidth: 0,
|
|
1403
|
+
display: "flex",
|
|
1404
|
+
alignItems: "stretch",
|
|
1405
|
+
background: "transparent",
|
|
1406
|
+
border: "none",
|
|
1407
|
+
textAlign: "left",
|
|
1408
|
+
color: colors.text,
|
|
1409
|
+
height: "100%",
|
|
1410
|
+
borderRadius: "0.5rem",
|
|
1411
|
+
cursor: "pointer"
|
|
1412
|
+
},
|
|
1413
|
+
itemBtnInner: {
|
|
1414
|
+
display: "flex",
|
|
1415
|
+
alignItems: "center",
|
|
1416
|
+
gap: "0.4rem",
|
|
1417
|
+
width: "100%",
|
|
1418
|
+
flex: 1,
|
|
1419
|
+
padding: "0.5rem 0.9rem"
|
|
1420
|
+
},
|
|
1421
|
+
idNum: {
|
|
1422
|
+
flexShrink: 0,
|
|
1423
|
+
opacity: 0.6,
|
|
1424
|
+
minWidth: "1.7em",
|
|
1425
|
+
textAlign: "right",
|
|
1426
|
+
fontWeight: 400,
|
|
1427
|
+
marginRight: "0.4em"
|
|
1428
|
+
},
|
|
1429
|
+
itemLabel: {
|
|
1430
|
+
flex: 1,
|
|
1431
|
+
fontSize: "1.4em",
|
|
1432
|
+
fontWeight: 700,
|
|
1433
|
+
whiteSpace: "nowrap",
|
|
1434
|
+
overflow: "hidden",
|
|
1435
|
+
textOverflow: "ellipsis",
|
|
1436
|
+
color: colors.text
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1439
|
+
var INJECTED_CSS = `
|
|
1440
|
+
.cris-co-list-scroll::-webkit-scrollbar { display: none; }
|
|
1441
|
+
.cris-co-list-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1442
|
+
`;
|
|
1443
|
+
var styleInjected = false;
|
|
1444
|
+
function injectStyle() {
|
|
1445
|
+
if (styleInjected) return;
|
|
1446
|
+
styleInjected = true;
|
|
1447
|
+
const style = document.createElement("style");
|
|
1448
|
+
style.textContent = INJECTED_CSS;
|
|
1449
|
+
document.head.appendChild(style);
|
|
1450
|
+
}
|
|
1451
|
+
function ListItemRow({
|
|
1452
|
+
item,
|
|
1453
|
+
selected,
|
|
1454
|
+
showIds,
|
|
1455
|
+
settings,
|
|
1456
|
+
onSelect,
|
|
1457
|
+
renderItem,
|
|
1458
|
+
itemClassName,
|
|
1459
|
+
itemStyle: itemStyleProp,
|
|
1460
|
+
itemActiveClassName,
|
|
1461
|
+
itemActiveStyle,
|
|
1462
|
+
itemDisabledClassName
|
|
1463
|
+
}) {
|
|
1464
|
+
const isEnabled = item.en !== false;
|
|
1465
|
+
const useDefaults = !itemClassName;
|
|
1466
|
+
const classes = [
|
|
1467
|
+
"cris-co-list-item",
|
|
1468
|
+
itemClassName,
|
|
1469
|
+
selected && (itemActiveClassName || "active"),
|
|
1470
|
+
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1471
|
+
].filter(Boolean).join(" ");
|
|
1472
|
+
const computedStyle = useDefaults ? {
|
|
1473
|
+
...defaults.item,
|
|
1474
|
+
...itemStyleProp,
|
|
1475
|
+
...selected ? { ...defaults.itemActive, ...itemActiveStyle } : void 0,
|
|
1476
|
+
opacity: isEnabled ? 1 : 0.4
|
|
1477
|
+
} : { ...itemStyleProp };
|
|
1478
|
+
if (renderItem) {
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.itemBtn, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1480
|
+
CrisButton,
|
|
1481
|
+
{
|
|
1482
|
+
selected,
|
|
1483
|
+
enabled: isEnabled,
|
|
1484
|
+
onPress: onSelect,
|
|
1485
|
+
showLocalFeedback: false,
|
|
1486
|
+
children: renderItem(item, selected, settings)
|
|
1487
|
+
}
|
|
1488
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1489
|
+
CrisButton,
|
|
1490
|
+
{
|
|
1491
|
+
selected,
|
|
1492
|
+
enabled: isEnabled,
|
|
1493
|
+
onPress: onSelect,
|
|
1494
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1495
|
+
classActive: itemActiveClassName,
|
|
1496
|
+
children: renderItem(item, selected, settings)
|
|
1497
|
+
}
|
|
1498
|
+
) });
|
|
1499
|
+
}
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.itemBtn, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1501
|
+
CrisButton,
|
|
1502
|
+
{
|
|
1503
|
+
selected,
|
|
1504
|
+
enabled: isEnabled,
|
|
1505
|
+
onPress: onSelect,
|
|
1506
|
+
showLocalFeedback: false,
|
|
1507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: defaults.itemBtnInner, children: [
|
|
1508
|
+
showIds && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "cris-co-list-id", style: defaults.idNum, children: item.id }),
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: defaults.itemLabel, children: item.lb || `Item ${item.id}` })
|
|
1510
|
+
] })
|
|
1511
|
+
}
|
|
1512
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1513
|
+
CrisButton,
|
|
1514
|
+
{
|
|
1515
|
+
selected,
|
|
1516
|
+
enabled: isEnabled,
|
|
1517
|
+
onPress: onSelect,
|
|
1518
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1519
|
+
classActive: itemActiveClassName,
|
|
1520
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1521
|
+
showIds && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "cris-co-list-id", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `Item ${item.id}` })
|
|
1523
|
+
] })
|
|
1524
|
+
}
|
|
1525
|
+
) });
|
|
1526
|
+
}
|
|
1527
|
+
function CrisCoList({
|
|
1528
|
+
oid,
|
|
1529
|
+
title,
|
|
1530
|
+
showIds = true,
|
|
1531
|
+
selectAction = "select",
|
|
1532
|
+
renderItem,
|
|
1533
|
+
className,
|
|
1534
|
+
style,
|
|
1535
|
+
headerClassName,
|
|
1536
|
+
headerStyle,
|
|
1537
|
+
itemClassName,
|
|
1538
|
+
itemStyle,
|
|
1539
|
+
itemActiveClassName,
|
|
1540
|
+
itemActiveStyle,
|
|
1541
|
+
itemDisabledClassName
|
|
1542
|
+
}) {
|
|
1543
|
+
const list = (0, import_cris_webui_ch5_core8.useCustomObject)(oid);
|
|
1544
|
+
const send = (0, import_cris_webui_ch5_core8.useCustomObjectSend)();
|
|
1545
|
+
injectStyle();
|
|
1546
|
+
if (!list) return null;
|
|
1547
|
+
const { st: settings, si, it: items } = list;
|
|
1548
|
+
const visibleItems = items?.filter((item) => item.vs !== false);
|
|
1549
|
+
const handleSelect = (id) => {
|
|
1550
|
+
send(oid, { action: selectAction, id });
|
|
1551
|
+
};
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1553
|
+
"div",
|
|
1554
|
+
{
|
|
1555
|
+
className,
|
|
1556
|
+
style: className ? style : { ...defaults.container, ...style },
|
|
1557
|
+
children: [
|
|
1558
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1559
|
+
"div",
|
|
1560
|
+
{
|
|
1561
|
+
className: headerClassName,
|
|
1562
|
+
style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
|
|
1563
|
+
children: title
|
|
1564
|
+
}
|
|
1565
|
+
),
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "cris-co-list-scroll", style: defaults.scroll, children: visibleItems?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1567
|
+
ListItemRow,
|
|
1568
|
+
{
|
|
1569
|
+
item,
|
|
1570
|
+
selected: si === item.id,
|
|
1571
|
+
showIds,
|
|
1572
|
+
settings,
|
|
1573
|
+
onSelect: () => handleSelect(item.id),
|
|
1574
|
+
renderItem,
|
|
1575
|
+
itemClassName,
|
|
1576
|
+
itemStyle,
|
|
1577
|
+
itemActiveClassName,
|
|
1578
|
+
itemActiveStyle,
|
|
1579
|
+
itemDisabledClassName
|
|
1580
|
+
},
|
|
1581
|
+
item.id
|
|
1582
|
+
)) })
|
|
1583
|
+
]
|
|
1584
|
+
}
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
// src/components/CrisCoMatrixListsTie.tsx
|
|
1589
|
+
var import_cris_webui_ch5_core9 = require("@imperosoft/cris-webui-ch5-core");
|
|
1590
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1591
|
+
var colors2 = {
|
|
1592
|
+
itemBg: "#4f5152",
|
|
1593
|
+
itemActiveBg: "#007ca0",
|
|
1594
|
+
vmActiveBg: "#dc2626",
|
|
1595
|
+
text: "#ffffff",
|
|
1596
|
+
headerText: "#6b7280",
|
|
1597
|
+
ioOn: "#4caf50",
|
|
1598
|
+
ioOff: "#f44336",
|
|
1599
|
+
sgOn: "#2196f3",
|
|
1600
|
+
sgOff: "#666666"
|
|
1601
|
+
};
|
|
1602
|
+
var defaults2 = {
|
|
1336
1603
|
container: {
|
|
1337
1604
|
display: "flex",
|
|
1338
1605
|
flexDirection: "row",
|
|
1339
|
-
gap:
|
|
1340
|
-
|
|
1606
|
+
gap: "1.5rem",
|
|
1607
|
+
padding: "1rem 2rem",
|
|
1608
|
+
height: "100%",
|
|
1609
|
+
width: "100%"
|
|
1341
1610
|
},
|
|
1342
1611
|
list: {
|
|
1343
1612
|
flex: 1,
|
|
@@ -1347,69 +1616,141 @@ var defaults = {
|
|
|
1347
1616
|
minHeight: 0
|
|
1348
1617
|
},
|
|
1349
1618
|
header: {
|
|
1350
|
-
fontSize:
|
|
1351
|
-
fontWeight:
|
|
1352
|
-
padding: "
|
|
1619
|
+
fontSize: "1.5em",
|
|
1620
|
+
fontWeight: 700,
|
|
1621
|
+
padding: "0.5rem 0.75rem",
|
|
1353
1622
|
textTransform: "uppercase",
|
|
1354
|
-
|
|
1355
|
-
|
|
1623
|
+
letterSpacing: "0.05em",
|
|
1624
|
+
color: colors2.headerText,
|
|
1625
|
+
flexShrink: 0,
|
|
1626
|
+
textAlign: "center"
|
|
1356
1627
|
},
|
|
1357
1628
|
scroll: {
|
|
1358
1629
|
flex: 1,
|
|
1359
1630
|
minHeight: 0,
|
|
1360
1631
|
overflow: "auto",
|
|
1632
|
+
scrollbarWidth: "none",
|
|
1361
1633
|
WebkitOverflowScrolling: "touch",
|
|
1362
1634
|
display: "flex",
|
|
1363
1635
|
flexDirection: "column",
|
|
1364
|
-
gap:
|
|
1636
|
+
gap: "0.15rem"
|
|
1365
1637
|
},
|
|
1366
1638
|
item: {
|
|
1367
1639
|
display: "flex",
|
|
1368
|
-
alignItems: "
|
|
1369
|
-
gap:
|
|
1370
|
-
padding: "
|
|
1371
|
-
minHeight:
|
|
1640
|
+
alignItems: "stretch",
|
|
1641
|
+
gap: "0.5rem",
|
|
1642
|
+
padding: "0 0.4rem 0 0",
|
|
1643
|
+
minHeight: "3.7rem",
|
|
1372
1644
|
cursor: "pointer",
|
|
1373
|
-
userSelect: "none"
|
|
1645
|
+
userSelect: "none",
|
|
1646
|
+
background: colors2.itemBg,
|
|
1647
|
+
borderRadius: "0.5rem",
|
|
1648
|
+
transition: "background 0.15s"
|
|
1649
|
+
},
|
|
1650
|
+
itemActive: {
|
|
1651
|
+
background: colors2.itemActiveBg
|
|
1652
|
+
},
|
|
1653
|
+
itemBtn: {
|
|
1654
|
+
flex: 1,
|
|
1655
|
+
minWidth: 0,
|
|
1656
|
+
display: "flex",
|
|
1657
|
+
alignItems: "stretch",
|
|
1658
|
+
background: "transparent",
|
|
1659
|
+
border: "none",
|
|
1660
|
+
textAlign: "left",
|
|
1661
|
+
color: colors2.text,
|
|
1662
|
+
height: "100%",
|
|
1663
|
+
borderRadius: "0.5rem",
|
|
1664
|
+
cursor: "pointer"
|
|
1665
|
+
},
|
|
1666
|
+
itemBtnInner: {
|
|
1667
|
+
display: "flex",
|
|
1668
|
+
alignItems: "center",
|
|
1669
|
+
gap: "0.4rem",
|
|
1670
|
+
width: "100%",
|
|
1671
|
+
flex: 1,
|
|
1672
|
+
padding: "0.5rem 0.9rem"
|
|
1673
|
+
},
|
|
1674
|
+
channelNum: {
|
|
1675
|
+
flexShrink: 0,
|
|
1676
|
+
opacity: 0.6,
|
|
1677
|
+
minWidth: "1.7em",
|
|
1678
|
+
textAlign: "right",
|
|
1679
|
+
fontWeight: 400,
|
|
1680
|
+
marginRight: "0.4em"
|
|
1374
1681
|
},
|
|
1375
1682
|
itemLabel: {
|
|
1376
1683
|
flex: 1,
|
|
1377
|
-
fontSize:
|
|
1684
|
+
fontSize: "1.4em",
|
|
1685
|
+
fontWeight: 700,
|
|
1378
1686
|
whiteSpace: "nowrap",
|
|
1379
1687
|
overflow: "hidden",
|
|
1380
|
-
textOverflow: "ellipsis"
|
|
1688
|
+
textOverflow: "ellipsis",
|
|
1689
|
+
color: colors2.text
|
|
1381
1690
|
},
|
|
1382
1691
|
indicators: {
|
|
1383
1692
|
display: "flex",
|
|
1384
|
-
gap:
|
|
1693
|
+
gap: "0.25rem",
|
|
1385
1694
|
alignItems: "center"
|
|
1386
1695
|
},
|
|
1387
1696
|
indicator: {
|
|
1388
|
-
width:
|
|
1389
|
-
height:
|
|
1697
|
+
width: "1rem",
|
|
1698
|
+
height: "1rem",
|
|
1390
1699
|
borderRadius: "50%",
|
|
1391
1700
|
flexShrink: 0
|
|
1701
|
+
},
|
|
1702
|
+
vmBtn: {
|
|
1703
|
+
flexShrink: 0,
|
|
1704
|
+
alignSelf: "stretch",
|
|
1705
|
+
display: "flex",
|
|
1706
|
+
alignItems: "center",
|
|
1707
|
+
background: colors2.itemBg,
|
|
1708
|
+
color: colors2.text,
|
|
1709
|
+
border: "none",
|
|
1710
|
+
borderRadius: "0.4rem",
|
|
1711
|
+
padding: "0 0.6rem",
|
|
1712
|
+
margin: "0.3rem 0.3rem 0.3rem 0",
|
|
1713
|
+
fontSize: "0.85em",
|
|
1714
|
+
fontWeight: 700,
|
|
1715
|
+
cursor: "pointer",
|
|
1716
|
+
transition: "background 0.15s"
|
|
1717
|
+
},
|
|
1718
|
+
vmBtnActive: {
|
|
1719
|
+
background: colors2.vmActiveBg,
|
|
1720
|
+
color: colors2.text
|
|
1392
1721
|
}
|
|
1393
1722
|
};
|
|
1723
|
+
var INJECTED_CSS2 = `
|
|
1724
|
+
.cris-co-matrix-scroll::-webkit-scrollbar { display: none; }
|
|
1725
|
+
.cris-co-matrix-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1726
|
+
`;
|
|
1727
|
+
var scrollbarStyleInjected = false;
|
|
1728
|
+
function injectScrollbarStyle() {
|
|
1729
|
+
if (scrollbarStyleInjected) return;
|
|
1730
|
+
scrollbarStyleInjected = true;
|
|
1731
|
+
const style = document.createElement("style");
|
|
1732
|
+
style.textContent = INJECTED_CSS2;
|
|
1733
|
+
document.head.appendChild(style);
|
|
1734
|
+
}
|
|
1394
1735
|
function DefaultIoIndicator({ on }) {
|
|
1395
|
-
return /* @__PURE__ */ (0,
|
|
1736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1396
1737
|
"div",
|
|
1397
1738
|
{
|
|
1398
1739
|
style: {
|
|
1399
|
-
...
|
|
1400
|
-
backgroundColor: on ?
|
|
1740
|
+
...defaults2.indicator,
|
|
1741
|
+
backgroundColor: on ? colors2.ioOn : colors2.ioOff
|
|
1401
1742
|
},
|
|
1402
1743
|
title: on ? "Online" : "Offline"
|
|
1403
1744
|
}
|
|
1404
1745
|
);
|
|
1405
1746
|
}
|
|
1406
1747
|
function DefaultSignalIndicator({ on }) {
|
|
1407
|
-
return /* @__PURE__ */ (0,
|
|
1748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1408
1749
|
"div",
|
|
1409
1750
|
{
|
|
1410
1751
|
style: {
|
|
1411
|
-
...
|
|
1412
|
-
backgroundColor: on ?
|
|
1752
|
+
...defaults2.indicator,
|
|
1753
|
+
backgroundColor: on ? colors2.sgOn : colors2.sgOff
|
|
1413
1754
|
},
|
|
1414
1755
|
title: on ? "Signal detected" : "No signal"
|
|
1415
1756
|
}
|
|
@@ -1420,6 +1761,7 @@ function MatrixItemRow({
|
|
|
1420
1761
|
type,
|
|
1421
1762
|
active,
|
|
1422
1763
|
showChannels,
|
|
1764
|
+
vmText,
|
|
1423
1765
|
onSelect,
|
|
1424
1766
|
onToggleVideoMute,
|
|
1425
1767
|
itemClassName,
|
|
@@ -1434,20 +1776,37 @@ function MatrixItemRow({
|
|
|
1434
1776
|
}) {
|
|
1435
1777
|
const isActive = active;
|
|
1436
1778
|
const isEnabled = item.sl.en;
|
|
1779
|
+
const useDefaults = !itemClassName;
|
|
1437
1780
|
const classes = [
|
|
1438
1781
|
"cris-co-matrix-item",
|
|
1439
1782
|
itemClassName,
|
|
1440
1783
|
isActive && (itemActiveClassName || "active"),
|
|
1441
1784
|
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1442
1785
|
].filter(Boolean).join(" ");
|
|
1443
|
-
const computedStyle =
|
|
1444
|
-
...
|
|
1786
|
+
const computedStyle = useDefaults ? {
|
|
1787
|
+
...defaults2.item,
|
|
1445
1788
|
...itemStyleProp,
|
|
1446
|
-
...isActive ? itemActiveStyle : void 0,
|
|
1789
|
+
...isActive ? { ...defaults2.itemActive, ...itemActiveStyle } : void 0,
|
|
1447
1790
|
opacity: isEnabled ? 1 : 0.4
|
|
1448
|
-
};
|
|
1449
|
-
return /* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1791
|
+
} : { ...itemStyleProp };
|
|
1792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: classes, style: computedStyle, children: [
|
|
1793
|
+
useDefaults ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: defaults2.itemBtn, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1794
|
+
CrisButton,
|
|
1795
|
+
{
|
|
1796
|
+
selected: isActive,
|
|
1797
|
+
enabled: isEnabled,
|
|
1798
|
+
onPress: onSelect,
|
|
1799
|
+
showLocalFeedback: false,
|
|
1800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: defaults2.itemBtnInner, children: [
|
|
1801
|
+
showChannels && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "cris-co-matrix-ch", style: defaults2.channelNum, children: item.id }),
|
|
1802
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: defaults2.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: defaults2.indicators, children: [
|
|
1804
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultIoIndicator, { on: item.io.on })),
|
|
1805
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1806
|
+
] })
|
|
1807
|
+
] })
|
|
1808
|
+
}
|
|
1809
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1451
1810
|
CrisButton,
|
|
1452
1811
|
{
|
|
1453
1812
|
selected: isActive,
|
|
@@ -1455,27 +1814,41 @@ function MatrixItemRow({
|
|
|
1455
1814
|
onPress: onSelect,
|
|
1456
1815
|
className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
|
|
1457
1816
|
classActive: itemActiveClassName,
|
|
1458
|
-
children: /* @__PURE__ */ (0,
|
|
1459
|
-
showChannels && /* @__PURE__ */ (0,
|
|
1460
|
-
/* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1462
|
-
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ (0,
|
|
1463
|
-
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ (0,
|
|
1817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1818
|
+
showChannels && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "cris-co-matrix-ch", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: defaults2.indicators, children: [
|
|
1821
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultIoIndicator, { on: item.io.on })),
|
|
1822
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1464
1823
|
] })
|
|
1465
1824
|
] })
|
|
1466
1825
|
}
|
|
1467
1826
|
),
|
|
1468
|
-
item.vm.vs && /* @__PURE__ */ (0,
|
|
1827
|
+
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: {
|
|
1828
|
+
...defaults2.vmBtn,
|
|
1829
|
+
...item.vm.on ? defaults2.vmBtnActive : void 0,
|
|
1830
|
+
opacity: item.vm.en ? 1 : 0.4,
|
|
1831
|
+
pointerEvents: item.vm.en ? "auto" : "none"
|
|
1832
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1833
|
+
CrisButton,
|
|
1834
|
+
{
|
|
1835
|
+
selected: item.vm.on,
|
|
1836
|
+
enabled: item.vm.en,
|
|
1837
|
+
text: vmText,
|
|
1838
|
+
onPress: onToggleVideoMute,
|
|
1839
|
+
showLocalFeedback: false
|
|
1840
|
+
}
|
|
1841
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1469
1842
|
CrisButton,
|
|
1470
1843
|
{
|
|
1471
1844
|
selected: item.vm.on,
|
|
1472
1845
|
enabled: item.vm.en,
|
|
1473
|
-
text:
|
|
1846
|
+
text: vmText,
|
|
1474
1847
|
onPress: onToggleVideoMute,
|
|
1475
1848
|
className: vmButtonClassName,
|
|
1476
1849
|
classActive: vmButtonActiveClassName
|
|
1477
1850
|
}
|
|
1478
|
-
)
|
|
1851
|
+
))
|
|
1479
1852
|
] });
|
|
1480
1853
|
}
|
|
1481
1854
|
function CrisCoMatrixListsTie({
|
|
@@ -1494,13 +1867,15 @@ function CrisCoMatrixListsTie({
|
|
|
1494
1867
|
itemActiveClassName,
|
|
1495
1868
|
itemActiveStyle,
|
|
1496
1869
|
itemDisabledClassName,
|
|
1870
|
+
vmText = "Mute",
|
|
1497
1871
|
vmButtonClassName,
|
|
1498
1872
|
vmButtonActiveClassName,
|
|
1499
1873
|
renderIoIndicator,
|
|
1500
1874
|
renderSignalIndicator
|
|
1501
1875
|
}) {
|
|
1502
|
-
const matrix = (0,
|
|
1503
|
-
const send = (0,
|
|
1876
|
+
const matrix = (0, import_cris_webui_ch5_core9.useCustomObject)(oid);
|
|
1877
|
+
const send = (0, import_cris_webui_ch5_core9.useCustomObjectSend)();
|
|
1878
|
+
injectScrollbarStyle();
|
|
1504
1879
|
if (!matrix) return null;
|
|
1505
1880
|
const { si, ip: inputs, op: outputs } = matrix;
|
|
1506
1881
|
const handleSelectInput = (id) => {
|
|
@@ -1512,33 +1887,34 @@ function CrisCoMatrixListsTie({
|
|
|
1512
1887
|
const handleToggleVideoMute = (type, id) => {
|
|
1513
1888
|
send(oid, { action: "toggleVideoMute", type, id });
|
|
1514
1889
|
};
|
|
1515
|
-
return /* @__PURE__ */ (0,
|
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1516
1891
|
"div",
|
|
1517
1892
|
{
|
|
1518
1893
|
className,
|
|
1519
|
-
style: className ? style : { ...
|
|
1894
|
+
style: className ? style : { ...defaults2.container, ...style },
|
|
1520
1895
|
children: [
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1522
1897
|
"div",
|
|
1523
1898
|
{
|
|
1524
1899
|
className: listClassName,
|
|
1525
|
-
style: listClassName ? listStyle : { ...
|
|
1900
|
+
style: listClassName ? listStyle : { ...defaults2.list, ...listStyle },
|
|
1526
1901
|
children: [
|
|
1527
|
-
/* @__PURE__ */ (0,
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1528
1903
|
"div",
|
|
1529
1904
|
{
|
|
1530
1905
|
className: headerClassName,
|
|
1531
|
-
style: headerClassName ? headerStyle : { ...
|
|
1906
|
+
style: headerClassName ? headerStyle : { ...defaults2.header, ...headerStyle },
|
|
1532
1907
|
children: inputTitle
|
|
1533
1908
|
}
|
|
1534
1909
|
),
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "cris-co-matrix-scroll", style: defaults2.scroll, children: inputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1536
1911
|
MatrixItemRow,
|
|
1537
1912
|
{
|
|
1538
1913
|
item,
|
|
1539
1914
|
type: "input",
|
|
1540
1915
|
active: si === item.id,
|
|
1541
1916
|
showChannels,
|
|
1917
|
+
vmText,
|
|
1542
1918
|
onSelect: () => handleSelectInput(item.id),
|
|
1543
1919
|
onToggleVideoMute: () => handleToggleVideoMute("input", item.id),
|
|
1544
1920
|
itemClassName,
|
|
@@ -1556,27 +1932,28 @@ function CrisCoMatrixListsTie({
|
|
|
1556
1932
|
]
|
|
1557
1933
|
}
|
|
1558
1934
|
),
|
|
1559
|
-
/* @__PURE__ */ (0,
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1560
1936
|
"div",
|
|
1561
1937
|
{
|
|
1562
1938
|
className: listClassName,
|
|
1563
|
-
style: listClassName ? listStyle : { ...
|
|
1939
|
+
style: listClassName ? listStyle : { ...defaults2.list, ...listStyle },
|
|
1564
1940
|
children: [
|
|
1565
|
-
/* @__PURE__ */ (0,
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1566
1942
|
"div",
|
|
1567
1943
|
{
|
|
1568
1944
|
className: headerClassName,
|
|
1569
|
-
style: headerClassName ? headerStyle : { ...
|
|
1945
|
+
style: headerClassName ? headerStyle : { ...defaults2.header, ...headerStyle },
|
|
1570
1946
|
children: outputTitle
|
|
1571
1947
|
}
|
|
1572
1948
|
),
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "cris-co-matrix-scroll", style: defaults2.scroll, children: outputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1574
1950
|
MatrixItemRow,
|
|
1575
1951
|
{
|
|
1576
1952
|
item,
|
|
1577
1953
|
type: "output",
|
|
1578
|
-
active:
|
|
1954
|
+
active: item.ti === si,
|
|
1579
1955
|
showChannels,
|
|
1956
|
+
vmText,
|
|
1580
1957
|
onSelect: () => handleTie(item.id),
|
|
1581
1958
|
onToggleVideoMute: () => handleToggleVideoMute("output", item.id),
|
|
1582
1959
|
itemClassName,
|
|
@@ -1602,6 +1979,7 @@ function CrisCoMatrixListsTie({
|
|
|
1602
1979
|
0 && (module.exports = {
|
|
1603
1980
|
CrisButton,
|
|
1604
1981
|
CrisCoDebug,
|
|
1982
|
+
CrisCoList,
|
|
1605
1983
|
CrisCoMatrixListsTie,
|
|
1606
1984
|
CrisGauge,
|
|
1607
1985
|
CrisOfflinePage,
|