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

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,270 @@ 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
+ },
1348
+ header: {
1349
+ fontSize: 13,
1350
+ fontWeight: 600,
1351
+ padding: "6px 10px",
1352
+ textTransform: "uppercase",
1353
+ opacity: 0.6,
1354
+ flexShrink: 0
1355
+ },
1356
+ scroll: {
1357
+ flex: 1,
1358
+ overflow: "auto",
1359
+ display: "flex",
1360
+ flexDirection: "column",
1361
+ gap: 2
1362
+ },
1363
+ item: {
1364
+ display: "flex",
1365
+ alignItems: "center",
1366
+ gap: 6,
1367
+ padding: "6px 10px",
1368
+ minHeight: 40,
1369
+ cursor: "pointer",
1370
+ userSelect: "none"
1371
+ },
1372
+ itemLabel: {
1373
+ flex: 1,
1374
+ fontSize: 13,
1375
+ whiteSpace: "nowrap",
1376
+ overflow: "hidden",
1377
+ textOverflow: "ellipsis"
1378
+ },
1379
+ indicators: {
1380
+ display: "flex",
1381
+ gap: 4,
1382
+ alignItems: "center"
1383
+ },
1384
+ indicator: {
1385
+ width: 8,
1386
+ height: 8,
1387
+ borderRadius: "50%",
1388
+ flexShrink: 0
1389
+ }
1390
+ };
1391
+ function DefaultIoIndicator({ on }) {
1392
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1393
+ "div",
1394
+ {
1395
+ style: {
1396
+ ...defaults.indicator,
1397
+ backgroundColor: on ? "#4caf50" : "#f44336"
1398
+ },
1399
+ title: on ? "Online" : "Offline"
1400
+ }
1401
+ );
1402
+ }
1403
+ function DefaultSignalIndicator({ on }) {
1404
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1405
+ "div",
1406
+ {
1407
+ style: {
1408
+ ...defaults.indicator,
1409
+ backgroundColor: on ? "#2196f3" : "#666"
1410
+ },
1411
+ title: on ? "Signal detected" : "No signal"
1412
+ }
1413
+ );
1414
+ }
1415
+ function MatrixItemRow({
1416
+ item,
1417
+ type,
1418
+ onSelect,
1419
+ onToggleVideoMute,
1420
+ itemClassName,
1421
+ itemStyle: itemStyleProp,
1422
+ itemActiveClassName,
1423
+ itemActiveStyle,
1424
+ itemDisabledClassName,
1425
+ vmButtonClassName,
1426
+ vmButtonActiveClassName,
1427
+ renderIoIndicator,
1428
+ renderSignalIndicator
1429
+ }) {
1430
+ const isActive = item.sl.on;
1431
+ const isEnabled = item.sl.en;
1432
+ const classes = [
1433
+ "cris-co-matrix-item",
1434
+ itemClassName,
1435
+ isActive && (itemActiveClassName || "active"),
1436
+ !isEnabled && (itemDisabledClassName || "disabled")
1437
+ ].filter(Boolean).join(" ");
1438
+ const computedStyle = itemClassName ? { ...itemStyleProp } : {
1439
+ ...defaults.item,
1440
+ ...itemStyleProp,
1441
+ ...isActive ? itemActiveStyle : void 0,
1442
+ opacity: isEnabled ? 1 : 0.4
1443
+ };
1444
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: classes, style: computedStyle, children: [
1445
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1446
+ CrisButton,
1447
+ {
1448
+ selected: isActive,
1449
+ enabled: isEnabled,
1450
+ onPress: onSelect,
1451
+ className: `cris-co-matrix-item-btn ${itemActiveClassName ?? ""}`,
1452
+ classActive: itemActiveClassName,
1453
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, width: "100%" }, children: [
1454
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: defaults.itemLabel, children: item.lb || `${type === "input" ? "Input" : "Output"} ${item.ch}` }),
1455
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: defaults.indicators, children: [
1456
+ item.io.vs && (renderIoIndicator ? renderIoIndicator(item.io.on) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DefaultIoIndicator, { on: item.io.on })),
1457
+ item.sg.vs && (renderSignalIndicator ? renderSignalIndicator(item.sg.on) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DefaultSignalIndicator, { on: item.sg.on }))
1458
+ ] })
1459
+ ] })
1460
+ }
1461
+ ),
1462
+ item.vm.vs && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1463
+ CrisButton,
1464
+ {
1465
+ selected: item.vm.on,
1466
+ enabled: item.vm.en,
1467
+ text: "VM",
1468
+ onPress: onToggleVideoMute,
1469
+ className: vmButtonClassName,
1470
+ classActive: vmButtonActiveClassName
1471
+ }
1472
+ )
1473
+ ] });
1474
+ }
1475
+ function CrisCoMatrixListsTie({
1476
+ oid,
1477
+ inputTitle = "Inputs",
1478
+ outputTitle = "Outputs",
1479
+ className,
1480
+ style,
1481
+ listClassName,
1482
+ listStyle,
1483
+ headerClassName,
1484
+ headerStyle,
1485
+ itemClassName,
1486
+ itemStyle,
1487
+ itemActiveClassName,
1488
+ itemActiveStyle,
1489
+ itemDisabledClassName,
1490
+ vmButtonClassName,
1491
+ vmButtonActiveClassName,
1492
+ renderIoIndicator,
1493
+ renderSignalIndicator
1494
+ }) {
1495
+ const matrix = (0, import_cris_webui_ch5_core8.useCustomObject)(oid);
1496
+ const send = (0, import_cris_webui_ch5_core8.useCustomObjectSend)();
1497
+ if (!matrix) return null;
1498
+ const { ip: inputs, op: outputs } = matrix;
1499
+ const handleSelectInput = (ch) => {
1500
+ send(oid, { action: "selectInput", ch });
1501
+ };
1502
+ const handleTie = (ch) => {
1503
+ send(oid, { action: "tie", ch });
1504
+ };
1505
+ const handleToggleVideoMute = (type, ch) => {
1506
+ send(oid, { action: "toggleVideoMute", type, ch });
1507
+ };
1508
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1509
+ "div",
1510
+ {
1511
+ className,
1512
+ style: className ? style : { ...defaults.container, ...style },
1513
+ children: [
1514
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1515
+ "div",
1516
+ {
1517
+ className: listClassName,
1518
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1519
+ children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1521
+ "div",
1522
+ {
1523
+ className: headerClassName,
1524
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1525
+ children: inputTitle
1526
+ }
1527
+ ),
1528
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.scroll, children: inputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1529
+ MatrixItemRow,
1530
+ {
1531
+ item,
1532
+ type: "input",
1533
+ onSelect: () => handleSelectInput(item.ch),
1534
+ onToggleVideoMute: () => handleToggleVideoMute("input", item.ch),
1535
+ itemClassName,
1536
+ itemStyle,
1537
+ itemActiveClassName,
1538
+ itemActiveStyle,
1539
+ itemDisabledClassName,
1540
+ vmButtonClassName,
1541
+ vmButtonActiveClassName,
1542
+ renderIoIndicator,
1543
+ renderSignalIndicator
1544
+ },
1545
+ item.ch
1546
+ )) })
1547
+ ]
1548
+ }
1549
+ ),
1550
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1551
+ "div",
1552
+ {
1553
+ className: listClassName,
1554
+ style: listClassName ? listStyle : { ...defaults.list, ...listStyle },
1555
+ children: [
1556
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1557
+ "div",
1558
+ {
1559
+ className: headerClassName,
1560
+ style: headerClassName ? headerStyle : { ...defaults.header, ...headerStyle },
1561
+ children: outputTitle
1562
+ }
1563
+ ),
1564
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: defaults.scroll, children: outputs?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1565
+ MatrixItemRow,
1566
+ {
1567
+ item,
1568
+ type: "output",
1569
+ onSelect: () => handleTie(item.ch),
1570
+ onToggleVideoMute: () => handleToggleVideoMute("output", item.ch),
1571
+ itemClassName,
1572
+ itemStyle,
1573
+ itemActiveClassName,
1574
+ itemActiveStyle,
1575
+ itemDisabledClassName,
1576
+ vmButtonClassName,
1577
+ vmButtonActiveClassName,
1578
+ renderIoIndicator,
1579
+ renderSignalIndicator
1580
+ },
1581
+ item.ch
1582
+ )) })
1583
+ ]
1584
+ }
1585
+ )
1586
+ ]
1587
+ }
1588
+ );
1589
+ }
1330
1590
  // Annotate the CommonJS export names for ESM import in node:
1331
1591
  0 && (module.exports = {
1332
1592
  CrisButton,
1333
1593
  CrisCoDebug,
1594
+ CrisCoMatrixListsTie,
1334
1595
  CrisGauge,
1335
1596
  CrisOfflinePage,
1336
1597
  CrisSlider,