@cwellt_software/cwellt-reactjs-lib 1.0.4 → 1.0.5

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.
Files changed (32) hide show
  1. package/dist/content/icons/new-cw-icons/NewCwIcons.html +27 -26
  2. package/dist/content/icons/new-cw-icons/NewCwIcons.json +1 -1
  3. package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +2 -1
  4. package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
  5. package/dist/index.cjs.js +391 -243
  6. package/dist/index.css +2 -2
  7. package/dist/index.d.ts +147 -82
  8. package/dist/index.es.js +391 -240
  9. package/dist/src/components/control/action/buttons/CwButtons.d.ts +0 -4
  10. package/dist/src/components/control/action/buttons/CwButtons.d.ts.map +1 -1
  11. package/dist/src/components/control/input/any/CwInput.d.ts.map +1 -1
  12. package/dist/src/components/control/input/number/CwInputNumber.d.ts.map +1 -1
  13. package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +1 -0
  14. package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
  15. package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
  16. package/dist/src/components/display/data/table/CwTable.d.ts +47 -62
  17. package/dist/src/components/display/data/table/CwTable.d.ts.map +1 -1
  18. package/dist/src/components/display/graphics/loading/CwLoading.d.ts +39 -9
  19. package/dist/src/components/display/graphics/loading/CwLoading.d.ts.map +1 -1
  20. package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts +13 -1
  21. package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts.map +1 -1
  22. package/dist/src/components/display/text/tag/CwTag.d.ts +2 -2
  23. package/dist/src/components/display/text/tag/CwTag.d.ts.map +1 -1
  24. package/dist/src/components/layout/dialog/CwDialog.d.ts +15 -4
  25. package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
  26. package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts +33 -0
  27. package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts.map +1 -0
  28. package/dist/src/components/layout/modal/legacy/cw_modal_report.d.ts.map +1 -1
  29. package/dist/src/components/layout/tabs/CwTabs.d.ts.map +1 -1
  30. package/dist/src/index.d.ts +2 -1
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -120,17 +120,17 @@ function CwTooltip(CwelltTooltipProps) {
120
120
  function CwTag(tagProps) {
121
121
  const hideTag = (event_clickTag) => {
122
122
  const tag = event_clickTag.currentTarget.parentElement;
123
- tag.classList.add("cwellt_display_none");
123
+ tag?.classList.add("cwellt_display_none");
124
124
  };
125
125
  const onClickClosableCustomTag = (event_clickClosableT) => {
126
126
  hideTag(event_clickClosableT);
127
- if (typeof tagProps.onClickClosableTag === "function") {
127
+ if (tagProps.onClickClosableTag != undefined) {
128
128
  tagProps.onClickClosableTag(event_clickClosableT);
129
129
  }
130
130
  };
131
131
  const onClickCustomTag = (event_clickTag) => {
132
132
  // click option interface
133
- if (typeof tagProps.onClickTag === "function") {
133
+ if (tagProps.onClickTag !== undefined) {
134
134
  tagProps.onClickTag(event_clickTag);
135
135
  }
136
136
  };
@@ -222,27 +222,50 @@ function CwDisplayMessage(message, type, duration) {
222
222
  CwMessageManager.getInstance().showMessage(message, type, duration);
223
223
  }
224
224
 
225
- function CwLoading(props) {
226
- return (jsx("div", { children: jsxs("div", { "aria-busy": props.cwelltBooleanLoading, className: props.cwelltBooleanLoading === true
227
- ? "cwellt_flex cwellt_flex_column cwelltContentLoading " +
228
- (props.cwelltClassNameContentLoading === undefined ? "" : props.cwelltClassNameContentLoading)
229
- : "", children: [props.cwelltBooleanLoading === true ? (
230
- // Container loading [ Icon and text of loading here is the property: cwelltClassNameLoading to custom orientation Vertical or Horizontal ]
231
- jsxs("div", { className: props.cwelltClassNameLoading === undefined
232
- ? "cwelltContainerLoading cwellt_flex cwellt_justify_center cwellt_align_items_center cwellt_flex_wrap "
233
- : props.cwelltClassNameLoading +
234
- " cwelltContainerLoading cwellt_flex cwellt_justify_center cwellt_align_items_center cwellt_flex_wrap", children: [jsx("div", { className: props.cwelltSizeLoading === undefined
235
- ? "cwelltDefaultLoadingSize cwellt_loading cwellt_flex cwellt_align_items_center "
236
- : props.cwelltSizeLoading +
237
- " cwelltDefaultLoadingSize cwellt_loading cwellt_flex cwellt_align_items_center ", children: jsx("span", { className: "cwelltIconLoading cwellt_flex cwellt_justify_center cwellt_align_items_center" }) }), jsx("div", { className: "cwelltTextLoading", children: jsx("h1", { children: props.cwelltTextLoading }) })] })) : (jsx("div", {})), jsx("div", { className: props.cwelltBooleanLoading === true ? "cwelltContentLoadingDisabled" : "", children: props.children })] }) }));
225
+ /**
226
+ * CwLoading
227
+ *
228
+ * A versatile loading component that shows a spinner with optional text
229
+ * and disables the wrapped content while in loading state.
230
+ *
231
+ * @example
232
+ * // Basic usage
233
+ * <CwLoading isLoading={isSubmitting}>
234
+ * <form>...</form>
235
+ * </CwLoading>
236
+ *
237
+ * // With custom text and size
238
+ * <CwLoading
239
+ * isLoading={isLoading}
240
+ * text="Please wait..."
241
+ * size="large"
242
+ * >
243
+ * <UserProfile />
244
+ * </CwLoading>
245
+ */
246
+ function CwLoading({ isLoading = false, text = '', size = 'regular', iconPosition = 'outside', iconName = 'cwi-plane-solid', animation = 'spin', children }) {
247
+ const iconClasses = `cwi-icons ${iconName || ''}`;
248
+ return (jsxs("div", { "aria-busy": isLoading, className: isLoading ? 'cw-loading-container' : '', children: [isLoading && (jsxs("div", { className: "cw-loading-content", "data-size": size, "data-animation": animation, children: [jsx("div", { className: "cw-loading", "data-icon-position": iconPosition, children: jsx("span", { className: iconClasses }) }), text && (jsx("p", { children: text }))] })), jsx("div", { className: isLoading ? 'cw-loading-disabled-content' : '', children: children })] }));
238
249
  }
239
250
 
251
+ /**
252
+ * @deprecated since may 2025. Use <CwLoading size="small"> instead.
253
+ *
254
+ * This component will be removed in a future release.
255
+ *
256
+ * @example
257
+ * // Instead of:
258
+ * <CwLoadingSmall />
259
+ *
260
+ * // Use:
261
+ * <CwLoading size="small" />
262
+ */
240
263
  function CwLoadingSmall(CwelltLoadingAppointements) {
241
- return (jsx("div", { children: CwelltLoadingAppointements.cwelltBooleanLoadingAppointment === true ? (
264
+ return (jsx("div", { children: CwelltLoadingAppointements.isLoading === true ? (
242
265
  // * Show loading appointment
243
- jsx("div", { className: "cwellt_loadingAppointmentContainer cwellt_loading cwellt_flex cwellt_align_items_center cwellt_loading cwellt_flex cwellt_align_items_center ", children: jsx("span", { className: "cwelltIconLoading cwellt_flex cwellt_justify_center cwellt_align_items_center" }) })) : (
266
+ jsx("div", { className: "cw-loading-container", children: jsx("div", { className: "cw-loading" }) })) : (
244
267
  // Show empty div
245
- jsx("div", { className: "cwellt_d_none" })) }));
268
+ jsx("div", {})) }));
246
269
  }
247
270
 
248
271
  var styles$b = {"cw-generic-tooltip-content":"cw-generic-tooltip-module_cw-generic-tooltip-content__la-Si"};
@@ -502,55 +525,100 @@ const parseSize = (size) => {
502
525
  if (typeof size === 'number')
503
526
  return { value: size, unit: 'px' };
504
527
  // Match numeric value and unit
505
- const match = size.match(/^([\d.]+)(\D+)$/);
528
+ const match = String(size).match(/^([\d.]+)(\D+)$/);
506
529
  if (match) {
507
- return { value: parseFloat(match[1]), unit: match[2] };
530
+ const unit = match[2];
531
+ // Only allow px, rem, vw, vh
532
+ if (['px', 'rem', 'vw', 'vh'].includes(unit)) {
533
+ return { value: parseFloat(match[1]), unit };
534
+ }
508
535
  }
509
- // Default to pixels if no unit specified
510
- return { value: parseFloat(size), unit: 'px' };
536
+ // Default to pixels if no unit specified or unit not supported
537
+ return { value: parseFloat(String(size)), unit: 'px' };
511
538
  };
512
539
  // Helper to convert size to px for calculations
513
540
  const convertToPx = (size) => {
514
- if (size.unit === 'px')
515
- return size.value;
516
- if (size.unit === 'rem')
517
- return size.value * 16; // Assuming 1rem = 16px
518
- if (size.unit === 'vh')
519
- return (window.innerHeight * size.value) / 100;
520
- if (size.unit === 'vw')
521
- return (window.innerWidth * size.value) / 100;
522
- return size.value; // Default fallback
541
+ switch (size.unit) {
542
+ case 'px': return size.value;
543
+ case 'rem': return size.value * 16; // Assuming 1rem = 16px
544
+ case 'vh': return (window.innerHeight * size.value) / 100;
545
+ case 'vw': return (window.innerWidth * size.value) / 100;
546
+ default: return size.value; // Default fallback
547
+ }
548
+ };
549
+ // Function to convert from px back to original unit
550
+ const convertFromPx = (px, unit) => {
551
+ switch (unit) {
552
+ case 'px': return px;
553
+ case 'rem': return px / 16;
554
+ case 'vh': return (px * 100) / window.innerHeight;
555
+ case 'vw': return (px * 100) / window.innerWidth;
556
+ default: return px;
557
+ }
523
558
  };
524
559
  const CwDialog = props => {
560
+ const { customFooter, customHeader, headline, width, height, dialogSize, scrim, onSave, onClose, hideFooter, children, open, ...domProps } = props;
525
561
  const dialogRef = useRef(null);
526
- // Default width and height with units
527
- const defaultWidth = 800;
528
- const defaultHeight = 600;
529
- // Parse width and height from props or use defaults
530
- const initialWidth = props.dialogSize?.width !== undefined ? props.dialogSize.width : defaultWidth;
531
- const initialHeight = props.dialogSize?.height !== undefined ? props.dialogSize.height : defaultHeight;
532
- // Parse the sizes to separate value and unit
533
- const parsedWidth = parseSize(initialWidth);
534
- const parsedHeight = parseSize(initialHeight);
535
- // Convert to px for internal calculations
536
- const initialWidthPx = convertToPx(parsedWidth);
537
- const initialHeightPx = convertToPx(parsedHeight);
538
- const initialDialogSize = {
539
- width: initialWidthPx,
540
- height: initialHeightPx,
541
- widthUnit: parsedWidth.unit,
542
- heightUnit: parsedHeight.unit
543
- };
562
+ const initialSetup = useMemo(() => {
563
+ // Default width and height with units
564
+ const defaultWidth = 800;
565
+ // Priority: direct props > dialogSize > default values
566
+ const initialWidth = width !== undefined
567
+ ? width
568
+ : dialogSize?.width !== undefined
569
+ ? dialogSize.width
570
+ : defaultWidth;
571
+ const initialHeight = height !== undefined
572
+ ? height
573
+ : dialogSize?.height !== undefined
574
+ ? dialogSize.height
575
+ : undefined; // Undefined for autoHeight
576
+ // Determine if height is automatic when height is not provided
577
+ const isAutoHeight = initialHeight === undefined;
578
+ // Parse the sizes to separate value and unit
579
+ const parsedWidth = parseSize(initialWidth);
580
+ const parsedHeight = isAutoHeight
581
+ ? { value: 0, unit: 'auto' }
582
+ : parseSize(initialHeight);
583
+ // Convert to px for internal calculations
584
+ const initialWidthPx = convertToPx(parsedWidth);
585
+ const initialHeightPx = isAutoHeight ? 0 : convertToPx(parsedHeight);
586
+ // Use estimated height for initial positioning when autoHeight is true
587
+ const initialEstimatedHeight = isAutoHeight ? 300 : initialHeightPx;
588
+ const initialDialogSize = {
589
+ width: initialWidthPx,
590
+ height: initialHeightPx,
591
+ widthUnit: parsedWidth.unit,
592
+ heightUnit: parsedHeight.unit,
593
+ autoHeight: isAutoHeight
594
+ };
595
+ const initialPosition = {
596
+ x: window.document.body.clientWidth / 2 - initialWidthPx / 2,
597
+ y: window.document.body.clientHeight / 2 - initialEstimatedHeight / 2
598
+ };
599
+ return { initialDialogSize, initialPosition };
600
+ }, [width, height, dialogSize]); // Only recalculate when these props change
544
601
  const [isDragging, setIsDragging] = useState(false);
545
602
  const [resizeDirection, setResizeDirection] = useState(null);
546
- const [position, setPosition] = useState({
547
- x: window.document.body.clientWidth / 2 - initialDialogSize.width / 2,
548
- y: window.document.body.clientHeight / 2 - initialDialogSize.height / 2
549
- });
550
- const [size, setSize] = useState(initialDialogSize);
603
+ const [position, setPosition] = useState(initialSetup.initialPosition);
604
+ const [size, setSize] = useState(initialSetup.initialDialogSize);
551
605
  const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
552
606
  // scrim is true by default
553
- const hasScrim = props.scrim !== false;
607
+ const hasScrim = scrim !== false;
608
+ // Adjust position after the dialog is rendered when using autoHeight
609
+ useEffect(() => {
610
+ if (size.autoHeight && dialogRef.current && open) {
611
+ // Get the actual height after rendering
612
+ const actualHeight = dialogRef.current.offsetHeight;
613
+ // Only update position if height is available
614
+ if (actualHeight > 0) {
615
+ setPosition(prevPos => ({
616
+ ...prevPos,
617
+ y: window.document.body.clientHeight / 2 - actualHeight / 2
618
+ }));
619
+ }
620
+ }
621
+ }, [size.autoHeight, open]);
554
622
  useEffect(() => {
555
623
  const handleMouseMove = (e) => {
556
624
  if (isDragging) {
@@ -580,29 +648,39 @@ const CwDialog = props => {
580
648
  let newY = position.y;
581
649
  const minVisiblePx = 64;
582
650
  const minSize = 100;
583
- if (resizeDirection.includes("w")) {
584
- const dx = e.clientX - position.x;
585
- newWidth = Math.max(size.width - dx, minSize);
586
- newX = Math.min(Math.max(position.x + dx, minVisiblePx - newWidth), position.x + size.width - minSize);
651
+ // Only allow horizontal resizing if autoHeight is true
652
+ if (!size.autoHeight || (!resizeDirection.includes("n") && !resizeDirection.includes("s"))) {
653
+ // Logic for horizontal resizing
654
+ if (resizeDirection.includes("w")) {
655
+ const dx = e.clientX - position.x;
656
+ newWidth = Math.max(size.width - dx, minSize);
657
+ newX = Math.min(Math.max(position.x + dx, minVisiblePx - newWidth), position.x + size.width - minSize);
658
+ }
659
+ if (resizeDirection.includes("e")) {
660
+ newWidth = Math.min(Math.max(e.clientX - position.x, minSize), parentRect.width - position.x + dialogRect.width - minVisiblePx);
661
+ }
587
662
  }
588
- if (resizeDirection.includes("e")) {
589
- newWidth = Math.min(Math.max(e.clientX - position.x, minSize), parentRect.width - position.x + dialogRect.width - minVisiblePx);
590
- }
591
- if (resizeDirection.includes("n")) {
592
- const dy = e.clientY - position.y;
593
- newHeight = Math.max(size.height - dy, minSize);
594
- newY = Math.min(Math.max(position.y + dy, minVisiblePx - newHeight), position.y + size.height - minSize);
595
- }
596
- if (resizeDirection.includes("s")) {
597
- newHeight = Math.min(Math.max(e.clientY - position.y, minSize), parentRect.height - position.y + dialogRect.height - minVisiblePx);
663
+ // Only apply vertical resizing if autoHeight is false
664
+ if (!size.autoHeight) {
665
+ if (resizeDirection.includes("n")) {
666
+ const dy = e.clientY - position.y;
667
+ newHeight = Math.max(size.height - dy, minSize);
668
+ newY = Math.min(Math.max(position.y + dy, minVisiblePx - newHeight), position.y + size.height - minSize);
669
+ }
670
+ if (resizeDirection.includes("s")) {
671
+ newHeight = Math.min(Math.max(e.clientY - position.y, minSize), parentRect.height - position.y + dialogRect.height - minVisiblePx);
672
+ }
598
673
  }
599
674
  // Ensure the modal stays within bounds after resizing
600
675
  newX = Math.min(Math.max(newX, minVisiblePx - newWidth), parentRect.width - minVisiblePx);
601
676
  newY = Math.min(Math.max(newY, minVisiblePx - newHeight), parentRect.height - minVisiblePx);
677
+ // Update state maintaining original units
602
678
  setSize({
603
- ...size,
604
679
  width: newWidth,
605
- height: newHeight
680
+ height: newHeight,
681
+ widthUnit: size.widthUnit,
682
+ heightUnit: size.heightUnit,
683
+ autoHeight: size.autoHeight
606
684
  });
607
685
  setPosition({ x: newX, y: newY });
608
686
  }
@@ -620,41 +698,54 @@ const CwDialog = props => {
620
698
  document.removeEventListener("mouseup", handleMouseUp);
621
699
  };
622
700
  }, [isDragging, resizeDirection, dragStart, position, size]);
623
- const handleMouseDown = (e) => {
701
+ const handleMouseDown = useCallback((e) => {
624
702
  setIsDragging(true);
625
703
  setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });
626
- };
627
- const handleResizeMouseDown = (direction) => (e) => {
704
+ }, [position]);
705
+ const handleResizeMouseDown = useCallback((direction) => (e) => {
628
706
  e.stopPropagation();
629
707
  setResizeDirection(direction);
630
- };
631
- const header = (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: props.headline }), props.customHeader || (jsx("button", { className: styles$a["cw-dialog-button-close"], onClick: props.onClose, children: "\u2A2F" }))] }));
632
- const content = (jsx("section", { style: { flex: 1, overflowX: "auto", overflowY: "auto", width: "100%" }, children: props.children }));
633
- const footer = (jsx("footer", { style: { width: "100%" }, children: props.customFooter || (jsx("button", { className: "cw-button-icon cwi-save", onClick: props.onSave })) }));
634
- const resizeHandles = [
635
- jsx("div", { "data-handle-n": true, onMouseDown: handleResizeMouseDown("n") }, "handle-n"),
636
- jsx("div", { "data-handle-s": true, onMouseDown: handleResizeMouseDown("s") }, "handle-s"),
637
- jsx("div", { "data-handle-e": true, onMouseDown: handleResizeMouseDown("e") }, "handle-e"),
638
- jsx("div", { "data-handle-w": true, onMouseDown: handleResizeMouseDown("w") }, "handle-w"),
639
- jsx("div", { "data-handle-ne": true, onMouseDown: handleResizeMouseDown("ne") }, "handle-ne"),
640
- jsx("div", { "data-handle-nw": true, onMouseDown: handleResizeMouseDown("nw") }, "handle-nw"),
641
- jsx("div", { "data-handle-se": true, onMouseDown: handleResizeMouseDown("se") }, "handle-se"),
642
- jsx("div", { "data-handle-sw": true, onMouseDown: handleResizeMouseDown("sw") }, "handle-sw")
643
- ];
644
- // Prepare width and height with units for display
645
- const displayWidth = `${size.width}${size.widthUnit === 'px' ? 'px' : size.widthUnit}`;
646
- const displayHeight = `${size.height}${size.heightUnit === 'px' ? 'px' : size.heightUnit}`;
647
- return (props.open && (jsx("div", { "data-has-scrim": hasScrim, className: styles$a["cw-dialog-main"], children: jsxs("dialog", { ...props, ref: dialogRef, style: {
708
+ }, []);
709
+ const handleScrimClick = useCallback((e) => {
710
+ if (e.target === e.currentTarget && onClose) {
711
+ onClose();
712
+ }
713
+ }, [onClose]);
714
+ const header = useMemo(() => (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: headline }), customHeader || (jsx("button", { className: styles$a["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
715
+ const content = useMemo(() => (jsx("section", { children: children })), [children]);
716
+ const footer = useMemo(() => (jsx("footer", { children: customFooter || (jsx("button", { className: "cw-button-icon cwi-save", onClick: onSave })) })), [customFooter, onSave]);
717
+ const resizeHandles = useMemo(() => size.autoHeight
718
+ ? [
719
+ // Only horizontal handles if autoHeight is true
720
+ jsx("div", { "data-handle-e": true, onMouseDown: handleResizeMouseDown("e") }, "handle-e"),
721
+ jsx("div", { "data-handle-w": true, onMouseDown: handleResizeMouseDown("w") }, "handle-w")
722
+ ]
723
+ : [
724
+ // All handles if autoHeight is false
725
+ jsx("div", { "data-handle-n": true, onMouseDown: handleResizeMouseDown("n") }, "handle-n"),
726
+ jsx("div", { "data-handle-s": true, onMouseDown: handleResizeMouseDown("s") }, "handle-s"),
727
+ jsx("div", { "data-handle-e": true, onMouseDown: handleResizeMouseDown("e") }, "handle-e"),
728
+ jsx("div", { "data-handle-w": true, onMouseDown: handleResizeMouseDown("w") }, "handle-w"),
729
+ jsx("div", { "data-handle-ne": true, onMouseDown: handleResizeMouseDown("ne") }, "handle-ne"),
730
+ jsx("div", { "data-handle-nw": true, onMouseDown: handleResizeMouseDown("nw") }, "handle-nw"),
731
+ jsx("div", { "data-handle-se": true, onMouseDown: handleResizeMouseDown("se") }, "handle-se"),
732
+ jsx("div", { "data-handle-sw": true, onMouseDown: handleResizeMouseDown("sw") }, "handle-sw")
733
+ ], [size.autoHeight, handleResizeMouseDown]);
734
+ const displayDimensions = useMemo(() => {
735
+ // Prepare width and height with original units for display
736
+ const displayWidth = `${convertFromPx(size.width, size.widthUnit)}${size.widthUnit}`;
737
+ // If autoHeight, don't specify height and let it adapt to content
738
+ const displayHeight = size.autoHeight
739
+ ? 'auto'
740
+ : `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
741
+ return { displayWidth, displayHeight };
742
+ }, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
743
+ return (open && (jsx("div", { "data-has-scrim": hasScrim, className: styles$a["cw-dialog-main"], onClick: handleScrimClick, children: jsxs("dialog", { ...domProps, ref: dialogRef, style: {
648
744
  left: `${position.x}px`,
649
745
  top: `${position.y}px`,
650
- width: displayWidth,
651
- height: displayHeight,
652
- zIndex: props.zIndex,
653
- minWidth: "200px", // Set an appropriate minimum size
654
- minHeight: "200px", // Set an appropriate minimum size
655
- display: "flex",
656
- flexDirection: "column"
657
- }, children: [header, content, props.isReport !== true && footer, resizeHandles] }) })));
746
+ width: displayDimensions.displayWidth,
747
+ height: displayDimensions.displayHeight
748
+ }, children: [header, content, hideFooter !== true && footer, resizeHandles] }) })));
658
749
  };
659
750
 
660
751
  const CwModalReportFunctional = (props) => {
@@ -675,7 +766,9 @@ const CwModalReportFunctional = (props) => {
675
766
  return (jsxs("div", { children: ["Please add a(n) ", props.reportName, " report in ", props.moduleSettings, " Settings"] }));
676
767
  }
677
768
  };
678
- return (jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsx(CwDialog, { open: props.visible, dialogSize: { width: props.width, height: props.height }, headline: props.title, customFooter: [jsx("div", {}, "footer")], onClose: props.onCloseModal, isReport: true, children: renderContentModal() })) : (jsx("div", { children: renderContentNotModal() })) }));
769
+ return (jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsx(CwDialog, { open: props.visible, width: props.width, headline: props.title,
770
+ //customFooter={[<div key="footer"></div>]}
771
+ onClose: props.onCloseModal, hideFooter: true, children: renderContentModal() })) : (jsx("div", { children: renderContentNotModal() })) }));
679
772
  };
680
773
 
681
774
  class CwReportModal extends React.Component {
@@ -695,10 +788,10 @@ class CwReportModal extends React.Component {
695
788
  };
696
789
  }
697
790
  render() {
698
- return (jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxs(CwDialog, { open: this.props.visible, dialogSize: { width: this.props.width, height: this.props.height }, headline: this.props.title, customFooter: new Array(jsx("div", {})), onClose: () => {
791
+ return (jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxs(CwDialog, { open: this.props.visible, width: this.props.width, headline: this.props.title, customFooter: new Array(jsx("div", {})), onClose: () => {
699
792
  this.formRef?.current?.resetFields();
700
793
  this.props.SET_MODAL_REPORT_VISIBLE(false);
701
- }, isReport: true, children: [this.props.name !== "Empty.pdf" && (jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", style: { width: "100%", height: "100%", display: "block" } }) })), this.props.name === "Empty.pdf" && (jsx("div", { children: jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "600px" })), this.props.name === "Empty.pdf" && (jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
794
+ }, hideFooter: true, children: [this.props.name !== "Empty.pdf" && (jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", style: { width: "100%", height: "100%", display: "block" } }) })), this.props.name === "Empty.pdf" && (jsx("div", { children: jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "600px" })), this.props.name === "Empty.pdf" && (jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
702
795
  }
703
796
  }
704
797
 
@@ -820,161 +913,207 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
820
913
  }
821
914
 
822
915
  /**
823
- * A Table view
824
- * @param props
916
+ * A reusable and customizable table component.
917
+ *
918
+ * @param props - Component props to configure columns, data, styles, pagination, expanded rows, and more.
919
+ *
825
920
  * @example
826
921
  * const columns = [
827
922
  * {
828
923
  * title: 'Name',
829
924
  * dataIndex: 'name',
830
925
  * key: 'name',
926
+ * sortable: true, // Column is sortable
927
+ * width: 100 // You can define the width of the column
831
928
  * },
832
929
  * {
833
930
  * title: 'Age',
834
931
  * dataIndex: 'age',
835
932
  * key: 'age',
836
- * render: (age) => <span>{age} years</span>, // Example of custom rendering
933
+ * sortable: true,
934
+ * render: (item) => <span>{item.age} years</span> // Custom rendering
837
935
  * },
838
936
  * {
839
937
  * title: 'Address',
840
938
  * dataIndex: 'address',
841
939
  * key: 'address',
842
- * render: (address) => (
843
- * <a href={`https://maps.google.com/?q=${encodeURIComponent(address)}`} target="_blank">
844
- * {address}
940
+ * render: (item) => (
941
+ * <a href={`https://maps.google.com/?q=${encodeURIComponent(item.address)}`} target="_blank" rel="noreferrer">
942
+ * {item.address}
845
943
  * </a>
846
- * ), // Example of custom link rendering
847
- * },
944
+ * ) // Link rendering
945
+ * }
848
946
  * ];
849
947
  *
850
948
  * const data = [
851
- * {
852
- * key: '1',
853
- * name: 'Mike',
854
- * age: 32,
855
- * address: '10 Downing Street',
856
- * },
857
- * {
858
- * key: '2',
859
- * name: 'John',
860
- * age: 42,
861
- * address: '10 Downing Street',
862
- * },
863
- * {
864
- * key: '3',
865
- * name: 'Andres',
866
- * age: 33,
867
- * address: '10 Downing Street',
868
- * },
869
- * {
870
- * key: '4',
871
- * name: 'Gabriel',
872
- * age: 22,
873
- * address: '10 Downing Street',
874
- * },
875
- * {
876
- * key: '5',
877
- * name: 'Sergio',
878
- * age: 47,
879
- * address: '10 Downing Street',
880
- * },
881
- * {
882
- * key: '6',
883
- * name: 'Zacarias',
884
- * age: 61,
885
- * address: '10 Downing Street',
886
- * },
949
+ * { key: '1', name: 'Mike', age: 32, address: '10 Downing Street' },
950
+ * { key: '2', name: 'John', age: 42, address: '11 Downing Street' },
951
+ * { key: '3', name: 'Andres', age: 33, address: '12 Downing Street' },
952
+ * { key: '4', name: 'Gabriel', age: 22, address: '13 Downing Street' },
953
+ * { key: '5', name: 'Sergio', age: 47, address: '14 Downing Street' },
954
+ * { key: '6', name: 'Zacarias', age: 61, address: '15 Downing Street' }
887
955
  * ];
888
956
  *
889
- * const generateExpandedContent = (record) => {
890
- * var testValue = record;
891
- * return (
892
- * <div>
893
- * Contenido expandido personalizado para {record.name}
894
- * </div>
895
- * );
896
- * };
897
- *
898
- * ------------------------- render ---------------------------
957
+ * const generateExpandedContent = (record) => (
958
+ * <div>
959
+ * Custom expanded content for {record.name}
960
+ * </div>
961
+ * );
899
962
  *
900
963
  * <CwTable
901
964
  * columns={columns}
902
- * data={data} // WTF whatever array of objects you add here, make sure each has a key otherwise everything will expand
903
- * itemsPerPage={3}
965
+ * data={data}
904
966
  * pagination={true}
967
+ * pageSizeOptions={[3, 5, 10]} // Optional, defaults to [5, 10, 20, 50]
905
968
  * expandedRowRender={generateExpandedContent}
906
- * onExpand={(e)=> test(e)}
969
+ * onExpand={(item) => console.log('Expanded:', item)}
970
+ * rowKey="key" // Optional, defaults to 'key'
971
+ * textNoData="No data available" // Optional message when no data
972
+ * loading={false} // Optional, shows loading indicator
973
+ * scrollHeight={300} // Optional scroll height, defaults to 300
974
+ * stickyHeader={true} // Optional, makes header sticky on scroll
975
+ * classNameContainer="my-table-wrapper" // Optional wrapper class
976
+ * className="my-table" // Optional table class
977
+ * classNameRow="my-table-row" // Optional class for each row
978
+ * id="custom-table-id" // Optional ID for the container
979
+ * style={{ border: '1px solid #ccc' }} // Optional inline styles
907
980
  * />
981
+ *
908
982
  * @returns React component
909
983
  */
910
- function CwTable({ columns, data, pagination, itemsPerPage, expandedRowRender, onExpand, className, classNameHeader, classNameRow, style, classNameContainer, id, textNoData }) {
984
+ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, }) {
911
985
  const [currentPage, setCurrentPage] = useState(1);
912
986
  const [expandedRowKey, setExpandedRowKey] = useState(null);
913
987
  const [sortConfig, setSortConfig] = useState({
914
988
  key: null,
915
989
  direction: "asc"
916
990
  });
917
- // Function to handle expanding/collapsing rows
918
- const handleRowExpand = (rowKey) => {
919
- if (expandedRowKey === rowKey.key) {
920
- setExpandedRowKey(null);
921
- }
922
- else {
923
- setExpandedRowKey(rowKey.key);
924
- }
925
- if (typeof onExpand === "function") {
926
- onExpand(rowKey);
927
- }
928
- };
929
- // Function to handle sorting by column
930
- const handleSort = (columnKey) => {
931
- let direction = "asc";
932
- if (sortConfig.key === columnKey && sortConfig.direction === "asc") {
933
- direction = "desc";
934
- }
935
- setSortConfig({ key: columnKey, direction });
936
- };
937
- // Use useMemo to calculate sortedData
991
+ const [localItemsPerPage, setLocalItemsPerPage] = useState(pageSizeOptions[0]);
992
+ const [columnWidths, setColumnWidths] = useState(() => columns.reduce((acc, col) => {
993
+ if (col.width)
994
+ acc[col.key] = col.width;
995
+ return acc;
996
+ }, {}));
997
+ const handleItemsPerPageChange = useCallback((e) => {
998
+ setLocalItemsPerPage(parseInt(e.target.value, 10));
999
+ setCurrentPage(1);
1000
+ }, []);
1001
+ const handleRowExpand = useCallback((item) => {
1002
+ const itemKey = item[rowKey];
1003
+ setExpandedRowKey(prev => (prev === itemKey ? null : itemKey));
1004
+ onExpand?.(item);
1005
+ }, [rowKey, onExpand]);
1006
+ const handleSort = useCallback((columnKey) => {
1007
+ setSortConfig(prev => {
1008
+ if (prev.key !== columnKey)
1009
+ return { key: columnKey, direction: "asc" };
1010
+ if (prev.direction === "asc")
1011
+ return { key: columnKey, direction: "desc" };
1012
+ return { key: null, direction: "asc" };
1013
+ });
1014
+ }, []);
938
1015
  const sortedData = useMemo(() => {
939
1016
  if (!data || data.length === 0)
940
- return null;
1017
+ return [];
941
1018
  const dataCopy = [...data];
942
- if (sortConfig.key !== null) {
1019
+ if (sortConfig.key) {
943
1020
  dataCopy.sort((a, b) => {
944
- const aValue = a[sortConfig.key];
945
- const bValue = b[sortConfig.key];
946
- if (aValue < bValue) {
947
- return sortConfig.direction === "asc" ? -1 : 1;
948
- }
949
- if (aValue > bValue) {
950
- return sortConfig.direction === "asc" ? 1 : -1;
951
- }
952
- return 0;
1021
+ const aVal = a[sortConfig.key];
1022
+ const bVal = b[sortConfig.key];
1023
+ return (aVal < bVal ? -1 : aVal > bVal ? 1 : 0) * (sortConfig.direction === "asc" ? 1 : -1);
953
1024
  });
954
1025
  }
955
1026
  return dataCopy;
956
1027
  }, [data, sortConfig]);
957
- // Calculate paged data only if sortedData is not null
958
1028
  const paginatedData = useMemo(() => {
959
1029
  if (!sortedData)
960
- return null;
961
- const startIndex = itemsPerPage !== undefined ? (currentPage - 1) * itemsPerPage : 0;
962
- const endIndex = itemsPerPage !== undefined ? startIndex + itemsPerPage : sortedData.length;
963
- return sortedData.slice(startIndex, endIndex);
964
- }, [sortedData, currentPage, itemsPerPage]);
965
- // Calculate the total number of pages for pagination
1030
+ return [];
1031
+ if (!pagination)
1032
+ return sortedData;
1033
+ const start = (currentPage - 1) * localItemsPerPage;
1034
+ return sortedData.slice(start, start + localItemsPerPage);
1035
+ }, [sortedData, currentPage, localItemsPerPage, pagination]);
966
1036
  const totalPages = useMemo(() => {
967
- if (!sortedData)
968
- return 0;
969
- return itemsPerPage !== undefined ? Math.ceil(sortedData.length / itemsPerPage) : 1;
970
- }, [sortedData, itemsPerPage]);
971
- // Function to handle page change
972
- const handlePageChange = (newPage) => {
973
- if (newPage >= 1 && newPage <= totalPages) {
974
- setCurrentPage(newPage);
1037
+ return pagination ? Math.ceil(sortedData.length / localItemsPerPage) : 1;
1038
+ }, [sortedData, localItemsPerPage, pagination]);
1039
+ const handlePageChange = (page) => {
1040
+ if (page >= 1 && page <= totalPages)
1041
+ setCurrentPage(page);
1042
+ };
1043
+ const startResize = (e, key) => {
1044
+ e.preventDefault();
1045
+ const startX = e.clientX;
1046
+ const startWidth = e.target.parentElement?.offsetWidth || 0;
1047
+ const onMouseMove = (moveEvent) => {
1048
+ const newWidth = Math.max(startWidth + moveEvent.clientX - startX, 50); // mínimo 50px
1049
+ setColumnWidths(prev => ({ ...prev, [key]: newWidth }));
1050
+ };
1051
+ const onMouseUp = () => {
1052
+ window.removeEventListener("mousemove", onMouseMove);
1053
+ window.removeEventListener("mouseup", onMouseUp);
1054
+ };
1055
+ window.addEventListener("mousemove", onMouseMove);
1056
+ window.addEventListener("mouseup", onMouseUp);
1057
+ };
1058
+ const scrollContainerStyle = useMemo(() => {
1059
+ if (stickyHeader || scrollHeight) {
1060
+ return {
1061
+ maxHeight: scrollHeight ?? 300,
1062
+ overflowY: "auto"
1063
+ };
975
1064
  }
1065
+ return {}; // sin altura ni scroll
1066
+ }, [stickyHeader, scrollHeight]);
1067
+ const getColSpan = () => columns.length + (expandedRowRender ? 1 : 0);
1068
+ const renderTableBody = () => {
1069
+ if (loading) {
1070
+ return (jsx("tr", { children: jsx("td", { colSpan: getColSpan(), children: jsx("div", { className: "text-center py-4 text-muted-foreground", children: "Loading data..." }) }) }));
1071
+ }
1072
+ if (!paginatedData || paginatedData.length === 0) {
1073
+ return (jsx("tr", { children: jsx("td", { colSpan: getColSpan(), className: "cw-table-cell-empty", style: { textAlign: "center" }, children: textNoData }) }));
1074
+ }
1075
+ return paginatedData.map(item => {
1076
+ const itemKey = item[rowKey];
1077
+ if (!itemKey)
1078
+ console.warn("Missing row key for item", item);
1079
+ return (jsxs(React__default.Fragment, { children: [jsxs("tr", { className: classNameRow ?? "", children: [expandedRowRender && (jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey ? "cwi-chevron-down" : "cwi-chevron-right"}` }) })), columns.map(col => (jsx("td", { className: col.className ?? "", children: col.render ? col.render(item) : item[col.dataIndex] }, `${itemKey}_${col.key}`)))] }), expandedRowRender && expandedRowKey === itemKey && (jsx("tr", { className: "cw-table-row-expanded", children: jsx("td", { colSpan: getColSpan(), children: expandedRowRender(item) }) }))] }, itemKey));
1080
+ });
976
1081
  };
977
- return (jsxs("div", { id: id, className: `cw-table-container ${classNameContainer || ""}`, children: [jsxs("table", { className: `cw-table ${className || ""}`, style: style, children: [jsx("thead", { className: `${classNameHeader || ""}`, children: jsxs("tr", { children: [expandedRowRender && jsx("th", {}), columns.map(column => (jsx("th", { onClick: () => handleSort(column.dataIndex), className: `${column.className || ""} ${sortConfig.key === column.dataIndex ? sortConfig.direction : ""}`.trim(), children: column.title }, column.key)))] }) }), jsx("tbody", { children: !paginatedData || paginatedData.length === 0 ? (jsx("tr", { children: jsx("td", { colSpan: columns.length + (expandedRowRender ? 1 : 0), style: { textAlign: "center" }, className: "cw-table-cell-empty", children: textNoData !== undefined && textNoData !== "" ? textNoData : "No data available at the moment" }) })) : (paginatedData.map(item => (jsxs(React__default.Fragment, { children: [jsxs("tr", { className: `${classNameRow || ""}`, children: [expandedRowRender && (jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === item.key ? "cwi-chevron-down" : "cwi-chevron-right"}` }) })), columns.map(column => (jsx("td", { className: column.className || "", children: column.render ? column.render(item) : item[column.dataIndex] }, `${item.key}_${column.key}`)))] }), expandedRowKey === item.key && expandedRowRender && (jsx("tr", { className: "cw-table-row-expanded", children: jsx("td", { colSpan: columns.length + 1, children: expandedRowRender(item) }) }))] }, item.key)))) })] }), pagination && totalPages > 1 && (jsxs("footer", { className: "cw-table-pagination", children: [jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1, className: "cw-button-icon cwi-chevron-left" }), jsxs("span", { children: ["Page ", currentPage, " of ", totalPages] }), jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages, className: "cw-button-icon cwi-chevron-right" })] }))] }));
1082
+ return (jsxs("div", { id: id, className: `cw-table-container ${classNameContainer ?? ""}`, style: style, children: [jsx("div", { style: scrollContainerStyle, children: jsxs("table", { className: `cw-table ${className ?? ""}`, style: { width: "100%" }, children: [jsx("thead", { style: stickyHeader
1083
+ ? { position: "sticky", top: 0, background: "white", zIndex: 2 }
1084
+ : undefined, children: jsxs("tr", { children: [expandedRowRender && jsx("th", {}), columns.map(col => (jsxs("th", { onClick: () => col.sortable && handleSort(col.dataIndex), className: `${col.className ?? ""} ${sortConfig.key === col.dataIndex ? sortConfig.direction : ""}`.trim(), style: {
1085
+ cursor: col.sortable ? "pointer" : "default",
1086
+ userSelect: "none",
1087
+ width: columnWidths[col.key] ?? col.width,
1088
+ position: "relative",
1089
+ ...((col.width || columnWidths[col.key]) && {
1090
+ minWidth: 50,
1091
+ maxWidth: columnWidths[col.key] ?? col.width
1092
+ }),
1093
+ }, children: [jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { children: col.title }), col.sortable && (jsx("span", { style: { fontSize: "12px", marginLeft: "6px" }, children: sortConfig.key !== col.dataIndex ? "↕" : sortConfig.direction === "asc" ? "↑" : "↓" }))] }), jsx("div", { onMouseDown: (e) => startResize(e, col.key), style: {
1094
+ position: "absolute",
1095
+ right: 0,
1096
+ top: 7,
1097
+ bottom: 0,
1098
+ width: "2px",
1099
+ cursor: "col-resize",
1100
+ zIndex: 1,
1101
+ backgroundColor: "white",
1102
+ height: 20,
1103
+ } })] }, col.key)))] }) }), jsx("tbody", { children: renderTableBody() })] }) }), pagination && (jsxs("footer", { className: "cw-table-pagination", children: [jsx("button", { onClick: () => handlePageChange(1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left-double", title: "First" }), jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left", title: "Previous" }), totalPages > 1 && (jsxs("span", { children: [jsx("input", { type: "number", value: currentPage, onChange: (e) => {
1104
+ const value = parseInt(e.target.value, 10);
1105
+ if (!isNaN(value))
1106
+ handlePageChange(value);
1107
+ }, onBlur: (e) => {
1108
+ const value = parseInt(e.target.value, 10);
1109
+ if (isNaN(value) || value < 1 || value > totalPages) {
1110
+ handlePageChange(1);
1111
+ }
1112
+ }, min: 1, max: totalPages, style: {
1113
+ width: "4rem",
1114
+ textAlign: "center",
1115
+ marginRight: "0.5rem"
1116
+ } }), "of ", totalPages] })), jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsx("button", { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, style: { marginLeft: "1rem" }, children: pageSizeOptions.map(size => (jsxs("option", { value: size, children: [size, " / page"] }, size))) })] }))] }));
978
1117
  }
979
1118
 
980
1119
  var styles$8 = {"cw-tabs":"cw-tabs-module_cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module_cw-tabs-content__HTp8d"};
@@ -1020,7 +1159,7 @@ function CwTabs(CwTabsProps) {
1020
1159
  const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
1021
1160
  ? { minWidth: CwTabsProps.tabsListWidth }
1022
1161
  : undefined;
1023
- return (jsxs("div", { id: CwTabsProps.id, className: styles$8['cw-tabs'], "data-tabs-position": position, children: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsx("div", { className: styles$8['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
1162
+ return (jsxs("div", { id: CwTabsProps.id, className: styles$8['cw-tabs'], style: CwTabsProps.style, "data-tabs-position": position, children: [jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsx("div", { className: styles$8['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
1024
1163
  }
1025
1164
 
1026
1165
  /**
@@ -1047,6 +1186,25 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
1047
1186
  return (jsx("div", { className: "cw-expandable", children: jsxs("details", { ref: myRef, ...detailsProps, children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }) }));
1048
1187
  };
1049
1188
 
1189
+ /**
1190
+ * A component for displaying key-value pairs in a definition list format
1191
+ * Used for read-only display of structured data
1192
+ *
1193
+ * @example
1194
+ * <CwKeyValueList
1195
+ * items={[
1196
+ * { key: "length", label: "Length", value: "10", suffix: "m" },
1197
+ * { key: "width", label: "Width", value: null, suffix: "m" }
1198
+ * ]}
1199
+ * emptyValue="N/A"
1200
+ * />
1201
+ */
1202
+ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "row" }) => {
1203
+ return (jsx("dl", { className: `cw-keyvalue-list ${className}`, children: items.map(item => (jsxs("div", { className: `cw-keyvalue-list-item cw-flex-${direction}`, children: [jsx("dt", { children: item.label }), jsx("dd", { children: item.value !== undefined && item.value !== null && item.value !== ""
1204
+ ? `${item.value}${item.suffix ? ` ${item.suffix}` : ''}`
1205
+ : emptyValue })] }, item.key))) }));
1206
+ };
1207
+
1050
1208
  /**
1051
1209
  * A table with expandable row groups.
1052
1210
  * @param props The data to display
@@ -1170,11 +1328,9 @@ function CwInput(CwInputProps) {
1170
1328
  const handleClearClick = () => {
1171
1329
  CwInputProps.onChange("");
1172
1330
  };
1173
- return (jsxs("div", { className: CwInputProps.labelPosition === "inline"
1174
- ? "cwellt_flex cwellt_flex_row cwellt_align_items_center cw_inputContent"
1175
- : CwInputProps.labelPosition === "column"
1176
- ? "cwellt_flex cwellt_flex_column cwellt_align-items_baseline cw_inputContent"
1177
- : "cwellt_flex cwellt_flex_row cwellt_align_items_center cw_inputContent", children: [jsx("label", { className: CwInputProps.disabled === true
1331
+ return (jsxs("div", { className: CwInputProps.labelPosition === "column"
1332
+ ? "cw-flex-column"
1333
+ : "cw-flex-row ", children: [jsx("label", { className: CwInputProps.disabled === true
1178
1334
  ? CwInputProps.labelClassName + " " + "cw_label_text cw_label_text_disabled"
1179
1335
  : CwInputProps.labelClassName + " " + "cw_label_text", children: CwInputProps.labelName }), jsx("input", { id: CwInputProps.id, type: "text", value: CwInputProps.value, onChange: e => handleChange(e), className: CwInputProps.className + " " + "cw_input", placeholder: CwInputProps.placeholder === undefined ? "Write a text please" : CwInputProps.placeholder, style: CwInputProps.style, disabled: CwInputProps.disabled, required: CwInputProps.required }), CwInputProps.value && (
1180
1336
  // if the component is disabled do not show clear button
@@ -1264,11 +1420,9 @@ function CwInputNumber(CwInputNumberProps) {
1264
1420
  const handleChange = (e) => {
1265
1421
  CwInputNumberProps.onChange(e.target.value);
1266
1422
  };
1267
- return (jsxs("div", { className: CwInputNumberProps.labelPosition == "inline"
1268
- ? "cw-label-input"
1269
- : CwInputNumberProps.labelPosition == "column"
1270
- ? "cwellt_flex cwellt_flex_column cwellt_align-items_baseline cw-label-input"
1271
- : "cw-label-input", children: [jsx("label", { className: CwInputNumberProps.disabled === true
1423
+ return (jsxs("div", { className: CwInputNumberProps.labelPosition == "column"
1424
+ ? "cw-flex-column"
1425
+ : "cw-flex-row", children: [jsx("label", { className: CwInputNumberProps.disabled === true
1272
1426
  ? CwInputNumberProps.labelClassName + " " + "cw_label_text cw_label_text_disabled"
1273
1427
  : CwInputNumberProps.labelClassName + " " + "cw_label_text", children: CwInputNumberProps.labelName }), jsx("input", { id: CwInputNumberProps.id, type: "number", value: CwInputNumberProps.value, onChange: e => handleChange(e), className: CwInputNumberProps.className + " " + " cw-input-number", placeholder: CwInputNumberProps.placeholder == undefined ? "Write a number please" : CwInputNumberProps.placeholder, style: CwInputNumberProps.style, disabled: CwInputNumberProps.disabled, required: CwInputNumberProps.required, step: CwInputNumberProps.step, min: CwInputNumberProps.min, max: CwInputNumberProps.max })] }));
1274
1428
  }
@@ -2776,7 +2930,7 @@ function CwMultiselect(CwelltCustomFilterTabProps) {
2776
2930
  const luminance = 0.299 * redBgColor_custom_tag_selected_list +
2777
2931
  0.587 * greenBgColor_custom_tag_selected_list +
2778
2932
  0.114 * blueBgColor_custom_tag_selected_list;
2779
- return s.type !== undefined && s.type !== undefined ? (jsx("div", { id: "cwContent_tag", "data-id": s.type + "_" + s.id, className: "cwellt_flex cwellt_align_items_center", children: jsx(CwTag, { styleTag: {
2933
+ return s.type !== undefined ? (jsx("div", { id: "cwContent_tag", "data-id": s.type + "_" + s.id, className: "cwellt_flex cwellt_align_items_center", children: jsx(CwTag, { styleTag: {
2780
2934
  background: s.color
2781
2935
  }, styleTag_description: {
2782
2936
  background: s.color,
@@ -3400,10 +3554,6 @@ function CwBtnAddFolder({ cw_btnOnclick, cw_btn_disabled }) {
3400
3554
  function CwBtnEditFolder({ cw_btnOnclick, cw_btn_disabled }) {
3401
3555
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-edit", disabled: cw_btn_disabled });
3402
3556
  }
3403
- // PropertyFolder
3404
- function CwBtnSelectedFolder({ cw_btnOnclick, cw_btn_disabled }) {
3405
- return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-selected", disabled: cw_btn_disabled });
3406
- }
3407
3557
  // UploadFiles
3408
3558
  function CwBtnUploadFiles({ cw_btnOnclick, cw_btn_disabled }) {
3409
3559
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btn_uploadFiles", disabled: cw_btn_disabled });
@@ -3416,14 +3566,6 @@ function CwBtnGoBackFolder({ cw_btnOnclick, cw_btn_disabled }) {
3416
3566
  function CwBtnBookMark({ cw_btnOnclick, cw_btn_disabled }) {
3417
3567
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-star", disabled: cw_btn_disabled });
3418
3568
  }
3419
- // Archive
3420
- function CwBtnArchive({ cw_btnOnclick, cw_btn_disabled }) {
3421
- return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-archive", disabled: cw_btn_disabled });
3422
- }
3423
- // Archive
3424
- function CwBtnArchiveRestore({ cw_btnOnclick, cw_btn_disabled }) {
3425
- return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-archive-restore", disabled: cw_btn_disabled });
3426
- }
3427
3569
  // Publish
3428
3570
  function CwBtnPublish({ cw_btnOnclick, cw_btn_disabled }) {
3429
3571
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnPublish", disabled: cw_btn_disabled });
@@ -3432,10 +3574,6 @@ function CwBtnPublish({ cw_btnOnclick, cw_btn_disabled }) {
3432
3574
  function CwBtnApprove({ cw_btnOnclick, cw_btn_disabled }) {
3433
3575
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnApprove", disabled: cw_btn_disabled });
3434
3576
  }
3435
- // BookMarkLinkPag
3436
- function CwBtnBookMarkLinkPage({ cw_btnOnclick, cw_btn_disabled }) {
3437
- return (jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-favorite-files", disabled: cw_btn_disabled }));
3438
- }
3439
3577
  // Bulk duty
3440
3578
  function CwBtnBulkDuty({ cw_btnOnclick, cw_btn_disabled }) {
3441
3579
  return jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnBulkDuty", disabled: cw_btn_disabled });
@@ -6145,7 +6283,20 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
6145
6283
  }, children: value.icons }), jsx("span", { style: {
6146
6284
  padding: "0.1rem",
6147
6285
  color: textColor,
6148
- }, children: value.name })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: heightRem * 0.7, onStartEvent: () => {
6286
+ display: "flex",
6287
+ flex: 1,
6288
+ alignItems: "center",
6289
+ width: "100%",
6290
+ }, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsx("div", { style: {
6291
+ display: "flex",
6292
+ width: "100%",
6293
+ }, children: value.rectangleColors.map((item, i) => (jsx("div", { className: "cwellt_rectangle_indicator", style: {
6294
+ backgroundColor: item,
6295
+ flex: 1,
6296
+ height: "8px",
6297
+ margin: 0,
6298
+ padding: 0,
6299
+ } }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: heightRem * 0.7, onStartEvent: () => {
6149
6300
  onEvent(new OnRightDragStart(value.id));
6150
6301
  } }))] }), value.primaryTimeMarkerColor && (jsx("div", { className: styles$2["time-marker"], style: {
6151
6302
  backgroundColor: value.primaryTimeMarkerColor,
@@ -7156,4 +7307,4 @@ class CwFindAirport extends React.Component {
7156
7307
  }
7157
7308
  }
7158
7309
 
7159
- export { CblDragAndDrop, CwAccordionContainer, CwAlign, CwBtnAdd, CwBtnAddFolder, CwBtnAirport, CwBtnAlert, CwBtnApprove, CwBtnArchive, CwBtnArchiveRestore, CwBtnBookMark, CwBtnBookMarkLinkPage, CwBtnBulkDuty, CwBtnCancel, CwBtnCrewPlanning, CwBtnDelay, CwBtnDelete, CwBtnDownLoadAllInfo, CwBtnDownload, CwBtnDropDownMenu, CwBtnEdit, CwBtnEditFolder, CwBtnFiles, CwBtnGeneratePairing, CwBtnGoBackFolder, CwBtnHide, CwBtnImportRequests, CwBtnInfo, CwBtnMVT, CwBtnNavFirstItemView, CwBtnNavLastItemView, CwBtnNavNextDay, CwBtnNavPreviewItem, CwBtnPairing, CwBtnPrint, CwBtnPropertyFolder, CwBtnPublish, CwBtnRefresh, CwBtnReleasePeriod, CwBtnSave, CwBtnSearch, CwBtnSelect, CwBtnSelectedFolder, CwBtnShare, CwBtnStatistic, CwBtnUploadFiles, CwBtnVacations, CwBtnView, CwBtnWarning, CwButton, CwButtonDef, CwCheckbox, CwContextMenu, CwContextualMenu, CwDialog, CwDialogManager, CwDigit, CwDisplayMessage, CwDropdown, CwDropdownContainer, CwDropdownFilter, CwDropdownNavigation, CwExpandable, CwFileUpload, CwFindAirport, CwFloatingButton, CwGenericTooltip, CwHeadFilter, CwHeadingMain, CwHeadingSecond, CwIcon, CwImageArea, CwInput, CwInputDate, CwInputDatePicker, CwInputDateText, CwInputDatetime, CwInputImage, CwInputNumber, CwInputPhone, CwInputText, CwLabel, CwLoading, CwLoadingSmall, CwMessage, CwMessageManager, CwMessageType, CwModal, CwModalConfirm, CwModalHover, CwModalIframe, CwModalReportFunctional, CwMultiFilter, CwMultiFilterTag, CwMultiselect, CwOption, CwOptionList, CwReportModal, CwScheduler, CwScheduler2, CwSearchInput, CwSelect, CwSelectList, CwSelectListItems, CwSuperScheduler, CwTable, CwTableGrouped, CwTabs, CwTag, CwTextArea, CwTime, CwToggle, CwTooltip, CwWeekdaySelector, DefaultRowHeader, MultiSelect, OnClearPinned, OnClickContextMenu, OnClickEvent, OnClickRowEvent, OnClickRowHeader, OnClickUtc, OnDoubleClickEvent, OnDoubleClickRowEvent, OnDragEvent, OnDropCtrlEvent, OnDropEvent, OnEndClickHeaderEvent, OnLeftDragStart, OnMultiClickEvent, OnPinRow, OnRangeClickEvent, OnRightClickEvent, OnRightClickRow, OnRightDragStart, OnStartClickHeaderEvent, OnUnpinRow, PinRowHeader, Resource, Scheduler, SchedulerEvent, SuperScheduler, UiEvent, Weekdays, cblEvent, eventIsVisible, getDefaultDivisions, getEventSizes, itemsToMultiFilterTags, useCwMessage };
7310
+ export { CblDragAndDrop, CwAccordionContainer, CwAlign, CwBtnAdd, CwBtnAddFolder, CwBtnAirport, CwBtnAlert, CwBtnApprove, CwBtnBookMark, CwBtnBulkDuty, CwBtnCancel, CwBtnCrewPlanning, CwBtnDelay, CwBtnDelete, CwBtnDownLoadAllInfo, CwBtnDownload, CwBtnDropDownMenu, CwBtnEdit, CwBtnEditFolder, CwBtnFiles, CwBtnGeneratePairing, CwBtnGoBackFolder, CwBtnHide, CwBtnImportRequests, CwBtnInfo, CwBtnMVT, CwBtnNavFirstItemView, CwBtnNavLastItemView, CwBtnNavNextDay, CwBtnNavPreviewItem, CwBtnPairing, CwBtnPrint, CwBtnPropertyFolder, CwBtnPublish, CwBtnRefresh, CwBtnReleasePeriod, CwBtnSave, CwBtnSearch, CwBtnSelect, CwBtnShare, CwBtnStatistic, CwBtnUploadFiles, CwBtnVacations, CwBtnView, CwBtnWarning, CwButton, CwButtonDef, CwCheckbox, CwContextMenu, CwContextualMenu, CwDialog, CwDialogManager, CwDigit, CwDisplayMessage, CwDropdown, CwDropdownContainer, CwDropdownFilter, CwDropdownNavigation, CwExpandable, CwFileUpload, CwFindAirport, CwFloatingButton, CwGenericTooltip, CwHeadFilter, CwHeadingMain, CwHeadingSecond, CwIcon, CwImageArea, CwInput, CwInputDate, CwInputDatePicker, CwInputDateText, CwInputDatetime, CwInputImage, CwInputNumber, CwInputPhone, CwInputText, CwKeyValueList, CwLabel, CwLoading, CwLoadingSmall, CwMessage, CwMessageManager, CwMessageType, CwModal, CwModalConfirm, CwModalHover, CwModalIframe, CwModalReportFunctional, CwMultiFilter, CwMultiFilterTag, CwMultiselect, CwOption, CwOptionList, CwReportModal, CwScheduler, CwScheduler2, CwSearchInput, CwSelect, CwSelectList, CwSelectListItems, CwSuperScheduler, CwTable, CwTableGrouped, CwTabs, CwTag, CwTextArea, CwTime, CwToggle, CwTooltip, CwWeekdaySelector, DefaultRowHeader, MultiSelect, OnClearPinned, OnClickContextMenu, OnClickEvent, OnClickRowEvent, OnClickRowHeader, OnClickUtc, OnDoubleClickEvent, OnDoubleClickRowEvent, OnDragEvent, OnDropCtrlEvent, OnDropEvent, OnEndClickHeaderEvent, OnLeftDragStart, OnMultiClickEvent, OnPinRow, OnRangeClickEvent, OnRightClickEvent, OnRightClickRow, OnRightDragStart, OnStartClickHeaderEvent, OnUnpinRow, PinRowHeader, Resource, Scheduler, SchedulerEvent, SuperScheduler, UiEvent, Weekdays, cblEvent, eventIsVisible, getDefaultDivisions, getEventSizes, itemsToMultiFilterTags, useCwMessage };