@imperosoft/cris-webui-components 1.1.2-beta.2 → 1.1.2-beta.4

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 CHANGED
@@ -314,6 +314,75 @@ interface CrisCoDebugProps {
314
314
  }
315
315
  declare function CrisCoDebug({ oid, title, className, style, itemClassName, itemStyle, buttonClassName, buttonActiveClassName, iconEthOn, iconEthOff, iconRs232On, iconRs232Off, }: CrisCoDebugProps): react_jsx_runtime.JSX.Element | null;
316
316
 
317
+ /** Shape of an input or output item from the backend */
318
+ interface MatrixItem {
319
+ ch: number;
320
+ lb: string;
321
+ gp: number;
322
+ sl: {
323
+ on: boolean;
324
+ en: boolean;
325
+ vs: boolean;
326
+ };
327
+ io: {
328
+ on: boolean;
329
+ vs: boolean;
330
+ };
331
+ sg: {
332
+ on: boolean;
333
+ vs: boolean;
334
+ };
335
+ vm: {
336
+ on: boolean;
337
+ en: boolean;
338
+ vs: boolean;
339
+ };
340
+ }
341
+ /** Shape of the matrix status from the backend */
342
+ interface MatrixStatus {
343
+ ip: MatrixItem[];
344
+ op: MatrixItem[];
345
+ }
346
+ interface CrisCoMatrixListsTieProps {
347
+ /** Custom object ID (e.g., "MTX1_VID") */
348
+ oid: string;
349
+ /** Input list title */
350
+ inputTitle?: string;
351
+ /** Output list title */
352
+ outputTitle?: string;
353
+ /** Container className */
354
+ className?: string;
355
+ /** Container style */
356
+ style?: CSSProperties;
357
+ /** List column className */
358
+ listClassName?: string;
359
+ /** List column style */
360
+ listStyle?: CSSProperties;
361
+ /** List header className */
362
+ headerClassName?: string;
363
+ /** List header style */
364
+ headerStyle?: CSSProperties;
365
+ /** Item className */
366
+ itemClassName?: string;
367
+ /** Item style */
368
+ itemStyle?: CSSProperties;
369
+ /** Item active (selected/tied) className */
370
+ itemActiveClassName?: string;
371
+ /** Item active style */
372
+ itemActiveStyle?: CSSProperties;
373
+ /** Item disabled className */
374
+ itemDisabledClassName?: string;
375
+ /** Video mute button className */
376
+ vmButtonClassName?: string;
377
+ /** Video mute button active className */
378
+ vmButtonActiveClassName?: string;
379
+ /** Custom render for I/O online indicator */
380
+ renderIoIndicator?: (on: boolean) => ReactNode;
381
+ /** Custom render for signal indicator */
382
+ renderSignalIndicator?: (on: boolean) => ReactNode;
383
+ }
384
+ declare function CrisCoMatrixListsTie({ oid, inputTitle, outputTitle, className, style, listClassName, listStyle, headerClassName, headerStyle, itemClassName, itemStyle, itemActiveClassName, itemActiveStyle, itemDisabledClassName, vmButtonClassName, vmButtonActiveClassName, renderIoIndicator, renderSignalIndicator, }: CrisCoMatrixListsTieProps): react_jsx_runtime.JSX.Element | null;
385
+
317
386
  /**
318
387
  * Icon configuration and utilities for CRIS components
319
388
  *
@@ -364,4 +433,4 @@ declare function getIconUrl(name: string): string;
364
433
  */
365
434
  declare function getIconFilter(active: boolean): string | undefined;
366
435
 
367
- export { CrisButton, type CrisButtonProps, CrisCoDebug, type CrisCoDebugProps, CrisGauge, type CrisGaugeProps, CrisOfflinePage, type CrisOfflinePageProps, CrisSlider, type CrisSliderProps, CrisSpinner, type CrisSpinnerProps, CrisText, type CrisTextProps, type DebugModule, type IconConfig, type SpinnerSpeed, configureIcons, getIconConfig, getIconFilter, getIconUrl };
436
+ export { CrisButton, type CrisButtonProps, CrisCoDebug, type CrisCoDebugProps, CrisCoMatrixListsTie, type CrisCoMatrixListsTieProps, CrisGauge, type CrisGaugeProps, CrisOfflinePage, type CrisOfflinePageProps, CrisSlider, type CrisSliderProps, CrisSpinner, type CrisSpinnerProps, CrisText, type CrisTextProps, type DebugModule, type IconConfig, type MatrixItem, type MatrixStatus, type SpinnerSpeed, configureIcons, getIconConfig, getIconFilter, getIconUrl };
package/dist/index.d.ts CHANGED
@@ -314,6 +314,75 @@ interface CrisCoDebugProps {
314
314
  }
315
315
  declare function CrisCoDebug({ oid, title, className, style, itemClassName, itemStyle, buttonClassName, buttonActiveClassName, iconEthOn, iconEthOff, iconRs232On, iconRs232Off, }: CrisCoDebugProps): react_jsx_runtime.JSX.Element | null;
316
316
 
317
+ /** Shape of an input or output item from the backend */
318
+ interface MatrixItem {
319
+ ch: number;
320
+ lb: string;
321
+ gp: number;
322
+ sl: {
323
+ on: boolean;
324
+ en: boolean;
325
+ vs: boolean;
326
+ };
327
+ io: {
328
+ on: boolean;
329
+ vs: boolean;
330
+ };
331
+ sg: {
332
+ on: boolean;
333
+ vs: boolean;
334
+ };
335
+ vm: {
336
+ on: boolean;
337
+ en: boolean;
338
+ vs: boolean;
339
+ };
340
+ }
341
+ /** Shape of the matrix status from the backend */
342
+ interface MatrixStatus {
343
+ ip: MatrixItem[];
344
+ op: MatrixItem[];
345
+ }
346
+ interface CrisCoMatrixListsTieProps {
347
+ /** Custom object ID (e.g., "MTX1_VID") */
348
+ oid: string;
349
+ /** Input list title */
350
+ inputTitle?: string;
351
+ /** Output list title */
352
+ outputTitle?: string;
353
+ /** Container className */
354
+ className?: string;
355
+ /** Container style */
356
+ style?: CSSProperties;
357
+ /** List column className */
358
+ listClassName?: string;
359
+ /** List column style */
360
+ listStyle?: CSSProperties;
361
+ /** List header className */
362
+ headerClassName?: string;
363
+ /** List header style */
364
+ headerStyle?: CSSProperties;
365
+ /** Item className */
366
+ itemClassName?: string;
367
+ /** Item style */
368
+ itemStyle?: CSSProperties;
369
+ /** Item active (selected/tied) className */
370
+ itemActiveClassName?: string;
371
+ /** Item active style */
372
+ itemActiveStyle?: CSSProperties;
373
+ /** Item disabled className */
374
+ itemDisabledClassName?: string;
375
+ /** Video mute button className */
376
+ vmButtonClassName?: string;
377
+ /** Video mute button active className */
378
+ vmButtonActiveClassName?: string;
379
+ /** Custom render for I/O online indicator */
380
+ renderIoIndicator?: (on: boolean) => ReactNode;
381
+ /** Custom render for signal indicator */
382
+ renderSignalIndicator?: (on: boolean) => ReactNode;
383
+ }
384
+ declare function CrisCoMatrixListsTie({ oid, inputTitle, outputTitle, className, style, listClassName, listStyle, headerClassName, headerStyle, itemClassName, itemStyle, itemActiveClassName, itemActiveStyle, itemDisabledClassName, vmButtonClassName, vmButtonActiveClassName, renderIoIndicator, renderSignalIndicator, }: CrisCoMatrixListsTieProps): react_jsx_runtime.JSX.Element | null;
385
+
317
386
  /**
318
387
  * Icon configuration and utilities for CRIS components
319
388
  *
@@ -364,4 +433,4 @@ declare function getIconUrl(name: string): string;
364
433
  */
365
434
  declare function getIconFilter(active: boolean): string | undefined;
366
435
 
367
- export { CrisButton, type CrisButtonProps, CrisCoDebug, type CrisCoDebugProps, CrisGauge, type CrisGaugeProps, CrisOfflinePage, type CrisOfflinePageProps, CrisSlider, type CrisSliderProps, CrisSpinner, type CrisSpinnerProps, CrisText, type CrisTextProps, type DebugModule, type IconConfig, type SpinnerSpeed, configureIcons, getIconConfig, getIconFilter, getIconUrl };
436
+ export { CrisButton, type CrisButtonProps, CrisCoDebug, type CrisCoDebugProps, CrisCoMatrixListsTie, type CrisCoMatrixListsTieProps, CrisGauge, type CrisGaugeProps, CrisOfflinePage, type CrisOfflinePageProps, CrisSlider, type CrisSliderProps, CrisSpinner, type CrisSpinnerProps, CrisText, type CrisTextProps, type DebugModule, type IconConfig, type MatrixItem, type MatrixStatus, type SpinnerSpeed, configureIcons, getIconConfig, getIconFilter, getIconUrl };
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
+ CrisCoMatrixListsTie: () => CrisCoMatrixListsTie,
25
26
  CrisGauge: () => CrisGauge,
26
27
  CrisOfflinePage: () => CrisOfflinePage,
27
28
  CrisSlider: () => CrisSlider,
@@ -1327,10 +1328,271 @@ function CrisCoDebug({
1327
1328
  }
1328
1329
  );
1329
1330
  }
1331
+
1332
+ // src/components/CrisCoMatrixListsTie.tsx
1333
+ var import_cris_webui_ch5_core8 = require("@imperosoft/cris-webui-ch5-core");
1334
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1335
+ var defaults = {
1336
+ container: {
1337
+ display: "flex",
1338
+ flexDirection: "row",
1339
+ gap: 8,
1340
+ height: "100%"
1341
+ },
1342
+ list: {
1343
+ flex: 1,
1344
+ display: "flex",
1345
+ flexDirection: "column",
1346
+ overflow: "hidden",
1347
+ minHeight: 0
1348
+ },
1349
+ header: {
1350
+ fontSize: 13,
1351
+ fontWeight: 600,
1352
+ padding: "6px 10px",
1353
+ textTransform: "uppercase",
1354
+ opacity: 0.6,
1355
+ flexShrink: 0
1356
+ },
1357
+ scroll: {
1358
+ flex: 1,
1359
+ overflow: "auto",
1360
+ display: "flex",
1361
+ flexDirection: "column",
1362
+ gap: 2
1363
+ },
1364
+ item: {
1365
+ display: "flex",
1366
+ alignItems: "center",
1367
+ gap: 6,
1368
+ padding: "6px 10px",
1369
+ minHeight: 40,
1370
+ cursor: "pointer",
1371
+ userSelect: "none"
1372
+ },
1373
+ itemLabel: {
1374
+ flex: 1,
1375
+ fontSize: 13,
1376
+ whiteSpace: "nowrap",
1377
+ overflow: "hidden",
1378
+ textOverflow: "ellipsis"
1379
+ },
1380
+ indicators: {
1381
+ display: "flex",
1382
+ gap: 4,
1383
+ alignItems: "center"
1384
+ },
1385
+ indicator: {
1386
+ width: 8,
1387
+ height: 8,
1388
+ borderRadius: "50%",
1389
+ flexShrink: 0
1390
+ }
1391
+ };
1392
+ function DefaultIoIndicator({ on }) {
1393
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1394
+ "div",
1395
+ {
1396
+ style: {
1397
+ ...defaults.indicator,
1398
+ backgroundColor: on ? "#4caf50" : "#f44336"
1399
+ },
1400
+ title: on ? "Online" : "Offline"
1401
+ }
1402
+ );
1403
+ }
1404
+ function DefaultSignalIndicator({ on }) {
1405
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1406
+ "div",
1407
+ {
1408
+ style: {
1409
+ ...defaults.indicator,
1410
+ backgroundColor: on ? "#2196f3" : "#666"
1411
+ },
1412
+ title: on ? "Signal detected" : "No signal"
1413
+ }
1414
+ );
1415
+ }
1416
+ function MatrixItemRow({
1417
+ item,
1418
+ type,
1419
+ onSelect,
1420
+ onToggleVideoMute,
1421
+ itemClassName,
1422
+ itemStyle: itemStyleProp,
1423
+ itemActiveClassName,
1424
+ itemActiveStyle,
1425
+ itemDisabledClassName,
1426
+ vmButtonClassName,
1427
+ vmButtonActiveClassName,
1428
+ renderIoIndicator,
1429
+ renderSignalIndicator
1430
+ }) {
1431
+ const isActive = item.sl.on;
1432
+ const isEnabled = item.sl.en;
1433
+ const classes = [
1434
+ "cris-co-matrix-item",
1435
+ itemClassName,
1436
+ isActive && (itemActiveClassName || "active"),
1437
+ !isEnabled && (itemDisabledClassName || "disabled")
1438
+ ].filter(Boolean).join(" ");
1439
+ const computedStyle = itemClassName ? { ...itemStyleProp } : {
1440
+ ...defaults.item,
1441
+ ...itemStyleProp,
1442
+ ...isActive ? itemActiveStyle : void 0,
1443
+ opacity: isEnabled ? 1 : 0.4
1444
+ };
1445
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: classes, style: computedStyle, children: [
1446
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1447
+ CrisButton,
1448
+ {
1449
+ selected: isActive,
1450
+ enabled: isEnabled,
1451
+ onPress: onSelect,
1452
+ className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
1453
+ classActive: itemActiveClassName,
1454
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, width: "100%" }, children: [
1455
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: defaults.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.ch}` }),
1456
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: defaults.indicators, children: [
1457
+ item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DefaultIoIndicator, { on: item.io.on })),
1458
+ item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DefaultSignalIndicator, { on: item.sg.on }))
1459
+ ] })
1460
+ ] })
1461
+ }
1462
+ ),
1463
+ item.vm.vs && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1464
+ CrisButton,
1465
+ {
1466
+ selected: item.vm.on,
1467
+ enabled: item.vm.en,
1468
+ text: "VM",
1469
+ onPress: onToggleVideoMute,
1470
+ className: vmButtonClassName,
1471
+ classActive: vmButtonActiveClassName
1472
+ }
1473
+ )
1474
+ ] });
1475
+ }
1476
+ function CrisCoMatrixListsTie({
1477
+ oid,
1478
+ inputTitle = "Inputs",
1479
+ outputTitle = "Outputs",
1480
+ className,
1481
+ style,
1482
+ listClassName,
1483
+ listStyle,
1484
+ headerClassName,
1485
+ headerStyle,
1486
+ itemClassName,
1487
+ itemStyle,
1488
+ itemActiveClassName,
1489
+ itemActiveStyle,
1490
+ itemDisabledClassName,
1491
+ vmButtonClassName,
1492
+ vmButtonActiveClassName,
1493
+ renderIoIndicator,
1494
+ renderSignalIndicator
1495
+ }) {
1496
+ const matrix = (0, import_cris_webui_ch5_core8.useCustomObject)(oid);
1497
+ const send = (0, import_cris_webui_ch5_core8.useCustomObjectSend)();
1498
+ if (!matrix) return null;
1499
+ const { ip: inputs, op: outputs } = matrix;
1500
+ const handleSelectInput = (ch) => {
1501
+ send(oid, { action: "selectInput", ch });
1502
+ };
1503
+ const handleTie = (ch) => {
1504
+ send(oid, { action: "tie", ch });
1505
+ };
1506
+ const handleToggleVideoMute = (type, ch) => {
1507
+ send(oid, { action: "toggleVideoMute", type, ch });
1508
+ };
1509
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1510
+ "div",
1511
+ {
1512
+ className,
1513
+ style: className ? style : { ...defaults.container, ...style },
1514
+ children: [
1515
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1516
+ "div",
1517
+ {
1518
+ className: listClassName,
1519
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1520
+ children: [
1521
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1522
+ "div",
1523
+ {
1524
+ className: headerClassName,
1525
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1526
+ children: inputTitle
1527
+ }
1528
+ ),
1529
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1530
+ MatrixItemRow,
1531
+ {
1532
+ item,
1533
+ type: "input",
1534
+ onSelect: () => handleSelectInput(item.ch),
1535
+ onToggleVideoMute: () => handleToggleVideoMute("input", item.ch),
1536
+ itemClassName,
1537
+ itemStyle,
1538
+ itemActiveClassName,
1539
+ itemActiveStyle,
1540
+ itemDisabledClassName,
1541
+ vmButtonClassName,
1542
+ vmButtonActiveClassName,
1543
+ renderIoIndicator,
1544
+ renderSignalIndicator
1545
+ },
1546
+ item.ch
1547
+ )) })
1548
+ ]
1549
+ }
1550
+ ),
1551
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1552
+ "div",
1553
+ {
1554
+ className: listClassName,
1555
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1556
+ children: [
1557
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1558
+ "div",
1559
+ {
1560
+ className: headerClassName,
1561
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1562
+ children: outputTitle
1563
+ }
1564
+ ),
1565
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1566
+ MatrixItemRow,
1567
+ {
1568
+ item,
1569
+ type: "output",
1570
+ onSelect: () => handleTie(item.ch),
1571
+ onToggleVideoMute: () => handleToggleVideoMute("output", item.ch),
1572
+ itemClassName,
1573
+ itemStyle,
1574
+ itemActiveClassName,
1575
+ itemActiveStyle,
1576
+ itemDisabledClassName,
1577
+ vmButtonClassName,
1578
+ vmButtonActiveClassName,
1579
+ renderIoIndicator,
1580
+ renderSignalIndicator
1581
+ },
1582
+ item.ch
1583
+ )) })
1584
+ ]
1585
+ }
1586
+ )
1587
+ ]
1588
+ }
1589
+ );
1590
+ }
1330
1591
  // Annotate the CommonJS export names for ESM import in node:
1331
1592
  0 && (module.exports = {
1332
1593
  CrisButton,
1333
1594
  CrisCoDebug,
1595
+ CrisCoMatrixListsTie,
1334
1596
  CrisGauge,
1335
1597
  CrisOfflinePage,
1336
1598
  CrisSlider,