@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.
- package/dist/content/icons/new-cw-icons/NewCwIcons.html +27 -26
- package/dist/content/icons/new-cw-icons/NewCwIcons.json +1 -1
- package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +2 -1
- package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
- package/dist/index.cjs.js +391 -243
- package/dist/index.css +2 -2
- package/dist/index.d.ts +147 -82
- package/dist/index.es.js +391 -240
- package/dist/src/components/control/action/buttons/CwButtons.d.ts +0 -4
- package/dist/src/components/control/action/buttons/CwButtons.d.ts.map +1 -1
- package/dist/src/components/control/input/any/CwInput.d.ts.map +1 -1
- package/dist/src/components/control/input/number/CwInputNumber.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +1 -0
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
- package/dist/src/components/display/data/table/CwTable.d.ts +47 -62
- package/dist/src/components/display/data/table/CwTable.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts +39 -9
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts +13 -1
- package/dist/src/components/display/graphics/loading-small/CwLoadingSmall.d.ts.map +1 -1
- package/dist/src/components/display/text/tag/CwTag.d.ts +2 -2
- package/dist/src/components/display/text/tag/CwTag.d.ts.map +1 -1
- package/dist/src/components/layout/dialog/CwDialog.d.ts +15 -4
- package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
- package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts +33 -0
- package/dist/src/components/layout/list/key-value/CwKeyValueList.d.ts.map +1 -0
- package/dist/src/components/layout/modal/legacy/cw_modal_report.d.ts.map +1 -1
- package/dist/src/components/layout/tabs/CwTabs.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -140,17 +140,17 @@ function CwTooltip(CwelltTooltipProps) {
|
|
|
140
140
|
function CwTag(tagProps) {
|
|
141
141
|
const hideTag = (event_clickTag) => {
|
|
142
142
|
const tag = event_clickTag.currentTarget.parentElement;
|
|
143
|
-
tag
|
|
143
|
+
tag?.classList.add("cwellt_display_none");
|
|
144
144
|
};
|
|
145
145
|
const onClickClosableCustomTag = (event_clickClosableT) => {
|
|
146
146
|
hideTag(event_clickClosableT);
|
|
147
|
-
if (
|
|
147
|
+
if (tagProps.onClickClosableTag != undefined) {
|
|
148
148
|
tagProps.onClickClosableTag(event_clickClosableT);
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const onClickCustomTag = (event_clickTag) => {
|
|
152
152
|
// click option interface
|
|
153
|
-
if (
|
|
153
|
+
if (tagProps.onClickTag !== undefined) {
|
|
154
154
|
tagProps.onClickTag(event_clickTag);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
@@ -242,27 +242,50 @@ function CwDisplayMessage(message, type, duration) {
|
|
|
242
242
|
CwMessageManager.getInstance().showMessage(message, type, duration);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
245
|
+
/**
|
|
246
|
+
* CwLoading
|
|
247
|
+
*
|
|
248
|
+
* A versatile loading component that shows a spinner with optional text
|
|
249
|
+
* and disables the wrapped content while in loading state.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* // Basic usage
|
|
253
|
+
* <CwLoading isLoading={isSubmitting}>
|
|
254
|
+
* <form>...</form>
|
|
255
|
+
* </CwLoading>
|
|
256
|
+
*
|
|
257
|
+
* // With custom text and size
|
|
258
|
+
* <CwLoading
|
|
259
|
+
* isLoading={isLoading}
|
|
260
|
+
* text="Please wait..."
|
|
261
|
+
* size="large"
|
|
262
|
+
* >
|
|
263
|
+
* <UserProfile />
|
|
264
|
+
* </CwLoading>
|
|
265
|
+
*/
|
|
266
|
+
function CwLoading({ isLoading = false, text = '', size = 'regular', iconPosition = 'outside', iconName = 'cwi-plane-solid', animation = 'spin', children }) {
|
|
267
|
+
const iconClasses = `cwi-icons ${iconName || ''}`;
|
|
268
|
+
return (jsxRuntime.jsxs("div", { "aria-busy": isLoading, className: isLoading ? 'cw-loading-container' : '', children: [isLoading && (jsxRuntime.jsxs("div", { className: "cw-loading-content", "data-size": size, "data-animation": animation, children: [jsxRuntime.jsx("div", { className: "cw-loading", "data-icon-position": iconPosition, children: jsxRuntime.jsx("span", { className: iconClasses }) }), text && (jsxRuntime.jsx("p", { children: text }))] })), jsxRuntime.jsx("div", { className: isLoading ? 'cw-loading-disabled-content' : '', children: children })] }));
|
|
258
269
|
}
|
|
259
270
|
|
|
271
|
+
/**
|
|
272
|
+
* @deprecated since may 2025. Use <CwLoading size="small"> instead.
|
|
273
|
+
*
|
|
274
|
+
* This component will be removed in a future release.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* // Instead of:
|
|
278
|
+
* <CwLoadingSmall />
|
|
279
|
+
*
|
|
280
|
+
* // Use:
|
|
281
|
+
* <CwLoading size="small" />
|
|
282
|
+
*/
|
|
260
283
|
function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
261
|
-
return (jsxRuntime.jsx("div", { children: CwelltLoadingAppointements.
|
|
284
|
+
return (jsxRuntime.jsx("div", { children: CwelltLoadingAppointements.isLoading === true ? (
|
|
262
285
|
// * Show loading appointment
|
|
263
|
-
jsxRuntime.jsx("div", { className: "
|
|
286
|
+
jsxRuntime.jsx("div", { className: "cw-loading-container", children: jsxRuntime.jsx("div", { className: "cw-loading" }) })) : (
|
|
264
287
|
// Show empty div
|
|
265
|
-
jsxRuntime.jsx("div", {
|
|
288
|
+
jsxRuntime.jsx("div", {})) }));
|
|
266
289
|
}
|
|
267
290
|
|
|
268
291
|
var styles$b = {"cw-generic-tooltip-content":"cw-generic-tooltip-module_cw-generic-tooltip-content__la-Si"};
|
|
@@ -522,55 +545,100 @@ const parseSize = (size) => {
|
|
|
522
545
|
if (typeof size === 'number')
|
|
523
546
|
return { value: size, unit: 'px' };
|
|
524
547
|
// Match numeric value and unit
|
|
525
|
-
const match = size.match(/^([\d.]+)(\D+)$/);
|
|
548
|
+
const match = String(size).match(/^([\d.]+)(\D+)$/);
|
|
526
549
|
if (match) {
|
|
527
|
-
|
|
550
|
+
const unit = match[2];
|
|
551
|
+
// Only allow px, rem, vw, vh
|
|
552
|
+
if (['px', 'rem', 'vw', 'vh'].includes(unit)) {
|
|
553
|
+
return { value: parseFloat(match[1]), unit };
|
|
554
|
+
}
|
|
528
555
|
}
|
|
529
|
-
// Default to pixels if no unit specified
|
|
530
|
-
return { value: parseFloat(size), unit: 'px' };
|
|
556
|
+
// Default to pixels if no unit specified or unit not supported
|
|
557
|
+
return { value: parseFloat(String(size)), unit: 'px' };
|
|
531
558
|
};
|
|
532
559
|
// Helper to convert size to px for calculations
|
|
533
560
|
const convertToPx = (size) => {
|
|
534
|
-
|
|
535
|
-
return size.value;
|
|
536
|
-
|
|
537
|
-
return size.value
|
|
538
|
-
|
|
539
|
-
return
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
561
|
+
switch (size.unit) {
|
|
562
|
+
case 'px': return size.value;
|
|
563
|
+
case 'rem': return size.value * 16; // Assuming 1rem = 16px
|
|
564
|
+
case 'vh': return (window.innerHeight * size.value) / 100;
|
|
565
|
+
case 'vw': return (window.innerWidth * size.value) / 100;
|
|
566
|
+
default: return size.value; // Default fallback
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
// Function to convert from px back to original unit
|
|
570
|
+
const convertFromPx = (px, unit) => {
|
|
571
|
+
switch (unit) {
|
|
572
|
+
case 'px': return px;
|
|
573
|
+
case 'rem': return px / 16;
|
|
574
|
+
case 'vh': return (px * 100) / window.innerHeight;
|
|
575
|
+
case 'vw': return (px * 100) / window.innerWidth;
|
|
576
|
+
default: return px;
|
|
577
|
+
}
|
|
543
578
|
};
|
|
544
579
|
const CwDialog = props => {
|
|
580
|
+
const { customFooter, customHeader, headline, width, height, dialogSize, scrim, onSave, onClose, hideFooter, children, open, ...domProps } = props;
|
|
545
581
|
const dialogRef = React.useRef(null);
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
height
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
582
|
+
const initialSetup = React.useMemo(() => {
|
|
583
|
+
// Default width and height with units
|
|
584
|
+
const defaultWidth = 800;
|
|
585
|
+
// Priority: direct props > dialogSize > default values
|
|
586
|
+
const initialWidth = width !== undefined
|
|
587
|
+
? width
|
|
588
|
+
: dialogSize?.width !== undefined
|
|
589
|
+
? dialogSize.width
|
|
590
|
+
: defaultWidth;
|
|
591
|
+
const initialHeight = height !== undefined
|
|
592
|
+
? height
|
|
593
|
+
: dialogSize?.height !== undefined
|
|
594
|
+
? dialogSize.height
|
|
595
|
+
: undefined; // Undefined for autoHeight
|
|
596
|
+
// Determine if height is automatic when height is not provided
|
|
597
|
+
const isAutoHeight = initialHeight === undefined;
|
|
598
|
+
// Parse the sizes to separate value and unit
|
|
599
|
+
const parsedWidth = parseSize(initialWidth);
|
|
600
|
+
const parsedHeight = isAutoHeight
|
|
601
|
+
? { value: 0, unit: 'auto' }
|
|
602
|
+
: parseSize(initialHeight);
|
|
603
|
+
// Convert to px for internal calculations
|
|
604
|
+
const initialWidthPx = convertToPx(parsedWidth);
|
|
605
|
+
const initialHeightPx = isAutoHeight ? 0 : convertToPx(parsedHeight);
|
|
606
|
+
// Use estimated height for initial positioning when autoHeight is true
|
|
607
|
+
const initialEstimatedHeight = isAutoHeight ? 300 : initialHeightPx;
|
|
608
|
+
const initialDialogSize = {
|
|
609
|
+
width: initialWidthPx,
|
|
610
|
+
height: initialHeightPx,
|
|
611
|
+
widthUnit: parsedWidth.unit,
|
|
612
|
+
heightUnit: parsedHeight.unit,
|
|
613
|
+
autoHeight: isAutoHeight
|
|
614
|
+
};
|
|
615
|
+
const initialPosition = {
|
|
616
|
+
x: window.document.body.clientWidth / 2 - initialWidthPx / 2,
|
|
617
|
+
y: window.document.body.clientHeight / 2 - initialEstimatedHeight / 2
|
|
618
|
+
};
|
|
619
|
+
return { initialDialogSize, initialPosition };
|
|
620
|
+
}, [width, height, dialogSize]); // Only recalculate when these props change
|
|
564
621
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
565
622
|
const [resizeDirection, setResizeDirection] = React.useState(null);
|
|
566
|
-
const [position, setPosition] = React.useState(
|
|
567
|
-
|
|
568
|
-
y: window.document.body.clientHeight / 2 - initialDialogSize.height / 2
|
|
569
|
-
});
|
|
570
|
-
const [size, setSize] = React.useState(initialDialogSize);
|
|
623
|
+
const [position, setPosition] = React.useState(initialSetup.initialPosition);
|
|
624
|
+
const [size, setSize] = React.useState(initialSetup.initialDialogSize);
|
|
571
625
|
const [dragStart, setDragStart] = React.useState({ x: 0, y: 0 });
|
|
572
626
|
// scrim is true by default
|
|
573
|
-
const hasScrim =
|
|
627
|
+
const hasScrim = scrim !== false;
|
|
628
|
+
// Adjust position after the dialog is rendered when using autoHeight
|
|
629
|
+
React.useEffect(() => {
|
|
630
|
+
if (size.autoHeight && dialogRef.current && open) {
|
|
631
|
+
// Get the actual height after rendering
|
|
632
|
+
const actualHeight = dialogRef.current.offsetHeight;
|
|
633
|
+
// Only update position if height is available
|
|
634
|
+
if (actualHeight > 0) {
|
|
635
|
+
setPosition(prevPos => ({
|
|
636
|
+
...prevPos,
|
|
637
|
+
y: window.document.body.clientHeight / 2 - actualHeight / 2
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}, [size.autoHeight, open]);
|
|
574
642
|
React.useEffect(() => {
|
|
575
643
|
const handleMouseMove = (e) => {
|
|
576
644
|
if (isDragging) {
|
|
@@ -600,29 +668,39 @@ const CwDialog = props => {
|
|
|
600
668
|
let newY = position.y;
|
|
601
669
|
const minVisiblePx = 64;
|
|
602
670
|
const minSize = 100;
|
|
603
|
-
if
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
671
|
+
// Only allow horizontal resizing if autoHeight is true
|
|
672
|
+
if (!size.autoHeight || (!resizeDirection.includes("n") && !resizeDirection.includes("s"))) {
|
|
673
|
+
// Logic for horizontal resizing
|
|
674
|
+
if (resizeDirection.includes("w")) {
|
|
675
|
+
const dx = e.clientX - position.x;
|
|
676
|
+
newWidth = Math.max(size.width - dx, minSize);
|
|
677
|
+
newX = Math.min(Math.max(position.x + dx, minVisiblePx - newWidth), position.x + size.width - minSize);
|
|
678
|
+
}
|
|
679
|
+
if (resizeDirection.includes("e")) {
|
|
680
|
+
newWidth = Math.min(Math.max(e.clientX - position.x, minSize), parentRect.width - position.x + dialogRect.width - minVisiblePx);
|
|
681
|
+
}
|
|
607
682
|
}
|
|
608
|
-
if
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
683
|
+
// Only apply vertical resizing if autoHeight is false
|
|
684
|
+
if (!size.autoHeight) {
|
|
685
|
+
if (resizeDirection.includes("n")) {
|
|
686
|
+
const dy = e.clientY - position.y;
|
|
687
|
+
newHeight = Math.max(size.height - dy, minSize);
|
|
688
|
+
newY = Math.min(Math.max(position.y + dy, minVisiblePx - newHeight), position.y + size.height - minSize);
|
|
689
|
+
}
|
|
690
|
+
if (resizeDirection.includes("s")) {
|
|
691
|
+
newHeight = Math.min(Math.max(e.clientY - position.y, minSize), parentRect.height - position.y + dialogRect.height - minVisiblePx);
|
|
692
|
+
}
|
|
618
693
|
}
|
|
619
694
|
// Ensure the modal stays within bounds after resizing
|
|
620
695
|
newX = Math.min(Math.max(newX, minVisiblePx - newWidth), parentRect.width - minVisiblePx);
|
|
621
696
|
newY = Math.min(Math.max(newY, minVisiblePx - newHeight), parentRect.height - minVisiblePx);
|
|
697
|
+
// Update state maintaining original units
|
|
622
698
|
setSize({
|
|
623
|
-
...size,
|
|
624
699
|
width: newWidth,
|
|
625
|
-
height: newHeight
|
|
700
|
+
height: newHeight,
|
|
701
|
+
widthUnit: size.widthUnit,
|
|
702
|
+
heightUnit: size.heightUnit,
|
|
703
|
+
autoHeight: size.autoHeight
|
|
626
704
|
});
|
|
627
705
|
setPosition({ x: newX, y: newY });
|
|
628
706
|
}
|
|
@@ -640,41 +718,54 @@ const CwDialog = props => {
|
|
|
640
718
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
641
719
|
};
|
|
642
720
|
}, [isDragging, resizeDirection, dragStart, position, size]);
|
|
643
|
-
const handleMouseDown = (e) => {
|
|
721
|
+
const handleMouseDown = React.useCallback((e) => {
|
|
644
722
|
setIsDragging(true);
|
|
645
723
|
setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });
|
|
646
|
-
};
|
|
647
|
-
const handleResizeMouseDown = (direction) => (e) => {
|
|
724
|
+
}, [position]);
|
|
725
|
+
const handleResizeMouseDown = React.useCallback((direction) => (e) => {
|
|
648
726
|
e.stopPropagation();
|
|
649
727
|
setResizeDirection(direction);
|
|
650
|
-
};
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
728
|
+
}, []);
|
|
729
|
+
const handleScrimClick = React.useCallback((e) => {
|
|
730
|
+
if (e.target === e.currentTarget && onClose) {
|
|
731
|
+
onClose();
|
|
732
|
+
}
|
|
733
|
+
}, [onClose]);
|
|
734
|
+
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$a["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
735
|
+
const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
|
|
736
|
+
const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx("button", { className: "cw-button-icon cwi-save", onClick: onSave })) })), [customFooter, onSave]);
|
|
737
|
+
const resizeHandles = React.useMemo(() => size.autoHeight
|
|
738
|
+
? [
|
|
739
|
+
// Only horizontal handles if autoHeight is true
|
|
740
|
+
jsxRuntime.jsx("div", { "data-handle-e": true, onMouseDown: handleResizeMouseDown("e") }, "handle-e"),
|
|
741
|
+
jsxRuntime.jsx("div", { "data-handle-w": true, onMouseDown: handleResizeMouseDown("w") }, "handle-w")
|
|
742
|
+
]
|
|
743
|
+
: [
|
|
744
|
+
// All handles if autoHeight is false
|
|
745
|
+
jsxRuntime.jsx("div", { "data-handle-n": true, onMouseDown: handleResizeMouseDown("n") }, "handle-n"),
|
|
746
|
+
jsxRuntime.jsx("div", { "data-handle-s": true, onMouseDown: handleResizeMouseDown("s") }, "handle-s"),
|
|
747
|
+
jsxRuntime.jsx("div", { "data-handle-e": true, onMouseDown: handleResizeMouseDown("e") }, "handle-e"),
|
|
748
|
+
jsxRuntime.jsx("div", { "data-handle-w": true, onMouseDown: handleResizeMouseDown("w") }, "handle-w"),
|
|
749
|
+
jsxRuntime.jsx("div", { "data-handle-ne": true, onMouseDown: handleResizeMouseDown("ne") }, "handle-ne"),
|
|
750
|
+
jsxRuntime.jsx("div", { "data-handle-nw": true, onMouseDown: handleResizeMouseDown("nw") }, "handle-nw"),
|
|
751
|
+
jsxRuntime.jsx("div", { "data-handle-se": true, onMouseDown: handleResizeMouseDown("se") }, "handle-se"),
|
|
752
|
+
jsxRuntime.jsx("div", { "data-handle-sw": true, onMouseDown: handleResizeMouseDown("sw") }, "handle-sw")
|
|
753
|
+
], [size.autoHeight, handleResizeMouseDown]);
|
|
754
|
+
const displayDimensions = React.useMemo(() => {
|
|
755
|
+
// Prepare width and height with original units for display
|
|
756
|
+
const displayWidth = `${convertFromPx(size.width, size.widthUnit)}${size.widthUnit}`;
|
|
757
|
+
// If autoHeight, don't specify height and let it adapt to content
|
|
758
|
+
const displayHeight = size.autoHeight
|
|
759
|
+
? 'auto'
|
|
760
|
+
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
761
|
+
return { displayWidth, displayHeight };
|
|
762
|
+
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
763
|
+
return (open && (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$a["cw-dialog-main"], onClick: handleScrimClick, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
668
764
|
left: `${position.x}px`,
|
|
669
765
|
top: `${position.y}px`,
|
|
670
|
-
width: displayWidth,
|
|
671
|
-
height: displayHeight
|
|
672
|
-
|
|
673
|
-
minWidth: "200px", // Set an appropriate minimum size
|
|
674
|
-
minHeight: "200px", // Set an appropriate minimum size
|
|
675
|
-
display: "flex",
|
|
676
|
-
flexDirection: "column"
|
|
677
|
-
}, children: [header, content, props.isReport !== true && footer, resizeHandles] }) })));
|
|
766
|
+
width: displayDimensions.displayWidth,
|
|
767
|
+
height: displayDimensions.displayHeight
|
|
768
|
+
}, children: [header, content, hideFooter !== true && footer, resizeHandles] }) })));
|
|
678
769
|
};
|
|
679
770
|
|
|
680
771
|
const CwModalReportFunctional = (props) => {
|
|
@@ -695,7 +786,9 @@ const CwModalReportFunctional = (props) => {
|
|
|
695
786
|
return (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", props.reportName, " report in ", props.moduleSettings, " Settings"] }));
|
|
696
787
|
}
|
|
697
788
|
};
|
|
698
|
-
return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsxRuntime.jsx(CwDialog, { open: props.visible,
|
|
789
|
+
return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsxRuntime.jsx(CwDialog, { open: props.visible, width: props.width, headline: props.title,
|
|
790
|
+
//customFooter={[<div key="footer"></div>]}
|
|
791
|
+
onClose: props.onCloseModal, hideFooter: true, children: renderContentModal() })) : (jsxRuntime.jsx("div", { children: renderContentNotModal() })) }));
|
|
699
792
|
};
|
|
700
793
|
|
|
701
794
|
class CwReportModal extends React__namespace.Component {
|
|
@@ -715,10 +808,10 @@ class CwReportModal extends React__namespace.Component {
|
|
|
715
808
|
};
|
|
716
809
|
}
|
|
717
810
|
render() {
|
|
718
|
-
return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxRuntime.jsxs(CwDialog, { open: this.props.visible,
|
|
811
|
+
return (jsxRuntime.jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxRuntime.jsxs(CwDialog, { open: this.props.visible, width: this.props.width, headline: this.props.title, customFooter: new Array(jsxRuntime.jsx("div", {})), onClose: () => {
|
|
719
812
|
this.formRef?.current?.resetFields();
|
|
720
813
|
this.props.SET_MODAL_REPORT_VISIBLE(false);
|
|
721
|
-
},
|
|
814
|
+
}, hideFooter: true, children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsxRuntime.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" && (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxRuntime.jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "600px" })), this.props.name === "Empty.pdf" && (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
|
|
722
815
|
}
|
|
723
816
|
}
|
|
724
817
|
|
|
@@ -840,161 +933,207 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
840
933
|
}
|
|
841
934
|
|
|
842
935
|
/**
|
|
843
|
-
* A
|
|
844
|
-
*
|
|
936
|
+
* A reusable and customizable table component.
|
|
937
|
+
*
|
|
938
|
+
* @param props - Component props to configure columns, data, styles, pagination, expanded rows, and more.
|
|
939
|
+
*
|
|
845
940
|
* @example
|
|
846
941
|
* const columns = [
|
|
847
942
|
* {
|
|
848
943
|
* title: 'Name',
|
|
849
944
|
* dataIndex: 'name',
|
|
850
945
|
* key: 'name',
|
|
946
|
+
* sortable: true, // Column is sortable
|
|
947
|
+
* width: 100 // You can define the width of the column
|
|
851
948
|
* },
|
|
852
949
|
* {
|
|
853
950
|
* title: 'Age',
|
|
854
951
|
* dataIndex: 'age',
|
|
855
952
|
* key: 'age',
|
|
856
|
-
*
|
|
953
|
+
* sortable: true,
|
|
954
|
+
* render: (item) => <span>{item.age} years</span> // Custom rendering
|
|
857
955
|
* },
|
|
858
956
|
* {
|
|
859
957
|
* title: 'Address',
|
|
860
958
|
* dataIndex: 'address',
|
|
861
959
|
* key: 'address',
|
|
862
|
-
* render: (
|
|
863
|
-
* <a href={`https://maps.google.com/?q=${encodeURIComponent(address)}`} target="_blank">
|
|
864
|
-
* {address}
|
|
960
|
+
* render: (item) => (
|
|
961
|
+
* <a href={`https://maps.google.com/?q=${encodeURIComponent(item.address)}`} target="_blank" rel="noreferrer">
|
|
962
|
+
* {item.address}
|
|
865
963
|
* </a>
|
|
866
|
-
* )
|
|
867
|
-
* }
|
|
964
|
+
* ) // Link rendering
|
|
965
|
+
* }
|
|
868
966
|
* ];
|
|
869
967
|
*
|
|
870
968
|
* const data = [
|
|
871
|
-
* {
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
876
|
-
* }
|
|
877
|
-
* {
|
|
878
|
-
* key: '2',
|
|
879
|
-
* name: 'John',
|
|
880
|
-
* age: 42,
|
|
881
|
-
* address: '10 Downing Street',
|
|
882
|
-
* },
|
|
883
|
-
* {
|
|
884
|
-
* key: '3',
|
|
885
|
-
* name: 'Andres',
|
|
886
|
-
* age: 33,
|
|
887
|
-
* address: '10 Downing Street',
|
|
888
|
-
* },
|
|
889
|
-
* {
|
|
890
|
-
* key: '4',
|
|
891
|
-
* name: 'Gabriel',
|
|
892
|
-
* age: 22,
|
|
893
|
-
* address: '10 Downing Street',
|
|
894
|
-
* },
|
|
895
|
-
* {
|
|
896
|
-
* key: '5',
|
|
897
|
-
* name: 'Sergio',
|
|
898
|
-
* age: 47,
|
|
899
|
-
* address: '10 Downing Street',
|
|
900
|
-
* },
|
|
901
|
-
* {
|
|
902
|
-
* key: '6',
|
|
903
|
-
* name: 'Zacarias',
|
|
904
|
-
* age: 61,
|
|
905
|
-
* address: '10 Downing Street',
|
|
906
|
-
* },
|
|
969
|
+
* { key: '1', name: 'Mike', age: 32, address: '10 Downing Street' },
|
|
970
|
+
* { key: '2', name: 'John', age: 42, address: '11 Downing Street' },
|
|
971
|
+
* { key: '3', name: 'Andres', age: 33, address: '12 Downing Street' },
|
|
972
|
+
* { key: '4', name: 'Gabriel', age: 22, address: '13 Downing Street' },
|
|
973
|
+
* { key: '5', name: 'Sergio', age: 47, address: '14 Downing Street' },
|
|
974
|
+
* { key: '6', name: 'Zacarias', age: 61, address: '15 Downing Street' }
|
|
907
975
|
* ];
|
|
908
976
|
*
|
|
909
|
-
* const generateExpandedContent = (record) =>
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
* </div>
|
|
915
|
-
* );
|
|
916
|
-
* };
|
|
917
|
-
*
|
|
918
|
-
* ------------------------- render ---------------------------
|
|
977
|
+
* const generateExpandedContent = (record) => (
|
|
978
|
+
* <div>
|
|
979
|
+
* Custom expanded content for {record.name}
|
|
980
|
+
* </div>
|
|
981
|
+
* );
|
|
919
982
|
*
|
|
920
983
|
* <CwTable
|
|
921
984
|
* columns={columns}
|
|
922
|
-
* data={data}
|
|
923
|
-
* itemsPerPage={3}
|
|
985
|
+
* data={data}
|
|
924
986
|
* pagination={true}
|
|
987
|
+
* pageSizeOptions={[3, 5, 10]} // Optional, defaults to [5, 10, 20, 50]
|
|
925
988
|
* expandedRowRender={generateExpandedContent}
|
|
926
|
-
* onExpand={(
|
|
989
|
+
* onExpand={(item) => console.log('Expanded:', item)}
|
|
990
|
+
* rowKey="key" // Optional, defaults to 'key'
|
|
991
|
+
* textNoData="No data available" // Optional message when no data
|
|
992
|
+
* loading={false} // Optional, shows loading indicator
|
|
993
|
+
* scrollHeight={300} // Optional scroll height, defaults to 300
|
|
994
|
+
* stickyHeader={true} // Optional, makes header sticky on scroll
|
|
995
|
+
* classNameContainer="my-table-wrapper" // Optional wrapper class
|
|
996
|
+
* className="my-table" // Optional table class
|
|
997
|
+
* classNameRow="my-table-row" // Optional class for each row
|
|
998
|
+
* id="custom-table-id" // Optional ID for the container
|
|
999
|
+
* style={{ border: '1px solid #ccc' }} // Optional inline styles
|
|
927
1000
|
* />
|
|
1001
|
+
*
|
|
928
1002
|
* @returns React component
|
|
929
1003
|
*/
|
|
930
|
-
function CwTable({ columns, data, pagination,
|
|
1004
|
+
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, }) {
|
|
931
1005
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
932
1006
|
const [expandedRowKey, setExpandedRowKey] = React.useState(null);
|
|
933
1007
|
const [sortConfig, setSortConfig] = React.useState({
|
|
934
1008
|
key: null,
|
|
935
1009
|
direction: "asc"
|
|
936
1010
|
});
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
if (
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1011
|
+
const [localItemsPerPage, setLocalItemsPerPage] = React.useState(pageSizeOptions[0]);
|
|
1012
|
+
const [columnWidths, setColumnWidths] = React.useState(() => columns.reduce((acc, col) => {
|
|
1013
|
+
if (col.width)
|
|
1014
|
+
acc[col.key] = col.width;
|
|
1015
|
+
return acc;
|
|
1016
|
+
}, {}));
|
|
1017
|
+
const handleItemsPerPageChange = React.useCallback((e) => {
|
|
1018
|
+
setLocalItemsPerPage(parseInt(e.target.value, 10));
|
|
1019
|
+
setCurrentPage(1);
|
|
1020
|
+
}, []);
|
|
1021
|
+
const handleRowExpand = React.useCallback((item) => {
|
|
1022
|
+
const itemKey = item[rowKey];
|
|
1023
|
+
setExpandedRowKey(prev => (prev === itemKey ? null : itemKey));
|
|
1024
|
+
onExpand?.(item);
|
|
1025
|
+
}, [rowKey, onExpand]);
|
|
1026
|
+
const handleSort = React.useCallback((columnKey) => {
|
|
1027
|
+
setSortConfig(prev => {
|
|
1028
|
+
if (prev.key !== columnKey)
|
|
1029
|
+
return { key: columnKey, direction: "asc" };
|
|
1030
|
+
if (prev.direction === "asc")
|
|
1031
|
+
return { key: columnKey, direction: "desc" };
|
|
1032
|
+
return { key: null, direction: "asc" };
|
|
1033
|
+
});
|
|
1034
|
+
}, []);
|
|
958
1035
|
const sortedData = React.useMemo(() => {
|
|
959
1036
|
if (!data || data.length === 0)
|
|
960
|
-
return
|
|
1037
|
+
return [];
|
|
961
1038
|
const dataCopy = [...data];
|
|
962
|
-
if (sortConfig.key
|
|
1039
|
+
if (sortConfig.key) {
|
|
963
1040
|
dataCopy.sort((a, b) => {
|
|
964
|
-
const
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
return sortConfig.direction === "asc" ? -1 : 1;
|
|
968
|
-
}
|
|
969
|
-
if (aValue > bValue) {
|
|
970
|
-
return sortConfig.direction === "asc" ? 1 : -1;
|
|
971
|
-
}
|
|
972
|
-
return 0;
|
|
1041
|
+
const aVal = a[sortConfig.key];
|
|
1042
|
+
const bVal = b[sortConfig.key];
|
|
1043
|
+
return (aVal < bVal ? -1 : aVal > bVal ? 1 : 0) * (sortConfig.direction === "asc" ? 1 : -1);
|
|
973
1044
|
});
|
|
974
1045
|
}
|
|
975
1046
|
return dataCopy;
|
|
976
1047
|
}, [data, sortConfig]);
|
|
977
|
-
// Calculate paged data only if sortedData is not null
|
|
978
1048
|
const paginatedData = React.useMemo(() => {
|
|
979
1049
|
if (!sortedData)
|
|
980
|
-
return
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1050
|
+
return [];
|
|
1051
|
+
if (!pagination)
|
|
1052
|
+
return sortedData;
|
|
1053
|
+
const start = (currentPage - 1) * localItemsPerPage;
|
|
1054
|
+
return sortedData.slice(start, start + localItemsPerPage);
|
|
1055
|
+
}, [sortedData, currentPage, localItemsPerPage, pagination]);
|
|
986
1056
|
const totalPages = React.useMemo(() => {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1057
|
+
return pagination ? Math.ceil(sortedData.length / localItemsPerPage) : 1;
|
|
1058
|
+
}, [sortedData, localItemsPerPage, pagination]);
|
|
1059
|
+
const handlePageChange = (page) => {
|
|
1060
|
+
if (page >= 1 && page <= totalPages)
|
|
1061
|
+
setCurrentPage(page);
|
|
1062
|
+
};
|
|
1063
|
+
const startResize = (e, key) => {
|
|
1064
|
+
e.preventDefault();
|
|
1065
|
+
const startX = e.clientX;
|
|
1066
|
+
const startWidth = e.target.parentElement?.offsetWidth || 0;
|
|
1067
|
+
const onMouseMove = (moveEvent) => {
|
|
1068
|
+
const newWidth = Math.max(startWidth + moveEvent.clientX - startX, 50); // mínimo 50px
|
|
1069
|
+
setColumnWidths(prev => ({ ...prev, [key]: newWidth }));
|
|
1070
|
+
};
|
|
1071
|
+
const onMouseUp = () => {
|
|
1072
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
1073
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
1074
|
+
};
|
|
1075
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
1076
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
1077
|
+
};
|
|
1078
|
+
const scrollContainerStyle = React.useMemo(() => {
|
|
1079
|
+
if (stickyHeader || scrollHeight) {
|
|
1080
|
+
return {
|
|
1081
|
+
maxHeight: scrollHeight ?? 300,
|
|
1082
|
+
overflowY: "auto"
|
|
1083
|
+
};
|
|
995
1084
|
}
|
|
1085
|
+
return {}; // sin altura ni scroll
|
|
1086
|
+
}, [stickyHeader, scrollHeight]);
|
|
1087
|
+
const getColSpan = () => columns.length + (expandedRowRender ? 1 : 0);
|
|
1088
|
+
const renderTableBody = () => {
|
|
1089
|
+
if (loading) {
|
|
1090
|
+
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: getColSpan(), children: jsxRuntime.jsx("div", { className: "text-center py-4 text-muted-foreground", children: "Loading data..." }) }) }));
|
|
1091
|
+
}
|
|
1092
|
+
if (!paginatedData || paginatedData.length === 0) {
|
|
1093
|
+
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: getColSpan(), className: "cw-table-cell-empty", style: { textAlign: "center" }, children: textNoData }) }));
|
|
1094
|
+
}
|
|
1095
|
+
return paginatedData.map(item => {
|
|
1096
|
+
const itemKey = item[rowKey];
|
|
1097
|
+
if (!itemKey)
|
|
1098
|
+
console.warn("Missing row key for item", item);
|
|
1099
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("tr", { className: classNameRow ?? "", children: [expandedRowRender && (jsxRuntime.jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsxRuntime.jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey ? "cwi-chevron-down" : "cwi-chevron-right"}` }) })), columns.map(col => (jsxRuntime.jsx("td", { className: col.className ?? "", children: col.render ? col.render(item) : item[col.dataIndex] }, `${itemKey}_${col.key}`)))] }), expandedRowRender && expandedRowKey === itemKey && (jsxRuntime.jsx("tr", { className: "cw-table-row-expanded", children: jsxRuntime.jsx("td", { colSpan: getColSpan(), children: expandedRowRender(item) }) }))] }, itemKey));
|
|
1100
|
+
});
|
|
996
1101
|
};
|
|
997
|
-
return (jsxRuntime.jsxs("div", { id: id, className: `cw-table-container ${classNameContainer
|
|
1102
|
+
return (jsxRuntime.jsxs("div", { id: id, className: `cw-table-container ${classNameContainer ?? ""}`, style: style, children: [jsxRuntime.jsx("div", { style: scrollContainerStyle, children: jsxRuntime.jsxs("table", { className: `cw-table ${className ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { style: stickyHeader
|
|
1103
|
+
? { position: "sticky", top: 0, background: "white", zIndex: 2 }
|
|
1104
|
+
: undefined, children: jsxRuntime.jsxs("tr", { children: [expandedRowRender && jsxRuntime.jsx("th", {}), columns.map(col => (jsxRuntime.jsxs("th", { onClick: () => col.sortable && handleSort(col.dataIndex), className: `${col.className ?? ""} ${sortConfig.key === col.dataIndex ? sortConfig.direction : ""}`.trim(), style: {
|
|
1105
|
+
cursor: col.sortable ? "pointer" : "default",
|
|
1106
|
+
userSelect: "none",
|
|
1107
|
+
width: columnWidths[col.key] ?? col.width,
|
|
1108
|
+
position: "relative",
|
|
1109
|
+
...((col.width || columnWidths[col.key]) && {
|
|
1110
|
+
minWidth: 50,
|
|
1111
|
+
maxWidth: columnWidths[col.key] ?? col.width
|
|
1112
|
+
}),
|
|
1113
|
+
}, children: [jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { children: col.title }), col.sortable && (jsxRuntime.jsx("span", { style: { fontSize: "12px", marginLeft: "6px" }, children: sortConfig.key !== col.dataIndex ? "↕" : sortConfig.direction === "asc" ? "↑" : "↓" }))] }), jsxRuntime.jsx("div", { onMouseDown: (e) => startResize(e, col.key), style: {
|
|
1114
|
+
position: "absolute",
|
|
1115
|
+
right: 0,
|
|
1116
|
+
top: 7,
|
|
1117
|
+
bottom: 0,
|
|
1118
|
+
width: "2px",
|
|
1119
|
+
cursor: "col-resize",
|
|
1120
|
+
zIndex: 1,
|
|
1121
|
+
backgroundColor: "white",
|
|
1122
|
+
height: 20,
|
|
1123
|
+
} })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }) }), pagination && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsx("button", { onClick: () => handlePageChange(1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left-double", title: "First" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left", title: "Previous" }), totalPages > 1 && (jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx("input", { type: "number", value: currentPage, onChange: (e) => {
|
|
1124
|
+
const value = parseInt(e.target.value, 10);
|
|
1125
|
+
if (!isNaN(value))
|
|
1126
|
+
handlePageChange(value);
|
|
1127
|
+
}, onBlur: (e) => {
|
|
1128
|
+
const value = parseInt(e.target.value, 10);
|
|
1129
|
+
if (isNaN(value) || value < 1 || value > totalPages) {
|
|
1130
|
+
handlePageChange(1);
|
|
1131
|
+
}
|
|
1132
|
+
}, min: 1, max: totalPages, style: {
|
|
1133
|
+
width: "4rem",
|
|
1134
|
+
textAlign: "center",
|
|
1135
|
+
marginRight: "0.5rem"
|
|
1136
|
+
} }), "of ", totalPages] })), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, style: { marginLeft: "1rem" }, children: pageSizeOptions.map(size => (jsxRuntime.jsxs("option", { value: size, children: [size, " / page"] }, size))) })] }))] }));
|
|
998
1137
|
}
|
|
999
1138
|
|
|
1000
1139
|
var styles$8 = {"cw-tabs":"cw-tabs-module_cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module_cw-tabs-content__HTp8d"};
|
|
@@ -1040,7 +1179,7 @@ function CwTabs(CwTabsProps) {
|
|
|
1040
1179
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
1041
1180
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
1042
1181
|
: undefined;
|
|
1043
|
-
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$8['cw-tabs'], "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$8['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
1182
|
+
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$8['cw-tabs'], style: CwTabsProps.style, "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$8['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
1044
1183
|
}
|
|
1045
1184
|
|
|
1046
1185
|
/**
|
|
@@ -1067,6 +1206,25 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
1067
1206
|
return (jsxRuntime.jsx("div", { className: "cw-expandable", children: jsxRuntime.jsxs("details", { ref: myRef, ...detailsProps, children: [jsxRuntime.jsx("summary", { children: briefing }), children && jsxRuntime.jsx("section", { children: children })] }) }));
|
|
1068
1207
|
};
|
|
1069
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* A component for displaying key-value pairs in a definition list format
|
|
1211
|
+
* Used for read-only display of structured data
|
|
1212
|
+
*
|
|
1213
|
+
* @example
|
|
1214
|
+
* <CwKeyValueList
|
|
1215
|
+
* items={[
|
|
1216
|
+
* { key: "length", label: "Length", value: "10", suffix: "m" },
|
|
1217
|
+
* { key: "width", label: "Width", value: null, suffix: "m" }
|
|
1218
|
+
* ]}
|
|
1219
|
+
* emptyValue="N/A"
|
|
1220
|
+
* />
|
|
1221
|
+
*/
|
|
1222
|
+
const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "row" }) => {
|
|
1223
|
+
return (jsxRuntime.jsx("dl", { className: `cw-keyvalue-list ${className}`, children: items.map(item => (jsxRuntime.jsxs("div", { className: `cw-keyvalue-list-item cw-flex-${direction}`, children: [jsxRuntime.jsx("dt", { children: item.label }), jsxRuntime.jsx("dd", { children: item.value !== undefined && item.value !== null && item.value !== ""
|
|
1224
|
+
? `${item.value}${item.suffix ? ` ${item.suffix}` : ''}`
|
|
1225
|
+
: emptyValue })] }, item.key))) }));
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1070
1228
|
/**
|
|
1071
1229
|
* A table with expandable row groups.
|
|
1072
1230
|
* @param props The data to display
|
|
@@ -1190,11 +1348,9 @@ function CwInput(CwInputProps) {
|
|
|
1190
1348
|
const handleClearClick = () => {
|
|
1191
1349
|
CwInputProps.onChange("");
|
|
1192
1350
|
};
|
|
1193
|
-
return (jsxRuntime.jsxs("div", { className: CwInputProps.labelPosition === "
|
|
1194
|
-
? "
|
|
1195
|
-
: CwInputProps.
|
|
1196
|
-
? "cwellt_flex cwellt_flex_column cwellt_align-items_baseline cw_inputContent"
|
|
1197
|
-
: "cwellt_flex cwellt_flex_row cwellt_align_items_center cw_inputContent", children: [jsxRuntime.jsx("label", { className: CwInputProps.disabled === true
|
|
1351
|
+
return (jsxRuntime.jsxs("div", { className: CwInputProps.labelPosition === "column"
|
|
1352
|
+
? "cw-flex-column"
|
|
1353
|
+
: "cw-flex-row ", children: [jsxRuntime.jsx("label", { className: CwInputProps.disabled === true
|
|
1198
1354
|
? CwInputProps.labelClassName + " " + "cw_label_text cw_label_text_disabled"
|
|
1199
1355
|
: CwInputProps.labelClassName + " " + "cw_label_text", children: CwInputProps.labelName }), jsxRuntime.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 && (
|
|
1200
1356
|
// if the component is disabled do not show clear button
|
|
@@ -1284,11 +1440,9 @@ function CwInputNumber(CwInputNumberProps) {
|
|
|
1284
1440
|
const handleChange = (e) => {
|
|
1285
1441
|
CwInputNumberProps.onChange(e.target.value);
|
|
1286
1442
|
};
|
|
1287
|
-
return (jsxRuntime.jsxs("div", { className: CwInputNumberProps.labelPosition == "
|
|
1288
|
-
? "cw-
|
|
1289
|
-
: CwInputNumberProps.
|
|
1290
|
-
? "cwellt_flex cwellt_flex_column cwellt_align-items_baseline cw-label-input"
|
|
1291
|
-
: "cw-label-input", children: [jsxRuntime.jsx("label", { className: CwInputNumberProps.disabled === true
|
|
1443
|
+
return (jsxRuntime.jsxs("div", { className: CwInputNumberProps.labelPosition == "column"
|
|
1444
|
+
? "cw-flex-column"
|
|
1445
|
+
: "cw-flex-row", children: [jsxRuntime.jsx("label", { className: CwInputNumberProps.disabled === true
|
|
1292
1446
|
? CwInputNumberProps.labelClassName + " " + "cw_label_text cw_label_text_disabled"
|
|
1293
1447
|
: CwInputNumberProps.labelClassName + " " + "cw_label_text", children: CwInputNumberProps.labelName }), jsxRuntime.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 })] }));
|
|
1294
1448
|
}
|
|
@@ -2796,7 +2950,7 @@ function CwMultiselect(CwelltCustomFilterTabProps) {
|
|
|
2796
2950
|
const luminance = 0.299 * redBgColor_custom_tag_selected_list +
|
|
2797
2951
|
0.587 * greenBgColor_custom_tag_selected_list +
|
|
2798
2952
|
0.114 * blueBgColor_custom_tag_selected_list;
|
|
2799
|
-
return s.type !== undefined
|
|
2953
|
+
return s.type !== undefined ? (jsxRuntime.jsx("div", { id: "cwContent_tag", "data-id": s.type + "_" + s.id, className: "cwellt_flex cwellt_align_items_center", children: jsxRuntime.jsx(CwTag, { styleTag: {
|
|
2800
2954
|
background: s.color
|
|
2801
2955
|
}, styleTag_description: {
|
|
2802
2956
|
background: s.color,
|
|
@@ -3420,10 +3574,6 @@ function CwBtnAddFolder({ cw_btnOnclick, cw_btn_disabled }) {
|
|
|
3420
3574
|
function CwBtnEditFolder({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3421
3575
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-edit", disabled: cw_btn_disabled });
|
|
3422
3576
|
}
|
|
3423
|
-
// PropertyFolder
|
|
3424
|
-
function CwBtnSelectedFolder({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3425
|
-
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-folder-selected", disabled: cw_btn_disabled });
|
|
3426
|
-
}
|
|
3427
3577
|
// UploadFiles
|
|
3428
3578
|
function CwBtnUploadFiles({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3429
3579
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btn_uploadFiles", disabled: cw_btn_disabled });
|
|
@@ -3436,14 +3586,6 @@ function CwBtnGoBackFolder({ cw_btnOnclick, cw_btn_disabled }) {
|
|
|
3436
3586
|
function CwBtnBookMark({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3437
3587
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-star", disabled: cw_btn_disabled });
|
|
3438
3588
|
}
|
|
3439
|
-
// Archive
|
|
3440
|
-
function CwBtnArchive({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3441
|
-
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-archive", disabled: cw_btn_disabled });
|
|
3442
|
-
}
|
|
3443
|
-
// Archive
|
|
3444
|
-
function CwBtnArchiveRestore({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3445
|
-
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-archive-restore", disabled: cw_btn_disabled });
|
|
3446
|
-
}
|
|
3447
3589
|
// Publish
|
|
3448
3590
|
function CwBtnPublish({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3449
3591
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnPublish", disabled: cw_btn_disabled });
|
|
@@ -3452,10 +3594,6 @@ function CwBtnPublish({ cw_btnOnclick, cw_btn_disabled }) {
|
|
|
3452
3594
|
function CwBtnApprove({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3453
3595
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnApprove", disabled: cw_btn_disabled });
|
|
3454
3596
|
}
|
|
3455
|
-
// BookMarkLinkPag
|
|
3456
|
-
function CwBtnBookMarkLinkPage({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3457
|
-
return (jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cwi-icons cwi-favorite-files", disabled: cw_btn_disabled }));
|
|
3458
|
-
}
|
|
3459
3597
|
// Bulk duty
|
|
3460
3598
|
function CwBtnBulkDuty({ cw_btnOnclick, cw_btn_disabled }) {
|
|
3461
3599
|
return jsxRuntime.jsx("button", { onClick: cw_btnOnclick, className: "cw-button-icon cw_btnBulkDuty", disabled: cw_btn_disabled });
|
|
@@ -6165,7 +6303,20 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
|
6165
6303
|
}, children: value.icons }), jsxRuntime.jsx("span", { style: {
|
|
6166
6304
|
padding: "0.1rem",
|
|
6167
6305
|
color: textColor,
|
|
6168
|
-
|
|
6306
|
+
display: "flex",
|
|
6307
|
+
flex: 1,
|
|
6308
|
+
alignItems: "center",
|
|
6309
|
+
width: "100%",
|
|
6310
|
+
}, children: value.rectangleColors && value.rectangleColors.length > 0 ? (jsxRuntime.jsx("div", { style: {
|
|
6311
|
+
display: "flex",
|
|
6312
|
+
width: "100%",
|
|
6313
|
+
}, children: value.rectangleColors.map((item, i) => (jsxRuntime.jsx("div", { className: "cwellt_rectangle_indicator", style: {
|
|
6314
|
+
backgroundColor: item,
|
|
6315
|
+
flex: 1,
|
|
6316
|
+
height: "8px",
|
|
6317
|
+
margin: 0,
|
|
6318
|
+
padding: 0,
|
|
6319
|
+
} }, value.id + "_" + i))) })) : (value.name) })] }), value.isResizable && (jsxRuntime.jsx(EventSideDrag, { heightRem: heightRem * 0.7, onStartEvent: () => {
|
|
6169
6320
|
onEvent(new OnRightDragStart(value.id));
|
|
6170
6321
|
} }))] }), value.primaryTimeMarkerColor && (jsxRuntime.jsx("div", { className: styles$2["time-marker"], style: {
|
|
6171
6322
|
backgroundColor: value.primaryTimeMarkerColor,
|
|
@@ -7184,10 +7335,7 @@ exports.CwBtnAddFolder = CwBtnAddFolder;
|
|
|
7184
7335
|
exports.CwBtnAirport = CwBtnAirport;
|
|
7185
7336
|
exports.CwBtnAlert = CwBtnAlert;
|
|
7186
7337
|
exports.CwBtnApprove = CwBtnApprove;
|
|
7187
|
-
exports.CwBtnArchive = CwBtnArchive;
|
|
7188
|
-
exports.CwBtnArchiveRestore = CwBtnArchiveRestore;
|
|
7189
7338
|
exports.CwBtnBookMark = CwBtnBookMark;
|
|
7190
|
-
exports.CwBtnBookMarkLinkPage = CwBtnBookMarkLinkPage;
|
|
7191
7339
|
exports.CwBtnBulkDuty = CwBtnBulkDuty;
|
|
7192
7340
|
exports.CwBtnCancel = CwBtnCancel;
|
|
7193
7341
|
exports.CwBtnCrewPlanning = CwBtnCrewPlanning;
|
|
@@ -7218,7 +7366,6 @@ exports.CwBtnReleasePeriod = CwBtnReleasePeriod;
|
|
|
7218
7366
|
exports.CwBtnSave = CwBtnSave;
|
|
7219
7367
|
exports.CwBtnSearch = CwBtnSearch;
|
|
7220
7368
|
exports.CwBtnSelect = CwBtnSelect;
|
|
7221
|
-
exports.CwBtnSelectedFolder = CwBtnSelectedFolder;
|
|
7222
7369
|
exports.CwBtnShare = CwBtnShare;
|
|
7223
7370
|
exports.CwBtnStatistic = CwBtnStatistic;
|
|
7224
7371
|
exports.CwBtnUploadFiles = CwBtnUploadFiles;
|
|
@@ -7257,6 +7404,7 @@ exports.CwInputImage = CwInputImage;
|
|
|
7257
7404
|
exports.CwInputNumber = CwInputNumber;
|
|
7258
7405
|
exports.CwInputPhone = CwInputPhone;
|
|
7259
7406
|
exports.CwInputText = CwInputText;
|
|
7407
|
+
exports.CwKeyValueList = CwKeyValueList;
|
|
7260
7408
|
exports.CwLabel = CwLabel;
|
|
7261
7409
|
exports.CwLoading = CwLoading;
|
|
7262
7410
|
exports.CwLoadingSmall = CwLoadingSmall;
|