jattac.libs.web.responsive-table 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +660 -660
- package/dist/Plugins/FilterPlugin.d.ts +1 -0
- package/dist/UI/InfiniteTable.d.ts +1 -2
- package/dist/UI/ResponsiveTable.d.ts +0 -1
- package/dist/index.js +106 -98
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ export declare class FilterPlugin<TData> implements IResponsiveTablePlugin<TData
|
|
|
4
4
|
id: string;
|
|
5
5
|
private filterText;
|
|
6
6
|
private api;
|
|
7
|
+
private debounceTimeout;
|
|
7
8
|
constructor();
|
|
8
9
|
onPluginInit: (api: IPluginAPI<TData>) => void;
|
|
9
10
|
renderHeader: () => React.JSX.Element | null;
|
|
@@ -50,13 +50,12 @@ declare class InfiniteTable<TData> extends Component<IProps<TData>, IState<TData
|
|
|
50
50
|
private debouncedResize;
|
|
51
51
|
private tableContainerRef;
|
|
52
52
|
private headerRef;
|
|
53
|
-
private
|
|
53
|
+
private debouncedScrollHandler;
|
|
54
54
|
constructor(props: IProps<TData>);
|
|
55
55
|
componentDidUpdate(prevProps: IProps<TData>): void;
|
|
56
56
|
componentDidMount(): void;
|
|
57
57
|
componentWillUnmount(): void;
|
|
58
58
|
private debounce;
|
|
59
|
-
private throttle;
|
|
60
59
|
handleResize: () => void;
|
|
61
60
|
private handleScroll;
|
|
62
61
|
private loadMoreData;
|
|
@@ -59,7 +59,6 @@ declare class ResponsiveTable<TData> extends Component<IProps<TData>, IState<TDa
|
|
|
59
59
|
componentDidUpdate(prevProps: IProps<TData>): void;
|
|
60
60
|
private handleScroll;
|
|
61
61
|
private initializePlugins;
|
|
62
|
-
private processData;
|
|
63
62
|
handleResize: () => void;
|
|
64
63
|
private getColumnDefinition;
|
|
65
64
|
private getRawColumnDefinition;
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ function styleInject(css, ref) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
var css_248z$2 = "/* Using CSS variables for a more maintainable and themeable design */\n.ResponsiveTable-module_responsiveTable__4y-Od {\n --table-border-color: #e0e0e0;\n --table-header-bg: #f8f9fa;\n --table-row-hover-bg: #e9ecef;\n --table-row-stripe-bg: #f2f2f2;\n --card-bg: #ffffff;\n --card-border-color: #e0e0e0;\n --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n --text-color: #212529;\n --text-color-muted: #6c757d;\n --interactive-color: #0056b3;\n}\n\n/* Mobile Card View */\n.ResponsiveTable-module_card__b-U2v {\n background-color: var(--card-bg);\n border: 1px solid var(--card-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: var(--card-shadow);\n transition: box-shadow 0.2s ease-in-out;\n}\n\n.ResponsiveTable-module_card__b-U2v:hover {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n}\n\n/* This is not used in the component, but keeping it styled in case it's added back */\n.ResponsiveTable-module_card-header__Ttk51 {\n background-color: var(--table-header-bg);\n padding: 0.75rem 1rem;\n font-weight: 600; /* Bolder */\n border-bottom: 1px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_card-body__XIy0h {\n padding: 1rem;\n font-size: 0.9rem;\n}\n\n.ResponsiveTable-module_card-body__XIy0h p {\n margin: 0 0 0.75rem;\n display: flex;\n justify-content: space-between;\n}\n\n.ResponsiveTable-module_card-body__XIy0h p:last-child {\n margin-bottom: 0;\n}\n\n.ResponsiveTable-module_card-label__v9L71 {\n font-weight: 600;\n color: var(--text-color);\n margin-right: 0.5rem;\n}\n\n/* Desktop Table View */\n.ResponsiveTable-module_responsiveTable__4y-Od {\n width: 100%;\n border-collapse: collapse;\n color: var(--text-color);\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od thead th {\n background-color: var(--table-header-bg);\n /* position: sticky; <-- REMOVED to prevent conflict with transform */\n /* top: 0; <-- REMOVED */\n z-index: 1;\n font-weight: 600;\n text-align: left;\n padding: 1rem; /* Keep padding for the th itself */\n border-bottom: 2px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_headerInnerWrapper__3VAhD {\n display: flex; /* Use flexbox for alignment within the th */\n align-items: center; /* Vertically center content */\n justify-content: space-between; /* Push icon to the right */\n width: 100%; /* Ensure it takes full width of th */\n}\n\n.ResponsiveTable-module_headerContent__ODMzS {\n flex-grow: 1; /* Allow content to take available space */\n overflow: hidden; /* Hide overflowing content */\n text-overflow: ellipsis; /* Show ellipsis for truncated text */\n white-space: nowrap; /* Prevent text from wrapping */\n padding-right: 0.5rem; /* Subtle space between text and icon */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od td {\n padding: 1rem;\n border-bottom: 1px solid var(--table-border-color);\n text-align: left;\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od tr {\n background-color: var(--card-bg);\n transition: background-color 0.2s ease-in-out;\n}\n\n/* Subtle striping for better readability */\n.ResponsiveTable-module_responsiveTable__4y-Od tr:nth-child(even) {\n background-color: var(--table-row-stripe-bg);\n}\n\n/* Modern hover effect */\n.ResponsiveTable-module_responsiveTable__4y-Od tr:hover {\n background-color: var(--table-row-hover-bg);\n}\n\n/* Clickable Header Style */\n.ResponsiveTable-module_clickableHeader__xHQhF {\n cursor: pointer;\n color: var(--interactive-color);\n}\n\n.ResponsiveTable-module_clickableHeader__xHQhF:hover {\n text-decoration: underline;\n}\n\n/* Sortable Header Styles */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK {\n cursor: pointer;\n position: relative;\n padding-right: 2.5rem; /* Space for the icon (1rem icon + 1rem margin + 0.5rem right offset) */\n transition: transform 0.2s ease-in-out; /* Add transition for smooth scaling */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60:hover,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa:hover,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK:hover {\n transform: scale(1.01); /* Subtle zoom effect on hover */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th .ResponsiveTable-module_sortIcon__A9WtD {\n position: absolute;\n right: 0.5rem;\n top: 50%;\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n opacity: 0.4; /* Ghosted by default */\n transition: opacity 0.2s ease-in-out;\n}\n\n/* Default unsorted icon (funnel) */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60 .ResponsiveTable-module_sortIcon__A9WtD {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M10 18h4v-2h-4v2zm-6-8v2h16V8H4zm3-6h10v2H7V2z'/%3E%3C/svg%3E\");\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60:hover .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1;\n}\n\n/* Ensure cursor applies to content within sortable header */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60 > * {\n cursor: inherit;\n}\n\n/* Sorted Ascending Icon */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1; /* Always prominent when sorted */\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E\");\n}\n\n/* Sorted Descending Icon */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1; /* Always prominent when sorted */\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E\");\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od tfoot {\n background-color: var(--table-header-bg);\n border-top: 2px solid var(--table-border-color);\n font-weight: 600;\n}\n\n.ResponsiveTable-module_footerCell__8H-uG {\n padding: 1rem;\n text-align: right;\n font-weight: 600;\n}\n\n.ResponsiveTable-module_clickableFooterCell__WB9Ss {\n cursor: pointer;\n color: var(--interactive-color);\n}\n\n.ResponsiveTable-module_clickableFooterCell__WB9Ss:hover {\n text-decoration: underline;\n}\n\n.ResponsiveTable-module_footerCard__-NE2M {\n background-color: var(--table-header-bg);\n border: 1px solid var(--card-border-color);\n border-top: 2px solid var(--table-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: none;\n}\n\n.ResponsiveTable-module_footer-card-body__CtBMv {\n padding: 1rem;\n font-size: 0.9rem;\n}\n\n.ResponsiveTable-module_footer-card-row__Vv6Ur {\n margin: 0 0 0.75rem;\n display: flex;\n justify-content: space-between;\n font-weight: 600;\n}\n\n/* No Data State */\n\n/* Staggered Entrance Animation */\n.ResponsiveTable-module_animatedRow__SFjrJ {\n animation: ResponsiveTable-module_fadeInUp__jMCS7 0.5s ease-out forwards;\n opacity: 0;\n}\n\n@keyframes ResponsiveTable-module_fadeInUp__jMCS7 {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Skeleton Loader */\n.ResponsiveTable-module_skeleton__XxsXW {\n background-color: #e0e0e0;\n border-radius: 4px;\n position: relative;\n overflow: hidden;\n}\n\n.ResponsiveTable-module_skeleton__XxsXW::after {\n content: '';\n position: absolute;\n top: 0;\n left: -150%;\n width: 150%;\n height: 100%;\n background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);\n animation: ResponsiveTable-module_shimmer__H8PhC 1.5s infinite;\n}\n\n.ResponsiveTable-module_skeletonText__T-Lgq {\n height: 1.2em;\n width: 100%;\n}\n\n.ResponsiveTable-module_skeletonCard__AYVwL {\n background-color: var(--card-bg);\n border: 1px solid var(--card-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n padding: 1rem;\n}\n\n@keyframes ResponsiveTable-module_shimmer__H8PhC {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n.ResponsiveTable-module_noDataWrapper__Rj-k3 {\n color: var(--text-color-muted); /* Softer color */\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n gap: 10px;\n padding: 40px;\n background-color: var(--table-header-bg);\n border: 1px dashed var(--table-border-color);\n border-radius: 8px;\n}\n\n.ResponsiveTable-module_noData__IpwNq {\n text-align: center;\n font-weight: 500; /* Less aggressive than bold */\n font-size: 1rem;\n}\n\n.ResponsiveTable-module_row-exit__EVX6T {\n opacity: 0;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n}\n\n.ResponsiveTable-module_row-enter__YKgI4 {\n opacity: 0;\n transform: translateY(20px);\n transition: transform 0.5s ease-out, opacity 0.5s ease-out;\n}\n\n.ResponsiveTable-module_row-flash__a4NOm {\n animation: ResponsiveTable-module_flash__nxeAX 0.5s ease-out;\n}\n\n@keyframes ResponsiveTable-module_flash__nxeAX {\n 0% {\n background-color: var(--table-row-hover-bg);\n }\n 100% {\n background-color: transparent;\n }\n}\n\n.ResponsiveTable-module_stickyHeader__-jjN- th {\n position: sticky;\n top: 0;\n z-index: 1;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.ResponsiveTable-module_internalStickyHeader__idiJY th {\n position: sticky;\n top: 0;\n z-index: 1;\n}\n/* Spinner for Loading More */\n.ResponsiveTable-module_spinner__Pn-3D {\n border: 4px solid rgba(0, 0, 0, 0.1);\n border-left-color: var(--interactive-color); /* Use theme color */\n border-radius: 50%;\n width: 24px;\n height: 24px;\n animation: ResponsiveTable-module_spin__i3NHn 1s linear infinite;\n display: inline-block;\n vertical-align: middle;\n margin-right: 8px;\n}\n\n@keyframes ResponsiveTable-module_spin__i3NHn {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n/* Loading/No More Data Container */\n.ResponsiveTable-module_infoContainer__b9IF5 {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 20px;\n color: var(--text-color-muted);\n font-size: 0.9rem;\n gap: 8px;\n background-color: var(--table-header-bg);\n border-top: 1px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_infoContainer__b9IF5.ResponsiveTable-module_noMoreData__he1rZ {\n font-weight: 500;\n}";
|
|
78
|
+
var css_248z$2 = "/* Using CSS variables for a more maintainable and themeable design */\n.ResponsiveTable-module_responsiveTable__4y-Od {\n --table-border-color: #e0e0e0;\n --table-header-bg: #f8f9fa;\n --table-row-hover-bg: #e9ecef;\n --table-row-stripe-bg: #f2f2f2;\n --card-bg: #ffffff;\n --card-border-color: #e0e0e0;\n --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n --text-color: #212529;\n --text-color-muted: #6c757d;\n --interactive-color: #0056b3;\n}\n\n/* Mobile Card View */\n.ResponsiveTable-module_card__b-U2v {\n background-color: var(--card-bg);\n border: 1px solid var(--card-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: var(--card-shadow);\n transition: box-shadow 0.2s ease-in-out;\n}\n\n.ResponsiveTable-module_card__b-U2v:hover {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n}\n\n/* This is not used in the component, but keeping it styled in case it's added back */\n.ResponsiveTable-module_card-header__Ttk51 {\n background-color: var(--table-header-bg);\n padding: 0.75rem 1rem;\n font-weight: 600; /* Bolder */\n border-bottom: 1px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_card-body__XIy0h {\n padding: 1rem;\n font-size: 0.9rem;\n}\n\n.ResponsiveTable-module_card-body__XIy0h p {\n margin: 0 0 0.75rem;\n display: flex;\n justify-content: space-between;\n}\n\n.ResponsiveTable-module_card-body__XIy0h p:last-child {\n margin-bottom: 0;\n}\n\n.ResponsiveTable-module_card-label__v9L71 {\n font-weight: 600;\n color: var(--text-color);\n margin-right: 0.5rem;\n}\n\n/* Desktop Table View */\n.ResponsiveTable-module_responsiveTable__4y-Od {\n width: 100%;\n border-collapse: collapse;\n color: var(--text-color);\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od thead th {\n background-color: var(--table-header-bg);\n /* position: sticky; <-- REMOVED to prevent conflict with transform */\n /* top: 0; <-- REMOVED */\n z-index: 1;\n font-weight: 600;\n text-align: left;\n padding: 1rem; /* Keep padding for the th itself */\n border-bottom: 2px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_headerInnerWrapper__3VAhD {\n display: flex; /* Use flexbox for alignment within the th */\n align-items: center; /* Vertically center content */\n justify-content: space-between; /* Push icon to the right */\n width: 100%; /* Ensure it takes full width of th */\n position: relative; /* Contain the absolutely positioned sort icon */\n}\n\n.ResponsiveTable-module_headerContent__ODMzS {\n flex-grow: 1; /* Allow content to take available space */\n overflow: hidden; /* Hide overflowing content */\n text-overflow: ellipsis; /* Show ellipsis for truncated text */\n white-space: nowrap; /* Prevent text from wrapping */\n padding-right: 0.5rem; /* Subtle space between text and icon */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od td {\n padding: 1rem;\n border-bottom: 1px solid var(--table-border-color);\n text-align: left;\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od tr {\n background-color: var(--card-bg);\n transition: background-color 0.2s ease-in-out;\n}\n\n/* Subtle striping for better readability */\n.ResponsiveTable-module_responsiveTable__4y-Od tr:nth-child(even) {\n background-color: var(--table-row-stripe-bg);\n}\n\n/* Modern hover effect */\n.ResponsiveTable-module_responsiveTable__4y-Od tr:hover {\n background-color: var(--table-row-hover-bg);\n}\n\n/* Clickable Header Style */\n.ResponsiveTable-module_clickableHeader__xHQhF {\n cursor: pointer;\n color: var(--interactive-color);\n}\n\n.ResponsiveTable-module_clickableHeader__xHQhF:hover {\n text-decoration: underline;\n}\n\n/* Sortable Header Styles */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK {\n cursor: pointer;\n /* position: relative; <-- REMOVED to fix sticky header bug */\n padding-right: 2.5rem; /* Space for the icon (1rem icon + 1rem margin + 0.5rem right offset) */\n transition: transform 0.2s ease-in-out; /* Add transition for smooth scaling */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60:hover,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa:hover,\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK:hover {\n transform: scale(1.01); /* Subtle zoom effect on hover */\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th .ResponsiveTable-module_sortIcon__A9WtD {\n position: absolute;\n right: 0.5rem;\n top: 50%;\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n opacity: 0.4; /* Ghosted by default */\n transition: opacity 0.2s ease-in-out;\n}\n\n/* Default unsorted icon (funnel) */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60 .ResponsiveTable-module_sortIcon__A9WtD {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M10 18h4v-2h-4v2zm-6-8v2h16V8H4zm3-6h10v2H7V2z'/%3E%3C/svg%3E\");\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60:hover .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1;\n}\n\n/* Ensure cursor applies to content within sortable header */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sortable__yvA60 > * {\n cursor: inherit;\n}\n\n/* Sorted Ascending Icon */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-asc__jzOIa .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1; /* Always prominent when sorted */\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E\");\n}\n\n/* Sorted Descending Icon */\n.ResponsiveTable-module_responsiveTable__4y-Od th.ResponsiveTable-module_sorted-desc__7WCFK .ResponsiveTable-module_sortIcon__A9WtD {\n opacity: 1; /* Always prominent when sorted */\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E\");\n}\n\n.ResponsiveTable-module_responsiveTable__4y-Od tfoot {\n background-color: var(--table-header-bg);\n border-top: 2px solid var(--table-border-color);\n font-weight: 600;\n}\n\n.ResponsiveTable-module_footerCell__8H-uG {\n padding: 1rem;\n text-align: right;\n font-weight: 600;\n}\n\n.ResponsiveTable-module_clickableFooterCell__WB9Ss {\n cursor: pointer;\n color: var(--interactive-color);\n}\n\n.ResponsiveTable-module_clickableFooterCell__WB9Ss:hover {\n text-decoration: underline;\n}\n\n.ResponsiveTable-module_footerCard__-NE2M {\n background-color: var(--table-header-bg);\n border: 1px solid var(--card-border-color);\n border-top: 2px solid var(--table-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: none;\n}\n\n.ResponsiveTable-module_footer-card-body__CtBMv {\n padding: 1rem;\n font-size: 0.9rem;\n}\n\n.ResponsiveTable-module_footer-card-row__Vv6Ur {\n margin: 0 0 0.75rem;\n display: flex;\n justify-content: space-between;\n font-weight: 600;\n}\n\n/* No Data State */\n\n/* Staggered Entrance Animation */\n.ResponsiveTable-module_animatedRow__SFjrJ {\n animation: ResponsiveTable-module_fadeInUp__jMCS7 0.5s ease-out forwards;\n opacity: 0;\n}\n\n@keyframes ResponsiveTable-module_fadeInUp__jMCS7 {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Skeleton Loader */\n.ResponsiveTable-module_skeleton__XxsXW {\n background-color: #e0e0e0;\n border-radius: 4px;\n position: relative;\n overflow: hidden;\n}\n\n.ResponsiveTable-module_skeleton__XxsXW::after {\n content: '';\n position: absolute;\n top: 0;\n left: -150%;\n width: 150%;\n height: 100%;\n background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);\n animation: ResponsiveTable-module_shimmer__H8PhC 1.5s infinite;\n}\n\n.ResponsiveTable-module_skeletonText__T-Lgq {\n height: 1.2em;\n width: 100%;\n}\n\n.ResponsiveTable-module_skeletonCard__AYVwL {\n background-color: var(--card-bg);\n border: 1px solid var(--card-border-color);\n margin-bottom: 1rem;\n border-radius: 8px;\n overflow: hidden;\n padding: 1rem;\n}\n\n@keyframes ResponsiveTable-module_shimmer__H8PhC {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n.ResponsiveTable-module_noDataWrapper__Rj-k3 {\n color: var(--text-color-muted); /* Softer color */\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n gap: 10px;\n padding: 40px;\n background-color: var(--table-header-bg);\n border: 1px dashed var(--table-border-color);\n border-radius: 8px;\n}\n\n.ResponsiveTable-module_noData__IpwNq {\n text-align: center;\n font-weight: 500; /* Less aggressive than bold */\n font-size: 1rem;\n}\n\n.ResponsiveTable-module_row-exit__EVX6T {\n opacity: 0;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n}\n\n.ResponsiveTable-module_row-enter__YKgI4 {\n opacity: 0;\n transform: translateY(20px);\n transition: transform 0.5s ease-out, opacity 0.5s ease-out;\n}\n\n.ResponsiveTable-module_row-flash__a4NOm {\n animation: ResponsiveTable-module_flash__nxeAX 0.5s ease-out;\n}\n\n@keyframes ResponsiveTable-module_flash__nxeAX {\n 0% {\n background-color: var(--table-row-hover-bg);\n }\n 100% {\n background-color: transparent;\n }\n}\n\n.ResponsiveTable-module_stickyHeader__-jjN- th {\n position: sticky;\n top: 0;\n z-index: 1;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.ResponsiveTable-module_internalStickyHeader__idiJY th {\n position: sticky;\n top: 0;\n z-index: 1;\n}\n/* Spinner for Loading More */\n.ResponsiveTable-module_spinner__Pn-3D {\n border: 4px solid rgba(0, 0, 0, 0.1);\n border-left-color: var(--interactive-color); /* Use theme color */\n border-radius: 50%;\n width: 24px;\n height: 24px;\n animation: ResponsiveTable-module_spin__i3NHn 1s linear infinite;\n display: inline-block;\n vertical-align: middle;\n margin-right: 8px;\n}\n\n@keyframes ResponsiveTable-module_spin__i3NHn {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n/* Loading/No More Data Container */\n.ResponsiveTable-module_infoContainer__b9IF5 {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 20px;\n color: var(--text-color-muted);\n font-size: 0.9rem;\n gap: 8px;\n background-color: var(--table-header-bg);\n border-top: 1px solid var(--table-border-color);\n}\n\n.ResponsiveTable-module_infoContainer__b9IF5.ResponsiveTable-module_noMoreData__he1rZ {\n font-weight: 500;\n}";
|
|
79
79
|
var styles$2 = {"responsiveTable":"ResponsiveTable-module_responsiveTable__4y-Od","card":"ResponsiveTable-module_card__b-U2v","card-header":"ResponsiveTable-module_card-header__Ttk51","card-body":"ResponsiveTable-module_card-body__XIy0h","card-label":"ResponsiveTable-module_card-label__v9L71","headerInnerWrapper":"ResponsiveTable-module_headerInnerWrapper__3VAhD","headerContent":"ResponsiveTable-module_headerContent__ODMzS","clickableHeader":"ResponsiveTable-module_clickableHeader__xHQhF","sortable":"ResponsiveTable-module_sortable__yvA60","sorted-asc":"ResponsiveTable-module_sorted-asc__jzOIa","sorted-desc":"ResponsiveTable-module_sorted-desc__7WCFK","sortIcon":"ResponsiveTable-module_sortIcon__A9WtD","footerCell":"ResponsiveTable-module_footerCell__8H-uG","clickableFooterCell":"ResponsiveTable-module_clickableFooterCell__WB9Ss","footerCard":"ResponsiveTable-module_footerCard__-NE2M","footer-card-body":"ResponsiveTable-module_footer-card-body__CtBMv","footer-card-row":"ResponsiveTable-module_footer-card-row__Vv6Ur","animatedRow":"ResponsiveTable-module_animatedRow__SFjrJ","fadeInUp":"ResponsiveTable-module_fadeInUp__jMCS7","skeleton":"ResponsiveTable-module_skeleton__XxsXW","shimmer":"ResponsiveTable-module_shimmer__H8PhC","skeletonText":"ResponsiveTable-module_skeletonText__T-Lgq","skeletonCard":"ResponsiveTable-module_skeletonCard__AYVwL","noDataWrapper":"ResponsiveTable-module_noDataWrapper__Rj-k3","noData":"ResponsiveTable-module_noData__IpwNq","row-exit":"ResponsiveTable-module_row-exit__EVX6T","row-enter":"ResponsiveTable-module_row-enter__YKgI4","row-flash":"ResponsiveTable-module_row-flash__a4NOm","flash":"ResponsiveTable-module_flash__nxeAX","stickyHeader":"ResponsiveTable-module_stickyHeader__-jjN-","internalStickyHeader":"ResponsiveTable-module_internalStickyHeader__idiJY","spinner":"ResponsiveTable-module_spinner__Pn-3D","spin":"ResponsiveTable-module_spin__i3NHn","infoContainer":"ResponsiveTable-module_infoContainer__b9IF5","noMoreData":"ResponsiveTable-module_noMoreData__he1rZ"};
|
|
80
80
|
styleInject(css_248z$2);
|
|
81
81
|
|
|
@@ -83,6 +83,7 @@ class FilterPlugin {
|
|
|
83
83
|
constructor() {
|
|
84
84
|
this.id = 'filter';
|
|
85
85
|
this.filterText = '';
|
|
86
|
+
this.debounceTimeout = null;
|
|
86
87
|
this.onPluginInit = (api) => {
|
|
87
88
|
this.api = api;
|
|
88
89
|
};
|
|
@@ -121,68 +122,18 @@ class FilterPlugin {
|
|
|
121
122
|
});
|
|
122
123
|
};
|
|
123
124
|
this.handleFilterChange = (e) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this.
|
|
125
|
+
const currentFilterText = e.target.value;
|
|
126
|
+
if (this.debounceTimeout) {
|
|
127
|
+
clearTimeout(this.debounceTimeout);
|
|
128
|
+
}
|
|
129
|
+
this.debounceTimeout = setTimeout(() => {
|
|
130
|
+
this.filterText = currentFilterText;
|
|
127
131
|
this.api.forceUpdate();
|
|
128
132
|
}, 300);
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
class InfiniteScrollPlugin {
|
|
134
|
-
constructor() {
|
|
135
|
-
this.id = 'infinite-scroll';
|
|
136
|
-
this.isLoadingMore = false;
|
|
137
|
-
this.onPluginInit = (api) => {
|
|
138
|
-
this.api = api;
|
|
139
|
-
this.attachScrollListener();
|
|
140
|
-
};
|
|
141
|
-
this.attachScrollListener = () => {
|
|
142
|
-
var _a, _b;
|
|
143
|
-
const scrollableElement = (_b = (_a = this.api).getScrollableElement) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
144
|
-
if (scrollableElement) {
|
|
145
|
-
scrollableElement.addEventListener('scroll', this.handleScroll);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
this.handleScroll = () => __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
var _a, _b, _c, _d, _e;
|
|
150
|
-
const scrollableElement = (_b = (_a = this.api).getScrollableElement) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
151
|
-
if (!scrollableElement || !((_c = this.api.infiniteScrollProps) === null || _c === void 0 ? void 0 : _c.enableInfiniteScroll)) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const { scrollTop, scrollHeight, clientHeight } = scrollableElement;
|
|
155
|
-
const scrollThreshold = 200; // Load more data when 200px from the bottom
|
|
156
|
-
if (scrollHeight - scrollTop - clientHeight < scrollThreshold &&
|
|
157
|
-
this.api.infiniteScrollProps.hasMore &&
|
|
158
|
-
!this.isLoadingMore) {
|
|
159
|
-
this.isLoadingMore = true;
|
|
160
|
-
this.api.forceUpdate(); // Trigger re-render to show loading component
|
|
161
|
-
yield ((_e = (_d = this.api.infiniteScrollProps).onLoadMore) === null || _e === void 0 ? void 0 : _e.call(_d, this.api.getData()));
|
|
162
|
-
this.isLoadingMore = false;
|
|
163
|
-
this.api.forceUpdate(); // Trigger re-render to hide loading component
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
this.processData = (data) => {
|
|
167
|
-
// This plugin doesn't modify the data directly, but rather triggers loading more.
|
|
168
|
-
// The main component's data prop should be updated by the consumer of the table.
|
|
169
|
-
return data;
|
|
170
|
-
};
|
|
171
|
-
this.renderFooter = () => {
|
|
172
|
-
if (!this.api.infiniteScrollProps) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
if (this.isLoadingMore) {
|
|
176
|
-
return this.api.infiniteScrollProps.loadingMoreComponent || React.createElement("div", null, "Loading more...");
|
|
177
|
-
}
|
|
178
|
-
else if (!this.api.infiniteScrollProps.hasMore) {
|
|
179
|
-
return this.api.infiniteScrollProps.noMoreDataComponent || React.createElement("div", null, "No more data.");
|
|
180
|
-
}
|
|
181
|
-
return null;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
137
|
var css_248z$1 = "/* Spinner for Loading More */\r\n.LoadingSpinner-module_spinner__F9V3x {\r\n border: 4px solid rgba(0, 0, 0, 0.1);\r\n border-left-color: var(--interactive-color); /* Use theme color */\r\n border-radius: 50%;\r\n width: 24px;\r\n height: 24px;\r\n animation: LoadingSpinner-module_spin__VkBDO 1s linear infinite;\r\n display: inline-block;\r\n vertical-align: middle;\r\n margin-right: 8px;\r\n}\r\n\r\n@keyframes LoadingSpinner-module_spin__VkBDO {\r\n 0% { transform: rotate(0deg); }\r\n 100% { transform: rotate(360deg); }\r\n}";
|
|
187
138
|
var styles$1 = {"spinner":"LoadingSpinner-module_spinner__F9V3x"};
|
|
188
139
|
styleInject(css_248z$1);
|
|
@@ -207,16 +158,6 @@ class InfiniteTable extends React.Component {
|
|
|
207
158
|
super(props);
|
|
208
159
|
this.tableContainerRef = React.createRef();
|
|
209
160
|
this.headerRef = React.createRef();
|
|
210
|
-
this.throttle = (func, limit) => {
|
|
211
|
-
let inThrottle;
|
|
212
|
-
return (event) => {
|
|
213
|
-
if (!inThrottle) {
|
|
214
|
-
func(event);
|
|
215
|
-
inThrottle = true;
|
|
216
|
-
setTimeout(() => (inThrottle = false), limit);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
161
|
this.handleResize = () => {
|
|
221
162
|
this.setState({
|
|
222
163
|
isMobile: window.innerWidth <= (this.props.mobileBreakpoint || 600),
|
|
@@ -320,11 +261,18 @@ class InfiniteTable extends React.Component {
|
|
|
320
261
|
activePlugins: [],
|
|
321
262
|
};
|
|
322
263
|
this.debouncedResize = this.debounce(this.handleResize, 200);
|
|
323
|
-
this.
|
|
264
|
+
this.debouncedScrollHandler = this.debounce(this.handleScroll, 200);
|
|
324
265
|
}
|
|
325
266
|
componentDidUpdate(prevProps) {
|
|
267
|
+
const propsHaveChanged = prevProps.plugins !== this.props.plugins ||
|
|
268
|
+
prevProps.filterProps !== this.props.filterProps;
|
|
326
269
|
if (prevProps.data !== this.props.data) {
|
|
327
|
-
|
|
270
|
+
// If initial data prop changes, reset internal state and re-initialize plugins
|
|
271
|
+
this.setState({ internalData: this.props.data }, () => this.initializePlugins());
|
|
272
|
+
}
|
|
273
|
+
else if (propsHaveChanged) {
|
|
274
|
+
// If only plugins or filter props change, just re-initialize them
|
|
275
|
+
this.initializePlugins();
|
|
328
276
|
}
|
|
329
277
|
}
|
|
330
278
|
componentDidMount() {
|
|
@@ -340,9 +288,11 @@ class InfiniteTable extends React.Component {
|
|
|
340
288
|
}
|
|
341
289
|
debounce(func, delay) {
|
|
342
290
|
let timeout;
|
|
343
|
-
return () => {
|
|
291
|
+
return (...args) => {
|
|
344
292
|
clearTimeout(timeout);
|
|
345
|
-
timeout = setTimeout(() =>
|
|
293
|
+
timeout = setTimeout(() => {
|
|
294
|
+
func(...args);
|
|
295
|
+
}, delay);
|
|
346
296
|
};
|
|
347
297
|
}
|
|
348
298
|
initializePlugins() {
|
|
@@ -407,7 +357,7 @@ class InfiniteTable extends React.Component {
|
|
|
407
357
|
const { infiniteScrollProps } = this.props;
|
|
408
358
|
const { isLoadingMore } = this.state;
|
|
409
359
|
const hasMore = ((_a = this.props.infiniteScrollProps) === null || _a === void 0 ? void 0 : _a.hasMore) !== undefined ? this.props.infiniteScrollProps.hasMore : this.state.internalHasMore;
|
|
410
|
-
return (React.createElement("div", { ref: this.tableContainerRef, onScroll: this.
|
|
360
|
+
return (React.createElement("div", { ref: this.tableContainerRef, onScroll: this.debouncedScrollHandler, style: { maxHeight: this.props.maxHeight, overflowY: 'auto' } },
|
|
411
361
|
React.createElement("table", { className: styles$2['responsiveTable'] },
|
|
412
362
|
React.createElement("thead", { ref: this.headerRef, className: this.state.isHeaderSticky ? styles$2.stickyHeader : '' },
|
|
413
363
|
React.createElement("tr", null, this.props.columnDefinitions.map((colDef, colIndex) => {
|
|
@@ -513,12 +463,15 @@ class ResponsiveTable extends React.Component {
|
|
|
513
463
|
}
|
|
514
464
|
}
|
|
515
465
|
componentDidUpdate(prevProps) {
|
|
516
|
-
if
|
|
517
|
-
|
|
466
|
+
// Re-initialize if data or plugin configuration changes.
|
|
467
|
+
if (prevProps.data !== this.props.data ||
|
|
468
|
+
prevProps.plugins !== this.props.plugins ||
|
|
469
|
+
prevProps.filterProps !== this.props.filterProps) {
|
|
470
|
+
this.initializePlugins();
|
|
518
471
|
}
|
|
519
472
|
}
|
|
520
473
|
initializePlugins() {
|
|
521
|
-
var _a
|
|
474
|
+
var _a;
|
|
522
475
|
const activePlugins = [];
|
|
523
476
|
// Add explicitly provided plugins first
|
|
524
477
|
if (this.props.plugins) {
|
|
@@ -528,15 +481,11 @@ class ResponsiveTable extends React.Component {
|
|
|
528
481
|
if (((_a = this.props.filterProps) === null || _a === void 0 ? void 0 : _a.showFilter) && !activePlugins.some(p => p.id === 'filter')) {
|
|
529
482
|
activePlugins.push(new FilterPlugin());
|
|
530
483
|
}
|
|
531
|
-
// Automatically add InfiniteScrollPlugin if infiniteScrollProps are provided and not already present
|
|
532
|
-
if (((_b = this.props.infiniteScrollProps) === null || _b === void 0 ? void 0 : _b.enableInfiniteScroll) && !activePlugins.some(p => p.id === 'infinite-scroll')) {
|
|
533
|
-
activePlugins.push(new InfiniteScrollPlugin());
|
|
534
|
-
}
|
|
535
484
|
activePlugins.forEach((plugin) => {
|
|
536
485
|
if (plugin.onPluginInit) {
|
|
537
486
|
plugin.onPluginInit({
|
|
538
487
|
getData: () => this.props.data,
|
|
539
|
-
forceUpdate: () => this.
|
|
488
|
+
forceUpdate: () => this.initializePlugins(),
|
|
540
489
|
getScrollableElement: () => this.tableContainerRef.current,
|
|
541
490
|
infiniteScrollProps: this.props.infiniteScrollProps,
|
|
542
491
|
filterProps: this.props.filterProps,
|
|
@@ -553,17 +502,6 @@ class ResponsiveTable extends React.Component {
|
|
|
553
502
|
});
|
|
554
503
|
this.setState({ processedData });
|
|
555
504
|
}
|
|
556
|
-
processData() {
|
|
557
|
-
let processedData = [...this.props.data];
|
|
558
|
-
if (this.props.plugins) {
|
|
559
|
-
this.props.plugins.forEach((plugin) => {
|
|
560
|
-
if (plugin.processData) {
|
|
561
|
-
processedData = plugin.processData(processedData);
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
this.setState({ processedData });
|
|
566
|
-
}
|
|
567
505
|
getColumnDefinition(columnDefinition, rowIndex) {
|
|
568
506
|
if (!this.hasData) {
|
|
569
507
|
return { displayLabel: '', cellRenderer: () => '' };
|
|
@@ -761,16 +699,78 @@ class ResponsiveTable extends React.Component {
|
|
|
761
699
|
}
|
|
762
700
|
}
|
|
763
701
|
|
|
702
|
+
class InfiniteScrollPlugin {
|
|
703
|
+
constructor() {
|
|
704
|
+
this.id = 'infinite-scroll';
|
|
705
|
+
this.isLoadingMore = false;
|
|
706
|
+
this.onPluginInit = (api) => {
|
|
707
|
+
this.api = api;
|
|
708
|
+
this.attachScrollListener();
|
|
709
|
+
};
|
|
710
|
+
this.attachScrollListener = () => {
|
|
711
|
+
var _a, _b;
|
|
712
|
+
const scrollableElement = (_b = (_a = this.api).getScrollableElement) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
713
|
+
if (scrollableElement) {
|
|
714
|
+
scrollableElement.addEventListener('scroll', this.handleScroll);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
this.handleScroll = () => __awaiter(this, void 0, void 0, function* () {
|
|
718
|
+
var _a, _b, _c, _d, _e;
|
|
719
|
+
const scrollableElement = (_b = (_a = this.api).getScrollableElement) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
720
|
+
if (!scrollableElement || !((_c = this.api.infiniteScrollProps) === null || _c === void 0 ? void 0 : _c.enableInfiniteScroll)) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollableElement;
|
|
724
|
+
const scrollThreshold = 200; // Load more data when 200px from the bottom
|
|
725
|
+
if (scrollHeight - scrollTop - clientHeight < scrollThreshold &&
|
|
726
|
+
this.api.infiniteScrollProps.hasMore &&
|
|
727
|
+
!this.isLoadingMore) {
|
|
728
|
+
this.isLoadingMore = true;
|
|
729
|
+
this.api.forceUpdate(); // Trigger re-render to show loading component
|
|
730
|
+
yield ((_e = (_d = this.api.infiniteScrollProps).onLoadMore) === null || _e === void 0 ? void 0 : _e.call(_d, this.api.getData()));
|
|
731
|
+
this.isLoadingMore = false;
|
|
732
|
+
this.api.forceUpdate(); // Trigger re-render to hide loading component
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
this.processData = (data) => {
|
|
736
|
+
// This plugin doesn't modify the data directly, but rather triggers loading more.
|
|
737
|
+
// The main component's data prop should be updated by the consumer of the table.
|
|
738
|
+
return data;
|
|
739
|
+
};
|
|
740
|
+
this.renderFooter = () => {
|
|
741
|
+
if (!this.api.infiniteScrollProps) {
|
|
742
|
+
return null;
|
|
743
|
+
}
|
|
744
|
+
if (this.isLoadingMore) {
|
|
745
|
+
return this.api.infiniteScrollProps.loadingMoreComponent || React.createElement("div", null, "Loading more...");
|
|
746
|
+
}
|
|
747
|
+
else if (!this.api.infiniteScrollProps.hasMore) {
|
|
748
|
+
return this.api.infiniteScrollProps.noMoreDataComponent || React.createElement("div", null, "No more data.");
|
|
749
|
+
}
|
|
750
|
+
return null;
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
764
755
|
// Type-safe sort comparer helpers
|
|
765
756
|
const createSortComparers = () => ({
|
|
766
757
|
numeric: (key) => (a, b, direction) => {
|
|
767
|
-
const
|
|
768
|
-
const
|
|
769
|
-
|
|
758
|
+
const numA = parseFloat(String(a[key]));
|
|
759
|
+
const numB = parseFloat(String(b[key]));
|
|
760
|
+
const aIsNaN = isNaN(numA);
|
|
761
|
+
const bIsNaN = isNaN(numB);
|
|
762
|
+
if (aIsNaN && bIsNaN)
|
|
763
|
+
return 0;
|
|
764
|
+
if (aIsNaN)
|
|
765
|
+
return 1; // Put non-numbers at the end
|
|
766
|
+
if (bIsNaN)
|
|
767
|
+
return -1;
|
|
768
|
+
return direction === 'asc' ? numA - numB : numB - numA;
|
|
770
769
|
},
|
|
771
770
|
caseInsensitiveString: (key) => (a, b, direction) => {
|
|
772
|
-
|
|
773
|
-
const
|
|
771
|
+
var _a, _b;
|
|
772
|
+
const valA = String((_a = a[key]) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
773
|
+
const valB = String((_b = b[key]) !== null && _b !== void 0 ? _b : '').toLowerCase();
|
|
774
774
|
if (valA < valB)
|
|
775
775
|
return direction === 'asc' ? -1 : 1;
|
|
776
776
|
if (valA > valB)
|
|
@@ -778,8 +778,16 @@ const createSortComparers = () => ({
|
|
|
778
778
|
return 0;
|
|
779
779
|
},
|
|
780
780
|
date: (key) => (a, b, direction) => {
|
|
781
|
-
const dateA = new Date(a[key]).getTime();
|
|
782
|
-
const dateB = new Date(b[key]).getTime();
|
|
781
|
+
const dateA = new Date(String(a[key])).getTime();
|
|
782
|
+
const dateB = new Date(String(b[key])).getTime();
|
|
783
|
+
const aIsNaN = isNaN(dateA);
|
|
784
|
+
const bIsNaN = isNaN(dateB);
|
|
785
|
+
if (aIsNaN && bIsNaN)
|
|
786
|
+
return 0;
|
|
787
|
+
if (aIsNaN)
|
|
788
|
+
return 1; // Put invalid dates at the end
|
|
789
|
+
if (bIsNaN)
|
|
790
|
+
return -1;
|
|
783
791
|
return direction === 'asc' ? dateA - dateB : dateB - dateA;
|
|
784
792
|
},
|
|
785
793
|
});
|