@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.mjs
CHANGED
|
@@ -100,6 +100,8 @@ function CrisButton({
|
|
|
100
100
|
const pressedRef = useRef(false);
|
|
101
101
|
const touchingRef = useRef(false);
|
|
102
102
|
const touchStartedHereRef = useRef(false);
|
|
103
|
+
const touchStartYRef = useRef(0);
|
|
104
|
+
const touchMovedRef = useRef(false);
|
|
103
105
|
const feedbackJoin = joinFeedback ?? join;
|
|
104
106
|
const feedback = useDigital(feedbackJoin ?? 0);
|
|
105
107
|
const enabledJoin = useDigital(joinEnable ?? 0);
|
|
@@ -182,30 +184,42 @@ function CrisButton({
|
|
|
182
184
|
dSet(join, false);
|
|
183
185
|
}
|
|
184
186
|
};
|
|
185
|
-
const
|
|
187
|
+
const SCROLL_THRESHOLD = 8;
|
|
188
|
+
const handleTouchStart = (e) => {
|
|
186
189
|
log("handleTouchStart");
|
|
187
190
|
touchStart();
|
|
188
191
|
touchingRef.current = true;
|
|
189
192
|
touchStartedHereRef.current = true;
|
|
190
|
-
|
|
193
|
+
touchMovedRef.current = false;
|
|
194
|
+
touchStartYRef.current = e.touches[0]?.clientY ?? 0;
|
|
195
|
+
};
|
|
196
|
+
const handleTouchMove = (e) => {
|
|
197
|
+
if (touchMovedRef.current) return;
|
|
198
|
+
const dy = Math.abs((e.touches[0]?.clientY ?? 0) - touchStartYRef.current);
|
|
199
|
+
if (dy > SCROLL_THRESHOLD) {
|
|
200
|
+
touchMovedRef.current = true;
|
|
201
|
+
log("touchMove: scroll detected, dy:", dy);
|
|
202
|
+
}
|
|
191
203
|
};
|
|
192
204
|
const handleTouchEnd = () => {
|
|
193
|
-
log("handleTouchEnd", {
|
|
205
|
+
log("handleTouchEnd", { touchStartedHere: touchStartedHereRef.current, moved: touchMovedRef.current });
|
|
194
206
|
touchEnd();
|
|
195
207
|
touchingRef.current = true;
|
|
196
|
-
if (touchStartedHereRef.current) {
|
|
208
|
+
if (touchStartedHereRef.current && !touchMovedRef.current) {
|
|
197
209
|
touchStartedHereRef.current = false;
|
|
210
|
+
handlePress();
|
|
198
211
|
handleRelease();
|
|
199
212
|
} else {
|
|
200
|
-
|
|
213
|
+
touchStartedHereRef.current = false;
|
|
214
|
+
log("SKIPPED: touch moved or did not start here");
|
|
201
215
|
}
|
|
202
216
|
};
|
|
203
217
|
const handleTouchCancel = () => {
|
|
204
|
-
log("handleTouchCancel");
|
|
218
|
+
log("handleTouchCancel (scroll detected)");
|
|
205
219
|
touchEnd();
|
|
206
220
|
touchingRef.current = true;
|
|
207
221
|
touchStartedHereRef.current = false;
|
|
208
|
-
|
|
222
|
+
touchMovedRef.current = false;
|
|
209
223
|
};
|
|
210
224
|
const handleMouseDown = () => {
|
|
211
225
|
if (isTouchActive() || touchingRef.current) return;
|
|
@@ -306,7 +320,7 @@ function CrisButton({
|
|
|
306
320
|
cursor: suppressKeyClicks ? "default" : "pointer",
|
|
307
321
|
position: isFreePositioned ? void 0 : "relative",
|
|
308
322
|
overflow: isFreePositioned ? void 0 : "hidden",
|
|
309
|
-
touchAction: "
|
|
323
|
+
touchAction: "pan-x pan-y",
|
|
310
324
|
userSelect: "none",
|
|
311
325
|
WebkitUserSelect: "none"
|
|
312
326
|
},
|
|
@@ -314,6 +328,7 @@ function CrisButton({
|
|
|
314
328
|
onMouseUp: handleMouseUp,
|
|
315
329
|
onMouseLeave: handleMouseLeave,
|
|
316
330
|
onTouchStart: handleTouchStart,
|
|
331
|
+
onTouchMove: handleTouchMove,
|
|
317
332
|
onTouchEnd: handleTouchEnd,
|
|
318
333
|
onTouchCancel: handleTouchCancel,
|
|
319
334
|
children: [
|
|
@@ -1292,15 +1307,268 @@ function CrisCoDebug({
|
|
|
1292
1307
|
);
|
|
1293
1308
|
}
|
|
1294
1309
|
|
|
1295
|
-
// src/components/
|
|
1310
|
+
// src/components/CrisCoList.tsx
|
|
1296
1311
|
import { useCustomObject as useCustomObject2, useCustomObjectSend as useCustomObjectSend2 } from "@imperosoft/cris-webui-ch5-core";
|
|
1297
1312
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1313
|
+
var colors = {
|
|
1314
|
+
itemBg: "#4f5152",
|
|
1315
|
+
itemActiveBg: "#007ca0",
|
|
1316
|
+
text: "#ffffff",
|
|
1317
|
+
headerText: "#6b7280"
|
|
1318
|
+
};
|
|
1298
1319
|
var defaults = {
|
|
1320
|
+
container: {
|
|
1321
|
+
display: "flex",
|
|
1322
|
+
flexDirection: "column",
|
|
1323
|
+
overflow: "hidden",
|
|
1324
|
+
height: "100%",
|
|
1325
|
+
width: "100%",
|
|
1326
|
+
padding: "1rem 2rem",
|
|
1327
|
+
minHeight: 0
|
|
1328
|
+
},
|
|
1329
|
+
header: {
|
|
1330
|
+
fontSize: "1.5em",
|
|
1331
|
+
fontWeight: 700,
|
|
1332
|
+
padding: "0.5rem 0.75rem",
|
|
1333
|
+
textTransform: "uppercase",
|
|
1334
|
+
letterSpacing: "0.05em",
|
|
1335
|
+
color: colors.headerText,
|
|
1336
|
+
flexShrink: 0,
|
|
1337
|
+
textAlign: "center"
|
|
1338
|
+
},
|
|
1339
|
+
scroll: {
|
|
1340
|
+
flex: 1,
|
|
1341
|
+
minHeight: 0,
|
|
1342
|
+
overflow: "auto",
|
|
1343
|
+
scrollbarWidth: "none",
|
|
1344
|
+
WebkitOverflowScrolling: "touch",
|
|
1345
|
+
display: "flex",
|
|
1346
|
+
flexDirection: "column",
|
|
1347
|
+
gap: "0.15rem"
|
|
1348
|
+
},
|
|
1349
|
+
item: {
|
|
1350
|
+
display: "flex",
|
|
1351
|
+
alignItems: "stretch",
|
|
1352
|
+
minHeight: "3.7rem",
|
|
1353
|
+
cursor: "pointer",
|
|
1354
|
+
userSelect: "none",
|
|
1355
|
+
background: colors.itemBg,
|
|
1356
|
+
borderRadius: "0.5rem",
|
|
1357
|
+
transition: "background 0.15s"
|
|
1358
|
+
},
|
|
1359
|
+
itemActive: {
|
|
1360
|
+
background: colors.itemActiveBg
|
|
1361
|
+
},
|
|
1362
|
+
itemBtn: {
|
|
1363
|
+
flex: 1,
|
|
1364
|
+
minWidth: 0,
|
|
1365
|
+
display: "flex",
|
|
1366
|
+
alignItems: "stretch",
|
|
1367
|
+
background: "transparent",
|
|
1368
|
+
border: "none",
|
|
1369
|
+
textAlign: "left",
|
|
1370
|
+
color: colors.text,
|
|
1371
|
+
height: "100%",
|
|
1372
|
+
borderRadius: "0.5rem",
|
|
1373
|
+
cursor: "pointer"
|
|
1374
|
+
},
|
|
1375
|
+
itemBtnInner: {
|
|
1376
|
+
display: "flex",
|
|
1377
|
+
alignItems: "center",
|
|
1378
|
+
gap: "0.4rem",
|
|
1379
|
+
width: "100%",
|
|
1380
|
+
flex: 1,
|
|
1381
|
+
padding: "0.5rem 0.9rem"
|
|
1382
|
+
},
|
|
1383
|
+
idNum: {
|
|
1384
|
+
flexShrink: 0,
|
|
1385
|
+
opacity: 0.6,
|
|
1386
|
+
minWidth: "1.7em",
|
|
1387
|
+
textAlign: "right",
|
|
1388
|
+
fontWeight: 400,
|
|
1389
|
+
marginRight: "0.4em"
|
|
1390
|
+
},
|
|
1391
|
+
itemLabel: {
|
|
1392
|
+
flex: 1,
|
|
1393
|
+
fontSize: "1.4em",
|
|
1394
|
+
fontWeight: 700,
|
|
1395
|
+
whiteSpace: "nowrap",
|
|
1396
|
+
overflow: "hidden",
|
|
1397
|
+
textOverflow: "ellipsis",
|
|
1398
|
+
color: colors.text
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
var INJECTED_CSS = `
|
|
1402
|
+
.cris-co-list-scroll::-webkit-scrollbar { display: none; }
|
|
1403
|
+
.cris-co-list-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1404
|
+
`;
|
|
1405
|
+
var styleInjected = false;
|
|
1406
|
+
function injectStyle() {
|
|
1407
|
+
if (styleInjected) return;
|
|
1408
|
+
styleInjected = true;
|
|
1409
|
+
const style = document.createElement("style");
|
|
1410
|
+
style.textContent = INJECTED_CSS;
|
|
1411
|
+
document.head.appendChild(style);
|
|
1412
|
+
}
|
|
1413
|
+
function ListItemRow({
|
|
1414
|
+
item,
|
|
1415
|
+
selected,
|
|
1416
|
+
showIds,
|
|
1417
|
+
settings,
|
|
1418
|
+
onSelect,
|
|
1419
|
+
renderItem,
|
|
1420
|
+
itemClassName,
|
|
1421
|
+
itemStyle: itemStyleProp,
|
|
1422
|
+
itemActiveClassName,
|
|
1423
|
+
itemActiveStyle,
|
|
1424
|
+
itemDisabledClassName
|
|
1425
|
+
}) {
|
|
1426
|
+
const isEnabled = item.en !== false;
|
|
1427
|
+
const useDefaults = !itemClassName;
|
|
1428
|
+
const classes = [
|
|
1429
|
+
"cris-co-list-item",
|
|
1430
|
+
itemClassName,
|
|
1431
|
+
selected && (itemActiveClassName || "active"),
|
|
1432
|
+
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1433
|
+
].filter(Boolean).join(" ");
|
|
1434
|
+
const computedStyle = useDefaults ? {
|
|
1435
|
+
...defaults.item,
|
|
1436
|
+
...itemStyleProp,
|
|
1437
|
+
...selected ? { ...defaults.itemActive, ...itemActiveStyle } : void 0,
|
|
1438
|
+
opacity: isEnabled ? 1 : 0.4
|
|
1439
|
+
} : { ...itemStyleProp };
|
|
1440
|
+
if (renderItem) {
|
|
1441
|
+
return /* @__PURE__ */ jsx8("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ jsx8("div", { style: defaults.itemBtn, children: /* @__PURE__ */ jsx8(
|
|
1442
|
+
CrisButton,
|
|
1443
|
+
{
|
|
1444
|
+
selected,
|
|
1445
|
+
enabled: isEnabled,
|
|
1446
|
+
onPress: onSelect,
|
|
1447
|
+
showLocalFeedback: false,
|
|
1448
|
+
children: renderItem(item, selected, settings)
|
|
1449
|
+
}
|
|
1450
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
1451
|
+
CrisButton,
|
|
1452
|
+
{
|
|
1453
|
+
selected,
|
|
1454
|
+
enabled: isEnabled,
|
|
1455
|
+
onPress: onSelect,
|
|
1456
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1457
|
+
classActive: itemActiveClassName,
|
|
1458
|
+
children: renderItem(item, selected, settings)
|
|
1459
|
+
}
|
|
1460
|
+
) });
|
|
1461
|
+
}
|
|
1462
|
+
return /* @__PURE__ */ jsx8("div", { className: classes, style: computedStyle, children: useDefaults ? /* @__PURE__ */ jsx8("div", { style: defaults.itemBtn, children: /* @__PURE__ */ jsx8(
|
|
1463
|
+
CrisButton,
|
|
1464
|
+
{
|
|
1465
|
+
selected,
|
|
1466
|
+
enabled: isEnabled,
|
|
1467
|
+
onPress: onSelect,
|
|
1468
|
+
showLocalFeedback: false,
|
|
1469
|
+
children: /* @__PURE__ */ jsxs7("div", { style: defaults.itemBtnInner, children: [
|
|
1470
|
+
showIds && /* @__PURE__ */ jsx8("span", { className: "cris-co-list-id", style: defaults.idNum, children: item.id }),
|
|
1471
|
+
/* @__PURE__ */ jsx8("span", { style: defaults.itemLabel, children: item.lb || `Item ${item.id}` })
|
|
1472
|
+
] })
|
|
1473
|
+
}
|
|
1474
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
1475
|
+
CrisButton,
|
|
1476
|
+
{
|
|
1477
|
+
selected,
|
|
1478
|
+
enabled: isEnabled,
|
|
1479
|
+
onPress: onSelect,
|
|
1480
|
+
className: `cris-co-list-item-btn ${itemActiveClassName ?? ""}`,
|
|
1481
|
+
classActive: itemActiveClassName,
|
|
1482
|
+
children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1483
|
+
showIds && /* @__PURE__ */ jsx8("span", { className: "cris-co-list-id", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1484
|
+
/* @__PURE__ */ jsx8("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `Item ${item.id}` })
|
|
1485
|
+
] })
|
|
1486
|
+
}
|
|
1487
|
+
) });
|
|
1488
|
+
}
|
|
1489
|
+
function CrisCoList({
|
|
1490
|
+
oid,
|
|
1491
|
+
title,
|
|
1492
|
+
showIds = true,
|
|
1493
|
+
selectAction = "select",
|
|
1494
|
+
renderItem,
|
|
1495
|
+
className,
|
|
1496
|
+
style,
|
|
1497
|
+
headerClassName,
|
|
1498
|
+
headerStyle,
|
|
1499
|
+
itemClassName,
|
|
1500
|
+
itemStyle,
|
|
1501
|
+
itemActiveClassName,
|
|
1502
|
+
itemActiveStyle,
|
|
1503
|
+
itemDisabledClassName
|
|
1504
|
+
}) {
|
|
1505
|
+
const list = useCustomObject2(oid);
|
|
1506
|
+
const send = useCustomObjectSend2();
|
|
1507
|
+
injectStyle();
|
|
1508
|
+
if (!list) return null;
|
|
1509
|
+
const { st: settings, si, it: items } = list;
|
|
1510
|
+
const visibleItems = items?.filter((item) => item.vs !== false);
|
|
1511
|
+
const handleSelect = (id) => {
|
|
1512
|
+
send(oid, { action: selectAction, id });
|
|
1513
|
+
};
|
|
1514
|
+
return /* @__PURE__ */ jsxs7(
|
|
1515
|
+
"div",
|
|
1516
|
+
{
|
|
1517
|
+
className,
|
|
1518
|
+
style: className ? style : { ...defaults.container, ...style },
|
|
1519
|
+
children: [
|
|
1520
|
+
title && /* @__PURE__ */ jsx8(
|
|
1521
|
+
"div",
|
|
1522
|
+
{
|
|
1523
|
+
className: headerClassName,
|
|
1524
|
+
style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
|
|
1525
|
+
children: title
|
|
1526
|
+
}
|
|
1527
|
+
),
|
|
1528
|
+
/* @__PURE__ */ jsx8("div", { className: "cris-co-list-scroll", style: defaults.scroll, children: visibleItems?.map((item) => /* @__PURE__ */ jsx8(
|
|
1529
|
+
ListItemRow,
|
|
1530
|
+
{
|
|
1531
|
+
item,
|
|
1532
|
+
selected: si === item.id,
|
|
1533
|
+
showIds,
|
|
1534
|
+
settings,
|
|
1535
|
+
onSelect: () => handleSelect(item.id),
|
|
1536
|
+
renderItem,
|
|
1537
|
+
itemClassName,
|
|
1538
|
+
itemStyle,
|
|
1539
|
+
itemActiveClassName,
|
|
1540
|
+
itemActiveStyle,
|
|
1541
|
+
itemDisabledClassName
|
|
1542
|
+
},
|
|
1543
|
+
item.id
|
|
1544
|
+
)) })
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
// src/components/CrisCoMatrixListsTie.tsx
|
|
1551
|
+
import { useCustomObject as useCustomObject3, useCustomObjectSend as useCustomObjectSend3 } from "@imperosoft/cris-webui-ch5-core";
|
|
1552
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1553
|
+
var colors2 = {
|
|
1554
|
+
itemBg: "#4f5152",
|
|
1555
|
+
itemActiveBg: "#007ca0",
|
|
1556
|
+
vmActiveBg: "#dc2626",
|
|
1557
|
+
text: "#ffffff",
|
|
1558
|
+
headerText: "#6b7280",
|
|
1559
|
+
ioOn: "#4caf50",
|
|
1560
|
+
ioOff: "#f44336",
|
|
1561
|
+
sgOn: "#2196f3",
|
|
1562
|
+
sgOff: "#666666"
|
|
1563
|
+
};
|
|
1564
|
+
var defaults2 = {
|
|
1299
1565
|
container: {
|
|
1300
1566
|
display: "flex",
|
|
1301
1567
|
flexDirection: "row",
|
|
1302
|
-
gap:
|
|
1303
|
-
|
|
1568
|
+
gap: "1.5rem",
|
|
1569
|
+
padding: "1rem 2rem",
|
|
1570
|
+
height: "100%",
|
|
1571
|
+
width: "100%"
|
|
1304
1572
|
},
|
|
1305
1573
|
list: {
|
|
1306
1574
|
flex: 1,
|
|
@@ -1310,69 +1578,141 @@ var defaults = {
|
|
|
1310
1578
|
minHeight: 0
|
|
1311
1579
|
},
|
|
1312
1580
|
header: {
|
|
1313
|
-
fontSize:
|
|
1314
|
-
fontWeight:
|
|
1315
|
-
padding: "
|
|
1581
|
+
fontSize: "1.5em",
|
|
1582
|
+
fontWeight: 700,
|
|
1583
|
+
padding: "0.5rem 0.75rem",
|
|
1316
1584
|
textTransform: "uppercase",
|
|
1317
|
-
|
|
1318
|
-
|
|
1585
|
+
letterSpacing: "0.05em",
|
|
1586
|
+
color: colors2.headerText,
|
|
1587
|
+
flexShrink: 0,
|
|
1588
|
+
textAlign: "center"
|
|
1319
1589
|
},
|
|
1320
1590
|
scroll: {
|
|
1321
1591
|
flex: 1,
|
|
1322
1592
|
minHeight: 0,
|
|
1323
1593
|
overflow: "auto",
|
|
1594
|
+
scrollbarWidth: "none",
|
|
1324
1595
|
WebkitOverflowScrolling: "touch",
|
|
1325
1596
|
display: "flex",
|
|
1326
1597
|
flexDirection: "column",
|
|
1327
|
-
gap:
|
|
1598
|
+
gap: "0.15rem"
|
|
1328
1599
|
},
|
|
1329
1600
|
item: {
|
|
1330
1601
|
display: "flex",
|
|
1331
|
-
alignItems: "
|
|
1332
|
-
gap:
|
|
1333
|
-
padding: "
|
|
1334
|
-
minHeight:
|
|
1602
|
+
alignItems: "stretch",
|
|
1603
|
+
gap: "0.5rem",
|
|
1604
|
+
padding: "0 0.4rem 0 0",
|
|
1605
|
+
minHeight: "3.7rem",
|
|
1335
1606
|
cursor: "pointer",
|
|
1336
|
-
userSelect: "none"
|
|
1607
|
+
userSelect: "none",
|
|
1608
|
+
background: colors2.itemBg,
|
|
1609
|
+
borderRadius: "0.5rem",
|
|
1610
|
+
transition: "background 0.15s"
|
|
1611
|
+
},
|
|
1612
|
+
itemActive: {
|
|
1613
|
+
background: colors2.itemActiveBg
|
|
1614
|
+
},
|
|
1615
|
+
itemBtn: {
|
|
1616
|
+
flex: 1,
|
|
1617
|
+
minWidth: 0,
|
|
1618
|
+
display: "flex",
|
|
1619
|
+
alignItems: "stretch",
|
|
1620
|
+
background: "transparent",
|
|
1621
|
+
border: "none",
|
|
1622
|
+
textAlign: "left",
|
|
1623
|
+
color: colors2.text,
|
|
1624
|
+
height: "100%",
|
|
1625
|
+
borderRadius: "0.5rem",
|
|
1626
|
+
cursor: "pointer"
|
|
1627
|
+
},
|
|
1628
|
+
itemBtnInner: {
|
|
1629
|
+
display: "flex",
|
|
1630
|
+
alignItems: "center",
|
|
1631
|
+
gap: "0.4rem",
|
|
1632
|
+
width: "100%",
|
|
1633
|
+
flex: 1,
|
|
1634
|
+
padding: "0.5rem 0.9rem"
|
|
1635
|
+
},
|
|
1636
|
+
channelNum: {
|
|
1637
|
+
flexShrink: 0,
|
|
1638
|
+
opacity: 0.6,
|
|
1639
|
+
minWidth: "1.7em",
|
|
1640
|
+
textAlign: "right",
|
|
1641
|
+
fontWeight: 400,
|
|
1642
|
+
marginRight: "0.4em"
|
|
1337
1643
|
},
|
|
1338
1644
|
itemLabel: {
|
|
1339
1645
|
flex: 1,
|
|
1340
|
-
fontSize:
|
|
1646
|
+
fontSize: "1.4em",
|
|
1647
|
+
fontWeight: 700,
|
|
1341
1648
|
whiteSpace: "nowrap",
|
|
1342
1649
|
overflow: "hidden",
|
|
1343
|
-
textOverflow: "ellipsis"
|
|
1650
|
+
textOverflow: "ellipsis",
|
|
1651
|
+
color: colors2.text
|
|
1344
1652
|
},
|
|
1345
1653
|
indicators: {
|
|
1346
1654
|
display: "flex",
|
|
1347
|
-
gap:
|
|
1655
|
+
gap: "0.25rem",
|
|
1348
1656
|
alignItems: "center"
|
|
1349
1657
|
},
|
|
1350
1658
|
indicator: {
|
|
1351
|
-
width:
|
|
1352
|
-
height:
|
|
1659
|
+
width: "1rem",
|
|
1660
|
+
height: "1rem",
|
|
1353
1661
|
borderRadius: "50%",
|
|
1354
1662
|
flexShrink: 0
|
|
1663
|
+
},
|
|
1664
|
+
vmBtn: {
|
|
1665
|
+
flexShrink: 0,
|
|
1666
|
+
alignSelf: "stretch",
|
|
1667
|
+
display: "flex",
|
|
1668
|
+
alignItems: "center",
|
|
1669
|
+
background: colors2.itemBg,
|
|
1670
|
+
color: colors2.text,
|
|
1671
|
+
border: "none",
|
|
1672
|
+
borderRadius: "0.4rem",
|
|
1673
|
+
padding: "0 0.6rem",
|
|
1674
|
+
margin: "0.3rem 0.3rem 0.3rem 0",
|
|
1675
|
+
fontSize: "0.85em",
|
|
1676
|
+
fontWeight: 700,
|
|
1677
|
+
cursor: "pointer",
|
|
1678
|
+
transition: "background 0.15s"
|
|
1679
|
+
},
|
|
1680
|
+
vmBtnActive: {
|
|
1681
|
+
background: colors2.vmActiveBg,
|
|
1682
|
+
color: colors2.text
|
|
1355
1683
|
}
|
|
1356
1684
|
};
|
|
1685
|
+
var INJECTED_CSS2 = `
|
|
1686
|
+
.cris-co-matrix-scroll::-webkit-scrollbar { display: none; }
|
|
1687
|
+
.cris-co-matrix-item > div:first-child > .cris-button { width: 100%; height: 100%; }
|
|
1688
|
+
`;
|
|
1689
|
+
var scrollbarStyleInjected = false;
|
|
1690
|
+
function injectScrollbarStyle() {
|
|
1691
|
+
if (scrollbarStyleInjected) return;
|
|
1692
|
+
scrollbarStyleInjected = true;
|
|
1693
|
+
const style = document.createElement("style");
|
|
1694
|
+
style.textContent = INJECTED_CSS2;
|
|
1695
|
+
document.head.appendChild(style);
|
|
1696
|
+
}
|
|
1357
1697
|
function DefaultIoIndicator({ on }) {
|
|
1358
|
-
return /* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ jsx9(
|
|
1359
1699
|
"div",
|
|
1360
1700
|
{
|
|
1361
1701
|
style: {
|
|
1362
|
-
...
|
|
1363
|
-
backgroundColor: on ?
|
|
1702
|
+
...defaults2.indicator,
|
|
1703
|
+
backgroundColor: on ? colors2.ioOn : colors2.ioOff
|
|
1364
1704
|
},
|
|
1365
1705
|
title: on ? "Online" : "Offline"
|
|
1366
1706
|
}
|
|
1367
1707
|
);
|
|
1368
1708
|
}
|
|
1369
1709
|
function DefaultSignalIndicator({ on }) {
|
|
1370
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsx9(
|
|
1371
1711
|
"div",
|
|
1372
1712
|
{
|
|
1373
1713
|
style: {
|
|
1374
|
-
...
|
|
1375
|
-
backgroundColor: on ?
|
|
1714
|
+
...defaults2.indicator,
|
|
1715
|
+
backgroundColor: on ? colors2.sgOn : colors2.sgOff
|
|
1376
1716
|
},
|
|
1377
1717
|
title: on ? "Signal detected" : "No signal"
|
|
1378
1718
|
}
|
|
@@ -1383,6 +1723,7 @@ function MatrixItemRow({
|
|
|
1383
1723
|
type,
|
|
1384
1724
|
active,
|
|
1385
1725
|
showChannels,
|
|
1726
|
+
vmText,
|
|
1386
1727
|
onSelect,
|
|
1387
1728
|
onToggleVideoMute,
|
|
1388
1729
|
itemClassName,
|
|
@@ -1397,20 +1738,37 @@ function MatrixItemRow({
|
|
|
1397
1738
|
}) {
|
|
1398
1739
|
const isActive = active;
|
|
1399
1740
|
const isEnabled = item.sl.en;
|
|
1741
|
+
const useDefaults = !itemClassName;
|
|
1400
1742
|
const classes = [
|
|
1401
1743
|
"cris-co-matrix-item",
|
|
1402
1744
|
itemClassName,
|
|
1403
1745
|
isActive && (itemActiveClassName || "active"),
|
|
1404
1746
|
!isEnabled && (itemDisabledClassName || "disabled")
|
|
1405
1747
|
].filter(Boolean).join(" ");
|
|
1406
|
-
const computedStyle =
|
|
1407
|
-
...
|
|
1748
|
+
const computedStyle = useDefaults ? {
|
|
1749
|
+
...defaults2.item,
|
|
1408
1750
|
...itemStyleProp,
|
|
1409
|
-
...isActive ? itemActiveStyle : void 0,
|
|
1751
|
+
...isActive ? { ...defaults2.itemActive, ...itemActiveStyle } : void 0,
|
|
1410
1752
|
opacity: isEnabled ? 1 : 0.4
|
|
1411
|
-
};
|
|
1412
|
-
return /* @__PURE__ */
|
|
1413
|
-
/* @__PURE__ */
|
|
1753
|
+
} : { ...itemStyleProp };
|
|
1754
|
+
return /* @__PURE__ */ jsxs8("div", { className: classes, style: computedStyle, children: [
|
|
1755
|
+
useDefaults ? /* @__PURE__ */ jsx9("div", { style: defaults2.itemBtn, children: /* @__PURE__ */ jsx9(
|
|
1756
|
+
CrisButton,
|
|
1757
|
+
{
|
|
1758
|
+
selected: isActive,
|
|
1759
|
+
enabled: isEnabled,
|
|
1760
|
+
onPress: onSelect,
|
|
1761
|
+
showLocalFeedback: false,
|
|
1762
|
+
children: /* @__PURE__ */ jsxs8("div", { style: defaults2.itemBtnInner, children: [
|
|
1763
|
+
showChannels && /* @__PURE__ */ jsx9("span", { className: "cris-co-matrix-ch", style: defaults2.channelNum, children: item.id }),
|
|
1764
|
+
/* @__PURE__ */ jsx9("span", { style: defaults2.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1765
|
+
/* @__PURE__ */ jsxs8("div", { style: defaults2.indicators, children: [
|
|
1766
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx9(DefaultIoIndicator, { on: item.io.on })),
|
|
1767
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx9(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1768
|
+
] })
|
|
1769
|
+
] })
|
|
1770
|
+
}
|
|
1771
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
1414
1772
|
CrisButton,
|
|
1415
1773
|
{
|
|
1416
1774
|
selected: isActive,
|
|
@@ -1418,27 +1776,41 @@ function MatrixItemRow({
|
|
|
1418
1776
|
onPress: onSelect,
|
|
1419
1777
|
className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
|
|
1420
1778
|
classActive: itemActiveClassName,
|
|
1421
|
-
children: /* @__PURE__ */
|
|
1422
|
-
showChannels && /* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */
|
|
1426
|
-
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */
|
|
1779
|
+
children: /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: "0.4rem", width: "100%" }, children: [
|
|
1780
|
+
showChannels && /* @__PURE__ */ jsx9("span", { className: "cris-co-matrix-ch", style: { flexShrink: 0, opacity: 0.6 }, children: item.id }),
|
|
1781
|
+
/* @__PURE__ */ jsx9("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.id}` }),
|
|
1782
|
+
/* @__PURE__ */ jsxs8("div", { style: defaults2.indicators, children: [
|
|
1783
|
+
item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ jsx9(DefaultIoIndicator, { on: item.io.on })),
|
|
1784
|
+
item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ jsx9(DefaultSignalIndicator, { on: item.sg.on }))
|
|
1427
1785
|
] })
|
|
1428
1786
|
] })
|
|
1429
1787
|
}
|
|
1430
1788
|
),
|
|
1431
|
-
item.vm.vs && /* @__PURE__ */
|
|
1789
|
+
item.vm.vs && (useDefaults && !vmButtonClassName ? /* @__PURE__ */ jsx9("div", { style: {
|
|
1790
|
+
...defaults2.vmBtn,
|
|
1791
|
+
...item.vm.on ? defaults2.vmBtnActive : void 0,
|
|
1792
|
+
opacity: item.vm.en ? 1 : 0.4,
|
|
1793
|
+
pointerEvents: item.vm.en ? "auto" : "none"
|
|
1794
|
+
}, children: /* @__PURE__ */ jsx9(
|
|
1795
|
+
CrisButton,
|
|
1796
|
+
{
|
|
1797
|
+
selected: item.vm.on,
|
|
1798
|
+
enabled: item.vm.en,
|
|
1799
|
+
text: vmText,
|
|
1800
|
+
onPress: onToggleVideoMute,
|
|
1801
|
+
showLocalFeedback: false
|
|
1802
|
+
}
|
|
1803
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
1432
1804
|
CrisButton,
|
|
1433
1805
|
{
|
|
1434
1806
|
selected: item.vm.on,
|
|
1435
1807
|
enabled: item.vm.en,
|
|
1436
|
-
text:
|
|
1808
|
+
text: vmText,
|
|
1437
1809
|
onPress: onToggleVideoMute,
|
|
1438
1810
|
className: vmButtonClassName,
|
|
1439
1811
|
classActive: vmButtonActiveClassName
|
|
1440
1812
|
}
|
|
1441
|
-
)
|
|
1813
|
+
))
|
|
1442
1814
|
] });
|
|
1443
1815
|
}
|
|
1444
1816
|
function CrisCoMatrixListsTie({
|
|
@@ -1457,13 +1829,15 @@ function CrisCoMatrixListsTie({
|
|
|
1457
1829
|
itemActiveClassName,
|
|
1458
1830
|
itemActiveStyle,
|
|
1459
1831
|
itemDisabledClassName,
|
|
1832
|
+
vmText = "Mute",
|
|
1460
1833
|
vmButtonClassName,
|
|
1461
1834
|
vmButtonActiveClassName,
|
|
1462
1835
|
renderIoIndicator,
|
|
1463
1836
|
renderSignalIndicator
|
|
1464
1837
|
}) {
|
|
1465
|
-
const matrix =
|
|
1466
|
-
const send =
|
|
1838
|
+
const matrix = useCustomObject3(oid);
|
|
1839
|
+
const send = useCustomObjectSend3();
|
|
1840
|
+
injectScrollbarStyle();
|
|
1467
1841
|
if (!matrix) return null;
|
|
1468
1842
|
const { si, ip: inputs, op: outputs } = matrix;
|
|
1469
1843
|
const handleSelectInput = (id) => {
|
|
@@ -1475,33 +1849,34 @@ function CrisCoMatrixListsTie({
|
|
|
1475
1849
|
const handleToggleVideoMute = (type, id) => {
|
|
1476
1850
|
send(oid, { action: "toggleVideoMute", type, id });
|
|
1477
1851
|
};
|
|
1478
|
-
return /* @__PURE__ */
|
|
1852
|
+
return /* @__PURE__ */ jsxs8(
|
|
1479
1853
|
"div",
|
|
1480
1854
|
{
|
|
1481
1855
|
className,
|
|
1482
|
-
style: className ? style : { ...
|
|
1856
|
+
style: className ? style : { ...defaults2.container, ...style },
|
|
1483
1857
|
children: [
|
|
1484
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ jsxs8(
|
|
1485
1859
|
"div",
|
|
1486
1860
|
{
|
|
1487
1861
|
className: listClassName,
|
|
1488
|
-
style: listClassName ? listStyle : { ...
|
|
1862
|
+
style: listClassName ? listStyle : { ...defaults2.list, ...listStyle },
|
|
1489
1863
|
children: [
|
|
1490
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ jsx9(
|
|
1491
1865
|
"div",
|
|
1492
1866
|
{
|
|
1493
1867
|
className: headerClassName,
|
|
1494
|
-
style: headerClassName ? headerStyle : { ...
|
|
1868
|
+
style: headerClassName ? headerStyle : { ...defaults2.header, ...headerStyle },
|
|
1495
1869
|
children: inputTitle
|
|
1496
1870
|
}
|
|
1497
1871
|
),
|
|
1498
|
-
/* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsx9("div", { className: "cris-co-matrix-scroll", style: defaults2.scroll, children: inputs?.map((item) => /* @__PURE__ */ jsx9(
|
|
1499
1873
|
MatrixItemRow,
|
|
1500
1874
|
{
|
|
1501
1875
|
item,
|
|
1502
1876
|
type: "input",
|
|
1503
1877
|
active: si === item.id,
|
|
1504
1878
|
showChannels,
|
|
1879
|
+
vmText,
|
|
1505
1880
|
onSelect: () => handleSelectInput(item.id),
|
|
1506
1881
|
onToggleVideoMute: () => handleToggleVideoMute("input", item.id),
|
|
1507
1882
|
itemClassName,
|
|
@@ -1519,27 +1894,28 @@ function CrisCoMatrixListsTie({
|
|
|
1519
1894
|
]
|
|
1520
1895
|
}
|
|
1521
1896
|
),
|
|
1522
|
-
/* @__PURE__ */
|
|
1897
|
+
/* @__PURE__ */ jsxs8(
|
|
1523
1898
|
"div",
|
|
1524
1899
|
{
|
|
1525
1900
|
className: listClassName,
|
|
1526
|
-
style: listClassName ? listStyle : { ...
|
|
1901
|
+
style: listClassName ? listStyle : { ...defaults2.list, ...listStyle },
|
|
1527
1902
|
children: [
|
|
1528
|
-
/* @__PURE__ */
|
|
1903
|
+
/* @__PURE__ */ jsx9(
|
|
1529
1904
|
"div",
|
|
1530
1905
|
{
|
|
1531
1906
|
className: headerClassName,
|
|
1532
|
-
style: headerClassName ? headerStyle : { ...
|
|
1907
|
+
style: headerClassName ? headerStyle : { ...defaults2.header, ...headerStyle },
|
|
1533
1908
|
children: outputTitle
|
|
1534
1909
|
}
|
|
1535
1910
|
),
|
|
1536
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ jsx9("div", { className: "cris-co-matrix-scroll", style: defaults2.scroll, children: outputs?.map((item) => /* @__PURE__ */ jsx9(
|
|
1537
1912
|
MatrixItemRow,
|
|
1538
1913
|
{
|
|
1539
1914
|
item,
|
|
1540
1915
|
type: "output",
|
|
1541
|
-
active:
|
|
1916
|
+
active: item.ti === si,
|
|
1542
1917
|
showChannels,
|
|
1918
|
+
vmText,
|
|
1543
1919
|
onSelect: () => handleTie(item.id),
|
|
1544
1920
|
onToggleVideoMute: () => handleToggleVideoMute("output", item.id),
|
|
1545
1921
|
itemClassName,
|
|
@@ -1564,6 +1940,7 @@ function CrisCoMatrixListsTie({
|
|
|
1564
1940
|
export {
|
|
1565
1941
|
CrisButton,
|
|
1566
1942
|
CrisCoDebug,
|
|
1943
|
+
CrisCoList,
|
|
1567
1944
|
CrisCoMatrixListsTie,
|
|
1568
1945
|
CrisGauge,
|
|
1569
1946
|
CrisOfflinePage,
|