ezux 1.1.13 → 1.1.18
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 +58 -15
- package/dist/DeleteConfirmationModal-CukNDgtX.cjs +1 -0
- package/dist/DeleteConfirmationModal-p8XGDGIw.js +38 -0
- package/dist/EzContextMenu-BCUoEQp5.cjs +1 -0
- package/dist/EzContextMenu-srLxujt8.js +287 -0
- package/dist/EzErrorBoundary-C7a6VisX.js +74 -0
- package/dist/EzErrorBoundary-d_2g-_EK.cjs +1 -0
- package/dist/EzEventModal-C079wLjP.js +725 -0
- package/dist/EzEventModal-CAA9cAM0.cjs +1 -0
- package/dist/EzFlow-C74NbZA9.js +2545 -0
- package/dist/EzFlow-CQFeY7DL.cjs +5 -0
- package/dist/EzGroupingPanel-BVaAJaVU.js +107 -0
- package/dist/EzGroupingPanel-BwWDWEuW.cjs +1 -0
- package/dist/EzKanban-BlJWybKe.js +1575 -0
- package/dist/EzKanban-DdKODRRv.cjs +2 -0
- package/dist/EzLayout-BGnqFtvO.cjs +1 -0
- package/dist/EzLayout-CiaPLniV.js +7005 -0
- package/dist/EzProvider-AlmsYIDk.js +982 -0
- package/dist/EzProvider-L2qQMq-v.cjs +1 -0
- package/dist/EzScheduler-C1Jtvvju.js +2700 -0
- package/dist/EzScheduler-CkqTngI6.cjs +1 -0
- package/dist/EzSchedulerQuickAdd-BIC8xbSn.js +124 -0
- package/dist/EzSchedulerQuickAdd-BeNfGdWs.cjs +1 -0
- package/dist/EzSchedulerToolbar-BJwTpgas.cjs +1 -0
- package/dist/EzSchedulerToolbar-Ba4gbvUg.js +305 -0
- package/dist/EzSignature-7UHO5lSP.js +386 -0
- package/dist/EzSignature-Df7UZ-IS.cjs +1 -0
- package/dist/EzTable-CEXvJR1t.cjs +3 -0
- package/dist/EzTable-D2p1IWHc.js +4290 -0
- package/dist/EzTableEditDialog-BXnnYSSy.cjs +1 -0
- package/dist/EzTableEditDialog-Ccd5XoHm.js +84 -0
- package/dist/EzTableFooter-CtexeDAC.cjs +1 -0
- package/dist/EzTableFooter-DrLoWelo.js +35 -0
- package/dist/EzTableToolbar-BH5z9fSJ.js +160 -0
- package/dist/EzTableToolbar-DwuumvWP.cjs +1 -0
- package/dist/EzTreeView-D1G0Aomc.js +818 -0
- package/dist/EzTreeView-KMGlU4ax.cjs +1 -0
- package/dist/HighlightText-BViuwe03.cjs +1 -0
- package/dist/HighlightText-DNA2R2uf.js +56 -0
- package/dist/KanbanBoard-B7_Z5sh1.js +1697 -0
- package/dist/KanbanBoard-CyitudI1.cjs +1 -0
- package/dist/Modal-BmX1C448.cjs +1 -0
- package/dist/Modal-CrzpKyjK.js +74 -0
- package/dist/NotificationPanel-BzpDc10Q.js +54 -0
- package/dist/NotificationPanel-CFME00wq.cjs +1 -0
- package/dist/TooltipWrapper-BSAmUx9H.js +44 -0
- package/dist/TooltipWrapper-DfbFAZ1U.cjs +1 -0
- package/dist/advanced.cjs +10 -0
- package/dist/advanced.d.ts +44 -0
- package/dist/advanced.es.js +400 -0
- package/dist/avatar-BSdRHETK.cjs +1 -0
- package/dist/avatar-BvCUJ-_r.js +27 -0
- package/dist/button-BBMwzUtG.cjs +1 -0
- package/dist/button-CYyNwV8S.js +44 -0
- package/dist/calendar-DEHX32Cp.cjs +1 -0
- package/dist/calendar-DOIPGsyI.js +112 -0
- package/dist/card-CPlRZxbq.cjs +1 -0
- package/dist/card-ZUNxcdIM.js +60 -0
- package/dist/checkbox-BrCh_Iid.cjs +1 -0
- package/dist/checkbox-DRkQuB4W.js +21 -0
- package/dist/components/EzFlow/EzConnectionLine.d.ts +5 -0
- package/dist/components/EzFlow/EzFlow.examples.d.ts +5 -0
- package/dist/components/EzFlow/EzFlow.types.d.ts +260 -0
- package/dist/components/EzFlow/EzFlowBackground.d.ts +5 -0
- package/dist/components/EzFlow/EzFlowCanvas.d.ts +3 -0
- package/dist/components/EzFlow/EzFlowControls.d.ts +5 -0
- package/dist/components/EzFlow/EzFlowEdge.d.ts +5 -0
- package/dist/components/EzFlow/EzFlowHeader.d.ts +6 -0
- package/dist/components/EzFlow/EzFlowToolbox.d.ts +6 -0
- package/dist/components/EzFlow/EzWorkflow.d.ts +5 -0
- package/dist/components/EzFlow/EzWorkflowPerformance.d.ts +3 -0
- package/dist/components/EzFlow/EzWorkflowServiceAdapters.d.ts +24 -0
- package/dist/components/EzFlow/EzWorkflowValidation.d.ts +95 -0
- package/dist/components/EzFlow/index.d.ts +13 -0
- package/dist/components/EzFlow/nodes/ActionNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/ApprovalNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/DecisionNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/DelayNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/EndNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/GroupNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/LoopNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/RequestNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/StartNode.d.ts +3 -0
- package/dist/components/EzFlow/nodes/index.d.ts +9 -0
- package/dist/components/EzKanban/EzKanban.types.d.ts +808 -0
- package/dist/components/EzKanban/components/CardEditorModal.d.ts +23 -0
- package/dist/components/EzKanban/components/EzKanbanErrorFallback.d.ts +1 -0
- package/dist/components/EzKanban/components/FilterPopover.d.ts +10 -0
- package/dist/components/EzKanban/components/KanbanBoard.d.ts +59 -0
- package/dist/components/EzKanban/components/KanbanCard.d.ts +46 -0
- package/dist/components/EzKanban/components/KanbanColumn.d.ts +55 -0
- package/dist/components/EzKanban/components/KanbanSwimlane.d.ts +45 -0
- package/dist/components/EzKanban/components/KanbanToolbar.d.ts +41 -0
- package/dist/components/EzKanban/exports.d.ts +4 -0
- package/dist/components/EzKanban/hooks/useKanbanCards.d.ts +36 -0
- package/dist/components/EzKanban/hooks/useKanbanColumns.d.ts +27 -0
- package/dist/components/EzKanban/hooks/useKanbanDragDrop.d.ts +31 -0
- package/dist/components/EzKanban/hooks/useKanbanFilters.d.ts +23 -0
- package/dist/components/EzKanban/hooks/useKanbanState.d.ts +79 -0
- package/dist/components/EzKanban/hooks/useKanbanSwimlanes.d.ts +27 -0
- package/dist/components/EzKanban/hooks/useKanbanVirtualization.d.ts +16 -0
- package/dist/components/EzKanban/index.d.ts +51 -0
- package/dist/components/EzKanban/services/KanbanService.d.ts +31 -0
- package/dist/components/EzKanban/state/kanban.store.d.ts +33 -0
- package/dist/components/EzKanban/useEzKanban.d.ts +87 -0
- package/dist/components/EzKanban/views/KanbanTimelineView.d.ts +15 -0
- package/dist/components/EzLayout/Authentication/AuthSlider.d.ts +13 -0
- package/dist/components/EzLayout/Authentication/InputPassword.d.ts +7 -0
- package/dist/components/EzLayout/Authentication/SignInForm.d.ts +21 -0
- package/dist/components/EzLayout/Authentication/SignUpForm.d.ts +20 -0
- package/dist/components/EzLayout/EzHeader.d.ts +48 -0
- package/dist/components/EzLayout/EzLanguageSwitcher.d.ts +4 -0
- package/dist/components/EzLayout/EzLayout.types.d.ts +261 -0
- package/dist/components/EzLayout/EzOrganizationSwitcher.d.ts +14 -0
- package/dist/components/EzLayout/EzSidebar.d.ts +24 -0
- package/dist/components/EzLayout/EzThemeColorChanger.d.ts +9 -0
- package/dist/components/EzLayout/EzThemeSwitcher.d.ts +8 -0
- package/dist/components/EzLayout/EzUserProfile.d.ts +27 -0
- package/dist/components/EzLayout/components/EzSidebarFooter.d.ts +8 -0
- package/dist/components/EzLayout/components/EzSidebarNav.d.ts +10 -0
- package/dist/components/EzLayout/components/EzSidebarNavItem.d.ts +11 -0
- package/dist/components/EzLayout/components/MainContent.d.ts +13 -0
- package/dist/components/EzLayout/hooks/useLayoutImperative.d.ts +17 -0
- package/dist/components/EzLayout/hooks/useLayoutState.d.ts +25 -0
- package/dist/components/EzLayout/index.d.ts +23 -0
- package/dist/components/EzLayout/useEzLayout.d.ts +34 -0
- package/dist/components/EzScheduler/EzScheduler.types.d.ts +1252 -0
- package/dist/components/EzScheduler/EzSchedulerToolbar.d.ts +117 -0
- package/dist/components/EzScheduler/components/EzEventModal.d.ts +23 -0
- package/dist/components/EzScheduler/components/EzOverlapAlert.d.ts +12 -0
- package/dist/components/EzScheduler/components/EzQuickInfoPopup.d.ts +22 -0
- package/dist/components/EzScheduler/components/EzResourceSidebar.d.ts +33 -0
- package/dist/components/EzScheduler/components/EzSchedulerContent.d.ts +111 -0
- package/dist/components/EzScheduler/components/EzSchedulerQuickAdd.d.ts +17 -0
- package/dist/components/EzScheduler/components/RecurrenceEditor.d.ts +7 -0
- package/dist/components/EzScheduler/components/SchedulerLoadingSpinner.d.ts +2 -0
- package/dist/components/EzScheduler/components/dnd/DraggableEvent.d.ts +24 -0
- package/dist/components/EzScheduler/components/dnd/DroppableSlot.d.ts +19 -0
- package/dist/components/EzScheduler/hooks/useRecurrence.d.ts +2 -0
- package/dist/components/EzScheduler/hooks/useSchedulerEventHandlers.d.ts +15 -0
- package/dist/components/EzScheduler/hooks/useSchedulerEvents.d.ts +27 -0
- package/dist/components/EzScheduler/hooks/useSchedulerImperative.d.ts +19 -0
- package/dist/components/EzScheduler/hooks/useSchedulerNavigation.d.ts +9 -0
- package/dist/components/EzScheduler/hooks/useSchedulerResources.d.ts +10 -0
- package/dist/components/EzScheduler/hooks/useSchedulerState.d.ts +14 -0
- package/dist/components/EzScheduler/hooks/useSchedulerVirtualization.d.ts +9 -0
- package/dist/components/EzScheduler/index.d.ts +43 -0
- package/dist/components/EzScheduler/models/EventSettings.d.ts +11 -0
- package/dist/components/EzScheduler/models/View.d.ts +49 -0
- package/dist/components/EzScheduler/models/index.d.ts +2 -0
- package/dist/components/EzScheduler/services/AttendeeService.d.ts +15 -0
- package/dist/components/EzScheduler/services/AuditService.d.ts +15 -0
- package/dist/components/EzScheduler/services/CollisionDetectionService.d.ts +19 -0
- package/dist/components/EzScheduler/services/DragAndDropService.d.ts +16 -0
- package/dist/components/EzScheduler/services/HistoryService.d.ts +31 -0
- package/dist/components/EzScheduler/services/ICalendarImportService.d.ts +16 -0
- package/dist/components/EzScheduler/services/PrintService.d.ts +7 -0
- package/dist/components/EzScheduler/services/RecurrenceEngine.d.ts +7 -0
- package/dist/components/EzScheduler/services/ReminderService.d.ts +17 -0
- package/dist/components/EzScheduler/services/SchedulerService.d.ts +71 -0
- package/dist/components/EzScheduler/services/SearchService.d.ts +11 -0
- package/dist/components/EzScheduler/services/SecurityService.d.ts +25 -0
- package/dist/components/EzScheduler/services/TimezoneService.d.ts +20 -0
- package/dist/components/EzScheduler/services/VirtualScrollingService.d.ts +34 -0
- package/dist/components/EzScheduler/state/scheduler.store.d.ts +27 -0
- package/dist/components/EzScheduler/templates/CellTemplate.d.ts +42 -0
- package/dist/components/EzScheduler/templates/EditorTemplate.d.ts +32 -0
- package/dist/components/EzScheduler/templates/HeaderTemplate.d.ts +36 -0
- package/dist/components/EzScheduler/useEzScheduler.d.ts +104 -0
- package/dist/components/EzScheduler/utils/createDragConstraint.d.ts +7 -0
- package/dist/components/EzScheduler/utils/getWeekNumber.d.ts +8 -0
- package/dist/components/EzScheduler/utils/sanitizeHtml.d.ts +18 -0
- package/dist/components/EzScheduler/views/AgendaView.d.ts +28 -0
- package/dist/components/EzScheduler/views/DayWeekView.d.ts +177 -0
- package/dist/components/EzScheduler/views/MonthView.d.ts +60 -0
- package/dist/components/EzScheduler/views/TimelineView.d.ts +116 -0
- package/dist/components/EzSignature/EzSignature.d.ts +42 -0
- package/dist/components/EzSignature/EzSignature.types.d.ts +132 -0
- package/dist/components/EzSignature/index.d.ts +2 -0
- package/dist/components/EzTable/EzColumnMenu.d.ts +7 -0
- package/dist/components/EzTable/EzDateFilterTree.d.ts +7 -0
- package/dist/components/EzTable/EzExcelFilter.d.ts +8 -0
- package/dist/components/EzTable/EzFilterBuilder.d.ts +12 -0
- package/dist/components/EzTable/EzGroupingPanel.d.ts +9 -0
- package/dist/components/EzTable/EzHeaderContextMenu.d.ts +8 -0
- package/dist/components/EzTable/EzPagination.d.ts +19 -0
- package/dist/components/EzTable/EzTable.types.d.ts +1 -0
- package/dist/components/EzTable/EzTableEditDialog.d.ts +15 -0
- package/dist/components/EzTable/EzTableFooter.d.ts +10 -0
- package/dist/components/EzTable/EzTableOverlays.d.ts +11 -0
- package/dist/components/EzTable/EzTableStatusBar.d.ts +10 -0
- package/dist/components/EzTable/EzTableToolbar.d.ts +60 -0
- package/dist/components/EzTable/SmartCell.d.ts +7 -0
- package/dist/components/EzTable/components/AdvancedColumnFilter.d.ts +16 -0
- package/dist/components/EzTable/components/BooleanFilterSection.d.ts +7 -0
- package/dist/components/EzTable/components/EzDraggableHeader.d.ts +10 -0
- package/dist/components/EzTable/components/EzHeaderDragPreview.d.ts +7 -0
- package/dist/components/EzTable/components/EzTableBodySection.d.ts +72 -0
- package/dist/components/EzTable/components/EzTableCell.d.ts +46 -0
- package/dist/components/EzTable/components/EzTableHeaderSection.d.ts +23 -0
- package/dist/components/EzTable/components/EzTablePaginationSection.d.ts +31 -0
- package/dist/components/EzTable/components/EzTableRow.d.ts +58 -0
- package/dist/components/EzTable/components/FilterActionButtons.d.ts +16 -0
- package/dist/components/EzTable/components/FilterRuleSelect.d.ts +26 -0
- package/dist/components/EzTable/components/SelectAllCheckbox.d.ts +21 -0
- package/dist/components/EzTable/components/SelectFilterSection.d.ts +18 -0
- package/dist/components/EzTable/components/VirtualizedFilterList.d.ts +21 -0
- package/dist/components/EzTable/constants/filterOptions.d.ts +47 -0
- package/dist/components/EzTable/context/EzTableContext.d.ts +10 -0
- package/dist/components/EzTable/context/TableConfigContext.d.ts +13 -0
- package/dist/components/EzTable/context/TableStore.d.ts +17 -0
- package/dist/components/EzTable/filterUtils.d.ts +5 -0
- package/dist/components/EzTable/hooks/useAutoFit.d.ts +4 -0
- package/dist/components/EzTable/hooks/useCellEventHandlers.d.ts +16 -0
- package/dist/components/EzTable/hooks/useColumnSizeVars.d.ts +6 -0
- package/dist/components/EzTable/hooks/useContainerResize.d.ts +11 -0
- package/dist/components/EzTable/hooks/useDialogStateInitialization.d.ts +8 -0
- package/dist/components/EzTable/hooks/useFilterSelection.d.ts +12 -0
- package/dist/components/EzTable/hooks/useTableFiltering.d.ts +23 -0
- package/dist/components/EzTable/hooks/useTableHistory.d.ts +87 -0
- package/dist/components/EzTable/hooks/useTableImperative.d.ts +42 -0
- package/dist/components/EzTable/hooks/useTableSelection.d.ts +32 -0
- package/dist/components/EzTable/hooks/useTableState.d.ts +33 -0
- package/dist/components/EzTable/hooks/useTableVirtualization.d.ts +35 -0
- package/dist/components/EzTable/index.d.ts +54 -0
- package/dist/components/EzTable/renderers/index.d.ts +6 -0
- package/dist/components/EzTable/services/TableService.d.ts +29 -0
- package/dist/components/EzTable/types/EzTableColumn.types.d.ts +146 -0
- package/dist/components/EzTable/types/EzTableEdit.types.d.ts +58 -0
- package/dist/components/EzTable/types/EzTableFilter.types.d.ts +50 -0
- package/dist/components/EzTable/types/EzTableProps.d.ts +750 -0
- package/dist/components/EzTable/types/index.d.ts +4 -0
- package/dist/components/EzTable/useEzTable.d.ts +17 -0
- package/dist/components/EzTable/utils/SizingUtils.d.ts +11 -0
- package/dist/components/EzTable/utils/TextMeasurer.d.ts +1 -0
- package/dist/components/EzTable/utils/TruncatedTooltip.d.ts +7 -0
- package/dist/components/EzTable/utils/columnTypeDetector.d.ts +5 -0
- package/dist/components/EzTable/utils/filterTypeGuards.d.ts +3 -0
- package/dist/components/EzTable/utils/index.d.ts +1 -0
- package/dist/components/EzTreeView/EzTreeView.types.d.ts +364 -0
- package/dist/components/EzTreeView/EzTreeViewItem.d.ts +89 -0
- package/dist/components/EzTreeView/EzVirtualTree.d.ts +84 -0
- package/dist/components/EzTreeView/components/EzTreeViewLoadingSpinner.d.ts +2 -0
- package/dist/components/EzTreeView/hooks/useTreeDragDrop.d.ts +31 -0
- package/dist/components/EzTreeView/hooks/useTreeExpansion.d.ts +21 -0
- package/dist/components/EzTreeView/hooks/useTreeImperative.d.ts +28 -0
- package/dist/components/EzTreeView/hooks/useTreeSelection.d.ts +31 -0
- package/dist/components/EzTreeView/hooks/useTreeState.d.ts +21 -0
- package/dist/components/EzTreeView/hooks/useTreeVirtualization.d.ts +18 -0
- package/dist/components/EzTreeView/index.d.ts +40 -0
- package/dist/components/EzTreeView/services/TreeService.d.ts +11 -0
- package/dist/components/EzTreeView/useEzTreeView.d.ts +50 -0
- package/dist/components/EzTreeView/utils/treeUtils.d.ts +17 -0
- package/dist/components/shared/components/EzErrorBoundary.d.ts +18 -0
- package/dist/components/shared/components/EzLayoutErrorFallback.d.ts +2 -0
- package/dist/components/shared/components/EzLoadingSpinner.d.ts +8 -0
- package/dist/components/shared/components/EzSchedulerErrorFallback.d.ts +2 -0
- package/dist/components/shared/components/EzSortableList.d.ts +12 -0
- package/dist/components/shared/components/EzTableErrorFallback.d.ts +2 -0
- package/dist/components/shared/components/EzTreeViewErrorFallback.d.ts +2 -0
- package/dist/components/ui/avatar.d.ts +10 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/calendar.d.ts +15 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/checkbox.d.ts +7 -0
- package/dist/components/ui/combobox.d.ts +19 -0
- package/dist/components/ui/command.d.ts +78 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/date-time-picker.d.ts +14 -0
- package/dist/components/ui/dropdown-menu.d.ts +31 -0
- package/dist/components/ui/index.d.ts +27 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/label.d.ts +9 -0
- package/dist/components/ui/modal.d.ts +9 -0
- package/dist/components/ui/password-input.d.ts +5 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/progress.d.ts +7 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +26 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +22 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/date-time-picker-Bs-7XzHD.cjs +1 -0
- package/dist/date-time-picker-fUzf4TnU.js +127 -0
- package/dist/dropdown-menu-BRP0tyR_.cjs +1 -0
- package/dist/dropdown-menu-B_7_K13o.js +78 -0
- package/dist/ezux.css +2 -1
- package/dist/flow.cjs +1 -0
- package/dist/flow.d.ts +2 -0
- package/dist/flow.es.js +2 -0
- package/dist/index.cjs +3 -12
- package/dist/index.d.ts +66 -6404
- package/dist/index.es.js +229 -1041
- package/dist/input-CYlvlbF7.cjs +1 -0
- package/dist/input-Cj3sQK3M.js +14 -0
- package/dist/kanban.cjs +1 -1
- package/dist/kanban.d.ts +2 -1343
- package/dist/kanban.es.js +4 -17
- package/dist/label-BGgvoZWD.cjs +1 -0
- package/dist/label-DWEV--5W.js +16 -0
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +2 -690
- package/dist/layout.es.js +2 -20
- package/dist/lib/perfect-freehand.d.ts +221 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/mock-services.cjs +1 -0
- package/dist/mock-services.d.ts +8 -0
- package/dist/mock-services.es.js +161 -0
- package/dist/popover-D1akYj0W.js +17 -0
- package/dist/popover-wZKNvYM5.cjs +1 -0
- package/dist/scheduler.cjs +1 -1
- package/dist/scheduler.d.ts +2 -1430
- package/dist/scheduler.es.js +2 -11
- package/dist/scroll-area-BJs87d45.js +35 -0
- package/dist/scroll-area-DSkE2KB_.cjs +1 -0
- package/dist/select-D4tFaSai.js +43 -0
- package/dist/select-sVieKbLu.cjs +1 -0
- package/dist/shared/components/AnimatedText.d.ts +44 -0
- package/dist/shared/components/BaseCell.d.ts +14 -0
- package/dist/shared/components/BooleanRenderer.d.ts +34 -0
- package/dist/shared/components/ChartRenderer.d.ts +19 -0
- package/dist/shared/components/DeleteConfirmationModal.d.ts +11 -0
- package/dist/shared/components/EzContextMenu.d.ts +12 -0
- package/dist/shared/components/EzNotificationDropdown.d.ts +2 -0
- package/dist/shared/components/HighlightText.d.ts +4 -0
- package/dist/shared/components/Modal.d.ts +13 -0
- package/dist/shared/components/NotificationPanel.d.ts +2 -0
- package/dist/shared/components/PrimitiveRenderer.d.ts +39 -0
- package/dist/shared/components/SearchableSelect.d.ts +13 -0
- package/dist/shared/components/SelectRenderer.d.ts +33 -0
- package/dist/shared/components/StatusBadge.d.ts +21 -0
- package/dist/shared/components/TooltipWrapper.d.ts +12 -0
- package/dist/shared/components/index.d.ts +9 -0
- package/dist/shared/contexts/EzProvider.d.ts +56 -0
- package/dist/shared/hooks/index.d.ts +56 -0
- package/dist/shared/hooks/useBaseComponent.d.ts +59 -0
- package/dist/shared/hooks/useComponentImperativeAPI.d.ts +11 -0
- package/dist/shared/hooks/useComponentState.d.ts +39 -0
- package/dist/shared/hooks/useCurrentTime.d.ts +6 -0
- package/dist/shared/hooks/useDataChangeEvents.d.ts +53 -0
- package/dist/shared/hooks/useDebounce.d.ts +10 -0
- package/dist/shared/hooks/useDeleteConfirmation.d.ts +9 -0
- package/dist/shared/hooks/useDialogState.d.ts +21 -0
- package/dist/shared/hooks/useDndHandlers.d.ts +19 -0
- package/dist/shared/hooks/useEditing.d.ts +107 -0
- package/dist/shared/hooks/useEventHandlers.d.ts +61 -0
- package/dist/shared/hooks/useEzTheme.d.ts +22 -0
- package/dist/shared/hooks/useFieldValidation.d.ts +24 -0
- package/dist/shared/hooks/useHistory.d.ts +13 -0
- package/dist/shared/hooks/useI18n.d.ts +8 -0
- package/dist/shared/hooks/useImperativeAPI.d.ts +8 -0
- package/dist/shared/hooks/useInitCoreServices.d.ts +5 -0
- package/dist/shared/hooks/useKeyboardNavigation.d.ts +36 -0
- package/dist/shared/hooks/useKeyboardShortcuts.d.ts +14 -0
- package/dist/shared/hooks/useLifecycleEvents.d.ts +22 -0
- package/dist/shared/hooks/useLoadingState.d.ts +17 -0
- package/dist/shared/hooks/useMediaQuery.d.ts +6 -0
- package/dist/shared/hooks/useNotificationService.d.ts +8 -0
- package/dist/shared/hooks/usePerformanceMonitor.d.ts +22 -0
- package/dist/shared/hooks/useRowSelectionEvents.d.ts +44 -0
- package/dist/shared/hooks/useSelection.d.ts +73 -0
- package/dist/shared/hooks/useService.d.ts +12 -0
- package/dist/shared/hooks/useServiceState.d.ts +1 -0
- package/dist/shared/hooks/useStateChangeEvents.d.ts +61 -0
- package/dist/shared/hooks/useTheme.d.ts +13 -0
- package/dist/shared/hooks/useVirtualization.d.ts +85 -0
- package/dist/shared/services/BaseService.d.ts +57 -0
- package/dist/shared/services/ContextMenuService.d.ts +58 -0
- package/dist/shared/services/ExportService.d.ts +35 -0
- package/dist/shared/services/FocusManagerService.d.ts +33 -0
- package/dist/shared/services/HierarchyService.d.ts +43 -0
- package/dist/shared/services/I18nService.d.ts +84 -0
- package/dist/shared/services/LayoutService.d.ts +80 -0
- package/dist/shared/services/NotificationService.d.ts +44 -0
- package/dist/shared/services/PersistenceService.d.ts +69 -0
- package/dist/shared/services/ServiceRegistry.d.ts +52 -0
- package/dist/shared/services/ThemeService.d.ts +49 -0
- package/dist/shared/services/VirtualizationService.d.ts +51 -0
- package/dist/shared/state/store.d.ts +10 -0
- package/dist/shared/themes.d.ts +25 -0
- package/dist/shared/types/BaseProps.d.ts +17 -0
- package/dist/shared/types/common.d.ts +373 -0
- package/dist/shared/types/index.d.ts +2 -0
- package/dist/shared/utils/canvasUtils.d.ts +16 -0
- package/dist/shared/utils/commonUtils.d.ts +28 -0
- package/dist/shared/utils/csvUtils.d.ts +7 -0
- package/dist/shared/utils/dateUtils.d.ts +5 -0
- package/dist/shared/utils/dndUtils.d.ts +16 -0
- package/dist/shared/utils/formatUtils.d.ts +20 -0
- package/dist/shared/utils/imperativeApiUtils.d.ts +36 -0
- package/dist/shared/utils/index.d.ts +11 -0
- package/dist/shared/utils/renderUtils.d.ts +6 -0
- package/dist/shared/utils/serviceUtils.d.ts +10 -0
- package/dist/shared/utils/styleUtils.d.ts +121 -0
- package/dist/shared/utils/validationUtils.d.ts +16 -0
- package/dist/signature.cjs +1 -1
- package/dist/signature.d.ts +2 -410
- package/dist/signature.es.js +2 -4
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +2 -1059
- package/dist/table.es.js +2 -17
- package/dist/theme-vars.css +143 -135
- package/dist/tooltip-B1wC9m05.js +16 -0
- package/dist/tooltip-Qmzrg5u5.cjs +1 -0
- package/dist/treeview.cjs +1 -1
- package/dist/treeview.d.ts +2 -656
- package/dist/treeview.es.js +2 -954
- package/dist/useComponentState-DiSFLYju.js +57 -0
- package/dist/useComponentState-Wcz6pjd6.cjs +1 -0
- package/dist/useImperativeAPI-Dbx2hMTb.js +7 -0
- package/dist/useImperativeAPI-VrgLwXEO.cjs +1 -0
- package/dist/useInitCoreServices-CuBrviDM.js +40 -0
- package/dist/useInitCoreServices-DlALVDNx.cjs +1 -0
- package/dist/useService-CnCBGG3G.js +10 -0
- package/dist/useService-CyF782jv.cjs +1 -0
- package/dist/useServiceState-CkrJZm1D.js +21 -0
- package/dist/useServiceState-PyYQWxHi.cjs +1 -0
- package/package.json +76 -56
- package/dist/EzContextMenu-B6HBUjWv.cjs +0 -5
- package/dist/EzContextMenu-BSA_B6Pr.js +0 -3500
- package/dist/EzErrorBoundary-CEdz_hDo.cjs +0 -41
- package/dist/EzErrorBoundary-D4NBadES.js +0 -3727
- package/dist/EzEventModal-BUMp_BFi.js +0 -689
- package/dist/EzEventModal-xzHfzi0O.cjs +0 -1
- package/dist/EzGroupingPanel-BUsIYDRi.js +0 -143
- package/dist/EzGroupingPanel-D0HdSomF.cjs +0 -1
- package/dist/EzSchedulerQuickAdd-C653LTGh.js +0 -118
- package/dist/EzSchedulerQuickAdd-UnOWCpJd.cjs +0 -1
- package/dist/EzSchedulerToolbar-C-5OdRY6.cjs +0 -1
- package/dist/EzSchedulerToolbar-CO5jjDQg.js +0 -240
- package/dist/EzSignature-BaNesxwC.cjs +0 -1
- package/dist/EzSignature-D4EYwo9W.js +0 -419
- package/dist/EzTableEditDialog-Cd948V1C.js +0 -63
- package/dist/EzTableEditDialog-NiOubaMT.cjs +0 -1
- package/dist/EzTableFooter-CWjfGCjL.cjs +0 -1
- package/dist/EzTableFooter-DveD12RC.js +0 -54
- package/dist/EzTableToolbar-Bz8UWv6j.js +0 -246
- package/dist/EzTableToolbar-DHE7Bb1R.cjs +0 -1
- package/dist/HighlightText-8D6KEyBw.js +0 -68
- package/dist/HighlightText-LtZmzCle.cjs +0 -1
- package/dist/NotificationPanel-D2Y-_ahk.js +0 -68
- package/dist/NotificationPanel-zLxrtTGf.cjs +0 -1
- package/dist/TooltipWrapper-BrRTi5EJ.js +0 -2021
- package/dist/TooltipWrapper-DWts4bAI.cjs +0 -1
- package/dist/avatar-BeK0E4mn.js +0 -41
- package/dist/avatar-DZAaTK2f.cjs +0 -1
- package/dist/bell-DAz8P0BR.js +0 -14
- package/dist/bell-DOX2y38e.cjs +0 -1
- package/dist/calendar-BMZ8ddOf.cjs +0 -1
- package/dist/calendar-Dy3rVMW2.js +0 -90
- package/dist/checkbox-B0lGHUyy.cjs +0 -1
- package/dist/checkbox-boJRxICT.js +0 -46
- package/dist/chevron-down-C3s8jU6B.js +0 -5
- package/dist/chevron-down-DZVL7VHW.cjs +0 -1
- package/dist/chevron-left-BFr8XZyF.js +0 -5
- package/dist/chevron-left-HWhRo6IH.cjs +0 -1
- package/dist/circle-alert-77QqFR-z.cjs +0 -1
- package/dist/circle-alert-B2AMDd8N.js +0 -9
- package/dist/circle-x-Cv7bfIC_.js +0 -9
- package/dist/circle-x-DwVXxhXr.cjs +0 -1
- package/dist/date-time-picker-DTxHdPgQ.cjs +0 -1
- package/dist/date-time-picker-Dj2eftJI.js +0 -1636
- package/dist/download-0ZhO2XaW.cjs +0 -1
- package/dist/download-panVHmk6.js +0 -9
- package/dist/ellipsis-CuqNthAj.js +0 -9
- package/dist/ellipsis-CzlqJf-i.cjs +0 -1
- package/dist/grip-vertical-CSyDKBul.js +0 -12
- package/dist/grip-vertical-DZNBW1Dn.cjs +0 -1
- package/dist/index-B3ipEEhH.cjs +0 -2
- package/dist/index-BPPb7bcs.js +0 -3220
- package/dist/index-BQKw_Vho.js +0 -9604
- package/dist/index-C5STgBSy.js +0 -5203
- package/dist/index-C6NfgycP.js +0 -4644
- package/dist/index-D4f2ZdrG.cjs +0 -2
- package/dist/index-DUY1SqMo.cjs +0 -1
- package/dist/index-c1Zg--dt.cjs +0 -7
- package/dist/input-BgM_la4k.cjs +0 -1
- package/dist/input-jYQ5VKNR.js +0 -21
- package/dist/isBefore-C3Y_wbk3.js +0 -15
- package/dist/isBefore-Cp1ttk6q.cjs +0 -1
- package/dist/label-ClOW9UCt.js +0 -55
- package/dist/label-Dx6oDB-X.cjs +0 -1
- package/dist/layers-BA4i1fYX.js +0 -27
- package/dist/layers-xSPd-hz3.cjs +0 -1
- package/dist/popover-BJq1CKmi.cjs +0 -1
- package/dist/popover-Cmlb7w3R.js +0 -341
- package/dist/scroll-area-9fwpVNxT.js +0 -573
- package/dist/scroll-area-CwwZSSA4.cjs +0 -1
- package/dist/select-GxA46anr.cjs +0 -1
- package/dist/select-mDCun_IR.js +0 -35
- package/dist/settings-CvyjK75A.js +0 -31
- package/dist/settings-DKPknrt8.cjs +0 -1
- package/dist/sortable.esm-CsRPuXyD.cjs +0 -1
- package/dist/sortable.esm-CzMCDPet.js +0 -477
- package/dist/tooltip-B41iztKT.cjs +0 -1
- package/dist/tooltip-BCtrEe0z.js +0 -490
- package/dist/useComponentState-C87xXa5d.js +0 -64
- package/dist/useComponentState-DDgGbBXv.cjs +0 -1
- package/dist/useImperativeAPI-DXmCQvPL.js +0 -7
- package/dist/useImperativeAPI-DbZ3owSV.cjs +0 -1
- package/dist/useInitCoreServices-CwXv2p4S.cjs +0 -1
- package/dist/useInitCoreServices-D1WaWlaI.js +0 -3929
- package/dist/useService-8OoezWr8.cjs +0 -1
- package/dist/useService-BUi3uAqE.js +0 -10
- package/dist/useServiceState-BjpCjUn2.cjs +0 -1
- package/dist/useServiceState-VE-viK8b.js +0 -24
|
@@ -0,0 +1,4290 @@
|
|
|
1
|
+
import { _ as e, f as t, n, u as r } from "./EzProvider-AlmsYIDk.js";
|
|
2
|
+
import { t as i } from "./button-CYyNwV8S.js";
|
|
3
|
+
import { t as a } from "./input-Cj3sQK3M.js";
|
|
4
|
+
import { t as o } from "./label-DWEV--5W.js";
|
|
5
|
+
import { n as s, t as c } from "./EzErrorBoundary-C7a6VisX.js";
|
|
6
|
+
import { t as l } from "./useComponentState-DiSFLYju.js";
|
|
7
|
+
import { n as u, t as d } from "./useInitCoreServices-CuBrviDM.js";
|
|
8
|
+
import { t as f } from "./useImperativeAPI-Dbx2hMTb.js";
|
|
9
|
+
import { t as p } from "./useServiceState-CkrJZm1D.js";
|
|
10
|
+
import { n as m, r as h, t as g } from "./popover-D1akYj0W.js";
|
|
11
|
+
import { i as _, n as v, r as y, t as b } from "./tooltip-B1wC9m05.js";
|
|
12
|
+
import { n as x, r as S, t as C } from "./HighlightText-DNA2R2uf.js";
|
|
13
|
+
import { a as w, i as T, n as E, r as D, t as O } from "./select-D4tFaSai.js";
|
|
14
|
+
import { t as k } from "./checkbox-DRkQuB4W.js";
|
|
15
|
+
import { _ as A, d as j, g as ee, i as te, n as M, o as N, t as P } from "./EzContextMenu-srLxujt8.js";
|
|
16
|
+
import { a as ne, i as F, o as I, r as re, s as L, t as R } from "./TooltipWrapper-BSAmUx9H.js";
|
|
17
|
+
import * as z from "react";
|
|
18
|
+
import B, { createContext as ie, memo as V, useCallback as H, useContext as ae, useEffect as U, useLayoutEffect as oe, useMemo as W, useRef as G, useState as K, useTransition as se } from "react";
|
|
19
|
+
import { AlertTriangle as ce, ArrowDown as le, ArrowUp as ue, Check as q, ChevronDown as de, ChevronLeft as fe, ChevronRight as pe, ChevronsLeft as me, ChevronsRight as he, ChevronsUpDown as ge, Circle as _e, Copy as ve, FilterIcon as ye, GripVertical as be, Group as xe, ListFilter as Se, Loader2 as Ce, Maximize2 as we, Minus as Te, Pin as Ee, PinOff as De, PlusIcon as Oe, RefreshCw as ke, Search as Ae, Ungroup as je, X as Me, XIcon as Ne } from "lucide-react";
|
|
20
|
+
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
21
|
+
import { Store as Pe } from "@tanstack/store";
|
|
22
|
+
import { DndContext as Fe, DragOverlay as Z, PointerSensor as Ie, pointerWithin as Le, useDraggable as Re, useDroppable as ze, useSensor as Be, useSensors as Ve } from "@dnd-kit/core";
|
|
23
|
+
import { useStore as He } from "@tanstack/react-store";
|
|
24
|
+
import { QueryClient as Ue, QueryClientProvider as We, useMutation as Ge, useQuery as Ke, useQueryClient as qe } from "@tanstack/react-query";
|
|
25
|
+
import { flexRender as Je, getCoreRowModel as Ye, getExpandedRowModel as Xe, getFacetedMinMaxValues as Ze, getFacetedUniqueValues as Qe, getFilteredRowModel as $e, getGroupedRowModel as et, getPaginationRowModel as tt, getSortedRowModel as nt, useReactTable as rt } from "@tanstack/react-table";
|
|
26
|
+
import * as it from "@radix-ui/react-switch";
|
|
27
|
+
import * as at from "@radix-ui/react-radio-group";
|
|
28
|
+
import { useVirtualizer as ot } from "@tanstack/react-virtual";
|
|
29
|
+
import { Command as Q } from "cmdk";
|
|
30
|
+
//#region src/shared/hooks/useDndHandlers.ts
|
|
31
|
+
var st = (e) => ({
|
|
32
|
+
sensors: Ve(Be(Ie, { activationConstraint: { distance: e.distance ?? 5 } })),
|
|
33
|
+
onDragStart: e.onDragStart,
|
|
34
|
+
onDragEnd: e.onDragEnd,
|
|
35
|
+
collisionDetection: e.collisionDetection
|
|
36
|
+
}), ct = (e) => {
|
|
37
|
+
let { validateField: t, editSettings: n } = e, r = H((e, r, i) => {
|
|
38
|
+
if (n?.requiredFields?.includes(e) && (r == null || r === "")) return {
|
|
39
|
+
isValid: !1,
|
|
40
|
+
error: "Field is required"
|
|
41
|
+
};
|
|
42
|
+
let a = n?.validationRules?.[e];
|
|
43
|
+
if (a) {
|
|
44
|
+
let t = a(r, i);
|
|
45
|
+
if (t !== !0 && t !== "") return {
|
|
46
|
+
isValid: !1,
|
|
47
|
+
error: typeof t == "string" ? t : `Invalid value for ${e}`
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (t) {
|
|
51
|
+
let n = t({
|
|
52
|
+
fieldName: e,
|
|
53
|
+
value: r,
|
|
54
|
+
data: i
|
|
55
|
+
});
|
|
56
|
+
if (n !== !0 && n !== "") return {
|
|
57
|
+
isValid: !1,
|
|
58
|
+
error: typeof n == "string" ? n : `Validation failed for ${e}`
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return { isValid: !0 };
|
|
62
|
+
}, [t, n]);
|
|
63
|
+
return {
|
|
64
|
+
validate: r,
|
|
65
|
+
validateForm: H((e, t) => {
|
|
66
|
+
let n = {}, i = !0;
|
|
67
|
+
return t.forEach((t) => {
|
|
68
|
+
let a = r(t, e[t], e);
|
|
69
|
+
n[t] = a, a.isValid || (i = !1);
|
|
70
|
+
}), n.__form = { isValid: i }, n;
|
|
71
|
+
}, [r])
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/shared/hooks/useDialogState.ts
|
|
76
|
+
function lt(e = {}) {
|
|
77
|
+
let [t, n] = K(!1), [r, i] = K(e.initialMode || "view"), [a, o] = K(e.initialData || {}), [s, c] = K({});
|
|
78
|
+
return {
|
|
79
|
+
isOpen: t,
|
|
80
|
+
mode: r,
|
|
81
|
+
data: a,
|
|
82
|
+
meta: s,
|
|
83
|
+
open: H((t, r, a) => {
|
|
84
|
+
i(t), r === void 0 ? e.defaultData && o(e.defaultData) : o(r), a !== void 0 && c(a), n(!0);
|
|
85
|
+
}, [e.defaultData]),
|
|
86
|
+
close: H(() => {
|
|
87
|
+
n(!1);
|
|
88
|
+
}, []),
|
|
89
|
+
toggle: H(() => {
|
|
90
|
+
n((e) => !e);
|
|
91
|
+
}, []),
|
|
92
|
+
setData: o,
|
|
93
|
+
setMode: i
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/components/EzTable/hooks/useTableHistory.ts
|
|
98
|
+
var ut = (e, t = "id") => {
|
|
99
|
+
let n = W(() => {
|
|
100
|
+
let n = /* @__PURE__ */ new Map();
|
|
101
|
+
return Array.isArray(e) && e.forEach((e) => {
|
|
102
|
+
let r = e[t];
|
|
103
|
+
r !== void 0 && n.set(r, e);
|
|
104
|
+
}), n;
|
|
105
|
+
}, [e, t]), [r, i] = K({
|
|
106
|
+
data: Array.isArray(e) ? e : [],
|
|
107
|
+
history: {
|
|
108
|
+
past: [],
|
|
109
|
+
future: []
|
|
110
|
+
}
|
|
111
|
+
}), a = G(/* @__PURE__ */ new Set()), o = G(e);
|
|
112
|
+
o.current !== e && (o.current = e, i({
|
|
113
|
+
data: Array.isArray(e) ? e : [],
|
|
114
|
+
history: {
|
|
115
|
+
past: [],
|
|
116
|
+
future: []
|
|
117
|
+
}
|
|
118
|
+
}), a.current.clear());
|
|
119
|
+
let s = H((e) => {
|
|
120
|
+
i((t) => ({
|
|
121
|
+
...t,
|
|
122
|
+
data: typeof e == "function" ? e(t.data) : e
|
|
123
|
+
}));
|
|
124
|
+
}, []), c = H((e, n, r) => {
|
|
125
|
+
i((i) => {
|
|
126
|
+
let o = i.data[e];
|
|
127
|
+
if (!o) return i;
|
|
128
|
+
let s = o[n];
|
|
129
|
+
if (s === r) return i;
|
|
130
|
+
let c = o[t];
|
|
131
|
+
c !== void 0 && a.current.add(c);
|
|
132
|
+
let l = {
|
|
133
|
+
type: "EDIT_CELL",
|
|
134
|
+
payload: {
|
|
135
|
+
rowIndex: e,
|
|
136
|
+
rowId: c,
|
|
137
|
+
columnId: n,
|
|
138
|
+
oldValue: s,
|
|
139
|
+
newValue: r
|
|
140
|
+
},
|
|
141
|
+
timestamp: Date.now()
|
|
142
|
+
}, u = [...i.data];
|
|
143
|
+
return u[e] = {
|
|
144
|
+
...o,
|
|
145
|
+
[n]: r
|
|
146
|
+
}, {
|
|
147
|
+
data: u,
|
|
148
|
+
history: {
|
|
149
|
+
past: [...i.history.past, l],
|
|
150
|
+
future: []
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
}, [t]), l = H((e, n = 0) => {
|
|
155
|
+
i((r) => {
|
|
156
|
+
let i = { ...e };
|
|
157
|
+
i[t] === void 0 && (i[t] = `_temp_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`);
|
|
158
|
+
let o = i[t];
|
|
159
|
+
o !== void 0 && a.current.add(o);
|
|
160
|
+
let s = {
|
|
161
|
+
type: "ADD_ROW",
|
|
162
|
+
payload: {
|
|
163
|
+
rowIndex: n,
|
|
164
|
+
rowId: o,
|
|
165
|
+
row: i
|
|
166
|
+
},
|
|
167
|
+
timestamp: Date.now()
|
|
168
|
+
}, c = [...r.data];
|
|
169
|
+
return c.splice(n, 0, i), {
|
|
170
|
+
data: c,
|
|
171
|
+
history: {
|
|
172
|
+
past: [...r.history.past, s],
|
|
173
|
+
future: []
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
}, [t]), u = H((e) => {
|
|
178
|
+
i((n) => {
|
|
179
|
+
let r = [...e].sort((e, t) => t - e), i = [...n.history.past], o = [...n.data];
|
|
180
|
+
return r.forEach((e) => {
|
|
181
|
+
let r = n.data[e];
|
|
182
|
+
if (!r) return;
|
|
183
|
+
let s = r[t];
|
|
184
|
+
s !== void 0 && a.current.add(s), i.push({
|
|
185
|
+
type: "DELETE_ROW",
|
|
186
|
+
payload: {
|
|
187
|
+
rowIndex: e,
|
|
188
|
+
rowId: s,
|
|
189
|
+
row: r
|
|
190
|
+
},
|
|
191
|
+
timestamp: Date.now()
|
|
192
|
+
}), o.splice(e, 1);
|
|
193
|
+
}), {
|
|
194
|
+
data: o,
|
|
195
|
+
history: {
|
|
196
|
+
past: i,
|
|
197
|
+
future: []
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
}, [t]), d = H(() => {
|
|
202
|
+
i((e) => {
|
|
203
|
+
if (e.history.past.length === 0) return e;
|
|
204
|
+
let n = e.history.past[e.history.past.length - 1], r = e.history.past.slice(0, -1), i = [...e.data];
|
|
205
|
+
if (n.type === "EDIT_CELL") {
|
|
206
|
+
let { rowId: e, columnId: r, oldValue: a } = n.payload, o = i.findIndex((n) => n[t] === e);
|
|
207
|
+
o !== -1 && r && (i[o] = {
|
|
208
|
+
...i[o],
|
|
209
|
+
[r]: a
|
|
210
|
+
});
|
|
211
|
+
} else if (n.type === "ADD_ROW") {
|
|
212
|
+
let { rowId: e } = n.payload, r = i.findIndex((n) => n[t] === e);
|
|
213
|
+
r !== -1 && i.splice(r, 1);
|
|
214
|
+
} else if (n.type === "DELETE_ROW") {
|
|
215
|
+
let { rowIndex: e, row: t } = n.payload;
|
|
216
|
+
t && e !== void 0 && i.splice(e, 0, t);
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
data: i,
|
|
220
|
+
history: {
|
|
221
|
+
past: r,
|
|
222
|
+
future: [n, ...e.history.future]
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
}, [t]), f = H(() => {
|
|
227
|
+
i((e) => {
|
|
228
|
+
if (e.history.future.length === 0) return e;
|
|
229
|
+
let n = e.history.future[0], r = e.history.future.slice(1), i = [...e.data];
|
|
230
|
+
if (n.type === "EDIT_CELL") {
|
|
231
|
+
let { rowId: e, columnId: r, newValue: a } = n.payload, o = i.findIndex((n) => n[t] === e);
|
|
232
|
+
o !== -1 && r && (i[o] = {
|
|
233
|
+
...i[o],
|
|
234
|
+
[r]: a
|
|
235
|
+
});
|
|
236
|
+
} else if (n.type === "ADD_ROW") {
|
|
237
|
+
let { rowIndex: e, row: t } = n.payload;
|
|
238
|
+
t && e !== void 0 && i.splice(e, 0, t);
|
|
239
|
+
} else if (n.type === "DELETE_ROW") {
|
|
240
|
+
let { rowId: e } = n.payload, r = i.findIndex((n) => n[t] === e);
|
|
241
|
+
r !== -1 && i.splice(r, 1);
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
data: i,
|
|
245
|
+
history: {
|
|
246
|
+
past: [...e.history.past, n],
|
|
247
|
+
future: r
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
}, [t]), { data: p } = r;
|
|
252
|
+
return {
|
|
253
|
+
data: p,
|
|
254
|
+
setData: s,
|
|
255
|
+
performEdit: c,
|
|
256
|
+
addRow: l,
|
|
257
|
+
deleteRows: u,
|
|
258
|
+
undo: d,
|
|
259
|
+
redo: f,
|
|
260
|
+
canUndo: r.history.past.length > 0,
|
|
261
|
+
canRedo: r.history.future.length > 0,
|
|
262
|
+
changes: W(() => {
|
|
263
|
+
if (p === e) return {
|
|
264
|
+
added: 0,
|
|
265
|
+
edited: 0,
|
|
266
|
+
deleted: 0
|
|
267
|
+
};
|
|
268
|
+
let r = /* @__PURE__ */ new Map();
|
|
269
|
+
Array.isArray(p) && p.forEach((e) => {
|
|
270
|
+
let n = e[t];
|
|
271
|
+
n !== void 0 && r.set(n, e);
|
|
272
|
+
});
|
|
273
|
+
let i = 0, a = 0, o = 0;
|
|
274
|
+
return Array.isArray(p) && p.forEach((e) => {
|
|
275
|
+
let r = e[t];
|
|
276
|
+
if (r === void 0 || !n.has(r)) i++;
|
|
277
|
+
else {
|
|
278
|
+
let t = n.get(r);
|
|
279
|
+
if (e === t) return;
|
|
280
|
+
Object.keys(e).some((n) => n.startsWith("_") ? !1 : e[n] !== t[n]) && a++;
|
|
281
|
+
}
|
|
282
|
+
}), n.forEach((e, t) => {
|
|
283
|
+
r.has(t) || o++;
|
|
284
|
+
}), {
|
|
285
|
+
added: i,
|
|
286
|
+
edited: a,
|
|
287
|
+
deleted: o
|
|
288
|
+
};
|
|
289
|
+
}, [
|
|
290
|
+
p,
|
|
291
|
+
e,
|
|
292
|
+
n,
|
|
293
|
+
t
|
|
294
|
+
]),
|
|
295
|
+
batchChanges: W(() => {
|
|
296
|
+
if (p === e) return {
|
|
297
|
+
addedRecords: [],
|
|
298
|
+
changedRecords: [],
|
|
299
|
+
deletedRecords: []
|
|
300
|
+
};
|
|
301
|
+
let r = /* @__PURE__ */ new Map();
|
|
302
|
+
Array.isArray(p) && p.forEach((e) => {
|
|
303
|
+
let n = e[t];
|
|
304
|
+
n !== void 0 && r.set(n, e);
|
|
305
|
+
});
|
|
306
|
+
let i = [], a = [], o = [];
|
|
307
|
+
return Array.isArray(p) && p.forEach((e) => {
|
|
308
|
+
let r = e[t];
|
|
309
|
+
if (r === void 0 || !n.has(r)) i.push(e);
|
|
310
|
+
else {
|
|
311
|
+
let t = n.get(r);
|
|
312
|
+
if (e === t) return;
|
|
313
|
+
Object.keys(e).some((n) => n.startsWith("_") ? !1 : e[n] !== t[n]) && a.push(e);
|
|
314
|
+
}
|
|
315
|
+
}), n.forEach((e, t) => {
|
|
316
|
+
r.has(t) || o.push(e);
|
|
317
|
+
}), {
|
|
318
|
+
addedRecords: i,
|
|
319
|
+
changedRecords: a,
|
|
320
|
+
deletedRecords: o
|
|
321
|
+
};
|
|
322
|
+
}, [
|
|
323
|
+
p,
|
|
324
|
+
e,
|
|
325
|
+
n,
|
|
326
|
+
t
|
|
327
|
+
]),
|
|
328
|
+
resetData: H(() => {
|
|
329
|
+
a.current.clear(), i({
|
|
330
|
+
data: e,
|
|
331
|
+
history: {
|
|
332
|
+
past: [],
|
|
333
|
+
future: []
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}, [e])
|
|
337
|
+
};
|
|
338
|
+
}, dt = (e, t = "14px Inter, sans-serif") => {
|
|
339
|
+
if (typeof document > "u") return 0;
|
|
340
|
+
let n = document.createElement("canvas").getContext("2d");
|
|
341
|
+
return n ? (n.font = t, n.measureText(e).width) : 0;
|
|
342
|
+
}, ft = (e, t = {}) => {
|
|
343
|
+
let { fontSize: n = "14px", fontWeight: r = "600", fontFamily: i = "Inter, sans-serif", padding: a = 32, hasIcons: o = !0 } = t, s = dt(e, `${r} ${n} ${i}`), c = o ? 70 : 0;
|
|
344
|
+
return Math.ceil(s + a + c);
|
|
345
|
+
}, pt = (e) => ({ autoFitColumn: H((n) => {
|
|
346
|
+
let i = e.getColumn(n);
|
|
347
|
+
if (!i) return;
|
|
348
|
+
let a = e.getRowModel().rows.slice(0, 50), o = {
|
|
349
|
+
fontSize: "14px",
|
|
350
|
+
fontWeight: "400",
|
|
351
|
+
fontFamily: "Inter, sans-serif"
|
|
352
|
+
}, s = {
|
|
353
|
+
fontSize: "14px",
|
|
354
|
+
fontWeight: "600",
|
|
355
|
+
fontFamily: "Inter, sans-serif"
|
|
356
|
+
}, c = i.columnDef.meta, l = 0, u = typeof i.columnDef.header == "string" ? i.columnDef.header : n;
|
|
357
|
+
l = Math.max(l, ft(u, { ...s })), a.forEach((e) => {
|
|
358
|
+
let i = e.getValue(n);
|
|
359
|
+
c?.columnType === "number" ? i = t(i, c.numberOptions) : c?.columnType === "date" ? i = r(i, c.dateOptions) : c?.columnType === "datetime" && (i = r(i, c.dateTimeOptions));
|
|
360
|
+
let a = i == null ? "" : String(i), s = a;
|
|
361
|
+
c?.columnType === "longtext" && c?.longTextOptions?.previewLength && (s = a.length > c.longTextOptions.previewLength ? a.substring(0, c.longTextOptions.previewLength) + "..." : a);
|
|
362
|
+
let u = dt(s, `${o.fontWeight} ${o.fontSize} ${o.fontFamily}`);
|
|
363
|
+
l = Math.max(l, u + 32);
|
|
364
|
+
}), e.setColumnSizing((e) => ({
|
|
365
|
+
...e,
|
|
366
|
+
[n]: l
|
|
367
|
+
}));
|
|
368
|
+
}, [e]) }), mt = (e) => e?.kind === "group", ht = (e, t, n) => {
|
|
369
|
+
if (typeof n == "string") {
|
|
370
|
+
if (!n) return !0;
|
|
371
|
+
let t = n.toLowerCase();
|
|
372
|
+
return e.getAllCells().some((e) => {
|
|
373
|
+
let n = e.getValue();
|
|
374
|
+
return String(n ?? "").toLowerCase().includes(t);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
let { quickSearch: r, advanced: i } = n;
|
|
378
|
+
if (r) {
|
|
379
|
+
let t = r.toLowerCase();
|
|
380
|
+
if (!e.getAllCells().some((e) => {
|
|
381
|
+
let n = e.getValue();
|
|
382
|
+
return String(n ?? "").toLowerCase().includes(t);
|
|
383
|
+
})) return !1;
|
|
384
|
+
}
|
|
385
|
+
return !(i && !x(i, (t) => e.getValue(t)));
|
|
386
|
+
}, gt = (e, t, n) => {
|
|
387
|
+
try {
|
|
388
|
+
if (Array.isArray(n)) {
|
|
389
|
+
if (n.length === 0) return !0;
|
|
390
|
+
let r = e.getValue(t);
|
|
391
|
+
return n.includes(r);
|
|
392
|
+
}
|
|
393
|
+
if (typeof n == "object" && n) {
|
|
394
|
+
if (mt(n)) return x(n, (n) => e.getValue(n || t));
|
|
395
|
+
if ("operator" in n) return S({
|
|
396
|
+
kind: "rule",
|
|
397
|
+
id: t,
|
|
398
|
+
field: t,
|
|
399
|
+
operator: n.operator,
|
|
400
|
+
value: n.value
|
|
401
|
+
}, (t) => e.getValue(t));
|
|
402
|
+
}
|
|
403
|
+
let r = e.getValue(t), i = String(r ?? "").toLowerCase(), a = String(n ?? "").toLowerCase();
|
|
404
|
+
return i.includes(a);
|
|
405
|
+
} catch (e) {
|
|
406
|
+
return console.error(`Error in smartColumnFilterFn for column ${t}:`, e), !0;
|
|
407
|
+
}
|
|
408
|
+
}, _t = ({ value: t, className: n, title: r, children: i, fallback: a = /* @__PURE__ */ Y("span", {
|
|
409
|
+
className: "text-muted-foreground text-sm italic",
|
|
410
|
+
children: "—"
|
|
411
|
+
}), align: o = "left" }) => t == null ? /* @__PURE__ */ Y(J, { children: a }) : /* @__PURE__ */ Y("div", {
|
|
412
|
+
className: e("text-sm", o === "center" && "text-center", o === "right" && "text-right", n),
|
|
413
|
+
title: r === void 0 ? typeof t == "string" ? t : String(t) : r,
|
|
414
|
+
children: i || String(t)
|
|
415
|
+
}), vt = ({ value: n, columnType: a, meta: o, className: s, align: c, table: l }) => {
|
|
416
|
+
let u = n;
|
|
417
|
+
if (n == null) return /* @__PURE__ */ Y(_t, {
|
|
418
|
+
value: n,
|
|
419
|
+
align: c,
|
|
420
|
+
className: s
|
|
421
|
+
});
|
|
422
|
+
switch (a) {
|
|
423
|
+
case "number":
|
|
424
|
+
u = t(n, {
|
|
425
|
+
minimumFractionDigits: 2,
|
|
426
|
+
maximumFractionDigits: 2,
|
|
427
|
+
...o?.numberOptions
|
|
428
|
+
});
|
|
429
|
+
break;
|
|
430
|
+
case "date":
|
|
431
|
+
case "datetime":
|
|
432
|
+
u = r(n, a === "datetime" ? o?.dateTimeOptions : o?.dateOptions);
|
|
433
|
+
break;
|
|
434
|
+
case "longtext":
|
|
435
|
+
let e = String(n);
|
|
436
|
+
u = /* @__PURE__ */ X("div", {
|
|
437
|
+
className: "flex items-start gap-1 group/longtext w-full overflow-hidden py-1.5",
|
|
438
|
+
children: [/* @__PURE__ */ X(b, { children: [/* @__PURE__ */ Y(_, {
|
|
439
|
+
asChild: !0,
|
|
440
|
+
children: /* @__PURE__ */ Y("div", {
|
|
441
|
+
className: "flex-1 min-w-0 cursor-help",
|
|
442
|
+
children: /* @__PURE__ */ Y("span", {
|
|
443
|
+
className: "block !whitespace-normal break-words text-sm leading-normal",
|
|
444
|
+
style: {
|
|
445
|
+
display: "-webkit-box",
|
|
446
|
+
WebkitLineClamp: 2,
|
|
447
|
+
WebkitBoxOrient: "vertical",
|
|
448
|
+
overflow: "hidden"
|
|
449
|
+
},
|
|
450
|
+
children: e
|
|
451
|
+
})
|
|
452
|
+
})
|
|
453
|
+
}), /* @__PURE__ */ Y(v, {
|
|
454
|
+
className: "max-w-[300px] p-3 break-words text-sm leading-relaxed",
|
|
455
|
+
children: e
|
|
456
|
+
})] }), e.length > 20 && /* @__PURE__ */ X(g, { children: [/* @__PURE__ */ Y(h, {
|
|
457
|
+
asChild: !0,
|
|
458
|
+
children: /* @__PURE__ */ Y(i, {
|
|
459
|
+
variant: "ghost",
|
|
460
|
+
size: "icon",
|
|
461
|
+
className: "h-5 w-5 opacity-0 group-hover/longtext:opacity-100 transition-opacity shrink-0",
|
|
462
|
+
onClick: (e) => e.stopPropagation(),
|
|
463
|
+
children: /* @__PURE__ */ Y(we, { className: "h-3 w-3 text-muted-foreground hover:text-primary" })
|
|
464
|
+
})
|
|
465
|
+
}), /* @__PURE__ */ Y(m, {
|
|
466
|
+
className: "w-[400px] p-4 shadow-xl border-border bg-popover",
|
|
467
|
+
align: "end",
|
|
468
|
+
onClick: (e) => e.stopPropagation(),
|
|
469
|
+
children: /* @__PURE__ */ X("div", {
|
|
470
|
+
className: "space-y-3",
|
|
471
|
+
children: [/* @__PURE__ */ X("div", {
|
|
472
|
+
className: "flex items-center justify-between border-b pb-2",
|
|
473
|
+
children: [/* @__PURE__ */ Y("h4", {
|
|
474
|
+
className: "text-xs font-bold uppercase tracking-widest text-muted-foreground",
|
|
475
|
+
children: "Detailed Description"
|
|
476
|
+
}), /* @__PURE__ */ X(i, {
|
|
477
|
+
variant: "outline",
|
|
478
|
+
size: "sm",
|
|
479
|
+
className: "h-7 px-2 gap-1.5 text-[10px] font-bold",
|
|
480
|
+
onClick: (t) => {
|
|
481
|
+
t.stopPropagation(), navigator.clipboard.writeText(e);
|
|
482
|
+
},
|
|
483
|
+
children: [/* @__PURE__ */ Y(ve, { className: "h-3 w-3" }), "Copy"]
|
|
484
|
+
})]
|
|
485
|
+
}), /* @__PURE__ */ Y("div", {
|
|
486
|
+
className: "text-sm leading-relaxed text-foreground max-h-[300px] overflow-auto pr-2 custom-scrollbar whitespace-pre-wrap",
|
|
487
|
+
children: e
|
|
488
|
+
})]
|
|
489
|
+
})
|
|
490
|
+
})] })]
|
|
491
|
+
});
|
|
492
|
+
break;
|
|
493
|
+
default: break;
|
|
494
|
+
}
|
|
495
|
+
if (l?.options.meta?.enableSearchHighlighting) {
|
|
496
|
+
let e = l.getState().globalFilter, t = typeof e == "string" ? e : e?.quickSearch;
|
|
497
|
+
t && (u = /* @__PURE__ */ Y(C, {
|
|
498
|
+
text: u,
|
|
499
|
+
highlight: t
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
let d = c || (a === "number" ? "right" : "left");
|
|
503
|
+
return /* @__PURE__ */ Y(_t, {
|
|
504
|
+
value: n,
|
|
505
|
+
align: d,
|
|
506
|
+
title: a === "longtext" || o?.clipMode === "ellipsis-tooltip" ? "" : void 0,
|
|
507
|
+
className: e(a === "number" && "font-mono tabular-nums", a === "number" && n < 0 && "text-rose-600 dark:text-rose-400", "px-3 min-h-full flex", a === "longtext" ? "items-start py-2 overflow-hidden" : o?.wrapText ? "items-start" : "items-center", d === "right" && "justify-end", d === "center" && "justify-center", s),
|
|
508
|
+
children: u
|
|
509
|
+
});
|
|
510
|
+
}, yt = ({ value: t, onChange: n, onBlur: r, columnType: i, autoFocus: o = !0, isFocused: s, className: c, placeholder: l, meta: u }) => {
|
|
511
|
+
let d = B.useRef(null);
|
|
512
|
+
B.useEffect(() => {
|
|
513
|
+
s && d.current && d.current.focus();
|
|
514
|
+
}, [s]);
|
|
515
|
+
let [f, p] = B.useState(() => t == null ? "" : i === "number" ? new Intl.NumberFormat("en-US", {
|
|
516
|
+
minimumFractionDigits: 0,
|
|
517
|
+
maximumFractionDigits: 20
|
|
518
|
+
}).format(t) : String(t)), m = (e) => {
|
|
519
|
+
let t = e.target.value;
|
|
520
|
+
if (p(t), i === "number") if (t === "") n(null);
|
|
521
|
+
else {
|
|
522
|
+
let e = t.replace(/,/g, ""), r = parseFloat(e);
|
|
523
|
+
isNaN(r) || n(r);
|
|
524
|
+
}
|
|
525
|
+
else n(t);
|
|
526
|
+
}, h = () => {
|
|
527
|
+
if (i === "number" && f !== "") {
|
|
528
|
+
let e = f.replace(/,/g, ""), t = parseFloat(e);
|
|
529
|
+
isNaN(t) || p(new Intl.NumberFormat("en-US", {
|
|
530
|
+
minimumFractionDigits: 2,
|
|
531
|
+
maximumFractionDigits: 2
|
|
532
|
+
}).format(t));
|
|
533
|
+
}
|
|
534
|
+
r?.();
|
|
535
|
+
}, g = u?.align || (i === "number" ? "right" : "left");
|
|
536
|
+
return /* @__PURE__ */ Y(a, {
|
|
537
|
+
ref: d,
|
|
538
|
+
type: i === "date" ? "date" : "text",
|
|
539
|
+
value: f,
|
|
540
|
+
onChange: m,
|
|
541
|
+
onBlur: h,
|
|
542
|
+
autoFocus: o,
|
|
543
|
+
className: e("h-7 px-2 w-full border-0 shadow-none bg-transparent focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0", g === "right" && "text-right", g === "center" && "text-center", i === "number" && "font-mono tabular-nums", c),
|
|
544
|
+
placeholder: l,
|
|
545
|
+
onClick: (e) => e.stopPropagation()
|
|
546
|
+
});
|
|
547
|
+
}, bt = {
|
|
548
|
+
text: [
|
|
549
|
+
{
|
|
550
|
+
label: "Contains",
|
|
551
|
+
value: "contains"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
label: "Does not contain",
|
|
555
|
+
value: "doesNotContain"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
label: "Equals",
|
|
559
|
+
value: "equals"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
label: "Does not equal",
|
|
563
|
+
value: "notEquals"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
label: "Starts with",
|
|
567
|
+
value: "startsWith"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
label: "Ends with",
|
|
571
|
+
value: "endsWith"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
number: [
|
|
575
|
+
{
|
|
576
|
+
label: "Equals",
|
|
577
|
+
value: "equals"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
label: "Greater than",
|
|
581
|
+
value: "gt"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
label: "Greater or equal",
|
|
585
|
+
value: "gte"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
label: "Less than",
|
|
589
|
+
value: "lt"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
label: "Less or equal",
|
|
593
|
+
value: "lte"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
label: "Between",
|
|
597
|
+
value: "between"
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
date: [
|
|
601
|
+
{
|
|
602
|
+
label: "Equals",
|
|
603
|
+
value: "equals"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
label: "After",
|
|
607
|
+
value: "gt"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
label: "On or after",
|
|
611
|
+
value: "gte"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
label: "Before",
|
|
615
|
+
value: "lt"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
label: "On or before",
|
|
619
|
+
value: "lte"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
label: "Between",
|
|
623
|
+
value: "between"
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
}, xt = ({ columnType: e, value: t, valueTo: n, operator: r, onChange: i }) => {
|
|
627
|
+
let o = bt[e === "datetime" || e === "date" ? "date" : e === "number" ? "number" : "text"] || bt.text, s = e === "number" ? "number" : e === "date" || e === "datetime" ? "date" : "text";
|
|
628
|
+
return /* @__PURE__ */ X("div", {
|
|
629
|
+
className: "p-3 space-y-3",
|
|
630
|
+
children: [/* @__PURE__ */ X("div", {
|
|
631
|
+
className: "space-y-1",
|
|
632
|
+
children: [/* @__PURE__ */ Y("label", {
|
|
633
|
+
className: "text-xs font-medium text-muted-foreground ml-1",
|
|
634
|
+
children: "Condition"
|
|
635
|
+
}), /* @__PURE__ */ X(O, {
|
|
636
|
+
value: r,
|
|
637
|
+
onValueChange: (e) => i(t, e, n),
|
|
638
|
+
children: [/* @__PURE__ */ Y(T, {
|
|
639
|
+
className: "h-8",
|
|
640
|
+
children: /* @__PURE__ */ Y(w, {})
|
|
641
|
+
}), /* @__PURE__ */ Y(E, { children: o.map((e) => /* @__PURE__ */ Y(D, {
|
|
642
|
+
value: e.value,
|
|
643
|
+
children: e.label
|
|
644
|
+
}, e.value)) })]
|
|
645
|
+
})]
|
|
646
|
+
}), /* @__PURE__ */ X("div", {
|
|
647
|
+
className: "space-y-2",
|
|
648
|
+
children: [
|
|
649
|
+
/* @__PURE__ */ Y("label", {
|
|
650
|
+
className: "text-xs font-medium text-muted-foreground ml-1",
|
|
651
|
+
children: "Value"
|
|
652
|
+
}),
|
|
653
|
+
/* @__PURE__ */ Y(a, {
|
|
654
|
+
type: s,
|
|
655
|
+
value: t ?? "",
|
|
656
|
+
onChange: (e) => i(e.target.value, r, n),
|
|
657
|
+
className: "h-8 antialiased",
|
|
658
|
+
placeholder: "Enter value...",
|
|
659
|
+
onClick: (e) => e.stopPropagation()
|
|
660
|
+
}),
|
|
661
|
+
r === "between" && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X("div", {
|
|
662
|
+
className: "flex items-center gap-2 px-1",
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ Y("div", { className: "h-[1px] flex-1 bg-border" }),
|
|
665
|
+
/* @__PURE__ */ Y("span", {
|
|
666
|
+
className: "text-[10px] text-muted-foreground uppercase font-bold",
|
|
667
|
+
children: "and"
|
|
668
|
+
}),
|
|
669
|
+
/* @__PURE__ */ Y("div", { className: "h-[1px] flex-1 bg-border" })
|
|
670
|
+
]
|
|
671
|
+
}), /* @__PURE__ */ Y(a, {
|
|
672
|
+
type: s,
|
|
673
|
+
value: n ?? "",
|
|
674
|
+
onChange: (e) => i(t, r, e.target.value),
|
|
675
|
+
className: "h-8 antialiased",
|
|
676
|
+
placeholder: "To value...",
|
|
677
|
+
onClick: (e) => e.stopPropagation()
|
|
678
|
+
})] })
|
|
679
|
+
]
|
|
680
|
+
})]
|
|
681
|
+
});
|
|
682
|
+
};
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/components/ui/switch.tsx
|
|
685
|
+
function St({ className: t, ref: n, ...r }) {
|
|
686
|
+
return /* @__PURE__ */ Y(it.Root, {
|
|
687
|
+
className: e("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", t),
|
|
688
|
+
...r,
|
|
689
|
+
ref: n,
|
|
690
|
+
children: /* @__PURE__ */ Y(it.Thumb, { className: e("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") })
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/shared/components/BooleanRenderer.tsx
|
|
695
|
+
var Ct = ({ value: t, trueLabel: n = "Yes", falseLabel: r = "No", nullLabel: i = "N/A", showIcon: a = !0, showLabel: o = !1, variant: s = "checkbox", className: c, disabled: l = !0, onChange: u }) => {
|
|
696
|
+
let d = t === !0, f = t === !1, p = t == null;
|
|
697
|
+
return s === "switch" ? /* @__PURE__ */ X("div", {
|
|
698
|
+
className: e("flex items-center gap-2", c),
|
|
699
|
+
children: [/* @__PURE__ */ Y(St, {
|
|
700
|
+
checked: d,
|
|
701
|
+
onCheckedChange: u,
|
|
702
|
+
disabled: l,
|
|
703
|
+
className: "scale-90"
|
|
704
|
+
}), o && /* @__PURE__ */ Y("span", {
|
|
705
|
+
className: "text-sm font-medium",
|
|
706
|
+
children: d ? n : f ? r : i
|
|
707
|
+
})]
|
|
708
|
+
}) : /* @__PURE__ */ X("div", {
|
|
709
|
+
className: e("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md transition-colors text-sm font-medium", d && "bg-emerald-50/50 text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400", f && "bg-rose-50/50 text-rose-700 dark:bg-rose-900/20 dark:text-rose-400", p && "bg-muted/60 text-muted-foreground", c),
|
|
710
|
+
children: [a && /* @__PURE__ */ X(J, { children: [
|
|
711
|
+
d && /* @__PURE__ */ Y(q, { className: "w-3.5 h-3.5" }),
|
|
712
|
+
f && /* @__PURE__ */ Y(Me, { className: "w-3.5 h-3.5" }),
|
|
713
|
+
p && /* @__PURE__ */ Y(Te, { className: "w-3.5 h-3.5" })
|
|
714
|
+
] }), o && /* @__PURE__ */ Y("span", {
|
|
715
|
+
className: "text-sm font-medium",
|
|
716
|
+
children: d ? n : f ? r : i
|
|
717
|
+
})]
|
|
718
|
+
});
|
|
719
|
+
}, wt = ({ value: t, onChange: n, trueLabel: r = "Yes", falseLabel: i = "No", variant: a = "checkbox", disabled: s = !1, className: c }) => {
|
|
720
|
+
let l = t === !0;
|
|
721
|
+
return a === "switch" ? /* @__PURE__ */ X("div", {
|
|
722
|
+
className: e("flex items-center gap-2 p-2", c),
|
|
723
|
+
children: [/* @__PURE__ */ Y(St, {
|
|
724
|
+
id: "boolean-switch",
|
|
725
|
+
checked: l,
|
|
726
|
+
onCheckedChange: (e) => {
|
|
727
|
+
n(e);
|
|
728
|
+
},
|
|
729
|
+
disabled: s
|
|
730
|
+
}), /* @__PURE__ */ Y(o, {
|
|
731
|
+
htmlFor: "boolean-switch",
|
|
732
|
+
className: "text-sm font-medium cursor-pointer",
|
|
733
|
+
children: l ? r : i
|
|
734
|
+
})]
|
|
735
|
+
}) : /* @__PURE__ */ X("div", {
|
|
736
|
+
className: e("flex items-center gap-2 p-2", c),
|
|
737
|
+
children: [/* @__PURE__ */ Y(k, {
|
|
738
|
+
id: "boolean-editor",
|
|
739
|
+
checked: l,
|
|
740
|
+
onCheckedChange: (e) => {
|
|
741
|
+
n(e === !0);
|
|
742
|
+
},
|
|
743
|
+
disabled: s,
|
|
744
|
+
className: "data-[state=checked]:bg-primary data-[state=checked]:border-primary"
|
|
745
|
+
}), /* @__PURE__ */ Y(o, {
|
|
746
|
+
htmlFor: "boolean-editor",
|
|
747
|
+
className: "text-sm font-medium cursor-pointer",
|
|
748
|
+
children: l ? r : i
|
|
749
|
+
})]
|
|
750
|
+
});
|
|
751
|
+
}, Tt = ({ value: t, onChange: n, trueLabel: r = "Yes", falseLabel: i = "No", nullLabel: a = "N/A", allLabel: o = "All", className: s }) => /* @__PURE__ */ X(O, {
|
|
752
|
+
value: t,
|
|
753
|
+
onValueChange: n,
|
|
754
|
+
children: [/* @__PURE__ */ Y(T, {
|
|
755
|
+
className: e("w-full h-8", s),
|
|
756
|
+
children: /* @__PURE__ */ Y(w, { placeholder: "Filter..." })
|
|
757
|
+
}), /* @__PURE__ */ X(E, { children: [
|
|
758
|
+
/* @__PURE__ */ Y(D, {
|
|
759
|
+
value: "all",
|
|
760
|
+
children: /* @__PURE__ */ X("div", {
|
|
761
|
+
className: "flex items-center gap-2",
|
|
762
|
+
children: [/* @__PURE__ */ Y(Te, { className: "w-4 h-4 text-muted-foreground" }), /* @__PURE__ */ Y("span", { children: o })]
|
|
763
|
+
})
|
|
764
|
+
}),
|
|
765
|
+
/* @__PURE__ */ Y(D, {
|
|
766
|
+
value: "true",
|
|
767
|
+
children: /* @__PURE__ */ X("div", {
|
|
768
|
+
className: "flex items-center gap-2",
|
|
769
|
+
children: [/* @__PURE__ */ Y(q, { className: "w-4 h-4 text-emerald-600" }), /* @__PURE__ */ Y("span", { children: r })]
|
|
770
|
+
})
|
|
771
|
+
}),
|
|
772
|
+
/* @__PURE__ */ Y(D, {
|
|
773
|
+
value: "false",
|
|
774
|
+
children: /* @__PURE__ */ X("div", {
|
|
775
|
+
className: "flex items-center gap-2",
|
|
776
|
+
children: [/* @__PURE__ */ Y(Me, { className: "w-4 h-4 text-rose-600" }), /* @__PURE__ */ Y("span", { children: i })]
|
|
777
|
+
})
|
|
778
|
+
}),
|
|
779
|
+
/* @__PURE__ */ Y(D, {
|
|
780
|
+
value: "null",
|
|
781
|
+
children: /* @__PURE__ */ X("div", {
|
|
782
|
+
className: "flex items-center gap-2",
|
|
783
|
+
children: [/* @__PURE__ */ Y(Te, { className: "w-4 h-4 text-muted-foreground" }), /* @__PURE__ */ Y("span", { children: a })]
|
|
784
|
+
})
|
|
785
|
+
})
|
|
786
|
+
] })]
|
|
787
|
+
}), Et = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(at.Root, {
|
|
788
|
+
className: e("grid gap-2", t),
|
|
789
|
+
...n,
|
|
790
|
+
ref: r
|
|
791
|
+
}));
|
|
792
|
+
Et.displayName = at.Root.displayName;
|
|
793
|
+
var Dt = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(at.Item, {
|
|
794
|
+
ref: r,
|
|
795
|
+
className: e("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary", t),
|
|
796
|
+
...n,
|
|
797
|
+
children: /* @__PURE__ */ Y(at.Indicator, {
|
|
798
|
+
className: "flex items-center justify-center",
|
|
799
|
+
children: /* @__PURE__ */ Y(_e, { className: "h-1.5 w-1.5 fill-white text-white" })
|
|
800
|
+
})
|
|
801
|
+
}));
|
|
802
|
+
Dt.displayName = at.Item.displayName;
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/components/ui/command.tsx
|
|
805
|
+
var Ot = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(Q, {
|
|
806
|
+
ref: r,
|
|
807
|
+
className: e("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", t),
|
|
808
|
+
...n
|
|
809
|
+
}));
|
|
810
|
+
Ot.displayName = Q.displayName;
|
|
811
|
+
var kt = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ X("div", {
|
|
812
|
+
className: "flex items-center border-b px-3",
|
|
813
|
+
"cmdk-input-wrapper": "",
|
|
814
|
+
children: [/* @__PURE__ */ Y(Ae, { className: "me-2 h-4 w-4 shrink-0 opacity-50" }), /* @__PURE__ */ Y(Q.Input, {
|
|
815
|
+
ref: r,
|
|
816
|
+
className: e("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
817
|
+
...n
|
|
818
|
+
})]
|
|
819
|
+
}));
|
|
820
|
+
kt.displayName = Q.Input.displayName;
|
|
821
|
+
var At = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(Q.List, {
|
|
822
|
+
ref: r,
|
|
823
|
+
className: e("max-h-[300px] overflow-y-auto overflow-x-hidden", t),
|
|
824
|
+
...n
|
|
825
|
+
}));
|
|
826
|
+
At.displayName = Q.List.displayName;
|
|
827
|
+
var jt = z.forwardRef((e, t) => /* @__PURE__ */ Y(Q.Empty, {
|
|
828
|
+
ref: t,
|
|
829
|
+
className: "py-6 text-center text-sm text-muted-foreground",
|
|
830
|
+
...e
|
|
831
|
+
}));
|
|
832
|
+
jt.displayName = Q.Empty.displayName;
|
|
833
|
+
var Mt = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(Q.Group, {
|
|
834
|
+
ref: r,
|
|
835
|
+
className: e("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", t),
|
|
836
|
+
...n
|
|
837
|
+
}));
|
|
838
|
+
Mt.displayName = Q.Group.displayName;
|
|
839
|
+
var Nt = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(Q.Separator, {
|
|
840
|
+
ref: r,
|
|
841
|
+
className: e("-mx-1 h-px bg-border", t),
|
|
842
|
+
...n
|
|
843
|
+
}));
|
|
844
|
+
Nt.displayName = Q.Separator.displayName;
|
|
845
|
+
var Pt = z.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ Y(Q.Item, {
|
|
846
|
+
ref: r,
|
|
847
|
+
className: e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-[selected='true']:bg-accent aria-[selected='true']:text-accent-foreground data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50 text-start", t),
|
|
848
|
+
...n
|
|
849
|
+
}));
|
|
850
|
+
Pt.displayName = Q.Item.displayName;
|
|
851
|
+
var Ft = ({ className: t, ...n }) => /* @__PURE__ */ Y("span", {
|
|
852
|
+
className: e("ms-auto text-xs tracking-widest text-muted-foreground", t),
|
|
853
|
+
...n
|
|
854
|
+
});
|
|
855
|
+
Ft.displayName = "CommandShortcut";
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/shared/components/SearchableSelect.tsx
|
|
858
|
+
var It = ({ value: t, onChange: n, options: r = [], placeholder: a = "Select option...", className: o, onBlur: s }) => {
|
|
859
|
+
let [c, l] = K(!1), [u, d] = K(""), f = W(() => {
|
|
860
|
+
if (!u) return r;
|
|
861
|
+
let e = u.toLowerCase();
|
|
862
|
+
return r.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e));
|
|
863
|
+
}, [r, u]), [p, _] = K(null), v = ot({
|
|
864
|
+
count: f.length,
|
|
865
|
+
getScrollElement: () => p,
|
|
866
|
+
estimateSize: () => 35,
|
|
867
|
+
overscan: 5
|
|
868
|
+
});
|
|
869
|
+
return /* @__PURE__ */ X(g, {
|
|
870
|
+
open: c,
|
|
871
|
+
onOpenChange: l,
|
|
872
|
+
children: [/* @__PURE__ */ Y(h, {
|
|
873
|
+
asChild: !0,
|
|
874
|
+
children: /* @__PURE__ */ X(i, {
|
|
875
|
+
variant: "outline",
|
|
876
|
+
role: "combobox",
|
|
877
|
+
"aria-expanded": c,
|
|
878
|
+
className: e("w-full justify-between h-8 px-2 font-normal text-xs", o),
|
|
879
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
880
|
+
className: "truncate",
|
|
881
|
+
children: t ? r.find((e) => e.value === t)?.label || t : a
|
|
882
|
+
}), /* @__PURE__ */ Y(ge, { className: "ml-2 h-3 w-3 shrink-0 opacity-50" })]
|
|
883
|
+
})
|
|
884
|
+
}), /* @__PURE__ */ Y(m, {
|
|
885
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0 max-h-[400px] overflow-hidden",
|
|
886
|
+
align: "start",
|
|
887
|
+
side: "bottom",
|
|
888
|
+
collisionPadding: 10,
|
|
889
|
+
children: /* @__PURE__ */ X(Ot, {
|
|
890
|
+
shouldFilter: !1,
|
|
891
|
+
className: "h-full",
|
|
892
|
+
children: [/* @__PURE__ */ X("div", {
|
|
893
|
+
className: "flex items-center border-b px-3",
|
|
894
|
+
children: [/* @__PURE__ */ Y(Ae, { className: "mr-2 h-3.5 w-3.5 shrink-0 opacity-50" }), /* @__PURE__ */ Y("input", {
|
|
895
|
+
className: "flex h-9 w-full rounded-md bg-transparent py-3 text-xs outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 text-zinc-950 dark:text-zinc-50",
|
|
896
|
+
placeholder: "Type to search...",
|
|
897
|
+
value: u,
|
|
898
|
+
onChange: (e) => d(e.target.value)
|
|
899
|
+
})]
|
|
900
|
+
}), /* @__PURE__ */ X(At, {
|
|
901
|
+
ref: _,
|
|
902
|
+
className: "max-h-[300px] overflow-y-auto",
|
|
903
|
+
style: { maxHeight: "300px" },
|
|
904
|
+
children: [f.length === 0 && /* @__PURE__ */ Y(jt, { children: "No option found." }), /* @__PURE__ */ Y("div", {
|
|
905
|
+
style: {
|
|
906
|
+
height: `${v.getTotalSize()}px`,
|
|
907
|
+
width: "100%",
|
|
908
|
+
position: "relative"
|
|
909
|
+
},
|
|
910
|
+
children: v.getVirtualItems().map((r) => {
|
|
911
|
+
let i = f[r.index];
|
|
912
|
+
return /* @__PURE__ */ Y("div", {
|
|
913
|
+
style: {
|
|
914
|
+
position: "absolute",
|
|
915
|
+
top: 0,
|
|
916
|
+
left: 0,
|
|
917
|
+
width: "100%",
|
|
918
|
+
height: `${r.size}px`,
|
|
919
|
+
transform: `translateY(${r.start}px)`
|
|
920
|
+
},
|
|
921
|
+
children: /* @__PURE__ */ X(Pt, {
|
|
922
|
+
value: i.value,
|
|
923
|
+
onSelect: (e) => {
|
|
924
|
+
n(e === t ? "" : e), l(!1), d("");
|
|
925
|
+
},
|
|
926
|
+
className: "flex items-center justify-between text-xs py-1.5",
|
|
927
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
928
|
+
className: "truncate",
|
|
929
|
+
children: i.label
|
|
930
|
+
}), /* @__PURE__ */ Y(q, { className: e("h-3 w-3", t === i.value ? "opacity-100" : "opacity-0") })]
|
|
931
|
+
})
|
|
932
|
+
}, r.key);
|
|
933
|
+
})
|
|
934
|
+
})]
|
|
935
|
+
})]
|
|
936
|
+
})
|
|
937
|
+
})]
|
|
938
|
+
});
|
|
939
|
+
}, Lt = ({ value: t, options: n = [], className: r, table: i }) => {
|
|
940
|
+
if (t == null) return /* @__PURE__ */ Y("span", {
|
|
941
|
+
className: "text-muted-foreground text-sm italic",
|
|
942
|
+
children: "—"
|
|
943
|
+
});
|
|
944
|
+
let a = Array.isArray(t) ? t : [t];
|
|
945
|
+
if (a.length === 0) return /* @__PURE__ */ Y("span", {
|
|
946
|
+
className: "text-muted-foreground text-sm italic",
|
|
947
|
+
children: "—"
|
|
948
|
+
});
|
|
949
|
+
let o = a.map((e) => n.find((t) => t.value === e) || {
|
|
950
|
+
value: e,
|
|
951
|
+
label: e,
|
|
952
|
+
color: "default"
|
|
953
|
+
}), s = (e) => {
|
|
954
|
+
let t = e === "success" ? "success" : e === "danger" || e === "destructive" ? "error" : e === "warning" ? "warning" : e === "primary" || e === "info" ? "info" : "neutral", n = t === "neutral";
|
|
955
|
+
return {
|
|
956
|
+
container: {
|
|
957
|
+
backgroundColor: n ? "transparent" : `var(--ez-status-${t}-bg)`,
|
|
958
|
+
color: n ? `var(--ez-status-${t}-bg)` : `var(--ez-status-${t}-text)`,
|
|
959
|
+
borderColor: `var(--ez-status-${t}-border)`
|
|
960
|
+
},
|
|
961
|
+
dot: { backgroundColor: `var(--ez-status-${t}-dot)` },
|
|
962
|
+
isColored: !n
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
return /* @__PURE__ */ Y("div", {
|
|
966
|
+
className: e("inline-flex items-center gap-1.5 flex-wrap py-1", r),
|
|
967
|
+
children: o.map((e, t) => {
|
|
968
|
+
let n = s(e.color);
|
|
969
|
+
return /* @__PURE__ */ X("div", {
|
|
970
|
+
className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[13px] font-bold border transition-all duration-300 shadow-sm",
|
|
971
|
+
style: n.container,
|
|
972
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
973
|
+
className: "w-1.5 h-1.5 rounded-full",
|
|
974
|
+
style: n.dot
|
|
975
|
+
}), i?.options.meta?.enableSearchHighlighting ? /* @__PURE__ */ Y(C, {
|
|
976
|
+
text: e.label,
|
|
977
|
+
highlight: typeof i.getState().globalFilter == "string" ? i.getState().globalFilter : i.getState().globalFilter?.quickSearch
|
|
978
|
+
}) : e.label]
|
|
979
|
+
}, `${e.value}-${t}`);
|
|
980
|
+
})
|
|
981
|
+
});
|
|
982
|
+
}, Rt = ({ value: t, onChange: n, options: r = [], variant: i = "dropdown", onBlur: a, className: s, placeholder: c = "Select...", isFocused: l }) => {
|
|
983
|
+
let [u, d] = B.useState(!1), f = B.useRef(!1);
|
|
984
|
+
return B.useEffect(() => {
|
|
985
|
+
l && i === "dropdown" ? f.current ||= (d(!0), !0) : (d(!1), f.current = !1);
|
|
986
|
+
}, [l, i]), i === "combobox" ? /* @__PURE__ */ Y("div", {
|
|
987
|
+
className: e("w-full", s),
|
|
988
|
+
children: /* @__PURE__ */ Y(It, {
|
|
989
|
+
value: t,
|
|
990
|
+
onChange: n,
|
|
991
|
+
options: r,
|
|
992
|
+
placeholder: c,
|
|
993
|
+
onBlur: a
|
|
994
|
+
})
|
|
995
|
+
}) : i === "radio" ? /* @__PURE__ */ Y("div", {
|
|
996
|
+
className: e("w-full px-2 py-1", s),
|
|
997
|
+
onBlur: a,
|
|
998
|
+
children: /* @__PURE__ */ Y(Et, {
|
|
999
|
+
value: t || "",
|
|
1000
|
+
onValueChange: n,
|
|
1001
|
+
children: r.map((e) => /* @__PURE__ */ X("div", {
|
|
1002
|
+
className: "flex items-center space-x-2",
|
|
1003
|
+
children: [/* @__PURE__ */ Y(Dt, {
|
|
1004
|
+
value: e.value,
|
|
1005
|
+
id: `radio-${e.value}`
|
|
1006
|
+
}), /* @__PURE__ */ Y(o, {
|
|
1007
|
+
htmlFor: `radio-${e.value}`,
|
|
1008
|
+
className: "text-xs font-medium cursor-pointer",
|
|
1009
|
+
children: e.label
|
|
1010
|
+
})]
|
|
1011
|
+
}, e.value))
|
|
1012
|
+
})
|
|
1013
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
1014
|
+
className: e("w-full -m-1 p-0.5", s),
|
|
1015
|
+
onBlur: a,
|
|
1016
|
+
onKeyDown: (e) => {
|
|
1017
|
+
[
|
|
1018
|
+
"Enter",
|
|
1019
|
+
" ",
|
|
1020
|
+
"ArrowUp",
|
|
1021
|
+
"ArrowDown"
|
|
1022
|
+
].includes(e.key) && e.stopPropagation();
|
|
1023
|
+
},
|
|
1024
|
+
children: /* @__PURE__ */ X(O, {
|
|
1025
|
+
value: t,
|
|
1026
|
+
onValueChange: n,
|
|
1027
|
+
open: u,
|
|
1028
|
+
onOpenChange: d,
|
|
1029
|
+
children: [/* @__PURE__ */ Y(T, {
|
|
1030
|
+
className: "h-7 py-0 border-0 shadow-none bg-transparent focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none",
|
|
1031
|
+
children: /* @__PURE__ */ Y(w, { placeholder: c })
|
|
1032
|
+
}), /* @__PURE__ */ Y(E, { children: r.map((e) => /* @__PURE__ */ Y(D, {
|
|
1033
|
+
value: e.value,
|
|
1034
|
+
children: e.label
|
|
1035
|
+
}, e.value)) })]
|
|
1036
|
+
})
|
|
1037
|
+
});
|
|
1038
|
+
}, zt = ({ options: t = [], selectedValues: n = [], onChange: r, className: i }) => {
|
|
1039
|
+
let a = (e) => {
|
|
1040
|
+
n.includes(e) ? r(n.filter((t) => t !== e)) : r([...n, e]);
|
|
1041
|
+
};
|
|
1042
|
+
return /* @__PURE__ */ X("div", {
|
|
1043
|
+
className: e("flex flex-col gap-2 p-2 min-w-[180px]", i),
|
|
1044
|
+
children: [/* @__PURE__ */ X("div", {
|
|
1045
|
+
className: "flex items-center justify-between border-b pb-2 mb-1",
|
|
1046
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
1047
|
+
className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider",
|
|
1048
|
+
children: "Filter Options"
|
|
1049
|
+
}), /* @__PURE__ */ Y("button", {
|
|
1050
|
+
onClick: () => {
|
|
1051
|
+
n.length === t.length ? r([]) : r(t.map((e) => e.value));
|
|
1052
|
+
},
|
|
1053
|
+
className: "text-[10px] font-medium text-primary hover:underline",
|
|
1054
|
+
children: n.length === t.length ? "Clear All" : "Select All"
|
|
1055
|
+
})]
|
|
1056
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1057
|
+
className: "max-h-[180px] overflow-y-auto",
|
|
1058
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1059
|
+
className: "flex flex-col gap-2 pr-2",
|
|
1060
|
+
children: t.map((e) => /* @__PURE__ */ X("div", {
|
|
1061
|
+
className: "flex items-center gap-2",
|
|
1062
|
+
children: [/* @__PURE__ */ Y(k, {
|
|
1063
|
+
id: `filter-${e.value}`,
|
|
1064
|
+
checked: n.includes(e.value),
|
|
1065
|
+
onCheckedChange: () => a(e.value)
|
|
1066
|
+
}), /* @__PURE__ */ Y(o, {
|
|
1067
|
+
htmlFor: `filter-${e.value}`,
|
|
1068
|
+
className: "text-sm font-normal cursor-pointer flex-1",
|
|
1069
|
+
children: e.label
|
|
1070
|
+
})]
|
|
1071
|
+
}, e.value))
|
|
1072
|
+
})
|
|
1073
|
+
})]
|
|
1074
|
+
});
|
|
1075
|
+
}, Bt = ({ value: t, showLabel: n = !0, color: r = "default", size: i = "md", className: a }) => {
|
|
1076
|
+
let o = Math.max(0, Math.min(100, t));
|
|
1077
|
+
return /* @__PURE__ */ X("div", {
|
|
1078
|
+
className: e("flex items-center gap-2 w-full", a),
|
|
1079
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1080
|
+
className: "flex-1 bg-muted rounded-full overflow-hidden min-w-[60px]",
|
|
1081
|
+
children: /* @__PURE__ */ Y("div", {
|
|
1082
|
+
className: e("transition-all duration-300 rounded-full", (() => {
|
|
1083
|
+
switch (i) {
|
|
1084
|
+
case "sm": return "h-1.5";
|
|
1085
|
+
case "lg": return "h-3";
|
|
1086
|
+
default: return "h-2";
|
|
1087
|
+
}
|
|
1088
|
+
})(), (() => {
|
|
1089
|
+
switch (r) {
|
|
1090
|
+
case "success": return "bg-emerald-500 dark:bg-emerald-600";
|
|
1091
|
+
case "warning": return "bg-amber-500 dark:bg-amber-600";
|
|
1092
|
+
case "danger": return "bg-rose-500 dark:bg-rose-600";
|
|
1093
|
+
case "info": return "bg-blue-500 dark:bg-blue-600";
|
|
1094
|
+
default: return "bg-primary";
|
|
1095
|
+
}
|
|
1096
|
+
})()),
|
|
1097
|
+
style: { width: `${o}%` }
|
|
1098
|
+
})
|
|
1099
|
+
}), n && /* @__PURE__ */ X("span", {
|
|
1100
|
+
className: "text-xs font-medium text-muted-foreground tabular-nums min-w-[42px] text-right",
|
|
1101
|
+
children: [o.toFixed(0), "%"]
|
|
1102
|
+
})]
|
|
1103
|
+
});
|
|
1104
|
+
}, Vt = ({ value: t, values: n, color: r = "default", height: i = 32, width: a = 100, showDots: o = !1, className: s }) => {
|
|
1105
|
+
let c = t || n || [], l = W(() => {
|
|
1106
|
+
if (!c || c.length === 0) return "";
|
|
1107
|
+
let e = Math.max(...c), t = Math.min(...c), n = e - t || 1;
|
|
1108
|
+
return `M ${c.map((e, r) => `${r / (c.length - 1) * a},${i - (e - t) / n * i}`).join(" L ")}`;
|
|
1109
|
+
}, [
|
|
1110
|
+
c,
|
|
1111
|
+
i,
|
|
1112
|
+
a
|
|
1113
|
+
]), u = W(() => {
|
|
1114
|
+
if (!c || c.length === 0 || !o) return [];
|
|
1115
|
+
let e = Math.max(...c), t = Math.min(...c), n = e - t || 1;
|
|
1116
|
+
return c.map((e, r) => ({
|
|
1117
|
+
x: r / (c.length - 1) * a,
|
|
1118
|
+
y: i - (e - t) / n * i
|
|
1119
|
+
}));
|
|
1120
|
+
}, [
|
|
1121
|
+
c,
|
|
1122
|
+
i,
|
|
1123
|
+
a,
|
|
1124
|
+
o
|
|
1125
|
+
]), d = () => {
|
|
1126
|
+
switch (r) {
|
|
1127
|
+
case "success": return "stroke-emerald-500 dark:stroke-emerald-400";
|
|
1128
|
+
case "warning": return "stroke-amber-500 dark:stroke-amber-400";
|
|
1129
|
+
case "danger": return "stroke-rose-500 dark:stroke-rose-400";
|
|
1130
|
+
case "info": return "stroke-blue-500 dark:stroke-blue-400";
|
|
1131
|
+
default: return "stroke-primary";
|
|
1132
|
+
}
|
|
1133
|
+
}, f = () => {
|
|
1134
|
+
switch (r) {
|
|
1135
|
+
case "success": return "fill-emerald-500 dark:fill-emerald-400";
|
|
1136
|
+
case "warning": return "fill-amber-500 dark:fill-amber-400";
|
|
1137
|
+
case "danger": return "fill-rose-500 dark:fill-rose-400";
|
|
1138
|
+
case "info": return "fill-blue-500 dark:fill-blue-400";
|
|
1139
|
+
default: return "fill-primary";
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
return !c || c.length === 0 ? /* @__PURE__ */ Y("div", {
|
|
1143
|
+
className: "text-muted-foreground text-xs italic",
|
|
1144
|
+
children: "No data"
|
|
1145
|
+
}) : /* @__PURE__ */ X("svg", {
|
|
1146
|
+
width: a,
|
|
1147
|
+
height: i,
|
|
1148
|
+
className: e("inline-block", s),
|
|
1149
|
+
viewBox: `0 0 ${a} ${i}`,
|
|
1150
|
+
children: [/* @__PURE__ */ Y("path", {
|
|
1151
|
+
d: l,
|
|
1152
|
+
fill: "none",
|
|
1153
|
+
className: e("transition-colors", d()),
|
|
1154
|
+
strokeWidth: "2",
|
|
1155
|
+
strokeLinecap: "round",
|
|
1156
|
+
strokeLinejoin: "round"
|
|
1157
|
+
}), o && u.map((t, n) => /* @__PURE__ */ Y("circle", {
|
|
1158
|
+
cx: t.x,
|
|
1159
|
+
cy: t.y,
|
|
1160
|
+
r: "2",
|
|
1161
|
+
className: e("transition-colors", f())
|
|
1162
|
+
}, n))]
|
|
1163
|
+
});
|
|
1164
|
+
}, Ht = ie({ renderers: {
|
|
1165
|
+
text: {
|
|
1166
|
+
Cell: vt,
|
|
1167
|
+
Editor: yt
|
|
1168
|
+
},
|
|
1169
|
+
number: {
|
|
1170
|
+
Cell: vt,
|
|
1171
|
+
Editor: yt
|
|
1172
|
+
},
|
|
1173
|
+
date: {
|
|
1174
|
+
Cell: vt,
|
|
1175
|
+
Editor: yt
|
|
1176
|
+
},
|
|
1177
|
+
datetime: {
|
|
1178
|
+
Cell: vt,
|
|
1179
|
+
Editor: yt
|
|
1180
|
+
},
|
|
1181
|
+
longtext: {
|
|
1182
|
+
Cell: vt,
|
|
1183
|
+
Editor: yt
|
|
1184
|
+
},
|
|
1185
|
+
boolean: {
|
|
1186
|
+
Cell: Ct,
|
|
1187
|
+
Editor: wt
|
|
1188
|
+
},
|
|
1189
|
+
select: {
|
|
1190
|
+
Cell: Lt,
|
|
1191
|
+
Editor: Rt
|
|
1192
|
+
},
|
|
1193
|
+
multiselect: {
|
|
1194
|
+
Cell: Lt,
|
|
1195
|
+
Editor: Rt
|
|
1196
|
+
},
|
|
1197
|
+
progress: { Cell: Bt },
|
|
1198
|
+
sparkline: { Cell: Vt },
|
|
1199
|
+
chart: { Cell: (e) => {
|
|
1200
|
+
let t = e.value;
|
|
1201
|
+
return Array.isArray(t) ? B.createElement(Vt, {
|
|
1202
|
+
values: t,
|
|
1203
|
+
...e
|
|
1204
|
+
}) : B.createElement(Bt, {
|
|
1205
|
+
value: t,
|
|
1206
|
+
...e
|
|
1207
|
+
});
|
|
1208
|
+
} }
|
|
1209
|
+
} }), Ut = () => ae(Ht), Wt = ({ getValue: e, row: t, column: n, table: r }) => {
|
|
1210
|
+
let { renderers: i } = Ut(), a = e(), [o, s] = K(a), c = n.columnDef.meta, l = c?.columnType || "text", u = r.options.meta?.isRowEditable ? r.options.meta.isRowEditable(t.original) : !0, d = r.options.meta?.isCellEditable ? r.options.meta.isCellEditable(t.original, n.id) : !0, f = n.columnDef.enableEditing !== !1, p = r.options.meta?.enableEditing || !1, m = r.options.meta?.editingRows?.[t.index] || !1, h = p && m && u && d && f;
|
|
1211
|
+
U(() => {
|
|
1212
|
+
s(a);
|
|
1213
|
+
}, [a]);
|
|
1214
|
+
let g = () => {
|
|
1215
|
+
r.options.meta?.updateData(t.index, n.id, o);
|
|
1216
|
+
}, _ = (e) => {
|
|
1217
|
+
s(e), (l === "boolean" || l === "select") && r.options.meta?.updateData(t.index, n.id, e);
|
|
1218
|
+
}, v = W(() => ({
|
|
1219
|
+
getValue: e,
|
|
1220
|
+
row: t,
|
|
1221
|
+
column: n,
|
|
1222
|
+
enableEditing: r.options.meta?.enableEditing,
|
|
1223
|
+
isCellEditable: r.options.meta?.isCellEditable,
|
|
1224
|
+
value: o,
|
|
1225
|
+
onChange: _,
|
|
1226
|
+
onBlur: g,
|
|
1227
|
+
columnType: l,
|
|
1228
|
+
meta: c,
|
|
1229
|
+
isFocused: r.options.meta?.focusedCell?.r === t.index && r.options.meta?.focusedCell?.c === r.getVisibleLeafColumns().findIndex((e) => e.id === n.id)
|
|
1230
|
+
}), [
|
|
1231
|
+
e,
|
|
1232
|
+
t,
|
|
1233
|
+
n,
|
|
1234
|
+
o,
|
|
1235
|
+
l,
|
|
1236
|
+
c,
|
|
1237
|
+
_,
|
|
1238
|
+
g,
|
|
1239
|
+
r.options.meta?.focusedCell,
|
|
1240
|
+
r.getVisibleLeafColumns
|
|
1241
|
+
]);
|
|
1242
|
+
if (h) {
|
|
1243
|
+
if (c?.Editor) {
|
|
1244
|
+
let e = c.Editor;
|
|
1245
|
+
return /* @__PURE__ */ Y(e, { ...v });
|
|
1246
|
+
}
|
|
1247
|
+
let e = i[l];
|
|
1248
|
+
if (e?.Editor) {
|
|
1249
|
+
let t = e.Editor, n = {
|
|
1250
|
+
...l === "boolean" ? c?.booleanOptions : {},
|
|
1251
|
+
...l === "select" ? c?.selectOptions : {}
|
|
1252
|
+
};
|
|
1253
|
+
return /* @__PURE__ */ Y(t, {
|
|
1254
|
+
...v,
|
|
1255
|
+
...n
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
if (c?.Cell) {
|
|
1260
|
+
let e = c.Cell;
|
|
1261
|
+
return /* @__PURE__ */ Y(e, { ...v });
|
|
1262
|
+
}
|
|
1263
|
+
let y = (i[l] || i.text).Cell, b = {
|
|
1264
|
+
...l === "boolean" ? c?.booleanOptions : {},
|
|
1265
|
+
...l === "longtext" ? c?.longTextOptions : {},
|
|
1266
|
+
...l === "number" ? c?.numberOptions : {},
|
|
1267
|
+
...l === "date" ? c?.dateOptions : {},
|
|
1268
|
+
...l === "datetime" ? c?.dateTimeOptions : {},
|
|
1269
|
+
...l === "select" ? c?.selectOptions : {},
|
|
1270
|
+
...l === "progress" || l === "chart" || l === "sparkline" ? c?.chartOptions : {}
|
|
1271
|
+
};
|
|
1272
|
+
return /* @__PURE__ */ Y(y, {
|
|
1273
|
+
...v,
|
|
1274
|
+
...b
|
|
1275
|
+
});
|
|
1276
|
+
}, $ = (e, t) => typeof e == "function" ? e(t) : e, Gt = (e, t) => {
|
|
1277
|
+
let { columns: n, rowCount: r, pageCount: i, pagination: a, pageSize: o = 10, enableRowSelection: s, selectionSettings: c, enableGrouping: u, enableRowPinning: d, enableColumnPinning: f, enableTreeData: p, getSubRows: m, manualPagination: h, manualSorting: g, manualFiltering: _, enablePersistence: v, persistenceKey: y, defaultGrouping: b = [], getRowId: x } = e, S = !!e.service || !!e.serviceName, { state: C, setState: w } = l({
|
|
1278
|
+
initialState: {
|
|
1279
|
+
sorting: [],
|
|
1280
|
+
columnFilters: [],
|
|
1281
|
+
globalFilter: "",
|
|
1282
|
+
columnSizing: {},
|
|
1283
|
+
rowSelection: {},
|
|
1284
|
+
grouping: b,
|
|
1285
|
+
expanded: {},
|
|
1286
|
+
rowPinning: {
|
|
1287
|
+
top: [],
|
|
1288
|
+
bottom: []
|
|
1289
|
+
},
|
|
1290
|
+
pagination: {
|
|
1291
|
+
pageIndex: 0,
|
|
1292
|
+
pageSize: o
|
|
1293
|
+
},
|
|
1294
|
+
columnPinning: {
|
|
1295
|
+
left: [],
|
|
1296
|
+
right: []
|
|
1297
|
+
},
|
|
1298
|
+
columnVisibility: {},
|
|
1299
|
+
columnOrder: []
|
|
1300
|
+
},
|
|
1301
|
+
persistenceKey: v ? y : void 0
|
|
1302
|
+
}), T = G({}), E = (t) => {
|
|
1303
|
+
w((n) => {
|
|
1304
|
+
let r = $(t, n.sorting);
|
|
1305
|
+
return setTimeout(() => {
|
|
1306
|
+
e.onSortingChange?.(r), e.onSort?.({ columns: r.map((e) => ({
|
|
1307
|
+
direction: e.desc ? "Descending" : "Ascending",
|
|
1308
|
+
name: e.id
|
|
1309
|
+
})) });
|
|
1310
|
+
}, 0), {
|
|
1311
|
+
...n,
|
|
1312
|
+
sorting: r
|
|
1313
|
+
};
|
|
1314
|
+
});
|
|
1315
|
+
}, D = (t) => {
|
|
1316
|
+
w((n) => {
|
|
1317
|
+
let r = $(t, n.pagination);
|
|
1318
|
+
return setTimeout(() => {
|
|
1319
|
+
e.onPaginationChange?.(r), e.onPageChange?.({
|
|
1320
|
+
action: "page",
|
|
1321
|
+
currentPage: r.pageIndex + 1
|
|
1322
|
+
});
|
|
1323
|
+
}, 0), {
|
|
1324
|
+
...n,
|
|
1325
|
+
pagination: r
|
|
1326
|
+
};
|
|
1327
|
+
});
|
|
1328
|
+
}, O = (n) => {
|
|
1329
|
+
w((r) => {
|
|
1330
|
+
let i = $(n, r.rowSelection), a = T.current, o = Object.keys(a).filter((e) => a[e]), s = Object.keys(i).filter((e) => i[e]), c = s.filter((e) => !o.includes(e)), l = o.filter((e) => !s.includes(e));
|
|
1331
|
+
return setTimeout(() => {
|
|
1332
|
+
e.onRowSelectionChange?.(i), c.forEach((n) => {
|
|
1333
|
+
let r = parseInt(n);
|
|
1334
|
+
!isNaN(r) && t[r] && e.onRowSelect?.({
|
|
1335
|
+
data: t[r],
|
|
1336
|
+
rowIndex: r
|
|
1337
|
+
});
|
|
1338
|
+
}), l.forEach((n) => {
|
|
1339
|
+
let r = parseInt(n);
|
|
1340
|
+
!isNaN(r) && t[r] && e.onRowDeselect?.({
|
|
1341
|
+
data: t[r],
|
|
1342
|
+
rowIndex: r
|
|
1343
|
+
});
|
|
1344
|
+
});
|
|
1345
|
+
}, 0), T.current = i, {
|
|
1346
|
+
...r,
|
|
1347
|
+
rowSelection: i
|
|
1348
|
+
};
|
|
1349
|
+
});
|
|
1350
|
+
}, k = (e) => w((t) => ({
|
|
1351
|
+
...t,
|
|
1352
|
+
columnFilters: $(e, t.columnFilters)
|
|
1353
|
+
})), A = (e) => w((t) => ({
|
|
1354
|
+
...t,
|
|
1355
|
+
globalFilter: $(e, t.globalFilter)
|
|
1356
|
+
})), j = (e) => w((t) => ({
|
|
1357
|
+
...t,
|
|
1358
|
+
columnSizing: $(e, t.columnSizing)
|
|
1359
|
+
})), ee = (e) => w((t) => ({
|
|
1360
|
+
...t,
|
|
1361
|
+
grouping: $(e, t.grouping)
|
|
1362
|
+
})), te = (e) => w((t) => ({
|
|
1363
|
+
...t,
|
|
1364
|
+
expanded: $(e, t.expanded)
|
|
1365
|
+
})), M = (e) => w((t) => ({
|
|
1366
|
+
...t,
|
|
1367
|
+
rowPinning: $(e, t.rowPinning)
|
|
1368
|
+
})), N = (e) => w((t) => ({
|
|
1369
|
+
...t,
|
|
1370
|
+
columnPinning: $(e, t.columnPinning)
|
|
1371
|
+
})), P = (e) => w((t) => ({
|
|
1372
|
+
...t,
|
|
1373
|
+
columnVisibility: $(e, t.columnVisibility)
|
|
1374
|
+
})), ne = (t) => {
|
|
1375
|
+
w((n) => {
|
|
1376
|
+
let r = $(t, n.columnOrder);
|
|
1377
|
+
return setTimeout(() => e.onColumnOrderChange?.(r), 0), {
|
|
1378
|
+
...n,
|
|
1379
|
+
columnOrder: r
|
|
1380
|
+
};
|
|
1381
|
+
});
|
|
1382
|
+
}, F = G(e.onColumnFiltersChange), I = G(e.onGlobalFilterChange);
|
|
1383
|
+
return U(() => {
|
|
1384
|
+
F.current = e.onColumnFiltersChange, I.current = e.onGlobalFilterChange;
|
|
1385
|
+
}), U(() => {
|
|
1386
|
+
_ && C.columnFilters.length >= 0 && F.current?.(C.columnFilters);
|
|
1387
|
+
}, [C.columnFilters, _]), U(() => {
|
|
1388
|
+
_ && I.current?.(C.globalFilter);
|
|
1389
|
+
}, [C.globalFilter, _]), {
|
|
1390
|
+
table: rt({
|
|
1391
|
+
data: t,
|
|
1392
|
+
columns: n,
|
|
1393
|
+
getRowId: x,
|
|
1394
|
+
rowCount: r,
|
|
1395
|
+
pageCount: i,
|
|
1396
|
+
state: W(() => ({
|
|
1397
|
+
sorting: C.sorting,
|
|
1398
|
+
columnFilters: C.columnFilters,
|
|
1399
|
+
globalFilter: C.globalFilter,
|
|
1400
|
+
columnSizing: C.columnSizing,
|
|
1401
|
+
rowSelection: C.rowSelection,
|
|
1402
|
+
pagination: C.pagination,
|
|
1403
|
+
grouping: C.grouping,
|
|
1404
|
+
expanded: C.expanded,
|
|
1405
|
+
rowPinning: C.rowPinning,
|
|
1406
|
+
columnPinning: C.columnPinning,
|
|
1407
|
+
columnVisibility: C.columnVisibility,
|
|
1408
|
+
columnOrder: C.columnOrder,
|
|
1409
|
+
...e.state
|
|
1410
|
+
}), [C, e.state]),
|
|
1411
|
+
onSortingChange: E,
|
|
1412
|
+
onColumnFiltersChange: k,
|
|
1413
|
+
onGlobalFilterChange: A,
|
|
1414
|
+
onColumnSizingChange: j,
|
|
1415
|
+
onRowSelectionChange: O,
|
|
1416
|
+
onPaginationChange: D,
|
|
1417
|
+
onGroupingChange: ee,
|
|
1418
|
+
onExpandedChange: te,
|
|
1419
|
+
onRowPinningChange: M,
|
|
1420
|
+
onColumnPinningChange: N,
|
|
1421
|
+
onColumnVisibilityChange: P,
|
|
1422
|
+
onColumnOrderChange: ne,
|
|
1423
|
+
globalFilterFn: ht,
|
|
1424
|
+
defaultColumn: {
|
|
1425
|
+
cell: Wt,
|
|
1426
|
+
filterFn: gt
|
|
1427
|
+
},
|
|
1428
|
+
manualPagination: S || h,
|
|
1429
|
+
manualSorting: S || g,
|
|
1430
|
+
manualFiltering: S || _,
|
|
1431
|
+
enableRowSelection: c ? !0 : s,
|
|
1432
|
+
enableMultiRowSelection: c ? c.type === "Multiple" : !0,
|
|
1433
|
+
enableGrouping: u,
|
|
1434
|
+
enableSorting: !0,
|
|
1435
|
+
enableRowPinning: d,
|
|
1436
|
+
enableColumnPinning: f,
|
|
1437
|
+
columnResizeMode: "onChange",
|
|
1438
|
+
enableColumnResizing: !0,
|
|
1439
|
+
aggregationFns: { uniqueCount: (e, t) => new Set(t.map((t) => t.getValue(e))).size },
|
|
1440
|
+
getSubRows: p ? m : void 0,
|
|
1441
|
+
getCoreRowModel: Ye(),
|
|
1442
|
+
getSortedRowModel: nt(),
|
|
1443
|
+
getFilteredRowModel: $e(),
|
|
1444
|
+
getPaginationRowModel: a ? tt() : void 0,
|
|
1445
|
+
getGroupedRowModel: u ? et() : void 0,
|
|
1446
|
+
getExpandedRowModel: u || p ? Xe() : void 0,
|
|
1447
|
+
getFacetedUniqueValues: Qe(),
|
|
1448
|
+
getFacetedMinMaxValues: Ze(),
|
|
1449
|
+
meta: {}
|
|
1450
|
+
}),
|
|
1451
|
+
states: {
|
|
1452
|
+
sorting: C.sorting,
|
|
1453
|
+
setSorting: E,
|
|
1454
|
+
columnFilters: C.columnFilters,
|
|
1455
|
+
setColumnFilters: k,
|
|
1456
|
+
globalFilter: C.globalFilter,
|
|
1457
|
+
setGlobalFilter: A,
|
|
1458
|
+
rowSelection: C.rowSelection,
|
|
1459
|
+
setRowSelection: O,
|
|
1460
|
+
paginationState: C.pagination,
|
|
1461
|
+
setPaginationState: D,
|
|
1462
|
+
grouping: C.grouping,
|
|
1463
|
+
setGrouping: ee,
|
|
1464
|
+
expanded: C.expanded,
|
|
1465
|
+
setExpanded: te,
|
|
1466
|
+
rowPinning: C.rowPinning,
|
|
1467
|
+
setRowPinning: M,
|
|
1468
|
+
columnPinning: C.columnPinning,
|
|
1469
|
+
setColumnPinning: N,
|
|
1470
|
+
columnVisibility: C.columnVisibility,
|
|
1471
|
+
setColumnVisibility: P,
|
|
1472
|
+
columnOrder: C.columnOrder,
|
|
1473
|
+
setColumnOrder: ne
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
}, Kt = (e, t, n = "ltr") => {
|
|
1477
|
+
let { density: r = "standard", rowHeight: i, estimatedRowHeight: a, rowSizingMode: o = "auto", enableColumnVirtualization: s = !1 } = e, { rows: c } = t.getRowModel(), l = W(() => {
|
|
1478
|
+
if (i) return i;
|
|
1479
|
+
if (a) return a;
|
|
1480
|
+
switch (r) {
|
|
1481
|
+
case "compact": return 41;
|
|
1482
|
+
case "comfortable": return 89;
|
|
1483
|
+
default: return 65;
|
|
1484
|
+
}
|
|
1485
|
+
}, [
|
|
1486
|
+
i,
|
|
1487
|
+
a,
|
|
1488
|
+
r
|
|
1489
|
+
]), u = W(() => {
|
|
1490
|
+
switch (r) {
|
|
1491
|
+
case "compact": return 40;
|
|
1492
|
+
case "comfortable": return 56;
|
|
1493
|
+
default: return 48;
|
|
1494
|
+
}
|
|
1495
|
+
}, [r]), d = W(() => {
|
|
1496
|
+
if (i) return !1;
|
|
1497
|
+
if (o === "dynamic") return !0;
|
|
1498
|
+
if (o === "fixed") return !1;
|
|
1499
|
+
let t = e.columns.some((e) => e.meta?.wrapText), n = e.textWrapSettings?.wrapMode === "Both" || e.textWrapSettings?.wrapMode === "Content";
|
|
1500
|
+
return !!(e.renderDetailPanel || e.enableEditing || t || n || e.adaptiveSizing);
|
|
1501
|
+
}, [
|
|
1502
|
+
i,
|
|
1503
|
+
o,
|
|
1504
|
+
e.columns,
|
|
1505
|
+
e.textWrapSettings,
|
|
1506
|
+
e.renderDetailPanel,
|
|
1507
|
+
e.enableEditing,
|
|
1508
|
+
e.adaptiveSizing
|
|
1509
|
+
]), { parentRef: f, rowVirtualizer: p, columnVirtualizer: m, scrollToIndex: h, scrollToRow: g, scrollToColumn: _ } = A({
|
|
1510
|
+
rowCount: c.length,
|
|
1511
|
+
rowHeight: l,
|
|
1512
|
+
overscanCount: e.overscanCount ?? 30,
|
|
1513
|
+
columnCount: s ? t.getVisibleLeafColumns().length : 0,
|
|
1514
|
+
columnWidth: (e) => t.getVisibleLeafColumns()[e].getSize(),
|
|
1515
|
+
enableColumnVirtualization: s,
|
|
1516
|
+
progressiveRendering: e.progressiveRendering ?? !1,
|
|
1517
|
+
prefetchDistance: e.prefetchDistance ?? 10,
|
|
1518
|
+
adaptiveSizing: d,
|
|
1519
|
+
id: e.id,
|
|
1520
|
+
debug: !1,
|
|
1521
|
+
languageDirection: n,
|
|
1522
|
+
scrollPaddingStart: e.enableStickyHeader ? e.scrollPaddingStart ?? u : e.scrollPaddingStart ?? 0,
|
|
1523
|
+
scrollMargin: 0
|
|
1524
|
+
});
|
|
1525
|
+
return {
|
|
1526
|
+
parentRef: f,
|
|
1527
|
+
rowVirtualizer: p,
|
|
1528
|
+
columnVirtualizer: m,
|
|
1529
|
+
scrollToIndex: h,
|
|
1530
|
+
scrollToRow: g,
|
|
1531
|
+
scrollToColumn: _,
|
|
1532
|
+
effectiveRowHeight: l,
|
|
1533
|
+
dynamicRowSizing: d
|
|
1534
|
+
};
|
|
1535
|
+
}, qt = (e, t) => {
|
|
1536
|
+
let { enableRangeSelection: n = !1 } = e, { rows: r } = t.getRowModel(), [i, a] = K(null), [o, s] = K(!1), c = H((e, t) => {
|
|
1537
|
+
n && (s(!0), a({
|
|
1538
|
+
start: {
|
|
1539
|
+
r: e,
|
|
1540
|
+
c: t
|
|
1541
|
+
},
|
|
1542
|
+
end: {
|
|
1543
|
+
r: e,
|
|
1544
|
+
c: t
|
|
1545
|
+
}
|
|
1546
|
+
}));
|
|
1547
|
+
}, [n]), l = H((e, t) => {
|
|
1548
|
+
!n || !o || a((n) => n ? {
|
|
1549
|
+
...n,
|
|
1550
|
+
end: {
|
|
1551
|
+
r: e,
|
|
1552
|
+
c: t
|
|
1553
|
+
}
|
|
1554
|
+
} : null);
|
|
1555
|
+
}, [n, o]);
|
|
1556
|
+
return U(() => {
|
|
1557
|
+
if (!n) return;
|
|
1558
|
+
let e = () => s(!1);
|
|
1559
|
+
return window.addEventListener("mouseup", e), () => window.removeEventListener("mouseup", e);
|
|
1560
|
+
}, [n]), {
|
|
1561
|
+
rangeSelection: i,
|
|
1562
|
+
onCellMouseDown: c,
|
|
1563
|
+
onCellMouseEnter: l,
|
|
1564
|
+
selectRowByRange: H((e, n) => {
|
|
1565
|
+
let i = {}, [a, o] = [Math.min(e, n), Math.max(e, n)];
|
|
1566
|
+
for (let e = a; e <= o; e++) {
|
|
1567
|
+
let t = r[e];
|
|
1568
|
+
t && (i[t.id] = !0);
|
|
1569
|
+
}
|
|
1570
|
+
t.setRowSelection((e) => ({
|
|
1571
|
+
...e,
|
|
1572
|
+
...i
|
|
1573
|
+
}));
|
|
1574
|
+
}, [r, t]),
|
|
1575
|
+
isSelecting: o
|
|
1576
|
+
};
|
|
1577
|
+
}, Jt = (e, t) => {
|
|
1578
|
+
let [n, r] = se();
|
|
1579
|
+
return {
|
|
1580
|
+
isFiltering: n,
|
|
1581
|
+
handleColumnFiltersChange: H((n) => {
|
|
1582
|
+
r(() => {
|
|
1583
|
+
t.setColumnFilters((t) => {
|
|
1584
|
+
let r = typeof n == "function" ? n(t) : n;
|
|
1585
|
+
return setTimeout(() => {
|
|
1586
|
+
e.onColumnFiltersChange?.(r);
|
|
1587
|
+
let t = r.map((e) => ({
|
|
1588
|
+
id: e.id,
|
|
1589
|
+
field: e.id,
|
|
1590
|
+
operator: "contains",
|
|
1591
|
+
value: e.value
|
|
1592
|
+
}));
|
|
1593
|
+
e.onFilter?.({ columns: t });
|
|
1594
|
+
}, 0), r;
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
}, [
|
|
1598
|
+
t,
|
|
1599
|
+
e.onColumnFiltersChange,
|
|
1600
|
+
e.onFilter
|
|
1601
|
+
]),
|
|
1602
|
+
handleGlobalFilterChange: H((n) => {
|
|
1603
|
+
r(() => {
|
|
1604
|
+
t.setGlobalFilter((t) => {
|
|
1605
|
+
let r = typeof n == "function" ? n(t) : n;
|
|
1606
|
+
return setTimeout(() => {
|
|
1607
|
+
e.onGlobalFilterChange?.(r), typeof r == "string" && e.onSearch?.(r);
|
|
1608
|
+
}, 0), r;
|
|
1609
|
+
});
|
|
1610
|
+
});
|
|
1611
|
+
}, [
|
|
1612
|
+
t,
|
|
1613
|
+
e.onGlobalFilterChange,
|
|
1614
|
+
e.onSearch
|
|
1615
|
+
]),
|
|
1616
|
+
setFilterModel: t.setColumnFilters,
|
|
1617
|
+
setGlobalFilter: t.setGlobalFilter
|
|
1618
|
+
};
|
|
1619
|
+
}, Yt = (e, t, r, i, a, o = {}) => {
|
|
1620
|
+
let c = n(), { rows: l } = t.getRowModel(), u = W(() => {
|
|
1621
|
+
let n = ne(i.refresh, i.forceUpdate), a = L(i.showSpinner, i.hideSpinner), s = I((e) => {
|
|
1622
|
+
let t = l[typeof e == "string" ? parseInt(e) : e];
|
|
1623
|
+
t?.getCanSelect() && t.toggleSelected(!0);
|
|
1624
|
+
}, (e) => {
|
|
1625
|
+
let n = {};
|
|
1626
|
+
e.forEach((e) => {
|
|
1627
|
+
let t = l[typeof e == "string" ? parseInt(e) : e];
|
|
1628
|
+
t && (n[t.id] = !0);
|
|
1629
|
+
}), t.setRowSelection(n);
|
|
1630
|
+
}, () => t.resetRowSelection(), () => t.toggleAllRowsSelected(!0), () => t.getSelectedRowModel().rows.map((e) => e.original), (e, t) => {
|
|
1631
|
+
let n = typeof e == "string" ? parseInt(e) : e;
|
|
1632
|
+
i.scrollToIndex(n);
|
|
1633
|
+
}), u = F(i.scrollToIndex, (e) => t.setPageIndex(e)), d = re(() => e.onExportCSV?.(t), () => e.onExportExcel?.(t), () => {
|
|
1634
|
+
window.print();
|
|
1635
|
+
});
|
|
1636
|
+
return {
|
|
1637
|
+
...n,
|
|
1638
|
+
...a,
|
|
1639
|
+
getData: () => r,
|
|
1640
|
+
setCellValue: (e, t, n) => {
|
|
1641
|
+
let r = parseInt(e);
|
|
1642
|
+
isNaN(r) || i.performEdit(r, t, n);
|
|
1643
|
+
},
|
|
1644
|
+
setRowData: (e, t) => {
|
|
1645
|
+
let n = parseInt(e);
|
|
1646
|
+
isNaN(n) || i.setData((e) => {
|
|
1647
|
+
let r = [...e];
|
|
1648
|
+
return r[n] = {
|
|
1649
|
+
...r[n],
|
|
1650
|
+
...t
|
|
1651
|
+
}, r;
|
|
1652
|
+
});
|
|
1653
|
+
},
|
|
1654
|
+
addRecord: async (n) => {
|
|
1655
|
+
let a = n || {}, o = e.editSettings?.primaryKey, s = o ? Array.isArray(o) ? o[0] : o : "id", l = a[s];
|
|
1656
|
+
if (l === void 0 && (l = `_temp_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, a[s] = l), i.service) try {
|
|
1657
|
+
let e = await i.addMutation.mutateAsync(a);
|
|
1658
|
+
c.get("NotificationService")?.show({
|
|
1659
|
+
type: "success",
|
|
1660
|
+
message: "Row Added Successfully!",
|
|
1661
|
+
duration: 3e3
|
|
1662
|
+
}), setTimeout(() => {
|
|
1663
|
+
let n = e[s] || l;
|
|
1664
|
+
t.setRowSelection({ [n]: !0 });
|
|
1665
|
+
let a = r.findIndex((e) => e[s] === n);
|
|
1666
|
+
a !== -1 && (i.toggleRowEditing(a, !0), i.scrollToIndex(a));
|
|
1667
|
+
}, 100);
|
|
1668
|
+
return;
|
|
1669
|
+
} catch (e) {
|
|
1670
|
+
throw c.get("NotificationService")?.show({
|
|
1671
|
+
type: "error",
|
|
1672
|
+
message: "Failed to Add Row",
|
|
1673
|
+
duration: 3e3
|
|
1674
|
+
}), e;
|
|
1675
|
+
}
|
|
1676
|
+
e.onDataChangeStart?.({
|
|
1677
|
+
action: "add",
|
|
1678
|
+
data: a
|
|
1679
|
+
}), e.onRowAddStart?.({ data: a }), i.addRow(a, 0), e.onDataChangeComplete?.({
|
|
1680
|
+
action: "add",
|
|
1681
|
+
data: a
|
|
1682
|
+
}), c.get("NotificationService")?.show({
|
|
1683
|
+
type: "success",
|
|
1684
|
+
message: "Row Added Successfully!",
|
|
1685
|
+
duration: 3e3
|
|
1686
|
+
}), setTimeout(() => {
|
|
1687
|
+
t.resetRowSelection(), t.setRowSelection({ [l]: !0 }), i.toggleRowEditing(0, !0), i.scrollToIndex(0);
|
|
1688
|
+
}, 50);
|
|
1689
|
+
},
|
|
1690
|
+
updateRecord: async (t, n) => {
|
|
1691
|
+
let a = typeof t == "number" ? t : parseInt(t), o = e.editSettings?.primaryKey, s = o ? Array.isArray(o) ? o[0] : o : "id", l = r[a]?.[s];
|
|
1692
|
+
if (i.service && l) try {
|
|
1693
|
+
await i.updateMutation.mutateAsync({
|
|
1694
|
+
id: l,
|
|
1695
|
+
updates: n
|
|
1696
|
+
}), c.get("NotificationService")?.show({
|
|
1697
|
+
type: "success",
|
|
1698
|
+
message: "Row Updated Successfully!",
|
|
1699
|
+
duration: 3e3
|
|
1700
|
+
});
|
|
1701
|
+
return;
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
throw c.get("NotificationService")?.show({
|
|
1704
|
+
type: "error",
|
|
1705
|
+
message: "Failed to Update Row",
|
|
1706
|
+
duration: 3e3
|
|
1707
|
+
}), e;
|
|
1708
|
+
}
|
|
1709
|
+
e.onDataChangeStart?.({
|
|
1710
|
+
action: "edit",
|
|
1711
|
+
data: n
|
|
1712
|
+
}), i.setData((e) => {
|
|
1713
|
+
let t = [...e];
|
|
1714
|
+
return t[a] = {
|
|
1715
|
+
...t[a],
|
|
1716
|
+
...n
|
|
1717
|
+
}, c.get("NotificationService")?.show({
|
|
1718
|
+
type: "success",
|
|
1719
|
+
message: "Row Updated Successfully!",
|
|
1720
|
+
duration: 3e3
|
|
1721
|
+
}), t;
|
|
1722
|
+
});
|
|
1723
|
+
},
|
|
1724
|
+
deleteRecord: async (t) => {
|
|
1725
|
+
let n = typeof t == "number" ? t : parseInt(t), a = r[n], o = e.editSettings?.primaryKey, s = o ? Array.isArray(o) ? o[0] : o : "id", l = a?.[s];
|
|
1726
|
+
if (i.service && l) try {
|
|
1727
|
+
await i.deleteMutation.mutateAsync(l), c.get("NotificationService")?.show({
|
|
1728
|
+
type: "success",
|
|
1729
|
+
message: "Row Deleted Successfully!",
|
|
1730
|
+
duration: 3e3
|
|
1731
|
+
});
|
|
1732
|
+
return;
|
|
1733
|
+
} catch (e) {
|
|
1734
|
+
throw c.get("NotificationService")?.show({
|
|
1735
|
+
type: "error",
|
|
1736
|
+
message: "Failed to Delete Row",
|
|
1737
|
+
duration: 3e3
|
|
1738
|
+
}), e;
|
|
1739
|
+
}
|
|
1740
|
+
e.onDataChangeStart?.({
|
|
1741
|
+
action: "delete",
|
|
1742
|
+
data: a
|
|
1743
|
+
}), i.deleteRows([n]), c.get("NotificationService")?.show({
|
|
1744
|
+
type: "success",
|
|
1745
|
+
message: "Row Deleted Successfully!",
|
|
1746
|
+
duration: 3e3
|
|
1747
|
+
});
|
|
1748
|
+
},
|
|
1749
|
+
deleteRecords: async (t) => {
|
|
1750
|
+
if (i.service) {
|
|
1751
|
+
let n = e.editSettings?.primaryKey, a = n ? Array.isArray(n) ? n[0] : n : "id";
|
|
1752
|
+
try {
|
|
1753
|
+
for (let e of t) {
|
|
1754
|
+
let t = r[e]?.[a];
|
|
1755
|
+
t && await i.deleteMutation.mutateAsync(t);
|
|
1756
|
+
}
|
|
1757
|
+
c.get("NotificationService")?.show({
|
|
1758
|
+
type: "success",
|
|
1759
|
+
message: `${t.length} Rows Deleted Successfully!`,
|
|
1760
|
+
duration: 3e3
|
|
1761
|
+
});
|
|
1762
|
+
return;
|
|
1763
|
+
} catch (e) {
|
|
1764
|
+
throw c.get("NotificationService")?.show({
|
|
1765
|
+
type: "error",
|
|
1766
|
+
message: "Failed to Delete Rows",
|
|
1767
|
+
duration: 3e3
|
|
1768
|
+
}), e;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
e.onDataChangeStart?.({
|
|
1772
|
+
action: "delete",
|
|
1773
|
+
data: t.map((e) => r[e])
|
|
1774
|
+
}), i.deleteRows(t), c.get("NotificationService")?.show({
|
|
1775
|
+
type: "success",
|
|
1776
|
+
message: `${t.length} Rows Deleted Successfully!`,
|
|
1777
|
+
duration: 3e3
|
|
1778
|
+
});
|
|
1779
|
+
},
|
|
1780
|
+
getRowInfo: (e) => l[typeof e == "number" ? e : parseInt(e)],
|
|
1781
|
+
editRecord: (e) => {
|
|
1782
|
+
let t = typeof e == "number" ? e : parseInt(e);
|
|
1783
|
+
i.toggleRowEditing(t, !0);
|
|
1784
|
+
},
|
|
1785
|
+
saveDataChanges: () => {
|
|
1786
|
+
e.onDataChangeComplete?.({
|
|
1787
|
+
action: "edit",
|
|
1788
|
+
data: i.batchChanges.changedRecords
|
|
1789
|
+
}), c.get("NotificationService")?.show({
|
|
1790
|
+
type: "success",
|
|
1791
|
+
message: "Changes Saved Successfully!",
|
|
1792
|
+
duration: 3e3
|
|
1793
|
+
});
|
|
1794
|
+
},
|
|
1795
|
+
cancelDataChanges: () => {
|
|
1796
|
+
i.resetData(), e.onDataChangeCancel?.({ action: "edit" }), c.get("NotificationService")?.show({
|
|
1797
|
+
type: "info",
|
|
1798
|
+
message: "Changes Discarded",
|
|
1799
|
+
duration: 3e3
|
|
1800
|
+
});
|
|
1801
|
+
},
|
|
1802
|
+
getBatchChanges: () => i.batchChanges,
|
|
1803
|
+
getChanges: () => i.batchChanges,
|
|
1804
|
+
history: {
|
|
1805
|
+
changes: i.changes,
|
|
1806
|
+
batchChanges: i.batchChanges
|
|
1807
|
+
},
|
|
1808
|
+
...s,
|
|
1809
|
+
getSelectedRowIndexes: () => Object.keys(t.getState().rowSelection).map(Number),
|
|
1810
|
+
clearRowSelection: () => t.resetRowSelection(),
|
|
1811
|
+
...u,
|
|
1812
|
+
search: (e) => t.setGlobalFilter(e),
|
|
1813
|
+
filterByColumn: (e, n, r) => t.getColumn(e)?.setFilterValue({
|
|
1814
|
+
operator: n,
|
|
1815
|
+
value: r
|
|
1816
|
+
}),
|
|
1817
|
+
clearFilter: (e) => e ? t.getColumn(e)?.setFilterValue(void 0) : t.resetColumnFilters(),
|
|
1818
|
+
sortByColumn: (e, n) => t.setSorting([{
|
|
1819
|
+
id: e,
|
|
1820
|
+
desc: n === "desc"
|
|
1821
|
+
}]),
|
|
1822
|
+
clearSort: () => t.resetSorting(),
|
|
1823
|
+
removeSortColumn: (e) => t.setSorting((t) => t.filter((t) => t.id !== e)),
|
|
1824
|
+
getVisibleColumns: () => t.getVisibleLeafColumns().map((e) => e.columnDef),
|
|
1825
|
+
getHiddenColumns: () => t.getAllLeafColumns().filter((e) => !e.getIsVisible()).map((e) => e.columnDef),
|
|
1826
|
+
getColumnByField: (e) => t.getColumn(e)?.columnDef || null,
|
|
1827
|
+
getColumns: () => t.getAllLeafColumns().map((e) => e.columnDef),
|
|
1828
|
+
setColumnVisibility: (e) => t.setColumnVisibility(e),
|
|
1829
|
+
copyToClipboard: async (e = !0) => {
|
|
1830
|
+
if (!navigator?.clipboard) return;
|
|
1831
|
+
let n = t.getVisibleLeafColumns(), r = t.getRowModel().rows, i = e ? n.map((e) => e.id).join(" ") + "\n" : "", a = r.map((e) => n.map((t) => {
|
|
1832
|
+
let n = e.getValue(t.id);
|
|
1833
|
+
return n == null ? "" : String(n);
|
|
1834
|
+
}).join(" ")).join("\n");
|
|
1835
|
+
try {
|
|
1836
|
+
await navigator.clipboard.writeText(i + a), c.get("NotificationService")?.show({
|
|
1837
|
+
type: "success",
|
|
1838
|
+
message: "Copied to Clipboard!",
|
|
1839
|
+
duration: 2e3
|
|
1840
|
+
});
|
|
1841
|
+
} catch (e) {
|
|
1842
|
+
console.error("Failed to copy", e), c.get("NotificationService")?.show({
|
|
1843
|
+
type: "error",
|
|
1844
|
+
message: "Failed to Copy",
|
|
1845
|
+
duration: 3e3
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
},
|
|
1849
|
+
autoFitColumns: () => {
|
|
1850
|
+
t.getVisibleLeafColumns().forEach((e) => {
|
|
1851
|
+
i.autoFitColumn(e.id);
|
|
1852
|
+
});
|
|
1853
|
+
},
|
|
1854
|
+
expandAllGroups: () => t.toggleAllRowsExpanded(!0),
|
|
1855
|
+
collapseAllGroups: () => t.toggleAllRowsExpanded(!1),
|
|
1856
|
+
isRemote: () => !!(e.manualPagination || e.onDataRequest),
|
|
1857
|
+
getDataModule: () => ({
|
|
1858
|
+
table: t,
|
|
1859
|
+
data: r
|
|
1860
|
+
}),
|
|
1861
|
+
setPagerMessage: (e) => i.setPagerMessage(e),
|
|
1862
|
+
validateEditForm: () => !0,
|
|
1863
|
+
getPrimaryKeyFieldNames: () => {
|
|
1864
|
+
let t = e.editSettings?.primaryKey;
|
|
1865
|
+
return t ? Array.isArray(t) ? t : [t] : [];
|
|
1866
|
+
},
|
|
1867
|
+
...d,
|
|
1868
|
+
...o
|
|
1869
|
+
};
|
|
1870
|
+
}, [
|
|
1871
|
+
e,
|
|
1872
|
+
t,
|
|
1873
|
+
r,
|
|
1874
|
+
l,
|
|
1875
|
+
i,
|
|
1876
|
+
o
|
|
1877
|
+
]);
|
|
1878
|
+
return s(a, u), u;
|
|
1879
|
+
}, Xt = (e) => {
|
|
1880
|
+
let t = G(!1);
|
|
1881
|
+
oe(() => {
|
|
1882
|
+
e.onRenderStart && e.onRenderStart();
|
|
1883
|
+
}), U(() => {
|
|
1884
|
+
!t.current && e.onRenderComplete && (e.onRenderComplete(), t.current = !0);
|
|
1885
|
+
}, [e.onRenderComplete]), U(() => () => {
|
|
1886
|
+
t.current = !1;
|
|
1887
|
+
}, []);
|
|
1888
|
+
}, Zt = [], Qt = (e, t, n = {}) => {
|
|
1889
|
+
let { api: r, serviceRegistry: i } = u(e), a = qe(), { dataSource: o, data: s, onRefresh: c, onDataRequest: l, onDataLoad: d, onError: f, enableEditing: m, isRowEditable: h, isCellEditable: g, pagination: _ = !0, enableExport: v = !1, enableStickyHeader: y = !0, enableStickyPagination: b = !0, enableChangeTracking: x = !0, density: S = "standard", dir: C } = e, w = p("I18nService"), T = C === "auto" || !C ? w?.dir || "ltr" : C, E = o || s || Zt, { data: D, setData: O, performEdit: k, addRow: A, deleteRows: j, undo: ee, redo: te, canUndo: M, canRedo: N, changes: P, batchChanges: ne, resetData: F } = ut(E, W(() => {
|
|
1890
|
+
let t = e.editSettings?.primaryKey;
|
|
1891
|
+
return t ? Array.isArray(t) ? t[0] : t : "id";
|
|
1892
|
+
}, [e.editSettings?.primaryKey])), [I, re] = K(void 0), L = W(() => e.service ? e.service : e.serviceName ? i.get(e.serviceName) : null, [e.service, e.serviceName]), { table: R, states: z } = Gt(e, D), B = R.getState().pagination, ie = R.getState().sorting, V = R.getState().columnFilters, ae = R.getState().globalFilter, oe = W(() => [
|
|
1893
|
+
"table-data",
|
|
1894
|
+
e.serviceName || "local",
|
|
1895
|
+
B.pageIndex,
|
|
1896
|
+
B.pageSize,
|
|
1897
|
+
ie,
|
|
1898
|
+
V,
|
|
1899
|
+
ae
|
|
1900
|
+
], [
|
|
1901
|
+
e.serviceName,
|
|
1902
|
+
B,
|
|
1903
|
+
ie,
|
|
1904
|
+
V,
|
|
1905
|
+
ae
|
|
1906
|
+
]), { data: G, isLoading: se, error: ce } = Ke({
|
|
1907
|
+
queryKey: oe,
|
|
1908
|
+
queryFn: async () => {
|
|
1909
|
+
if (!L) return {
|
|
1910
|
+
data: E,
|
|
1911
|
+
totalCount: E.length
|
|
1912
|
+
};
|
|
1913
|
+
let { onDataChange: t, ...n } = e;
|
|
1914
|
+
return await L.getData({
|
|
1915
|
+
...n,
|
|
1916
|
+
state: R.getState(),
|
|
1917
|
+
data: [],
|
|
1918
|
+
columns: []
|
|
1919
|
+
});
|
|
1920
|
+
},
|
|
1921
|
+
enabled: !!L,
|
|
1922
|
+
placeholderData: {
|
|
1923
|
+
data: E,
|
|
1924
|
+
totalCount: E.length
|
|
1925
|
+
}
|
|
1926
|
+
}), le = G?.data || E, ue = G?.totalCount ?? E.length;
|
|
1927
|
+
U(() => {
|
|
1928
|
+
L && le && !P.added && !P.edited && !P.deleted && O(le);
|
|
1929
|
+
}, [
|
|
1930
|
+
le,
|
|
1931
|
+
L,
|
|
1932
|
+
O,
|
|
1933
|
+
P.added,
|
|
1934
|
+
P.edited,
|
|
1935
|
+
P.deleted
|
|
1936
|
+
]);
|
|
1937
|
+
let q = Ge({
|
|
1938
|
+
mutationFn: (e) => L.createRow(e),
|
|
1939
|
+
onSuccess: () => a.invalidateQueries({ queryKey: oe })
|
|
1940
|
+
}), de = Ge({
|
|
1941
|
+
mutationFn: ({ id: e, updates: t }) => L.updateRow(e, t),
|
|
1942
|
+
onSuccess: () => a.invalidateQueries({ queryKey: oe })
|
|
1943
|
+
}), fe = Ge({
|
|
1944
|
+
mutationFn: (e) => L.deleteRow(e),
|
|
1945
|
+
onSuccess: () => a.invalidateQueries({ queryKey: oe })
|
|
1946
|
+
}), [pe, me] = K(!1), he = se || pe, { isFiltering: ge, handleColumnFiltersChange: _e, handleGlobalFilterChange: ve, setFilterModel: ye, setGlobalFilter: be } = Jt(e, R), { parentRef: xe, rowVirtualizer: Se, columnVirtualizer: Ce, effectiveRowHeight: we, dynamicRowSizing: Te } = Kt(e, R, T), { rangeSelection: Ee, onCellMouseDown: De, onCellMouseEnter: Oe, selectRowByRange: ke } = qt(e, R), [Ae, je] = K(null), Me = H((e, t) => {
|
|
1947
|
+
je((n) => {
|
|
1948
|
+
if (!n) return {
|
|
1949
|
+
r: 0,
|
|
1950
|
+
c: 0
|
|
1951
|
+
};
|
|
1952
|
+
let r = R.getRowModel().rows.length;
|
|
1953
|
+
return {
|
|
1954
|
+
r: Math.max(0, Math.min(r - 1, n.r + e)),
|
|
1955
|
+
c: Math.max(0, Math.min(R.getVisibleLeafColumns().length - 1, n.c + t))
|
|
1956
|
+
};
|
|
1957
|
+
});
|
|
1958
|
+
}, [R]), [Ne, J] = K({}), Y = H((t, n) => {
|
|
1959
|
+
let r = n === !0 || n === void 0 && !Ne[t];
|
|
1960
|
+
r && D[t] && e.onRowEditStart?.({
|
|
1961
|
+
row: R.getRowModel().rows[t],
|
|
1962
|
+
data: D[t]
|
|
1963
|
+
}), J((i) => r && (e.editSettings?.mode === "Normal" || !e.editSettings?.mode) ? { [String(t)]: !0 } : {
|
|
1964
|
+
...i,
|
|
1965
|
+
[t]: n === void 0 ? !i[t] : n
|
|
1966
|
+
}), r && je((e) => ({
|
|
1967
|
+
r: t,
|
|
1968
|
+
c: e?.c ?? 0
|
|
1969
|
+
}));
|
|
1970
|
+
}, [
|
|
1971
|
+
D,
|
|
1972
|
+
Ne,
|
|
1973
|
+
e.onRowEditStart,
|
|
1974
|
+
e.editSettings?.mode,
|
|
1975
|
+
R
|
|
1976
|
+
]), X = H((e, t, n) => {
|
|
1977
|
+
if (!m) return;
|
|
1978
|
+
let r = D[e];
|
|
1979
|
+
h && !h(r) || g && !g(r, t) || k(e, t, n);
|
|
1980
|
+
}, [
|
|
1981
|
+
m,
|
|
1982
|
+
k,
|
|
1983
|
+
D,
|
|
1984
|
+
h,
|
|
1985
|
+
g
|
|
1986
|
+
]), { autoFitColumn: Pe } = pt(R), Fe = H(async () => {
|
|
1987
|
+
if (L) await a.invalidateQueries({ queryKey: oe });
|
|
1988
|
+
else if (l) {
|
|
1989
|
+
me(!0);
|
|
1990
|
+
try {
|
|
1991
|
+
l(R.getState());
|
|
1992
|
+
} catch (e) {
|
|
1993
|
+
f && f(e);
|
|
1994
|
+
} finally {
|
|
1995
|
+
me(!1);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
R.reset(), c?.();
|
|
1999
|
+
}, [
|
|
2000
|
+
l,
|
|
2001
|
+
R,
|
|
2002
|
+
c,
|
|
2003
|
+
f,
|
|
2004
|
+
L,
|
|
2005
|
+
a,
|
|
2006
|
+
oe
|
|
2007
|
+
]);
|
|
2008
|
+
U(() => {
|
|
2009
|
+
ce && f && f(ce);
|
|
2010
|
+
}, [ce, f]), U(() => {
|
|
2011
|
+
L && ue !== void 0 && R.setOptions((e) => ({
|
|
2012
|
+
...e,
|
|
2013
|
+
rowCount: ue
|
|
2014
|
+
}));
|
|
2015
|
+
}, [
|
|
2016
|
+
ue,
|
|
2017
|
+
R,
|
|
2018
|
+
L
|
|
2019
|
+
]);
|
|
2020
|
+
let Z = Yt(e, R, D, {
|
|
2021
|
+
refresh: Fe,
|
|
2022
|
+
setData: O,
|
|
2023
|
+
performEdit: k,
|
|
2024
|
+
showSpinner: () => me(!0),
|
|
2025
|
+
hideSpinner: () => me(!1),
|
|
2026
|
+
scrollToIndex: (e) => Se.scrollToIndex(e, { align: "center" }),
|
|
2027
|
+
toggleRowEditing: Y,
|
|
2028
|
+
forceUpdate: () => {
|
|
2029
|
+
me((e) => !e), setTimeout(() => me((e) => !e), 0);
|
|
2030
|
+
},
|
|
2031
|
+
resetData: F,
|
|
2032
|
+
setPagerMessage: re,
|
|
2033
|
+
batchChanges: ne,
|
|
2034
|
+
changes: P,
|
|
2035
|
+
addRow: A,
|
|
2036
|
+
deleteRows: j,
|
|
2037
|
+
setFocusedCell: je,
|
|
2038
|
+
autoFitColumn: Pe,
|
|
2039
|
+
addMutation: q,
|
|
2040
|
+
updateMutation: de,
|
|
2041
|
+
deleteMutation: fe,
|
|
2042
|
+
service: L
|
|
2043
|
+
}, t, n), Ie = W(() => ({
|
|
2044
|
+
updateData: X,
|
|
2045
|
+
editingRows: Ne,
|
|
2046
|
+
toggleRowEditing: Y,
|
|
2047
|
+
focusedCell: Ae,
|
|
2048
|
+
setFocusedCell: je,
|
|
2049
|
+
navigateFocus: Me,
|
|
2050
|
+
addRecord: Z.addRecord,
|
|
2051
|
+
deleteRecord: Z.deleteRecord,
|
|
2052
|
+
deleteRecords: Z.deleteRecords,
|
|
2053
|
+
enableEditing: e.enableEditing && (e.editSettings?.allowEditing ?? !0),
|
|
2054
|
+
isRowEditable: h,
|
|
2055
|
+
isCellEditable: g,
|
|
2056
|
+
enableSearchHighlighting: e.enableSearchHighlighting,
|
|
2057
|
+
selectionSettings: e.selectionSettings,
|
|
2058
|
+
editSettings: e.editSettings,
|
|
2059
|
+
classNames: e.classNames,
|
|
2060
|
+
icons: e.icons,
|
|
2061
|
+
slots: e.slots,
|
|
2062
|
+
slotProps: e.slotProps,
|
|
2063
|
+
localization: e.localization,
|
|
2064
|
+
dir: T,
|
|
2065
|
+
containerRef: xe
|
|
2066
|
+
}), [
|
|
2067
|
+
X,
|
|
2068
|
+
Ne,
|
|
2069
|
+
Y,
|
|
2070
|
+
Ae,
|
|
2071
|
+
Z.addRecord,
|
|
2072
|
+
Z.deleteRecord,
|
|
2073
|
+
Z.deleteRecords,
|
|
2074
|
+
e.enableEditing,
|
|
2075
|
+
e.editSettings,
|
|
2076
|
+
h,
|
|
2077
|
+
g,
|
|
2078
|
+
e.enableSearchHighlighting,
|
|
2079
|
+
e.selectionSettings,
|
|
2080
|
+
e.editSettings,
|
|
2081
|
+
e.classNames,
|
|
2082
|
+
e.icons,
|
|
2083
|
+
e.slots,
|
|
2084
|
+
e.slotProps,
|
|
2085
|
+
e.localization,
|
|
2086
|
+
xe
|
|
2087
|
+
]);
|
|
2088
|
+
return R.options.meta = Ie, U(() => {
|
|
2089
|
+
d && d(D);
|
|
2090
|
+
}, [D, d]), Xt({
|
|
2091
|
+
onRenderStart: e.onGridRenderStart,
|
|
2092
|
+
onRenderComplete: e.onGridRenderComplete
|
|
2093
|
+
}), W(() => ({
|
|
2094
|
+
state: {
|
|
2095
|
+
...z,
|
|
2096
|
+
rows: R.getRowModel().rows,
|
|
2097
|
+
rangeSelection: Ee,
|
|
2098
|
+
canUndo: M,
|
|
2099
|
+
canRedo: N,
|
|
2100
|
+
changes: P,
|
|
2101
|
+
batchChanges: ne,
|
|
2102
|
+
density: S,
|
|
2103
|
+
isPending: ge || e.isLoading || he,
|
|
2104
|
+
focusedCell: Ae,
|
|
2105
|
+
globalFilter: z.globalFilter,
|
|
2106
|
+
pagerMessage: I,
|
|
2107
|
+
internalLoading: pe
|
|
2108
|
+
},
|
|
2109
|
+
actions: {
|
|
2110
|
+
undo: ee,
|
|
2111
|
+
redo: te,
|
|
2112
|
+
resetData: F,
|
|
2113
|
+
addRow: A,
|
|
2114
|
+
deleteRows: j,
|
|
2115
|
+
toggleRowEditing: Y,
|
|
2116
|
+
autoFitColumn: Pe,
|
|
2117
|
+
onCellMouseDown: De,
|
|
2118
|
+
onCellMouseEnter: Oe,
|
|
2119
|
+
onRowClick: e.onRowClick,
|
|
2120
|
+
onRowDoubleClick: e.onRowDoubleClick,
|
|
2121
|
+
onCellFocus: e.onCellFocus,
|
|
2122
|
+
onToolbarItemClick: e.onToolbarItemClick,
|
|
2123
|
+
setFocusedCell: je,
|
|
2124
|
+
setGlobalFilter: be,
|
|
2125
|
+
handleColumnFiltersChange: _e,
|
|
2126
|
+
handleGlobalFilterChange: ve,
|
|
2127
|
+
setFilterModel: ye,
|
|
2128
|
+
getData: () => D,
|
|
2129
|
+
getPrimaryKeyFieldNames: () => {
|
|
2130
|
+
let t = e.editSettings?.primaryKey;
|
|
2131
|
+
return t ? Array.isArray(t) ? t : [t] : [];
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2134
|
+
refs: {
|
|
2135
|
+
parentRef: xe,
|
|
2136
|
+
rowVirtualizer: Se,
|
|
2137
|
+
columnVirtualizer: Ce
|
|
2138
|
+
},
|
|
2139
|
+
config: {
|
|
2140
|
+
paginationEnabled: _,
|
|
2141
|
+
exportEnabled: v,
|
|
2142
|
+
enableStickyHeader: y,
|
|
2143
|
+
enableStickyPagination: b,
|
|
2144
|
+
enableChangeTracking: x,
|
|
2145
|
+
enableEditing: m,
|
|
2146
|
+
gridLines: e.gridLines,
|
|
2147
|
+
enableAltRow: e.enableAltRow,
|
|
2148
|
+
enableHover: e.enableHover,
|
|
2149
|
+
rowHeight: we,
|
|
2150
|
+
dynamicRowSizing: Te,
|
|
2151
|
+
selectionSettings: e.selectionSettings,
|
|
2152
|
+
filterSettings: e.filterSettings,
|
|
2153
|
+
searchSettings: e.searchSettings,
|
|
2154
|
+
sortSettings: e.sortSettings,
|
|
2155
|
+
editSettings: e.editSettings
|
|
2156
|
+
},
|
|
2157
|
+
services: {},
|
|
2158
|
+
table: R,
|
|
2159
|
+
dir: T,
|
|
2160
|
+
baseApi: r,
|
|
2161
|
+
imperativeAPI: Z
|
|
2162
|
+
}), [
|
|
2163
|
+
r,
|
|
2164
|
+
Z,
|
|
2165
|
+
z,
|
|
2166
|
+
xe,
|
|
2167
|
+
Se,
|
|
2168
|
+
Ce,
|
|
2169
|
+
R,
|
|
2170
|
+
T,
|
|
2171
|
+
_,
|
|
2172
|
+
v,
|
|
2173
|
+
Ee,
|
|
2174
|
+
De,
|
|
2175
|
+
Oe,
|
|
2176
|
+
y,
|
|
2177
|
+
b,
|
|
2178
|
+
x,
|
|
2179
|
+
ee,
|
|
2180
|
+
te,
|
|
2181
|
+
M,
|
|
2182
|
+
N,
|
|
2183
|
+
P,
|
|
2184
|
+
ne,
|
|
2185
|
+
F,
|
|
2186
|
+
A,
|
|
2187
|
+
j,
|
|
2188
|
+
Y,
|
|
2189
|
+
S,
|
|
2190
|
+
ge,
|
|
2191
|
+
e,
|
|
2192
|
+
D,
|
|
2193
|
+
_e,
|
|
2194
|
+
ve,
|
|
2195
|
+
ye,
|
|
2196
|
+
be,
|
|
2197
|
+
I,
|
|
2198
|
+
Ae,
|
|
2199
|
+
je,
|
|
2200
|
+
pe
|
|
2201
|
+
]);
|
|
2202
|
+
};
|
|
2203
|
+
//#endregion
|
|
2204
|
+
//#region src/shared/hooks/useEventHandlers.ts
|
|
2205
|
+
function $t(e) {
|
|
2206
|
+
return {
|
|
2207
|
+
handleDragStart: H((t) => {
|
|
2208
|
+
e.onDragStart?.(t);
|
|
2209
|
+
}, [e.onDragStart]),
|
|
2210
|
+
handleDragOver: H((t) => {
|
|
2211
|
+
e.onDragOver?.(t);
|
|
2212
|
+
}, [e.onDragOver]),
|
|
2213
|
+
handleDragEnd: H((t) => {
|
|
2214
|
+
e.onDragEnd?.(t);
|
|
2215
|
+
}, [e.onDragEnd]),
|
|
2216
|
+
handleKeyPress: H((t) => {
|
|
2217
|
+
e.onKeyPress?.(t);
|
|
2218
|
+
}, [e.onKeyPress]),
|
|
2219
|
+
handleKeyDown: H((t) => {
|
|
2220
|
+
e.onKeyDown?.(t);
|
|
2221
|
+
}, [e.onKeyDown]),
|
|
2222
|
+
handleKeyUp: H((t) => {
|
|
2223
|
+
e.onKeyUp?.(t);
|
|
2224
|
+
}, [e.onKeyUp]),
|
|
2225
|
+
handleClick: H((t) => {
|
|
2226
|
+
e.onClick?.(t);
|
|
2227
|
+
}, [e.onClick]),
|
|
2228
|
+
handleDoubleClick: H((t) => {
|
|
2229
|
+
e.onDoubleClick?.(t);
|
|
2230
|
+
}, [e.onDoubleClick]),
|
|
2231
|
+
handlePointerDown: H((t) => {
|
|
2232
|
+
e.onPointerDown?.(t);
|
|
2233
|
+
}, [e.onPointerDown]),
|
|
2234
|
+
handlePointerMove: H((t) => {
|
|
2235
|
+
e.onPointerMove?.(t);
|
|
2236
|
+
}, [e.onPointerMove]),
|
|
2237
|
+
handlePointerUp: H((t) => {
|
|
2238
|
+
e.onPointerUp?.(t);
|
|
2239
|
+
}, [e.onPointerUp]),
|
|
2240
|
+
handlePointerLeave: H((t) => {
|
|
2241
|
+
e.onPointerLeave?.(t);
|
|
2242
|
+
}, [e.onPointerLeave]),
|
|
2243
|
+
handlePointerEnter: H((t) => {
|
|
2244
|
+
e.onPointerEnter?.(t);
|
|
2245
|
+
}, [e.onPointerEnter]),
|
|
2246
|
+
handleFocus: H(() => {
|
|
2247
|
+
e.onFocusChange?.(!0);
|
|
2248
|
+
}, [e.onFocusChange]),
|
|
2249
|
+
handleBlur: H(() => {
|
|
2250
|
+
e.onFocusChange?.(!1);
|
|
2251
|
+
}, [e.onFocusChange])
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
//#endregion
|
|
2255
|
+
//#region src/components/EzTable/hooks/useContainerResize.ts
|
|
2256
|
+
var en = ({ containerRef: e, containerSizeRef: t, resizeTimeoutRef: n, onResize: r }, i) => {
|
|
2257
|
+
U(() => {
|
|
2258
|
+
if (!e.current) return;
|
|
2259
|
+
let i = e.current;
|
|
2260
|
+
i.style.height = "100%", i.style.minHeight = "0", i.style.height = "";
|
|
2261
|
+
let a = new ResizeObserver((e) => {
|
|
2262
|
+
n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
2263
|
+
for (let n of e) {
|
|
2264
|
+
let { width: e, height: i } = n.contentRect;
|
|
2265
|
+
(Math.abs(e - t.current.width) > 1 || Math.abs(i - t.current.height) > 1) && (t.current = {
|
|
2266
|
+
width: e,
|
|
2267
|
+
height: i
|
|
2268
|
+
}, r());
|
|
2269
|
+
}
|
|
2270
|
+
}, 100);
|
|
2271
|
+
});
|
|
2272
|
+
return a.observe(i), () => {
|
|
2273
|
+
a.disconnect(), n.current && clearTimeout(n.current);
|
|
2274
|
+
};
|
|
2275
|
+
}, i);
|
|
2276
|
+
}, tn = ({ table: e, editSettings: t, toggleRowEditing: n, onRowClickProp: r, onRowDoubleClickProp: i, onCellClickProp: a, onCellDoubleClickProp: o }) => {
|
|
2277
|
+
let s = H((s, c) => {
|
|
2278
|
+
let l = e.options.meta;
|
|
2279
|
+
if (l?.setFocusedCell) {
|
|
2280
|
+
let t = s.colIndex ?? e.getVisibleLeafColumns().findIndex((e) => e.id === s.columnId);
|
|
2281
|
+
t !== -1 && l.setFocusedCell({
|
|
2282
|
+
r: s.rowIndex,
|
|
2283
|
+
c: t
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
c === "dblclick" && t?.allowEditing && t?.allowEditOnDblClick !== !1 && n(s.rowIndex, !0), (c === "click" ? a ?? r : o ?? i)?.(s);
|
|
2287
|
+
}, [
|
|
2288
|
+
e,
|
|
2289
|
+
t,
|
|
2290
|
+
n,
|
|
2291
|
+
r,
|
|
2292
|
+
i
|
|
2293
|
+
]);
|
|
2294
|
+
return {
|
|
2295
|
+
onRowClick: (e) => s(e, "click"),
|
|
2296
|
+
onRowDoubleClick: (e) => s(e, "dblclick"),
|
|
2297
|
+
onCellClick: (e) => s(e, "click"),
|
|
2298
|
+
onCellDoubleClick: (e) => s(e, "dblclick")
|
|
2299
|
+
};
|
|
2300
|
+
}, nn = ({ dialogState: e, isDialogMode: t, rows: n, table: r }) => {
|
|
2301
|
+
U(() => {
|
|
2302
|
+
if (!t) return;
|
|
2303
|
+
let i = Object.keys(r.options.meta?.editingRows || {}).find((e) => r.options.meta?.editingRows?.[e]);
|
|
2304
|
+
if (i !== void 0) {
|
|
2305
|
+
let t = parseInt(i);
|
|
2306
|
+
!isNaN(t) && n[t] && e.open("edit", n[t].original, { index: t });
|
|
2307
|
+
}
|
|
2308
|
+
}, [
|
|
2309
|
+
t,
|
|
2310
|
+
e,
|
|
2311
|
+
n,
|
|
2312
|
+
r
|
|
2313
|
+
]);
|
|
2314
|
+
}, rn = () => /* @__PURE__ */ Y("div", {
|
|
2315
|
+
className: "flex flex-col items-center justify-center min-h-screen p-4",
|
|
2316
|
+
children: /* @__PURE__ */ X("div", {
|
|
2317
|
+
className: "flex flex-col items-center gap-4 max-w-md w-full",
|
|
2318
|
+
children: [
|
|
2319
|
+
/* @__PURE__ */ Y("div", {
|
|
2320
|
+
className: "flex items-center justify-center w-16 h-16 rounded-full bg-destructive/10",
|
|
2321
|
+
children: /* @__PURE__ */ Y(ce, { className: "w-8 h-8 text-destructive" })
|
|
2322
|
+
}),
|
|
2323
|
+
/* @__PURE__ */ X("div", {
|
|
2324
|
+
className: "flex flex-col items-center gap-2 text-center",
|
|
2325
|
+
children: [/* @__PURE__ */ Y("h2", {
|
|
2326
|
+
className: "text-lg font-semibold",
|
|
2327
|
+
children: "Table Error"
|
|
2328
|
+
}), /* @__PURE__ */ Y("p", {
|
|
2329
|
+
className: "text-sm text-muted-foreground",
|
|
2330
|
+
children: "Something went wrong with the table. Please refresh the page or try again."
|
|
2331
|
+
})]
|
|
2332
|
+
}),
|
|
2333
|
+
/* @__PURE__ */ X("button", {
|
|
2334
|
+
onClick: () => window.location.reload(),
|
|
2335
|
+
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-primary hover:bg-primary/10 rounded-md transition-colors",
|
|
2336
|
+
children: [/* @__PURE__ */ Y(ke, { className: "w-4 h-4" }), "Refresh Page"]
|
|
2337
|
+
})
|
|
2338
|
+
]
|
|
2339
|
+
})
|
|
2340
|
+
}), an = (e) => {
|
|
2341
|
+
switch (e) {
|
|
2342
|
+
case "compact": return "min-h-[40px]";
|
|
2343
|
+
case "comfortable": return "min-h-[56px]";
|
|
2344
|
+
default: return "min-h-[48px]";
|
|
2345
|
+
}
|
|
2346
|
+
}, on = (e) => {
|
|
2347
|
+
switch (e) {
|
|
2348
|
+
case "compact": return "py-0 px-2";
|
|
2349
|
+
case "comfortable": return "py-4 px-4";
|
|
2350
|
+
default: return "py-2 px-4";
|
|
2351
|
+
}
|
|
2352
|
+
}, sn = (e) => {
|
|
2353
|
+
switch (e) {
|
|
2354
|
+
case "compact": return "text-[13px] leading-5";
|
|
2355
|
+
case "comfortable": return "text-base";
|
|
2356
|
+
default: return "text-sm";
|
|
2357
|
+
}
|
|
2358
|
+
}, cn = (t) => e(an(t), on(t), sn(t)), ln = (e, t, n = "ltr") => e ? {
|
|
2359
|
+
position: "sticky",
|
|
2360
|
+
[n === "rtl" ? e === "left" ? "right" : "left" : e === "left" ? "left" : "right"]: `${t}px`,
|
|
2361
|
+
zIndex: 30
|
|
2362
|
+
} : {}, un = (t, n = "ltr") => {
|
|
2363
|
+
if (!t) return "";
|
|
2364
|
+
let r = t === "left", i = n === "rtl";
|
|
2365
|
+
return e("bg-background", r && !i || !r && i ? "shadow-[2px_0_5px_-2px_rgba(0,0,0,0.1)] dark:shadow-[2px_0_5px_-2px_rgba(0,0,0,0.3)]" : "shadow-[-2px_0_5px_-2px_rgba(0,0,0,0.1)] dark:shadow-[-2px_0_5px_-2px_rgba(0,0,0,0.3)]");
|
|
2366
|
+
}, dn = (e, t = "ltr") => {
|
|
2367
|
+
switch (e) {
|
|
2368
|
+
case "center": return "justify-center text-center";
|
|
2369
|
+
case "right": return "justify-end text-right";
|
|
2370
|
+
case "left": return "justify-start text-left";
|
|
2371
|
+
default: return t === "rtl" ? "justify-end text-right" : "justify-start text-left";
|
|
2372
|
+
}
|
|
2373
|
+
}, fn = (t, n) => e(t && "bg-primary/10 ring-1 ring-inset ring-primary/30 z-[1]", n && "bg-primary/10 z-[10]"), pn = (e, t) => {
|
|
2374
|
+
switch (e) {
|
|
2375
|
+
case "wrap": return "whitespace-normal break-words";
|
|
2376
|
+
case "ellipsis": return t ? "overflow-hidden" : "truncate";
|
|
2377
|
+
default: return "truncate";
|
|
2378
|
+
}
|
|
2379
|
+
}, mn = (e, t, n = "ltr") => t || !e || e === "None" || e === "Horizontal" ? "" : n === "rtl" ? "border-l border-border/50" : "border-r border-border/50", hn = {
|
|
2380
|
+
compact: "py-1 text-xs",
|
|
2381
|
+
standard: "py-2 text-sm",
|
|
2382
|
+
comfortable: "py-4 text-base"
|
|
2383
|
+
}, gn = (e = "standard") => hn[e], _n = "flex flex-col", vn = {
|
|
2384
|
+
default: "border border-border",
|
|
2385
|
+
bottom: "border-b border-border",
|
|
2386
|
+
top: "border-t border-border",
|
|
2387
|
+
left: "border-l border-border",
|
|
2388
|
+
right: "border-r border-border",
|
|
2389
|
+
none: "border-0"
|
|
2390
|
+
}, yn = ({ header: t, density: n }) => {
|
|
2391
|
+
let r = t.column.columnDef.meta?.align || "left";
|
|
2392
|
+
return /* @__PURE__ */ Y("div", {
|
|
2393
|
+
className: e("relative h-full font-semibold text-foreground flex items-center select-none px-4", "bg-background/90 border border-border/50 shadow-lg rounded-md opacity-90 cursor-grabbing", "ring-2 ring-primary/20", gn(n), r === "center" && "justify-center text-center", r === "right" && "justify-end text-right"),
|
|
2394
|
+
style: {
|
|
2395
|
+
width: t.getSize(),
|
|
2396
|
+
maxWidth: t.column.columnDef.maxSize,
|
|
2397
|
+
minWidth: t.column.columnDef.minSize
|
|
2398
|
+
},
|
|
2399
|
+
children: /* @__PURE__ */ X("div", {
|
|
2400
|
+
className: e("flex items-center w-full gap-2", r === "center" && "justify-center relative", r === "right" && "justify-end"),
|
|
2401
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2402
|
+
className: "p-1 text-zinc-400",
|
|
2403
|
+
children: /* @__PURE__ */ Y(be, { className: "w-3.5 h-3.5" })
|
|
2404
|
+
}), /* @__PURE__ */ Y("span", {
|
|
2405
|
+
className: "truncate",
|
|
2406
|
+
children: Je(t.column.columnDef.header, t.getContext())
|
|
2407
|
+
})]
|
|
2408
|
+
})
|
|
2409
|
+
});
|
|
2410
|
+
}, bn = V(({ table: t, totalRows: n, selectionInfo: r, rowSelection: i }) => {
|
|
2411
|
+
let a = n ?? (t.getPrePaginationRowModel().rows.length || t.options.rowCount || t.getRowModel().rows.length), o = typeof a == "number" ? a : 0, s = Object.keys(i || {}).length;
|
|
2412
|
+
return /* @__PURE__ */ X("div", {
|
|
2413
|
+
className: e("flex border-t border-border p-2 text-xs text-muted-foreground justify-between bg-muted/30", "rounded-b-md"),
|
|
2414
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2415
|
+
className: "flex gap-4 items-center",
|
|
2416
|
+
children: [
|
|
2417
|
+
/* @__PURE__ */ X("span", { children: [
|
|
2418
|
+
"Total: ",
|
|
2419
|
+
o,
|
|
2420
|
+
" rows"
|
|
2421
|
+
] }),
|
|
2422
|
+
s > 0 && /* @__PURE__ */ X("span", {
|
|
2423
|
+
className: "text-primary font-medium",
|
|
2424
|
+
children: [s, " selected"]
|
|
2425
|
+
}),
|
|
2426
|
+
typeof r == "string" && /* @__PURE__ */ X("span", { children: ["| ", r] })
|
|
2427
|
+
]
|
|
2428
|
+
}), /* @__PURE__ */ Y("div", { className: "flex gap-2" })]
|
|
2429
|
+
});
|
|
2430
|
+
});
|
|
2431
|
+
bn.displayName = "EzTableStatusBar";
|
|
2432
|
+
//#endregion
|
|
2433
|
+
//#region src/components/EzTable/utils/columnTypeDetector.ts
|
|
2434
|
+
function xn(e) {
|
|
2435
|
+
if (!e || e.length === 0) return "text";
|
|
2436
|
+
let t = e.slice(0, 100).filter((e) => e != null && e !== "");
|
|
2437
|
+
if (t.length === 0) return "text";
|
|
2438
|
+
if (t.every((e) => typeof e == "boolean" || e === "true" || e === "false")) return "boolean";
|
|
2439
|
+
if (t.every((e) => typeof e == "number" || !isNaN(parseFloat(e)) && isFinite(e))) return "number";
|
|
2440
|
+
if (t.every((e) => e instanceof Date ? !0 : typeof e == "string" ? !isNaN(Date.parse(e)) && e.length > 5 && (e.includes("-") || e.includes("/") || e.includes(":")) : !1)) return t.some((e) => String(e).includes(":") || e instanceof Date && (e.getHours() !== 0 || e.getMinutes() !== 0)) ? "datetime" : "date";
|
|
2441
|
+
let n = new Set(t.map((e) => String(e)));
|
|
2442
|
+
return n.size > 0 && n.size <= Math.min(t.length * .2, 10) ? "select" : t.some((e) => typeof e == "string" && e.length > 100) ? "longtext" : "text";
|
|
2443
|
+
}
|
|
2444
|
+
//#endregion
|
|
2445
|
+
//#region src/components/EzTable/hooks/useFilterSelection.ts
|
|
2446
|
+
function Sn(e, t) {
|
|
2447
|
+
let [n, r] = K(() => Array.isArray(e) ? new Set(e) : null);
|
|
2448
|
+
return {
|
|
2449
|
+
selectedValues: n,
|
|
2450
|
+
isAllSelected: n === null,
|
|
2451
|
+
handleSelectAll: H((e) => {
|
|
2452
|
+
r(e ? null : /* @__PURE__ */ new Set());
|
|
2453
|
+
}, []),
|
|
2454
|
+
handleSelect: H((e, n) => {
|
|
2455
|
+
r((r) => {
|
|
2456
|
+
if (r === null) {
|
|
2457
|
+
if (n) return null;
|
|
2458
|
+
let r = new Set(t);
|
|
2459
|
+
return r.delete(e), r;
|
|
2460
|
+
}
|
|
2461
|
+
let i = new Set(r);
|
|
2462
|
+
if (n) {
|
|
2463
|
+
if (i.add(e), i.size === t.length) return null;
|
|
2464
|
+
} else i.delete(e);
|
|
2465
|
+
return i;
|
|
2466
|
+
});
|
|
2467
|
+
}, [t]),
|
|
2468
|
+
handleBulkSelect: H((e, n) => {
|
|
2469
|
+
r((r) => {
|
|
2470
|
+
let i = r || new Set(t), a = new Set(i);
|
|
2471
|
+
if (n) {
|
|
2472
|
+
if (e.forEach((e) => a.add(e)), a.size === t.length) return null;
|
|
2473
|
+
} else e.forEach((e) => a.delete(e));
|
|
2474
|
+
return a;
|
|
2475
|
+
});
|
|
2476
|
+
}, [t]),
|
|
2477
|
+
clearSelection: H(() => {
|
|
2478
|
+
r(null);
|
|
2479
|
+
}, [])
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
//#endregion
|
|
2483
|
+
//#region src/components/EzTable/components/SelectAllCheckbox.tsx
|
|
2484
|
+
var Cn = B.memo(({ checked: e, indeterminate: t, onSelectAll: n, showSearchResults: r = !1 }) => /* @__PURE__ */ X("div", {
|
|
2485
|
+
className: "flex items-center space-x-2 px-2 py-1.5 hover:bg-muted rounded text-sm cursor-pointer",
|
|
2486
|
+
onClick: () => n(!e),
|
|
2487
|
+
children: [/* @__PURE__ */ Y(k, {
|
|
2488
|
+
checked: e ? !0 : t ? "indeterminate" : !1,
|
|
2489
|
+
onCheckedChange: (e) => n(e === !0)
|
|
2490
|
+
}), /* @__PURE__ */ Y("label", {
|
|
2491
|
+
className: "flex-1 cursor-pointer",
|
|
2492
|
+
children: r ? "(Select All Search Results)" : "(Select All)"
|
|
2493
|
+
})]
|
|
2494
|
+
}));
|
|
2495
|
+
Cn.displayName = "SelectAllCheckbox";
|
|
2496
|
+
//#endregion
|
|
2497
|
+
//#region src/components/EzTable/components/BooleanFilterSection.tsx
|
|
2498
|
+
var wn = B.memo(({ column: e }) => {
|
|
2499
|
+
let t = e.columnDef.meta;
|
|
2500
|
+
return /* @__PURE__ */ X("div", {
|
|
2501
|
+
className: "p-3 space-y-3",
|
|
2502
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
2503
|
+
className: "text-sm font-medium",
|
|
2504
|
+
children: "Filter by value:"
|
|
2505
|
+
}), /* @__PURE__ */ Y(Tt, {
|
|
2506
|
+
value: e.getFilterValue() || "all",
|
|
2507
|
+
onChange: (t) => {
|
|
2508
|
+
e.setFilterValue(t);
|
|
2509
|
+
},
|
|
2510
|
+
trueLabel: t?.booleanOptions?.trueLabel,
|
|
2511
|
+
falseLabel: t?.booleanOptions?.falseLabel,
|
|
2512
|
+
nullLabel: t?.booleanOptions?.nullLabel
|
|
2513
|
+
})]
|
|
2514
|
+
});
|
|
2515
|
+
});
|
|
2516
|
+
wn.displayName = "BooleanFilterSection";
|
|
2517
|
+
//#endregion
|
|
2518
|
+
//#region src/components/EzTable/components/SelectFilterSection.tsx
|
|
2519
|
+
var Tn = B.memo(({ column: e, allAvailableValues: t }) => /* @__PURE__ */ Y("div", {
|
|
2520
|
+
className: "p-1",
|
|
2521
|
+
children: /* @__PURE__ */ Y(zt, {
|
|
2522
|
+
options: t.map((e) => ({
|
|
2523
|
+
value: String(e),
|
|
2524
|
+
label: String(e)
|
|
2525
|
+
})),
|
|
2526
|
+
selectedValues: Array.isArray(e.getFilterValue()) ? e.getFilterValue() : [],
|
|
2527
|
+
onChange: (t) => {
|
|
2528
|
+
e.setFilterValue(t.length > 0 ? t : void 0);
|
|
2529
|
+
}
|
|
2530
|
+
})
|
|
2531
|
+
}));
|
|
2532
|
+
Tn.displayName = "SelectFilterSection";
|
|
2533
|
+
//#endregion
|
|
2534
|
+
//#region src/components/EzTable/components/VirtualizedFilterList.tsx
|
|
2535
|
+
var En = B.memo(({ sortedUniqueValues: e, selectedValues: t, handleSelect: n, formatter: r }) => {
|
|
2536
|
+
let i = G(null), a = ot({
|
|
2537
|
+
count: e.length,
|
|
2538
|
+
getScrollElement: () => i.current,
|
|
2539
|
+
estimateSize: () => 32,
|
|
2540
|
+
overscan: 5
|
|
2541
|
+
});
|
|
2542
|
+
return /* @__PURE__ */ Y("div", {
|
|
2543
|
+
ref: i,
|
|
2544
|
+
className: "flex-1 overflow-y-auto px-2 pb-2 min-h-0 pt-2",
|
|
2545
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2546
|
+
style: {
|
|
2547
|
+
height: `${a.getTotalSize()}px`,
|
|
2548
|
+
width: "100%",
|
|
2549
|
+
position: "relative"
|
|
2550
|
+
},
|
|
2551
|
+
children: a.getVirtualItems().map((i) => {
|
|
2552
|
+
let a = e[i.index], o = t === null || t.has(a), s = r ? r(a) : String(a) || "(Empty)";
|
|
2553
|
+
return /* @__PURE__ */ X("div", {
|
|
2554
|
+
className: "absolute top-0 left-0 w-full flex items-center space-x-2 px-2 py-1 hover:bg-muted rounded text-sm cursor-pointer",
|
|
2555
|
+
style: {
|
|
2556
|
+
height: `${i.size}px`,
|
|
2557
|
+
transform: `translateY(${i.start}px)`
|
|
2558
|
+
},
|
|
2559
|
+
onClick: () => n(a, !o),
|
|
2560
|
+
children: [/* @__PURE__ */ Y(k, {
|
|
2561
|
+
checked: o,
|
|
2562
|
+
onCheckedChange: (e) => n(a, e === !0)
|
|
2563
|
+
}), /* @__PURE__ */ Y("span", {
|
|
2564
|
+
className: "flex-1 truncate",
|
|
2565
|
+
children: s
|
|
2566
|
+
})]
|
|
2567
|
+
}, i.key);
|
|
2568
|
+
})
|
|
2569
|
+
})
|
|
2570
|
+
});
|
|
2571
|
+
});
|
|
2572
|
+
En.displayName = "VirtualizedFilterList";
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region src/components/EzTable/components/FilterActionButtons.tsx
|
|
2575
|
+
var Dn = B.memo(({ onClear: e, onApply: t, onAddRule: n, onAddGroup: r, onRemove: a, showClear: o = !0, showApply: s = !0, showAddRule: c = !1, showAddGroup: l = !1, showRemove: u = !1, className: d }) => /* @__PURE__ */ X("div", {
|
|
2576
|
+
className: `p-2 border-t flex justify-between bg-popover text-popover-foreground flex-shrink-0 sticky bottom-0 z-20 ${d || ""}`,
|
|
2577
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2578
|
+
className: "flex gap-2",
|
|
2579
|
+
children: [
|
|
2580
|
+
o && e && /* @__PURE__ */ Y(i, {
|
|
2581
|
+
variant: "ghost",
|
|
2582
|
+
size: "sm",
|
|
2583
|
+
onClick: e,
|
|
2584
|
+
className: "h-8 text-xs",
|
|
2585
|
+
children: "Clear"
|
|
2586
|
+
}),
|
|
2587
|
+
c && n && /* @__PURE__ */ Y(i, {
|
|
2588
|
+
variant: "ghost",
|
|
2589
|
+
size: "icon",
|
|
2590
|
+
className: "h-6 w-6",
|
|
2591
|
+
onClick: n,
|
|
2592
|
+
title: "Add Rule",
|
|
2593
|
+
children: /* @__PURE__ */ Y(Oe, { className: "w-4 h-4" })
|
|
2594
|
+
}),
|
|
2595
|
+
l && r && /* @__PURE__ */ Y(i, {
|
|
2596
|
+
variant: "ghost",
|
|
2597
|
+
size: "icon",
|
|
2598
|
+
className: "h-6 w-6",
|
|
2599
|
+
onClick: r,
|
|
2600
|
+
title: "Add Group",
|
|
2601
|
+
children: /* @__PURE__ */ Y("span", {
|
|
2602
|
+
className: "font-bold text-xs",
|
|
2603
|
+
children: "( )"
|
|
2604
|
+
})
|
|
2605
|
+
})
|
|
2606
|
+
]
|
|
2607
|
+
}), /* @__PURE__ */ X("div", {
|
|
2608
|
+
className: "flex gap-2",
|
|
2609
|
+
children: [u && a && /* @__PURE__ */ Y(i, {
|
|
2610
|
+
variant: "ghost",
|
|
2611
|
+
size: "icon",
|
|
2612
|
+
className: "h-6 w-6 text-red-500 hover:text-red-600",
|
|
2613
|
+
onClick: a,
|
|
2614
|
+
children: /* @__PURE__ */ Y(Ne, { className: "w-4 h-4" })
|
|
2615
|
+
}), s && t && /* @__PURE__ */ Y(i, {
|
|
2616
|
+
size: "sm",
|
|
2617
|
+
onClick: t,
|
|
2618
|
+
className: "min-w-[70px] h-8 text-xs font-semibold",
|
|
2619
|
+
children: "OK"
|
|
2620
|
+
})]
|
|
2621
|
+
})]
|
|
2622
|
+
}));
|
|
2623
|
+
Dn.displayName = "FilterActionButtons";
|
|
2624
|
+
//#endregion
|
|
2625
|
+
//#region src/components/EzTable/EzDateFilterTree.tsx
|
|
2626
|
+
function On({ node: e, selectedValues: t, onBulkSelect: n }) {
|
|
2627
|
+
let [r, i] = K(!1), a = !1;
|
|
2628
|
+
if (t === null) a = !0;
|
|
2629
|
+
else {
|
|
2630
|
+
let n = e.fullValues.filter((e) => t.has(e)).length;
|
|
2631
|
+
a = n === e.fullValues.length && e.fullValues.length > 0 ? !0 : n > 0 ? "indeterminate" : !1;
|
|
2632
|
+
}
|
|
2633
|
+
let o = (t) => {
|
|
2634
|
+
n(e.fullValues, t);
|
|
2635
|
+
};
|
|
2636
|
+
return /* @__PURE__ */ X("div", {
|
|
2637
|
+
className: "pl-4",
|
|
2638
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2639
|
+
className: "flex items-center space-x-2 py-1 hover:bg-muted/50 rounded",
|
|
2640
|
+
children: [
|
|
2641
|
+
e.children && e.children.length > 0 ? /* @__PURE__ */ Y("button", {
|
|
2642
|
+
onClick: (e) => {
|
|
2643
|
+
e.stopPropagation(), i(!r);
|
|
2644
|
+
},
|
|
2645
|
+
className: "p-0.5 hover:bg-muted rounded mr-1 text-muted-foreground",
|
|
2646
|
+
children: Y(r ? de : pe, { className: "w-4 h-4" })
|
|
2647
|
+
}) : /* @__PURE__ */ Y("span", { className: "w-5 mr-1" }),
|
|
2648
|
+
/* @__PURE__ */ Y(k, {
|
|
2649
|
+
checked: a === "indeterminate" ? "indeterminate" : a,
|
|
2650
|
+
onCheckedChange: (e) => o(e === !0),
|
|
2651
|
+
id: `node-${e.key}`
|
|
2652
|
+
}),
|
|
2653
|
+
/* @__PURE__ */ X("label", {
|
|
2654
|
+
htmlFor: `node-${e.key}`,
|
|
2655
|
+
className: "text-sm flex-1 cursor-pointer select-none text-foreground",
|
|
2656
|
+
children: [e.label, /* @__PURE__ */ X("span", {
|
|
2657
|
+
className: "ml-2 text-xs text-muted-foreground",
|
|
2658
|
+
children: [
|
|
2659
|
+
"(",
|
|
2660
|
+
e.fullValues.length,
|
|
2661
|
+
")"
|
|
2662
|
+
]
|
|
2663
|
+
})]
|
|
2664
|
+
})
|
|
2665
|
+
]
|
|
2666
|
+
}), e.children && r && /* @__PURE__ */ Y("div", {
|
|
2667
|
+
className: "border-l border-border ml-2",
|
|
2668
|
+
children: e.children.map((e) => /* @__PURE__ */ Y(On, {
|
|
2669
|
+
node: e,
|
|
2670
|
+
selectedValues: t,
|
|
2671
|
+
onBulkSelect: n
|
|
2672
|
+
}, e.key))
|
|
2673
|
+
})]
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
function kn({ uniqueValues: e, selectedValues: t, onBulkSelect: n }) {
|
|
2677
|
+
let r = W(() => {
|
|
2678
|
+
let t = [], n = Array.from(e.keys()).map((e) => {
|
|
2679
|
+
let t = e instanceof Date ? e : new Date(e);
|
|
2680
|
+
return {
|
|
2681
|
+
date: t,
|
|
2682
|
+
original: e,
|
|
2683
|
+
valid: !isNaN(t.getTime())
|
|
2684
|
+
};
|
|
2685
|
+
}).filter((e) => e.valid);
|
|
2686
|
+
n.sort((e, t) => e.date.getTime() - t.date.getTime());
|
|
2687
|
+
let r = /* @__PURE__ */ new Map();
|
|
2688
|
+
return n.forEach((e) => {
|
|
2689
|
+
let t = e.date.getFullYear();
|
|
2690
|
+
r.has(t) || r.set(t, []), r.get(t).push(e);
|
|
2691
|
+
}), r.forEach((e, n) => {
|
|
2692
|
+
let r = {
|
|
2693
|
+
key: String(n),
|
|
2694
|
+
label: String(n),
|
|
2695
|
+
level: 0,
|
|
2696
|
+
fullValues: e.map((e) => e.original),
|
|
2697
|
+
children: []
|
|
2698
|
+
}, i = /* @__PURE__ */ new Map();
|
|
2699
|
+
e.forEach((e) => {
|
|
2700
|
+
let t = e.date.getMonth();
|
|
2701
|
+
i.has(t) || i.set(t, []), i.get(t).push(e);
|
|
2702
|
+
}), i.forEach((e, t) => {
|
|
2703
|
+
let i = new Date(n, t).toLocaleString("default", { month: "long" }), a = {
|
|
2704
|
+
key: `${n}-${t}`,
|
|
2705
|
+
label: i,
|
|
2706
|
+
level: 1,
|
|
2707
|
+
fullValues: e.map((e) => e.original),
|
|
2708
|
+
children: []
|
|
2709
|
+
}, o = /* @__PURE__ */ new Map();
|
|
2710
|
+
e.forEach((e) => {
|
|
2711
|
+
let t = e.date.getDate();
|
|
2712
|
+
o.has(t) || o.set(t, []), o.get(t).push(e);
|
|
2713
|
+
}), o.forEach((e, r) => {
|
|
2714
|
+
let i = {
|
|
2715
|
+
key: `${n}-${t}-${r}`,
|
|
2716
|
+
label: String(r),
|
|
2717
|
+
level: 2,
|
|
2718
|
+
fullValues: e.map((e) => e.original),
|
|
2719
|
+
children: []
|
|
2720
|
+
};
|
|
2721
|
+
a.children.push(i);
|
|
2722
|
+
}), r.children.push(a);
|
|
2723
|
+
}), t.push(r);
|
|
2724
|
+
}), t;
|
|
2725
|
+
}, [e]);
|
|
2726
|
+
return /* @__PURE__ */ X("div", {
|
|
2727
|
+
className: "space-y-1",
|
|
2728
|
+
children: [r.length === 0 && /* @__PURE__ */ Y("div", {
|
|
2729
|
+
className: "p-2 text-sm text-muted-foreground",
|
|
2730
|
+
children: "No dates found"
|
|
2731
|
+
}), r.map((e) => /* @__PURE__ */ Y(On, {
|
|
2732
|
+
node: e,
|
|
2733
|
+
selectedValues: t,
|
|
2734
|
+
onBulkSelect: n
|
|
2735
|
+
}, e.key))]
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
//#endregion
|
|
2739
|
+
//#region src/components/EzTable/components/FilterRuleSelect.tsx
|
|
2740
|
+
var An = B.memo(({ value: e, onChange: t, options: n, placeholder: r, className: i }) => /* @__PURE__ */ X(O, {
|
|
2741
|
+
value: e,
|
|
2742
|
+
onValueChange: (e) => t(e),
|
|
2743
|
+
children: [/* @__PURE__ */ Y(T, {
|
|
2744
|
+
className: i,
|
|
2745
|
+
children: /* @__PURE__ */ Y(w, { placeholder: r })
|
|
2746
|
+
}), /* @__PURE__ */ Y(E, { children: n.map((e) => /* @__PURE__ */ Y(D, {
|
|
2747
|
+
value: e.value,
|
|
2748
|
+
children: e.label
|
|
2749
|
+
}, e.value)) })]
|
|
2750
|
+
}));
|
|
2751
|
+
An.displayName = "FilterRuleSelect";
|
|
2752
|
+
//#endregion
|
|
2753
|
+
//#region src/components/EzTable/components/AdvancedColumnFilter.tsx
|
|
2754
|
+
var jn = {
|
|
2755
|
+
text: [
|
|
2756
|
+
{
|
|
2757
|
+
label: "Contains",
|
|
2758
|
+
value: "contains"
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
label: "Does not contain",
|
|
2762
|
+
value: "doesNotContain"
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
label: "Equals",
|
|
2766
|
+
value: "equals"
|
|
2767
|
+
},
|
|
2768
|
+
{
|
|
2769
|
+
label: "Does not equal",
|
|
2770
|
+
value: "notEquals"
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
label: "Starts with",
|
|
2774
|
+
value: "startsWith"
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
label: "Ends with",
|
|
2778
|
+
value: "endsWith"
|
|
2779
|
+
}
|
|
2780
|
+
],
|
|
2781
|
+
number: [
|
|
2782
|
+
{
|
|
2783
|
+
label: "Equals",
|
|
2784
|
+
value: "equals"
|
|
2785
|
+
},
|
|
2786
|
+
{
|
|
2787
|
+
label: "Greater than",
|
|
2788
|
+
value: "gt"
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
label: "Greater or equal",
|
|
2792
|
+
value: "gte"
|
|
2793
|
+
},
|
|
2794
|
+
{
|
|
2795
|
+
label: "Less than",
|
|
2796
|
+
value: "lt"
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
label: "Less or equal",
|
|
2800
|
+
value: "lte"
|
|
2801
|
+
},
|
|
2802
|
+
{
|
|
2803
|
+
label: "Between",
|
|
2804
|
+
value: "between"
|
|
2805
|
+
}
|
|
2806
|
+
],
|
|
2807
|
+
date: [
|
|
2808
|
+
{
|
|
2809
|
+
label: "Equals",
|
|
2810
|
+
value: "equals"
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
label: "After",
|
|
2814
|
+
value: "gt"
|
|
2815
|
+
},
|
|
2816
|
+
{
|
|
2817
|
+
label: "On or after",
|
|
2818
|
+
value: "gte"
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
label: "Before",
|
|
2822
|
+
value: "lt"
|
|
2823
|
+
},
|
|
2824
|
+
{
|
|
2825
|
+
label: "On or before",
|
|
2826
|
+
value: "lte"
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
label: "Between",
|
|
2830
|
+
value: "between"
|
|
2831
|
+
}
|
|
2832
|
+
]
|
|
2833
|
+
}, Mn = ({ columnType: e, columnId: t, value: n, onChange: r }) => {
|
|
2834
|
+
let i = jn[e === "datetime" || e === "date" ? "date" : e === "number" ? "number" : "text"] || jn.text, s = e === "number" ? "number" : e === "date" || e === "datetime" ? "date" : "text", c = n?.kind === "group", l = c ? n.filters[0] : n?.operator ? n : {
|
|
2835
|
+
operator: i[0].value,
|
|
2836
|
+
value: ""
|
|
2837
|
+
}, u = c ? n.filters[1] : {
|
|
2838
|
+
operator: i[0].value,
|
|
2839
|
+
value: ""
|
|
2840
|
+
}, d = c ? n.logic : "OR", f = c, [p, m] = K(l), [h, g] = K(u), [_, v] = K(d), [y, b] = K(f);
|
|
2841
|
+
B.useEffect(() => {
|
|
2842
|
+
let e = n?.kind === "group", t = e ? n.filters[0] : n?.operator ? n : {
|
|
2843
|
+
operator: i[0].value,
|
|
2844
|
+
value: ""
|
|
2845
|
+
}, r = e ? n.filters[1] : {
|
|
2846
|
+
operator: i[0].value,
|
|
2847
|
+
value: ""
|
|
2848
|
+
}, a = e ? n.logic : "OR";
|
|
2849
|
+
m(t), g(r), v(a), b(e);
|
|
2850
|
+
}, [n, i]);
|
|
2851
|
+
let x = (e, n, i, a) => {
|
|
2852
|
+
if (!a) {
|
|
2853
|
+
r({
|
|
2854
|
+
kind: "rule",
|
|
2855
|
+
operator: e.operator,
|
|
2856
|
+
value: e.value,
|
|
2857
|
+
field: e.field || t,
|
|
2858
|
+
id: e.id || t
|
|
2859
|
+
});
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
r({
|
|
2863
|
+
kind: "group",
|
|
2864
|
+
logic: i,
|
|
2865
|
+
filters: [{
|
|
2866
|
+
kind: "rule",
|
|
2867
|
+
operator: e.operator,
|
|
2868
|
+
value: e.value,
|
|
2869
|
+
field: e.field || t,
|
|
2870
|
+
id: e.id || `${t}_1`
|
|
2871
|
+
}, {
|
|
2872
|
+
kind: "rule",
|
|
2873
|
+
operator: n.operator,
|
|
2874
|
+
value: n.value,
|
|
2875
|
+
field: n.field || t,
|
|
2876
|
+
id: n.id || `${t}_2`
|
|
2877
|
+
}]
|
|
2878
|
+
});
|
|
2879
|
+
}, S = (e, t, n) => {
|
|
2880
|
+
let r = (r) => {
|
|
2881
|
+
let i = {
|
|
2882
|
+
...e,
|
|
2883
|
+
value: r
|
|
2884
|
+
};
|
|
2885
|
+
t(i);
|
|
2886
|
+
let a = y || n;
|
|
2887
|
+
n && !y && b(!0), x(n ? p : i, n ? i : h, _, a);
|
|
2888
|
+
};
|
|
2889
|
+
if (e.operator === "between") {
|
|
2890
|
+
let t = Array.isArray(e.value) ? e.value : [e.value ?? "", ""];
|
|
2891
|
+
return /* @__PURE__ */ X("div", {
|
|
2892
|
+
className: "flex gap-2",
|
|
2893
|
+
children: [/* @__PURE__ */ Y(a, {
|
|
2894
|
+
type: s,
|
|
2895
|
+
value: t[0],
|
|
2896
|
+
onChange: (e) => r([e.target.value, t[1]]),
|
|
2897
|
+
className: "h-8 shadow-none flex-1",
|
|
2898
|
+
placeholder: "From..."
|
|
2899
|
+
}), /* @__PURE__ */ Y(a, {
|
|
2900
|
+
type: s,
|
|
2901
|
+
value: t[1],
|
|
2902
|
+
onChange: (e) => r([t[0], e.target.value]),
|
|
2903
|
+
className: "h-8 shadow-none flex-1",
|
|
2904
|
+
placeholder: "To..."
|
|
2905
|
+
})]
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
return /* @__PURE__ */ Y(a, {
|
|
2909
|
+
type: s,
|
|
2910
|
+
value: e.value ?? "",
|
|
2911
|
+
onChange: (e) => r(e.target.value),
|
|
2912
|
+
className: "h-8 shadow-none",
|
|
2913
|
+
placeholder: "Enter value..."
|
|
2914
|
+
});
|
|
2915
|
+
};
|
|
2916
|
+
return /* @__PURE__ */ X("div", {
|
|
2917
|
+
className: "p-3 space-y-4",
|
|
2918
|
+
children: [
|
|
2919
|
+
/* @__PURE__ */ X("div", {
|
|
2920
|
+
className: "space-y-2",
|
|
2921
|
+
children: [/* @__PURE__ */ Y(o, {
|
|
2922
|
+
className: "text-xs font-medium text-muted-foreground uppercase",
|
|
2923
|
+
children: "Show rows where:"
|
|
2924
|
+
}), /* @__PURE__ */ X("div", {
|
|
2925
|
+
className: "space-y-2",
|
|
2926
|
+
children: [/* @__PURE__ */ Y(An, {
|
|
2927
|
+
value: p.operator,
|
|
2928
|
+
options: i,
|
|
2929
|
+
onChange: (e) => {
|
|
2930
|
+
let t = e, n = {
|
|
2931
|
+
...p,
|
|
2932
|
+
operator: t,
|
|
2933
|
+
value: t === "between" ? ["", ""] : p.value
|
|
2934
|
+
};
|
|
2935
|
+
m(n), x(n, h, _, y);
|
|
2936
|
+
},
|
|
2937
|
+
placeholder: "Select operator",
|
|
2938
|
+
className: "h-8 shadow-none"
|
|
2939
|
+
}), S(p, m, !1)]
|
|
2940
|
+
})]
|
|
2941
|
+
}),
|
|
2942
|
+
/* @__PURE__ */ Y("div", {
|
|
2943
|
+
className: "flex justify-center",
|
|
2944
|
+
children: /* @__PURE__ */ X(Et, {
|
|
2945
|
+
value: _,
|
|
2946
|
+
onValueChange: (e) => {
|
|
2947
|
+
v(e), y || b(!0), x(p, h, e, !0);
|
|
2948
|
+
},
|
|
2949
|
+
className: "flex gap-4",
|
|
2950
|
+
children: [/* @__PURE__ */ X("div", {
|
|
2951
|
+
className: "flex items-center space-x-1.5 focus-within:bg-muted/50 px-2 py-0.5 rounded transition",
|
|
2952
|
+
children: [/* @__PURE__ */ Y(Dt, {
|
|
2953
|
+
value: "AND",
|
|
2954
|
+
id: "and",
|
|
2955
|
+
className: "h-3.5 w-3.5"
|
|
2956
|
+
}), /* @__PURE__ */ Y(o, {
|
|
2957
|
+
htmlFor: "and",
|
|
2958
|
+
className: "text-xs cursor-pointer font-semibold uppercase tracking-wider",
|
|
2959
|
+
children: "And"
|
|
2960
|
+
})]
|
|
2961
|
+
}), /* @__PURE__ */ X("div", {
|
|
2962
|
+
className: "flex items-center space-x-1.5 focus-within:bg-muted/50 px-2 py-0.5 rounded transition",
|
|
2963
|
+
children: [/* @__PURE__ */ Y(Dt, {
|
|
2964
|
+
value: "OR",
|
|
2965
|
+
id: "or",
|
|
2966
|
+
className: "h-3.5 w-3.5"
|
|
2967
|
+
}), /* @__PURE__ */ Y(o, {
|
|
2968
|
+
htmlFor: "or",
|
|
2969
|
+
className: "text-xs cursor-pointer font-semibold uppercase tracking-wider",
|
|
2970
|
+
children: "Or"
|
|
2971
|
+
})]
|
|
2972
|
+
})]
|
|
2973
|
+
})
|
|
2974
|
+
}),
|
|
2975
|
+
/* @__PURE__ */ Y("div", {
|
|
2976
|
+
className: `space-y-2 transition-opacity duration-200 ${y ? "" : "opacity-50"}`,
|
|
2977
|
+
children: /* @__PURE__ */ X("div", {
|
|
2978
|
+
className: "space-y-2",
|
|
2979
|
+
children: [/* @__PURE__ */ Y(An, {
|
|
2980
|
+
value: h.operator,
|
|
2981
|
+
options: i,
|
|
2982
|
+
onChange: (e) => {
|
|
2983
|
+
let t = e, n = {
|
|
2984
|
+
...h,
|
|
2985
|
+
operator: t,
|
|
2986
|
+
value: t === "between" ? ["", ""] : h.value
|
|
2987
|
+
};
|
|
2988
|
+
g(n), y || b(!0), x(p, n, _, !0);
|
|
2989
|
+
},
|
|
2990
|
+
placeholder: "Select operator",
|
|
2991
|
+
className: "h-8 shadow-none"
|
|
2992
|
+
}), S(h, g, !0)]
|
|
2993
|
+
})
|
|
2994
|
+
}),
|
|
2995
|
+
!y && /* @__PURE__ */ Y("div", {
|
|
2996
|
+
className: "text-[10px] text-muted-foreground italic text-center",
|
|
2997
|
+
children: "Select AND/OR or enter a second value to combine filters"
|
|
2998
|
+
})
|
|
2999
|
+
]
|
|
3000
|
+
});
|
|
3001
|
+
};
|
|
3002
|
+
//#endregion
|
|
3003
|
+
//#region src/components/EzTable/EzExcelFilter.tsx
|
|
3004
|
+
function Nn({ column: t, table: n }) {
|
|
3005
|
+
let [r, i] = K(!1), a = n.options.meta?.containerRef;
|
|
3006
|
+
return /* @__PURE__ */ X(g, {
|
|
3007
|
+
open: r,
|
|
3008
|
+
onOpenChange: i,
|
|
3009
|
+
children: [/* @__PURE__ */ Y(h, {
|
|
3010
|
+
asChild: !0,
|
|
3011
|
+
children: /* @__PURE__ */ Y("div", {
|
|
3012
|
+
className: e("ml-1 cursor-pointer p-1 rounded hover:bg-muted transition focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", t.getIsFiltered() ? "bg-primary/10" : ""),
|
|
3013
|
+
onClick: (e) => {
|
|
3014
|
+
e.stopPropagation();
|
|
3015
|
+
},
|
|
3016
|
+
children: /* @__PURE__ */ Y(Se, { className: e("w-4 h-4", t.getIsFiltered() ? "text-primary fill-primary" : "text-muted-foreground") })
|
|
3017
|
+
})
|
|
3018
|
+
}), /* @__PURE__ */ Y(m, {
|
|
3019
|
+
className: "w-[280px] p-0",
|
|
3020
|
+
align: "start",
|
|
3021
|
+
container: a?.current,
|
|
3022
|
+
collisionBoundary: a?.current,
|
|
3023
|
+
children: r && /* @__PURE__ */ Y(Ln, {
|
|
3024
|
+
column: t,
|
|
3025
|
+
table: n,
|
|
3026
|
+
setIsOpen: i,
|
|
3027
|
+
filterValue: t.getFilterValue()
|
|
3028
|
+
})
|
|
3029
|
+
})]
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
var Pn = ["date", "datetime"], Fn = ["boolean"], In = ["select"], Ln = B.memo(({ column: n, table: r, setIsOpen: o, filterValue: s }) => {
|
|
3033
|
+
let [c, l] = K("list"), [u, d] = K(""), [f, p] = K(""), [m, h] = K(!0), [g, _] = K(/* @__PURE__ */ new Map()), [v, y] = K([]), b = (r.options.meta?.containerRef?.current || (typeof document < "u" ? document.getElementById("ez-table-default") : null))?.clientHeight ?? 500, x = Math.min(500, b > 100 ? b - 40 : 500);
|
|
3034
|
+
U(() => {
|
|
3035
|
+
let e = setTimeout(() => p(u), 200), t = setTimeout(() => {
|
|
3036
|
+
let e = n.getFacetedUniqueValues();
|
|
3037
|
+
_(e), y(Array.from(e.keys())), h(!1);
|
|
3038
|
+
}, 50);
|
|
3039
|
+
return () => {
|
|
3040
|
+
clearTimeout(e), clearTimeout(t);
|
|
3041
|
+
};
|
|
3042
|
+
}, [u, n]);
|
|
3043
|
+
let { selectedValues: S, handleSelectAll: C, handleSelect: w, handleBulkSelect: T, clearSelection: E } = Sn(s, v), D = W(() => {
|
|
3044
|
+
let e = n.columnDef.meta;
|
|
3045
|
+
return e?.columnType ? e.columnType : v.length === 0 ? "text" : xn(v);
|
|
3046
|
+
}, [n.columnDef.meta, v]), O = Pn.includes(D), k = Fn.includes(D), A = In.includes(D), j = W(() => {
|
|
3047
|
+
let e = [...v].sort((e, t) => {
|
|
3048
|
+
if (e === t) return 0;
|
|
3049
|
+
if (e == null) return -1;
|
|
3050
|
+
if (t == null) return 1;
|
|
3051
|
+
let n = String(e), r = String(t);
|
|
3052
|
+
return n.localeCompare(r, void 0, {
|
|
3053
|
+
numeric: !0,
|
|
3054
|
+
sensitivity: "base"
|
|
3055
|
+
});
|
|
3056
|
+
});
|
|
3057
|
+
if (!f) return e;
|
|
3058
|
+
let t = f.toLowerCase();
|
|
3059
|
+
return e.filter((e) => String(e).toLowerCase().includes(t));
|
|
3060
|
+
}, [v, f]), ee = () => {
|
|
3061
|
+
if (c === "filters") {
|
|
3062
|
+
o(!1);
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3065
|
+
let e;
|
|
3066
|
+
e = S === null ? f ? j : void 0 : Array.from(S), n.setFilterValue(e?.length === 0 ? void 0 : e), o(!1);
|
|
3067
|
+
}, te = () => {
|
|
3068
|
+
n.setFilterValue(void 0), o(!1), E(), d("");
|
|
3069
|
+
}, M = s, N = M && typeof M == "object" && !Array.isArray(M), P = (e) => {
|
|
3070
|
+
n.setFilterValue(e);
|
|
3071
|
+
}, ne = W(() => S === null ? !0 : j.length > 0 && j.every((e) => S.has(e)), [S, j]), F = W(() => S === null ? j.length > 0 : j.some((e) => S.has(e)), [S, j]);
|
|
3072
|
+
return m ? /* @__PURE__ */ X("div", {
|
|
3073
|
+
className: "h-[300px] flex flex-col items-center justify-center space-y-3 bg-popover text-popover-foreground",
|
|
3074
|
+
children: [/* @__PURE__ */ Y(Ce, { className: "h-8 w-8 animate-spin text-primary" }), /* @__PURE__ */ Y("span", {
|
|
3075
|
+
className: "text-sm text-muted-foreground animate-pulse font-medium",
|
|
3076
|
+
children: "Calculating filter values..."
|
|
3077
|
+
})]
|
|
3078
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
3079
|
+
className: "flex flex-col min-h-0 overflow-hidden",
|
|
3080
|
+
style: { maxHeight: `${x}px` },
|
|
3081
|
+
children: c === "filters" ? /* @__PURE__ */ X("div", {
|
|
3082
|
+
className: "flex flex-col animate-in fade-in slide-in-from-right-2 duration-200",
|
|
3083
|
+
children: [
|
|
3084
|
+
/* @__PURE__ */ X("div", {
|
|
3085
|
+
className: "p-3 border-b flex items-center space-x-2 bg-muted/30",
|
|
3086
|
+
children: [/* @__PURE__ */ Y(i, {
|
|
3087
|
+
variant: "ghost",
|
|
3088
|
+
size: "sm",
|
|
3089
|
+
onClick: () => l("list"),
|
|
3090
|
+
className: "h-6 w-6 p-0",
|
|
3091
|
+
children: /* @__PURE__ */ Y(fe, { className: "h-4 w-4" })
|
|
3092
|
+
}), /* @__PURE__ */ X("span", {
|
|
3093
|
+
className: "font-semibold text-sm capitalize",
|
|
3094
|
+
children: [D, " Filters"]
|
|
3095
|
+
})]
|
|
3096
|
+
}),
|
|
3097
|
+
/* @__PURE__ */ Y("div", {
|
|
3098
|
+
className: "flex-1 overflow-y-auto min-h-0",
|
|
3099
|
+
children: /* @__PURE__ */ Y(Mn, {
|
|
3100
|
+
columnType: D,
|
|
3101
|
+
columnId: n.id,
|
|
3102
|
+
value: N ? M : void 0,
|
|
3103
|
+
onChange: P
|
|
3104
|
+
})
|
|
3105
|
+
}),
|
|
3106
|
+
/* @__PURE__ */ Y(Dn, {
|
|
3107
|
+
onClear: te,
|
|
3108
|
+
onApply: ee,
|
|
3109
|
+
className: "border-t mt-auto"
|
|
3110
|
+
})
|
|
3111
|
+
]
|
|
3112
|
+
}) : /* @__PURE__ */ X("div", {
|
|
3113
|
+
className: "flex flex-col animate-in fade-in slide-in-from-left-2 duration-200 flex-1 min-h-0",
|
|
3114
|
+
children: [
|
|
3115
|
+
n.getCanPin() && /* @__PURE__ */ X("div", {
|
|
3116
|
+
className: "p-1 border-b border-border space-y-0.5",
|
|
3117
|
+
children: [["left", "right"].map((t) => n.getIsPinned() !== t && /* @__PURE__ */ X("div", {
|
|
3118
|
+
className: "flex items-center gap-2 px-2 py-1.5 text-xs font-medium cursor-pointer hover:bg-muted rounded",
|
|
3119
|
+
onClick: () => {
|
|
3120
|
+
n.pin(t), o(!1);
|
|
3121
|
+
},
|
|
3122
|
+
children: [
|
|
3123
|
+
/* @__PURE__ */ Y(Ee, { className: e("w-3.5 h-3.5", t === "left" ? "rotate-[-45deg]" : "rotate-[45deg]") }),
|
|
3124
|
+
" Pin to ",
|
|
3125
|
+
t.charAt(0).toUpperCase() + t.slice(1)
|
|
3126
|
+
]
|
|
3127
|
+
}, t)), n.getIsPinned() && /* @__PURE__ */ X("div", {
|
|
3128
|
+
className: "flex items-center gap-2 px-2 py-1.5 text-xs font-medium text-red-500 cursor-pointer hover:bg-red-50 dark:hover:bg-red-900/20 rounded",
|
|
3129
|
+
onClick: () => {
|
|
3130
|
+
n.pin(!1), o(!1);
|
|
3131
|
+
},
|
|
3132
|
+
children: [/* @__PURE__ */ Y(De, { className: "w-3.5 h-3.5" }), " Unpin Column"]
|
|
3133
|
+
})]
|
|
3134
|
+
}),
|
|
3135
|
+
!k && !A && /* @__PURE__ */ X("div", {
|
|
3136
|
+
className: "p-2 border-b border-border flex justify-between items-center cursor-pointer hover:bg-muted/50 transition group",
|
|
3137
|
+
onClick: () => l("filters"),
|
|
3138
|
+
children: [/* @__PURE__ */ X("span", {
|
|
3139
|
+
className: "text-sm font-medium capitalize",
|
|
3140
|
+
children: [D, " Filters"]
|
|
3141
|
+
}), /* @__PURE__ */ Y(pe, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" })]
|
|
3142
|
+
}),
|
|
3143
|
+
/* @__PURE__ */ Y("div", {
|
|
3144
|
+
className: "flex flex-col flex-1 overflow-hidden min-h-0",
|
|
3145
|
+
children: k ? /* @__PURE__ */ Y(wn, { column: n }) : A ? /* @__PURE__ */ Y(Tn, {
|
|
3146
|
+
column: n,
|
|
3147
|
+
allAvailableValues: v
|
|
3148
|
+
}) : /* @__PURE__ */ X("div", {
|
|
3149
|
+
className: "flex flex-col flex-1 min-h-0 pointer-events-auto",
|
|
3150
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3151
|
+
className: "sticky top-0 bg-popover text-popover-foreground border-b z-20",
|
|
3152
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
3153
|
+
className: "p-2",
|
|
3154
|
+
children: /* @__PURE__ */ X("div", {
|
|
3155
|
+
className: "relative",
|
|
3156
|
+
children: [/* @__PURE__ */ Y(Ae, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ Y(a, {
|
|
3157
|
+
placeholder: "Search...",
|
|
3158
|
+
value: u,
|
|
3159
|
+
onChange: (e) => d(e.target.value),
|
|
3160
|
+
className: "pl-9 h-9",
|
|
3161
|
+
autoFocus: !0
|
|
3162
|
+
})]
|
|
3163
|
+
})
|
|
3164
|
+
}), /* @__PURE__ */ Y(Cn, {
|
|
3165
|
+
checked: ne,
|
|
3166
|
+
indeterminate: F && !ne,
|
|
3167
|
+
onSelectAll: (e) => {
|
|
3168
|
+
f ? T(j, e) : C(e);
|
|
3169
|
+
},
|
|
3170
|
+
showSearchResults: !!f
|
|
3171
|
+
})]
|
|
3172
|
+
}), O ? /* @__PURE__ */ Y("div", {
|
|
3173
|
+
className: "flex-1 overflow-y-auto px-2 pb-2 min-h-0 pt-2",
|
|
3174
|
+
children: /* @__PURE__ */ Y(kn, {
|
|
3175
|
+
uniqueValues: g,
|
|
3176
|
+
selectedValues: S,
|
|
3177
|
+
onBulkSelect: T
|
|
3178
|
+
})
|
|
3179
|
+
}) : /* @__PURE__ */ Y(En, {
|
|
3180
|
+
sortedUniqueValues: j,
|
|
3181
|
+
selectedValues: S,
|
|
3182
|
+
handleSelect: w,
|
|
3183
|
+
formatter: (e) => {
|
|
3184
|
+
let r = n.columnDef.meta;
|
|
3185
|
+
if (r?.columnType === "number") {
|
|
3186
|
+
if (r?.numberOptions?.format === "currency") return t(e, {
|
|
3187
|
+
format: "currency",
|
|
3188
|
+
...r.numberOptions
|
|
3189
|
+
});
|
|
3190
|
+
if (r?.numberOptions?.format === "percentage") return t(e, {
|
|
3191
|
+
format: "percentage",
|
|
3192
|
+
...r.numberOptions
|
|
3193
|
+
});
|
|
3194
|
+
if (r?.numberOptions?.format === "float" || r?.numberOptions?.format === "integer") return t(e, {
|
|
3195
|
+
format: r.numberOptions.format,
|
|
3196
|
+
...r.numberOptions
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3199
|
+
return String(e);
|
|
3200
|
+
}
|
|
3201
|
+
})]
|
|
3202
|
+
})
|
|
3203
|
+
}),
|
|
3204
|
+
/* @__PURE__ */ Y(Dn, {
|
|
3205
|
+
onClear: te,
|
|
3206
|
+
onApply: ee
|
|
3207
|
+
})
|
|
3208
|
+
]
|
|
3209
|
+
})
|
|
3210
|
+
});
|
|
3211
|
+
});
|
|
3212
|
+
Ln.displayName = "FilterContent";
|
|
3213
|
+
//#endregion
|
|
3214
|
+
//#region src/components/EzTable/EzHeaderContextMenu.tsx
|
|
3215
|
+
function Rn({ header: e, children: t }) {
|
|
3216
|
+
let n = e.column, r = n.getIsPinned(), i = n.getCanGroup(), a = n.getIsGrouped();
|
|
3217
|
+
return /* @__PURE__ */ X(M, { children: [/* @__PURE__ */ Y(ee, {
|
|
3218
|
+
asChild: !0,
|
|
3219
|
+
children: t
|
|
3220
|
+
}), /* @__PURE__ */ X(te, {
|
|
3221
|
+
className: "w-48",
|
|
3222
|
+
children: [
|
|
3223
|
+
i && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(N, {
|
|
3224
|
+
onClick: () => n.toggleGrouping(),
|
|
3225
|
+
className: "gap-2",
|
|
3226
|
+
children: a ? /* @__PURE__ */ X(J, { children: [
|
|
3227
|
+
/* @__PURE__ */ Y(je, { className: "w-3.5 h-3.5" }),
|
|
3228
|
+
"Ungroup ",
|
|
3229
|
+
n.id
|
|
3230
|
+
] }) : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(xe, { className: "w-3.5 h-3.5 text-zinc-500/70" }), "Group by column"] })
|
|
3231
|
+
}), /* @__PURE__ */ Y(j, {})] }),
|
|
3232
|
+
/* @__PURE__ */ X(N, {
|
|
3233
|
+
onClick: () => n.pin("left"),
|
|
3234
|
+
disabled: r === "left",
|
|
3235
|
+
className: "gap-2",
|
|
3236
|
+
children: [/* @__PURE__ */ Y(Ee, { className: "w-3.5 h-3.5 rotate-[-45deg]" }), "Pin to Left"]
|
|
3237
|
+
}),
|
|
3238
|
+
/* @__PURE__ */ X(N, {
|
|
3239
|
+
onClick: () => n.pin("right"),
|
|
3240
|
+
disabled: r === "right",
|
|
3241
|
+
className: "gap-2",
|
|
3242
|
+
children: [/* @__PURE__ */ Y(Ee, { className: "w-3.5 h-3.5 rotate-[45deg]" }), "Pin to Right"]
|
|
3243
|
+
}),
|
|
3244
|
+
r && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(j, {}), /* @__PURE__ */ X(N, {
|
|
3245
|
+
onClick: () => n.pin(!1),
|
|
3246
|
+
className: "text-red-600 focus:text-red-700 focus:bg-red-50 dark:focus:bg-red-900/20 gap-2",
|
|
3247
|
+
children: [/* @__PURE__ */ Y(De, { className: "w-3.5 h-3.5" }), "Unpin Column"]
|
|
3248
|
+
})] })
|
|
3249
|
+
]
|
|
3250
|
+
})] });
|
|
3251
|
+
}
|
|
3252
|
+
//#endregion
|
|
3253
|
+
//#region src/components/EzTable/components/EzDraggableHeader.tsx
|
|
3254
|
+
var zn = V(({ header: t, density: n, onAutoFit: r, columnPinning: i }) => {
|
|
3255
|
+
let a = t.getContext().table.options.meta, o = t.id === "select" || t.id === "actions", s = t.column.columnDef.meta, c = t.column.columnDef, l = a?.enableColumnReorder !== !1 && !o && s?.allowReordering !== !1 && c?.allowReordering !== !1, u = !(t.column.getCanGroup() && !o) && !l || t.isPlaceholder, { attributes: d, listeners: f, setNodeRef: p, isDragging: m } = Re({
|
|
3256
|
+
id: t.column.id,
|
|
3257
|
+
disabled: u,
|
|
3258
|
+
data: {
|
|
3259
|
+
type: "column",
|
|
3260
|
+
columnId: t.column.id
|
|
3261
|
+
}
|
|
3262
|
+
}), { setNodeRef: h, isOver: g } = ze({
|
|
3263
|
+
id: `header-${t.column.id}`,
|
|
3264
|
+
disabled: u,
|
|
3265
|
+
data: {
|
|
3266
|
+
type: "header",
|
|
3267
|
+
columnId: t.column.id
|
|
3268
|
+
}
|
|
3269
|
+
}), _ = t.column.getIsPinned(), v = W(() => {
|
|
3270
|
+
if (!_) return {};
|
|
3271
|
+
let e = _ === "right" ? t.column.getAfter("right") : t.column.getStart("left"), n = t.getContext().table.options.meta;
|
|
3272
|
+
return ln(_, e, n?.dir);
|
|
3273
|
+
}, [
|
|
3274
|
+
_,
|
|
3275
|
+
t.column,
|
|
3276
|
+
i
|
|
3277
|
+
]), y = B.useRef(0), b = H((e) => {
|
|
3278
|
+
let n = Date.now();
|
|
3279
|
+
n - y.current < 300 && r?.(t.column.id), y.current = n, t.getResizeHandler()(e);
|
|
3280
|
+
}, [t, r]), x = t.column.columnDef.meta?.align || "left", S = t.column.columnDef.meta?.gridLines || t.getContext().table.options.meta?.gridLines, C = a?.focusedCell?.c === t.index, w = /* @__PURE__ */ X("div", {
|
|
3281
|
+
ref: (e) => {
|
|
3282
|
+
p(e), h(e);
|
|
3283
|
+
},
|
|
3284
|
+
className: e("relative h-full font-semibold text-foreground flex items-center select-none group/header transition-all flex-shrink-0 px-4", a?.dir === "rtl" ? "border-l border-border/50" : "border-r border-border/50", gn(n), m && "opacity-50 bg-muted pointer-events-none", g && "ring-2 ring-inset ring-primary bg-accent/50", t.column.getIsGrouped() && "bg-accent/30", C && "bg-primary/5 text-primary border-b-2 border-primary", x === "center" && "justify-center text-center", x === "right" && "justify-end text-right", un(_), (S === "Both" || S === "Vertical") && (a?.dir === "rtl" ? "border-l border-border" : "border-r border-border")),
|
|
3285
|
+
style: {
|
|
3286
|
+
width: `calc(var(--header-${t.id}-size) * 1px)`,
|
|
3287
|
+
minWidth: (t.column.columnDef.minSize ?? 0) > 0 ? t.column.columnDef.minSize : void 0,
|
|
3288
|
+
maxWidth: (t.column.columnDef.maxSize ?? 0) > 0 && t.column.columnDef.maxSize !== 2 ** 53 - 1 ? t.column.columnDef.maxSize : void 0,
|
|
3289
|
+
...v
|
|
3290
|
+
},
|
|
3291
|
+
role: "columnheader",
|
|
3292
|
+
"aria-colindex": t.index + 1,
|
|
3293
|
+
"aria-sort": t.column.getIsSorted() === "asc" ? "ascending" : t.column.getIsSorted() === "desc" ? "descending" : "none",
|
|
3294
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3295
|
+
className: e("flex items-center w-full h-full gap-2", x === "center" && "justify-center relative", x === "right" && "justify-end"),
|
|
3296
|
+
children: [
|
|
3297
|
+
!u && /* @__PURE__ */ Y("div", {
|
|
3298
|
+
...d,
|
|
3299
|
+
...f,
|
|
3300
|
+
className: e("cursor-grab active:cursor-grabbing p-1 text-muted-foreground hover:text-foreground transition-colors z-50", x === "center" ? a?.dir === "rtl" ? "absolute right-1 top-1/2 -translate-y-1/2" : "absolute left-1 top-1/2 -translate-y-1/2" : a?.dir === "rtl" ? "-mr-2 ml-1" : "-ml-2 mr-1"),
|
|
3301
|
+
children: /* @__PURE__ */ Y(be, { className: "w-3.5 h-3.5" })
|
|
3302
|
+
}),
|
|
3303
|
+
/* @__PURE__ */ X("div", {
|
|
3304
|
+
className: e("flex items-center min-w-0 gap-2 cursor-pointer group h-full select-none", x === "center" && "justify-center", x === "right" && "justify-end", t.column.getCanSort() ? "hover:text-foreground/80" : "", x !== "center" && x !== "right" && "flex-1"),
|
|
3305
|
+
onClick: t.column.getToggleSortingHandler(),
|
|
3306
|
+
tabIndex: t.column.getCanSort() ? 0 : -1,
|
|
3307
|
+
role: "button",
|
|
3308
|
+
"aria-label": `Sort by ${t.column.columnDef.header}`,
|
|
3309
|
+
children: [
|
|
3310
|
+
x === "center" && t.column.getIsSorted() && /* @__PURE__ */ Y("div", {
|
|
3311
|
+
className: "w-4 h-4 flex-shrink-0",
|
|
3312
|
+
"aria-hidden": "true"
|
|
3313
|
+
}),
|
|
3314
|
+
/* @__PURE__ */ Y("span", {
|
|
3315
|
+
className: "truncate min-w-0",
|
|
3316
|
+
children: !t.isPlaceholder && Je(t.column.columnDef.header, t.getContext())
|
|
3317
|
+
}),
|
|
3318
|
+
t.column.getIsSorted() === "asc" && /* @__PURE__ */ Y(ue, { className: "w-4 h-4 text-foreground flex-shrink-0" }),
|
|
3319
|
+
t.column.getIsSorted() === "desc" && /* @__PURE__ */ Y(le, { className: "w-4 h-4 text-foreground flex-shrink-0" })
|
|
3320
|
+
]
|
|
3321
|
+
}),
|
|
3322
|
+
!t.isPlaceholder && t.column.getCanFilter() && /* @__PURE__ */ Y("div", {
|
|
3323
|
+
className: e(a?.dir === "rtl" ? "ml-2" : "mr-2", x === "center" && (a?.dir === "rtl" ? "absolute left-1 top-1/2 -translate-y-1/2 ml-0" : "absolute right-1 top-1/2 -translate-y-1/2 mr-0")),
|
|
3324
|
+
children: /* @__PURE__ */ Y(Nn, {
|
|
3325
|
+
column: t.column,
|
|
3326
|
+
table: t.getContext().table
|
|
3327
|
+
})
|
|
3328
|
+
})
|
|
3329
|
+
]
|
|
3330
|
+
}), t.column.getCanResize() && /* @__PURE__ */ Y("div", {
|
|
3331
|
+
onMouseDown: b,
|
|
3332
|
+
onTouchStart: t.getResizeHandler(),
|
|
3333
|
+
className: e("absolute top-0 h-full w-4 cursor-col-resize hover:bg-primary/10 touch-none select-none z-30 transition-colors", a?.dir === "rtl" ? "left-0" : "right-0", t.column.getIsResizing() ? "bg-primary w-1" : ""),
|
|
3334
|
+
role: "separator"
|
|
3335
|
+
})]
|
|
3336
|
+
});
|
|
3337
|
+
return t.column.getCanPin() || t.column.getCanGroup() ? /* @__PURE__ */ Y(Rn, {
|
|
3338
|
+
header: t,
|
|
3339
|
+
children: w
|
|
3340
|
+
}) : w;
|
|
3341
|
+
});
|
|
3342
|
+
zn.displayName = "EzDraggableHeader";
|
|
3343
|
+
//#endregion
|
|
3344
|
+
//#region src/components/EzTable/components/EzTableHeaderSection.tsx
|
|
3345
|
+
var Bn = B.memo(Vn);
|
|
3346
|
+
function Vn({ table: t, enableStickyHeader: n, classNames: r, density: i, autoFitColumn: a, slots: o }) {
|
|
3347
|
+
return /* @__PURE__ */ Y("div", {
|
|
3348
|
+
className: e(_n, "w-full bg-white dark:bg-zinc-900 shadow-sm", vn.bottom, n && "sticky top-0 z-30", r?.header),
|
|
3349
|
+
role: "rowgroup",
|
|
3350
|
+
children: t.getHeaderGroups().map((n) => /* @__PURE__ */ Y("div", {
|
|
3351
|
+
className: e("flex w-full border-border/50 last:border-0 h-full", vn.bottom),
|
|
3352
|
+
role: "row",
|
|
3353
|
+
children: o?.header ? /* @__PURE__ */ Y("div", {
|
|
3354
|
+
className: "contents",
|
|
3355
|
+
children: (() => {
|
|
3356
|
+
let e = o.header;
|
|
3357
|
+
return n.headers.map((n) => /* @__PURE__ */ Y(e, {
|
|
3358
|
+
header: n,
|
|
3359
|
+
table: t
|
|
3360
|
+
}, n.id));
|
|
3361
|
+
})()
|
|
3362
|
+
}) : n.headers.map((e) => /* @__PURE__ */ Y(zn, {
|
|
3363
|
+
header: e,
|
|
3364
|
+
density: i,
|
|
3365
|
+
onAutoFit: a,
|
|
3366
|
+
columnPinning: t.getState().columnPinning
|
|
3367
|
+
}, e.id))
|
|
3368
|
+
}, n.id))
|
|
3369
|
+
});
|
|
3370
|
+
}
|
|
3371
|
+
//#endregion
|
|
3372
|
+
//#region src/components/EzTable/EzTableOverlays.tsx
|
|
3373
|
+
var Hn = V(({ isLoading: e, rowCount: t, renderNoRowsOverlay: n, slots: r, localization: i }) => {
|
|
3374
|
+
if (e) {
|
|
3375
|
+
let e = r?.loading || r?.loadingOverlay;
|
|
3376
|
+
return e ? /* @__PURE__ */ Y(e, {}) : /* @__PURE__ */ Y("div", {
|
|
3377
|
+
className: "absolute inset-x-0 top-0 z-50 flex flex-col items-center justify-center bg-white/50 dark:bg-black/50 backdrop-blur-[1px] min-h-[200px]",
|
|
3378
|
+
children: /* @__PURE__ */ X("div", {
|
|
3379
|
+
className: "flex flex-col items-center gap-3 py-10",
|
|
3380
|
+
children: [/* @__PURE__ */ Y("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }), /* @__PURE__ */ Y("span", {
|
|
3381
|
+
className: "text-sm font-medium text-zinc-600 dark:text-zinc-400",
|
|
3382
|
+
children: i?.loadingLabel || "Loading data..."
|
|
3383
|
+
})]
|
|
3384
|
+
})
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
if (t === 0) {
|
|
3388
|
+
let e = r?.emptyRecord || r?.noRowsOverlay;
|
|
3389
|
+
return e ? /* @__PURE__ */ Y(e, {}) : /* @__PURE__ */ Y("div", {
|
|
3390
|
+
className: "absolute inset-0 flex flex-col items-center justify-center p-10 text-center",
|
|
3391
|
+
children: n ? n() : /* @__PURE__ */ X("div", {
|
|
3392
|
+
className: "flex flex-col items-center gap-2 text-zinc-400",
|
|
3393
|
+
children: [
|
|
3394
|
+
/* @__PURE__ */ Y(ye, { className: "w-12 h-12 opacity-10 mb-2" }),
|
|
3395
|
+
/* @__PURE__ */ Y("span", {
|
|
3396
|
+
className: "text-sm font-medium",
|
|
3397
|
+
children: i?.noRowsLabel || "No results found"
|
|
3398
|
+
}),
|
|
3399
|
+
/* @__PURE__ */ Y("p", {
|
|
3400
|
+
className: "text-xs",
|
|
3401
|
+
children: "Adjust your filters or search to see more results"
|
|
3402
|
+
})
|
|
3403
|
+
]
|
|
3404
|
+
})
|
|
3405
|
+
});
|
|
3406
|
+
}
|
|
3407
|
+
return null;
|
|
3408
|
+
});
|
|
3409
|
+
Hn.displayName = "EzTableOverlays";
|
|
3410
|
+
//#endregion
|
|
3411
|
+
//#region src/components/EzTable/utils/TruncatedTooltip.tsx
|
|
3412
|
+
var Un = ({ children: e, text: t }) => {
|
|
3413
|
+
let n = G(null), [r, i] = K(!1), a = () => n.current ? n.current.scrollWidth > n.current.clientWidth + 1 : !1;
|
|
3414
|
+
return U(() => {
|
|
3415
|
+
if (a(), n.current) {
|
|
3416
|
+
let e = new ResizeObserver(a);
|
|
3417
|
+
return e.observe(n.current), () => e.disconnect();
|
|
3418
|
+
}
|
|
3419
|
+
}, [e, t]), /* @__PURE__ */ Y(y, { children: /* @__PURE__ */ X(b, {
|
|
3420
|
+
delayDuration: 300,
|
|
3421
|
+
open: r,
|
|
3422
|
+
children: [/* @__PURE__ */ Y(_, {
|
|
3423
|
+
asChild: !0,
|
|
3424
|
+
children: /* @__PURE__ */ Y("div", {
|
|
3425
|
+
ref: n,
|
|
3426
|
+
className: "truncate w-full cursor-default min-w-0",
|
|
3427
|
+
onMouseEnter: () => {
|
|
3428
|
+
a() && i(!0);
|
|
3429
|
+
},
|
|
3430
|
+
onMouseLeave: () => {
|
|
3431
|
+
i(!1);
|
|
3432
|
+
},
|
|
3433
|
+
children: e
|
|
3434
|
+
})
|
|
3435
|
+
}), /* @__PURE__ */ Y(v, { children: /* @__PURE__ */ Y("p", {
|
|
3436
|
+
className: "max-w-sm break-words",
|
|
3437
|
+
children: t || e
|
|
3438
|
+
}) })]
|
|
3439
|
+
}) });
|
|
3440
|
+
}, Wn = V(({ cell: t, virtualRowIndex: n, cellIndex: r, isPinned: i, isSelected: a, isFocused: o, density: s, onCellMouseDown: c, onCellMouseEnter: l, onCellClick: u, onCellDoubleClick: d, tableMeta: f, rowDepth: p, renderDetailPanel: m, isFirstColumn: h, columnPinning: g }) => {
|
|
3441
|
+
let _ = W(() => ({
|
|
3442
|
+
width: `calc(var(--col-${t.column.id}-size) * 1px)`,
|
|
3443
|
+
minWidth: (t.column.columnDef.minSize ?? 0) > 0 ? t.column.columnDef.minSize : void 0,
|
|
3444
|
+
maxWidth: (t.column.columnDef.maxSize ?? 0) > 0 && t.column.columnDef.maxSize !== 2 ** 53 - 1 ? t.column.columnDef.maxSize : void 0,
|
|
3445
|
+
...ln(i, i === "right" ? t.column.getAfter("right") : t.column.getStart("left"), f?.dir),
|
|
3446
|
+
paddingLeft: f?.dir !== "rtl" && (t.column.id === "firstName" || t.column.id === "name" || t.column.id === "id") ? `${p * 20 + 16}px` : void 0,
|
|
3447
|
+
paddingRight: f?.dir === "rtl" && (t.column.id === "firstName" || t.column.id === "name" || t.column.id === "id") ? `${p * 20 + 16}px` : void 0
|
|
3448
|
+
}), [
|
|
3449
|
+
t.column.id,
|
|
3450
|
+
i,
|
|
3451
|
+
p,
|
|
3452
|
+
g
|
|
3453
|
+
]), v = /* @__PURE__ */ Y(J, { children: t.getIsGrouped() ? /* @__PURE__ */ X("span", {
|
|
3454
|
+
className: "font-semibold",
|
|
3455
|
+
children: [Je(t.column.columnDef.cell, t.getContext()), /* @__PURE__ */ X("span", {
|
|
3456
|
+
className: "text-muted-foreground font-normal ml-1",
|
|
3457
|
+
children: [
|
|
3458
|
+
"(",
|
|
3459
|
+
t.row.subRows.length,
|
|
3460
|
+
")"
|
|
3461
|
+
]
|
|
3462
|
+
})]
|
|
3463
|
+
}) : t.getIsAggregated() ? /* @__PURE__ */ Y("span", {
|
|
3464
|
+
className: e("font-medium tabular-nums", f?.enableGroupFooters && "text-primary/80 bg-primary/5 px-2 py-0.5 rounded"),
|
|
3465
|
+
children: Je(t.column.columnDef.aggregatedCell ?? t.column.columnDef.cell, t.getContext())
|
|
3466
|
+
}) : t.getIsPlaceholder() ? null : Je(t.column.columnDef.cell, t.getContext()) }), y = t.column.columnDef.meta?.clipMode, b = W(() => {
|
|
3467
|
+
if (!f?.validate || !f?.validationAttempted) return { isValid: !0 };
|
|
3468
|
+
let e = t.column.id, n = t.getValue(), r = t.row.original;
|
|
3469
|
+
return f.validate(e, n, r);
|
|
3470
|
+
}, [
|
|
3471
|
+
f,
|
|
3472
|
+
t,
|
|
3473
|
+
n,
|
|
3474
|
+
t.getValue()
|
|
3475
|
+
]), x = o ? {
|
|
3476
|
+
boxShadow: b.isValid ? "inset 0 0 0 2px hsl(var(--primary))" : "inset 0 0 0 2px hsl(var(--destructive))",
|
|
3477
|
+
zIndex: 20,
|
|
3478
|
+
position: "relative"
|
|
3479
|
+
} : {};
|
|
3480
|
+
return /* @__PURE__ */ X("div", {
|
|
3481
|
+
onMouseDown: (e) => {
|
|
3482
|
+
e.button === 0 && (c(n, r, e), f?.setFocusedCell?.({
|
|
3483
|
+
r: n,
|
|
3484
|
+
c: r
|
|
3485
|
+
}));
|
|
3486
|
+
},
|
|
3487
|
+
onMouseEnter: () => l(n, r),
|
|
3488
|
+
onClick: (e) => {
|
|
3489
|
+
u?.({
|
|
3490
|
+
row: t.row.original,
|
|
3491
|
+
columnId: t.column.id,
|
|
3492
|
+
cellValue: t.getValue(),
|
|
3493
|
+
event: e,
|
|
3494
|
+
rowIndex: n,
|
|
3495
|
+
colIndex: r
|
|
3496
|
+
}), o && f?.toggleRowEditing && !f?.editingRows?.[n] && f.toggleRowEditing(n, !0);
|
|
3497
|
+
},
|
|
3498
|
+
onDoubleClick: (e) => d?.({
|
|
3499
|
+
row: t.row.original,
|
|
3500
|
+
columnId: t.column.id,
|
|
3501
|
+
cellValue: t.getValue(),
|
|
3502
|
+
event: e,
|
|
3503
|
+
rowIndex: n,
|
|
3504
|
+
colIndex: r
|
|
3505
|
+
}),
|
|
3506
|
+
className: e("px-4 text-sm font-medium text-foreground flex select-none min-h-full min-w-0 flex-shrink-0 relative", o && "z-20", o && b.isValid && "bg-primary/5", o && !b.isValid && "bg-destructive/5", !b.isValid && "ring-1 ring-inset ring-destructive", !o && (f?.dir === "rtl" ? "border-l border-border/50" : "border-r border-border/50"), t.column.columnDef.meta?.wrapText ? "items-start pt-3" : "items-center", cn(s), fn(a, o), dn(t.column.columnDef.meta?.align, f?.dir), pn(t.column.columnDef.meta?.wrapText ? "wrap" : y === "ellipsis-tooltip" ? "ellipsis" : "truncate", y === "ellipsis-tooltip"), un(i, f?.dir), !o && mn(t.column.columnDef.meta?.gridLines || f?.gridLines, void 0, f?.dir), typeof f?.classNames?.cell == "function" ? f.classNames.cell(t) : f?.classNames?.cell),
|
|
3507
|
+
style: {
|
|
3508
|
+
..._,
|
|
3509
|
+
...x
|
|
3510
|
+
},
|
|
3511
|
+
role: "cell",
|
|
3512
|
+
"data-column-id": t.column.id,
|
|
3513
|
+
children: [t.getIsGrouped() || t.row.getCanExpand() && h || m && h ? /* @__PURE__ */ Y("button", {
|
|
3514
|
+
className: e(f?.dir === "rtl" ? "ml-2" : "mr-2", "p-1 hover:bg-muted rounded transition-transform", !t.row.getCanExpand() && !m && "invisible"),
|
|
3515
|
+
onClick: (e) => {
|
|
3516
|
+
e.stopPropagation(), t.row.getToggleExpandedHandler()();
|
|
3517
|
+
},
|
|
3518
|
+
children: t.row.getIsExpanded() ? /* @__PURE__ */ Y(de, { className: "w-4 h-4" }) : /* @__PURE__ */ Y(pe, { className: "w-4 h-4" })
|
|
3519
|
+
}) : null, b.isValid ? y === "ellipsis-tooltip" ? /* @__PURE__ */ Y("div", {
|
|
3520
|
+
className: "flex-1 min-w-0",
|
|
3521
|
+
children: /* @__PURE__ */ Y(Un, {
|
|
3522
|
+
text: typeof t.getValue() == "string" ? t.getValue() : void 0,
|
|
3523
|
+
children: v
|
|
3524
|
+
})
|
|
3525
|
+
}) : v : /* @__PURE__ */ Y("div", {
|
|
3526
|
+
className: "flex-1 min-w-0",
|
|
3527
|
+
children: /* @__PURE__ */ Y(R, {
|
|
3528
|
+
enabled: !0,
|
|
3529
|
+
side: f?.dir === "rtl" ? "left" : "right",
|
|
3530
|
+
className: "bg-destructive text-destructive-foreground border-destructive/20 shadow-xl z-50",
|
|
3531
|
+
content: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("p", {
|
|
3532
|
+
className: "text-[10px] font-bold uppercase tracking-wider mb-0.5 opacity-80",
|
|
3533
|
+
children: "Validation Error"
|
|
3534
|
+
}), /* @__PURE__ */ Y("p", {
|
|
3535
|
+
className: "text-xs font-medium",
|
|
3536
|
+
children: b.error
|
|
3537
|
+
})] }),
|
|
3538
|
+
children: /* @__PURE__ */ Y("div", {
|
|
3539
|
+
className: "w-full h-full flex items-center",
|
|
3540
|
+
children: v
|
|
3541
|
+
})
|
|
3542
|
+
})
|
|
3543
|
+
})]
|
|
3544
|
+
});
|
|
3545
|
+
});
|
|
3546
|
+
Wn.displayName = "EzTableCell";
|
|
3547
|
+
//#endregion
|
|
3548
|
+
//#region src/components/EzTable/components/EzTableRow.tsx
|
|
3549
|
+
var Gn = V(({ virtualRow: t, row: n, table: r, density: i, enableContextMenu: a, onContextMenuItemClick: o, isCellSelected: s, onCellMouseDown: c, onCellMouseEnter: l, onCellClick: u, onCellDoubleClick: d, focusedCell: f, renderDetailPanel: p, measureElement: m, dynamicRowSizing: h, columnVirtualizer: g, onRowClick: _, onRowDoubleClick: v, onRowMouseEnter: y, onRowMouseLeave: b, columnPinning: x }) => {
|
|
3550
|
+
let S = g?.getVirtualItems() || n.getVisibleCells().map((e, t) => ({ index: t })), C = n.getVisibleCells(), w = !!h || n.getIsExpanded() || C.some((e) => e.column.columnDef.meta?.wrapText), { paddingLeft: T, paddingRight: E } = W(() => !g || S.length === 0 ? {
|
|
3551
|
+
paddingLeft: 0,
|
|
3552
|
+
paddingRight: 0
|
|
3553
|
+
} : {
|
|
3554
|
+
paddingLeft: S[0]?.start || 0,
|
|
3555
|
+
paddingRight: g.getTotalSize() - (S[S.length - 1]?.end || 0)
|
|
3556
|
+
}, [g, S]);
|
|
3557
|
+
return /* @__PURE__ */ Y(P, {
|
|
3558
|
+
row: n,
|
|
3559
|
+
enabled: a,
|
|
3560
|
+
onAction: (e, t) => {
|
|
3561
|
+
e === "pin-top" ? n.pin("top") : e === "pin-bottom" ? n.pin("bottom") : e === "unpin" ? n.pin(!1) : o?.(e, t);
|
|
3562
|
+
},
|
|
3563
|
+
children: /* @__PURE__ */ X("div", {
|
|
3564
|
+
"data-index": t.index,
|
|
3565
|
+
ref: m,
|
|
3566
|
+
className: "absolute top-0 left-0 w-full flex flex-col group border-b border-border",
|
|
3567
|
+
role: "row",
|
|
3568
|
+
"aria-rowindex": t.index + 1,
|
|
3569
|
+
style: {
|
|
3570
|
+
transform: `translateY(${t.start}px)`,
|
|
3571
|
+
...w ? { minHeight: `${t.size}px` } : { height: `${t.size}px` }
|
|
3572
|
+
},
|
|
3573
|
+
onClick: (e) => _?.({
|
|
3574
|
+
row: n.original,
|
|
3575
|
+
data: n.original,
|
|
3576
|
+
rowIndex: n.index,
|
|
3577
|
+
originalEvent: e
|
|
3578
|
+
}),
|
|
3579
|
+
onDoubleClick: (e) => v?.({
|
|
3580
|
+
row: n.original,
|
|
3581
|
+
data: n.original,
|
|
3582
|
+
rowIndex: n.index,
|
|
3583
|
+
originalEvent: e
|
|
3584
|
+
}),
|
|
3585
|
+
onMouseEnter: (e) => y?.(n.index, e),
|
|
3586
|
+
onMouseLeave: (e) => b?.(n.index, e),
|
|
3587
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3588
|
+
className: e("flex items-stretch w-full min-w-max hover:bg-muted/50 transition-[background-color] duration-200", n.getIsSelected() && "bg-muted", cn(i), typeof r.options.meta?.classNames?.row == "function" ? r.options.meta.classNames.row(n) : r.options.meta?.classNames?.row),
|
|
3589
|
+
children: [
|
|
3590
|
+
T > 0 && /* @__PURE__ */ Y("div", { style: { flex: `0 0 ${T}px` } }),
|
|
3591
|
+
S.map((e) => {
|
|
3592
|
+
let a = C[e.index];
|
|
3593
|
+
return a ? /* @__PURE__ */ Y(Wn, {
|
|
3594
|
+
cell: a,
|
|
3595
|
+
virtualRowIndex: t.index,
|
|
3596
|
+
cellIndex: e.index,
|
|
3597
|
+
density: i,
|
|
3598
|
+
isPinned: a.column.getIsPinned(),
|
|
3599
|
+
isSelected: s(t.index, e.index),
|
|
3600
|
+
isFocused: f?.r === t.index && f?.c === e.index,
|
|
3601
|
+
onCellMouseDown: (e, t, n) => c(e, t, n),
|
|
3602
|
+
onCellMouseEnter: l,
|
|
3603
|
+
onCellClick: u,
|
|
3604
|
+
onCellDoubleClick: d,
|
|
3605
|
+
tableMeta: r.options.meta,
|
|
3606
|
+
rowDepth: n.depth,
|
|
3607
|
+
renderDetailPanel: p,
|
|
3608
|
+
isFirstColumn: e.index === 0,
|
|
3609
|
+
table: r,
|
|
3610
|
+
columnPinning: x
|
|
3611
|
+
}, a.id) : null;
|
|
3612
|
+
}),
|
|
3613
|
+
E > 0 && /* @__PURE__ */ Y("div", { style: { flex: `0 0 ${E}px` } })
|
|
3614
|
+
]
|
|
3615
|
+
}), n.getIsExpanded() && p && /* @__PURE__ */ Y("div", {
|
|
3616
|
+
className: "w-full bg-muted/30 border-t border-border",
|
|
3617
|
+
children: p({ row: n })
|
|
3618
|
+
})]
|
|
3619
|
+
})
|
|
3620
|
+
});
|
|
3621
|
+
});
|
|
3622
|
+
Gn.displayName = "EzTableRow";
|
|
3623
|
+
//#endregion
|
|
3624
|
+
//#region src/components/EzTable/components/EzTableBodySection.tsx
|
|
3625
|
+
function Kn({ table: t, rows: n, rowVirtualizer: r, columnVirtualizer: i, density: a, classNames: o, isLoading: s, enableInfiniteScroll: c, isPending: l, renderNoRowsOverlay: u, slots: d, localization: f, enableContextMenu: p, onContextMenuItemClick: m, isCellSelected: h, focusedCell: g, onCellMouseDown: _, onCellMouseEnter: v, onCellClick: y, onCellDoubleClick: b, renderDetailPanel: x, dynamicRowSizing: S, onRowClick: C, onRowDoubleClick: w }) {
|
|
3626
|
+
let T = !!((s || l) && !c);
|
|
3627
|
+
return /* @__PURE__ */ X("div", {
|
|
3628
|
+
className: e("relative w-full", o?.body),
|
|
3629
|
+
style: {
|
|
3630
|
+
height: `${r?.getTotalSize() ?? 0}px`,
|
|
3631
|
+
minHeight: "0",
|
|
3632
|
+
flexShrink: "0"
|
|
3633
|
+
},
|
|
3634
|
+
children: [/* @__PURE__ */ Y(Hn, {
|
|
3635
|
+
isLoading: T,
|
|
3636
|
+
rowCount: n.length,
|
|
3637
|
+
renderNoRowsOverlay: u,
|
|
3638
|
+
slots: d,
|
|
3639
|
+
localization: f
|
|
3640
|
+
}), r?.getVirtualItems().map((e) => {
|
|
3641
|
+
let o = n[e.index];
|
|
3642
|
+
return /* @__PURE__ */ Y(d?.row || Gn, {
|
|
3643
|
+
virtualRow: e,
|
|
3644
|
+
row: o,
|
|
3645
|
+
table: t,
|
|
3646
|
+
density: a,
|
|
3647
|
+
enableContextMenu: !!p,
|
|
3648
|
+
onContextMenuItemClick: m,
|
|
3649
|
+
isCellSelected: h,
|
|
3650
|
+
focusedCell: g,
|
|
3651
|
+
onCellMouseDown: _,
|
|
3652
|
+
onCellMouseEnter: v,
|
|
3653
|
+
onCellClick: y,
|
|
3654
|
+
onCellDoubleClick: b,
|
|
3655
|
+
renderDetailPanel: x,
|
|
3656
|
+
measureElement: S ? r.measureElement : void 0,
|
|
3657
|
+
dynamicRowSizing: S,
|
|
3658
|
+
columnVirtualizer: i,
|
|
3659
|
+
onRowClick: C,
|
|
3660
|
+
onRowDoubleClick: w,
|
|
3661
|
+
columnPinning: t.getState().columnPinning,
|
|
3662
|
+
tableMeta: t.options.meta
|
|
3663
|
+
}, o.id);
|
|
3664
|
+
})]
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3667
|
+
//#endregion
|
|
3668
|
+
//#region src/components/EzTable/EzPagination.tsx
|
|
3669
|
+
var qn = ({ pageIndex: e, pageSize: t, pageCount: n, totalRows: r, onPageChange: o, onPageSizeChange: s, canPreviousPage: c, canNextPage: l, localization: u, changes: d }) => /* @__PURE__ */ X("div", {
|
|
3670
|
+
className: "flex items-center justify-between w-full px-4 py-3 border-t border-border bg-background",
|
|
3671
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3672
|
+
className: "flex items-center gap-6",
|
|
3673
|
+
children: [
|
|
3674
|
+
/* @__PURE__ */ X("div", {
|
|
3675
|
+
className: "flex items-center gap-2 text-sm text-muted-foreground",
|
|
3676
|
+
children: [
|
|
3677
|
+
/* @__PURE__ */ Y("span", {
|
|
3678
|
+
className: "hidden sm:inline whitespace-nowrap",
|
|
3679
|
+
children: u?.rowsPerPageLabel || "Rows per page"
|
|
3680
|
+
}),
|
|
3681
|
+
/* @__PURE__ */ Y("span", {
|
|
3682
|
+
className: "sm:hidden",
|
|
3683
|
+
children: u?.rowsLabel || "Rows"
|
|
3684
|
+
}),
|
|
3685
|
+
/* @__PURE__ */ X(O, {
|
|
3686
|
+
value: `${t}`,
|
|
3687
|
+
onValueChange: (e) => s(Number(e)),
|
|
3688
|
+
children: [/* @__PURE__ */ Y(T, {
|
|
3689
|
+
className: "h-8 w-[70px] bg-muted/20 border-border",
|
|
3690
|
+
children: /* @__PURE__ */ Y(w, { placeholder: t.toString() })
|
|
3691
|
+
}), /* @__PURE__ */ Y(E, { children: [
|
|
3692
|
+
10,
|
|
3693
|
+
20,
|
|
3694
|
+
30,
|
|
3695
|
+
40,
|
|
3696
|
+
50,
|
|
3697
|
+
100
|
|
3698
|
+
].map((e) => /* @__PURE__ */ Y(D, {
|
|
3699
|
+
value: `${e}`,
|
|
3700
|
+
children: e
|
|
3701
|
+
}, e)) })]
|
|
3702
|
+
})
|
|
3703
|
+
]
|
|
3704
|
+
}),
|
|
3705
|
+
/* @__PURE__ */ Y("div", { className: "h-4 w-px bg-border hidden sm:block" }),
|
|
3706
|
+
/* @__PURE__ */ X("div", {
|
|
3707
|
+
className: "hidden md:flex items-center gap-2 text-sm text-muted-foreground font-medium bg-muted/30 px-3 py-1 rounded-full border border-border/50",
|
|
3708
|
+
children: [/* @__PURE__ */ X("div", { children: [
|
|
3709
|
+
u?.totalLabel || "Total",
|
|
3710
|
+
" ",
|
|
3711
|
+
/* @__PURE__ */ Y("span", {
|
|
3712
|
+
className: "text-foreground font-bold",
|
|
3713
|
+
children: r
|
|
3714
|
+
}),
|
|
3715
|
+
" ",
|
|
3716
|
+
u?.recordsLabel || "records"
|
|
3717
|
+
] }), d && (d.added > 0 || d.edited > 0 || d.deleted > 0) && /* @__PURE__ */ X("div", {
|
|
3718
|
+
className: "flex items-center gap-2 border-l border-border/50 pl-2 ml-1",
|
|
3719
|
+
children: [
|
|
3720
|
+
d.added > 0 && /* @__PURE__ */ X("span", {
|
|
3721
|
+
className: "text-success dark:text-success/80 font-bold",
|
|
3722
|
+
children: [d.added, " added"]
|
|
3723
|
+
}),
|
|
3724
|
+
d.edited > 0 && /* @__PURE__ */ X("span", {
|
|
3725
|
+
className: "text-warning dark:text-warning/80 font-bold",
|
|
3726
|
+
children: [d.edited, " edited"]
|
|
3727
|
+
}),
|
|
3728
|
+
d.deleted > 0 && /* @__PURE__ */ X("span", {
|
|
3729
|
+
className: "text-error dark:text-error/80 font-bold",
|
|
3730
|
+
children: [d.deleted, " deleted"]
|
|
3731
|
+
})
|
|
3732
|
+
]
|
|
3733
|
+
})]
|
|
3734
|
+
}),
|
|
3735
|
+
u?.pagerMessage && /* @__PURE__ */ Y("div", {
|
|
3736
|
+
className: "hidden lg:block text-sm text-muted-foreground italic",
|
|
3737
|
+
children: u.pagerMessage
|
|
3738
|
+
})
|
|
3739
|
+
]
|
|
3740
|
+
}), /* @__PURE__ */ X("div", {
|
|
3741
|
+
className: "flex items-center gap-4",
|
|
3742
|
+
children: [/* @__PURE__ */ X("div", {
|
|
3743
|
+
className: "flex items-center text-sm font-medium text-foreground whitespace-nowrap bg-muted/20 px-3 py-1 rounded-md border border-border/50 gap-1.5",
|
|
3744
|
+
children: [
|
|
3745
|
+
/* @__PURE__ */ Y("span", {
|
|
3746
|
+
className: "text-muted-foreground font-normal",
|
|
3747
|
+
children: u?.pageLabel || "Page"
|
|
3748
|
+
}),
|
|
3749
|
+
/* @__PURE__ */ Y("span", {
|
|
3750
|
+
className: "text-primary font-black px-0.5",
|
|
3751
|
+
children: e + 1
|
|
3752
|
+
}),
|
|
3753
|
+
/* @__PURE__ */ Y("span", {
|
|
3754
|
+
className: "text-muted-foreground font-normal",
|
|
3755
|
+
children: u?.ofLabel || "of"
|
|
3756
|
+
}),
|
|
3757
|
+
/* @__PURE__ */ Y("span", {
|
|
3758
|
+
className: "font-bold px-0.5",
|
|
3759
|
+
children: n
|
|
3760
|
+
})
|
|
3761
|
+
]
|
|
3762
|
+
}), /* @__PURE__ */ X("div", {
|
|
3763
|
+
className: "flex items-center gap-1.5",
|
|
3764
|
+
children: [
|
|
3765
|
+
/* @__PURE__ */ X("div", {
|
|
3766
|
+
className: "flex items-center gap-1",
|
|
3767
|
+
children: [/* @__PURE__ */ X(i, {
|
|
3768
|
+
variant: "outline",
|
|
3769
|
+
className: "hidden h-8 w-8 p-0 lg:flex bg-background border-border hover:bg-muted",
|
|
3770
|
+
onClick: () => o(0),
|
|
3771
|
+
disabled: !c,
|
|
3772
|
+
title: u?.firstPage || "First Page",
|
|
3773
|
+
children: [/* @__PURE__ */ Y(me, { className: "h-4 w-4" }), /* @__PURE__ */ Y("span", {
|
|
3774
|
+
className: "sr-only",
|
|
3775
|
+
children: "Go to first page"
|
|
3776
|
+
})]
|
|
3777
|
+
}), /* @__PURE__ */ X(i, {
|
|
3778
|
+
variant: "outline",
|
|
3779
|
+
className: "h-8 w-8 p-0 bg-background border-border hover:bg-muted",
|
|
3780
|
+
onClick: () => o(e - 1),
|
|
3781
|
+
disabled: !c,
|
|
3782
|
+
title: u?.previousPage || "Previous Page",
|
|
3783
|
+
children: [/* @__PURE__ */ Y(fe, { className: "h-4 w-4" }), /* @__PURE__ */ Y("span", {
|
|
3784
|
+
className: "sr-only",
|
|
3785
|
+
children: "Go to previous page"
|
|
3786
|
+
})]
|
|
3787
|
+
})]
|
|
3788
|
+
}),
|
|
3789
|
+
/* @__PURE__ */ X("div", {
|
|
3790
|
+
className: "flex items-center gap-2 px-2 h-8 bg-muted/20 rounded-md border border-border/50 hover:border-primary/50 transition-colors",
|
|
3791
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
3792
|
+
className: "text-[10px] hidden sm:inline text-muted-foreground uppercase font-black tracking-tighter",
|
|
3793
|
+
children: u?.goToLabel || "Go To"
|
|
3794
|
+
}), /* @__PURE__ */ Y(a, {
|
|
3795
|
+
type: "number",
|
|
3796
|
+
min: 1,
|
|
3797
|
+
max: n,
|
|
3798
|
+
value: e + 1,
|
|
3799
|
+
onFocus: (e) => e.target.select(),
|
|
3800
|
+
onClick: (e) => e.currentTarget.select(),
|
|
3801
|
+
onChange: (e) => {
|
|
3802
|
+
let t = e.target.value;
|
|
3803
|
+
if (t === "") return;
|
|
3804
|
+
let r = Number(t) - 1;
|
|
3805
|
+
r >= 0 && r < n && o(r);
|
|
3806
|
+
},
|
|
3807
|
+
className: "h-6 w-10 p-0 text-center border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm font-bold"
|
|
3808
|
+
})]
|
|
3809
|
+
}),
|
|
3810
|
+
/* @__PURE__ */ X("div", {
|
|
3811
|
+
className: "flex items-center gap-1",
|
|
3812
|
+
children: [/* @__PURE__ */ X(i, {
|
|
3813
|
+
variant: "outline",
|
|
3814
|
+
className: "h-8 w-8 p-0 bg-background border-border hover:bg-muted",
|
|
3815
|
+
onClick: () => o(e + 1),
|
|
3816
|
+
disabled: !l,
|
|
3817
|
+
title: u?.nextPage || "Next Page",
|
|
3818
|
+
children: [/* @__PURE__ */ Y(pe, { className: "h-4 w-4" }), /* @__PURE__ */ Y("span", {
|
|
3819
|
+
className: "sr-only",
|
|
3820
|
+
children: "Go to next page"
|
|
3821
|
+
})]
|
|
3822
|
+
}), /* @__PURE__ */ X(i, {
|
|
3823
|
+
variant: "outline",
|
|
3824
|
+
className: "hidden h-8 w-8 p-0 lg:flex bg-background border-border hover:bg-muted",
|
|
3825
|
+
onClick: () => o(n - 1),
|
|
3826
|
+
disabled: !l,
|
|
3827
|
+
title: u?.lastPage || "Last Page",
|
|
3828
|
+
children: [/* @__PURE__ */ Y(he, { className: "h-4 w-4" }), /* @__PURE__ */ Y("span", {
|
|
3829
|
+
className: "sr-only",
|
|
3830
|
+
children: "Go to last page"
|
|
3831
|
+
})]
|
|
3832
|
+
})]
|
|
3833
|
+
})
|
|
3834
|
+
]
|
|
3835
|
+
})]
|
|
3836
|
+
})]
|
|
3837
|
+
});
|
|
3838
|
+
//#endregion
|
|
3839
|
+
//#region src/components/EzTable/components/EzTablePaginationSection.tsx
|
|
3840
|
+
function Jn({ table: t, pagerMessage: n, enableStickyPagination: r, classNames: i, localization: a, changes: o }) {
|
|
3841
|
+
return /* @__PURE__ */ Y("div", {
|
|
3842
|
+
className: e("w-full bg-background border-t border-border z-30", r && "sticky bottom-0 shadow-[0_-4px_12px_rgba(0,0,0,0.1)] dark:shadow-[0_-4px_12px_rgba(0,0,0,0.3)]", i?.footer),
|
|
3843
|
+
children: /* @__PURE__ */ Y(qn, {
|
|
3844
|
+
pageIndex: t.getState().pagination.pageIndex,
|
|
3845
|
+
pageSize: t.getState().pagination.pageSize,
|
|
3846
|
+
pageCount: t.getPageCount(),
|
|
3847
|
+
totalRows: t.options.rowCount ?? t.getPrePaginationRowModel().rows.length,
|
|
3848
|
+
canNextPage: t.getCanNextPage(),
|
|
3849
|
+
canPreviousPage: t.getCanPreviousPage(),
|
|
3850
|
+
onPageChange: t.setPageIndex,
|
|
3851
|
+
onPageSizeChange: t.setPageSize,
|
|
3852
|
+
localization: {
|
|
3853
|
+
...a,
|
|
3854
|
+
pagerMessage: n
|
|
3855
|
+
},
|
|
3856
|
+
changes: o
|
|
3857
|
+
})
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
//#endregion
|
|
3861
|
+
//#region src/components/EzTable/hooks/useColumnSizeVars.ts
|
|
3862
|
+
var Yn = (e) => W(() => {
|
|
3863
|
+
let t = e.getFlatHeaders(), n = {};
|
|
3864
|
+
for (let e = 0; e < t.length; e++) {
|
|
3865
|
+
let r = t[e];
|
|
3866
|
+
n[`--header-${r.id}-size`] = r.getSize(), n[`--col-${r.column.id}-size`] = r.column.getSize();
|
|
3867
|
+
}
|
|
3868
|
+
return n;
|
|
3869
|
+
}, [
|
|
3870
|
+
e.getState().columnSizing,
|
|
3871
|
+
e.getState().columnSizingInfo,
|
|
3872
|
+
e.getState().columnVisibility,
|
|
3873
|
+
e.getFlatHeaders()
|
|
3874
|
+
]), Xn = (e = []) => new Pe({
|
|
3875
|
+
data: e,
|
|
3876
|
+
globalFilter: "",
|
|
3877
|
+
columnFilters: [],
|
|
3878
|
+
sorting: [],
|
|
3879
|
+
pagination: {
|
|
3880
|
+
pageIndex: 0,
|
|
3881
|
+
pageSize: 10
|
|
3882
|
+
},
|
|
3883
|
+
rowSelection: {},
|
|
3884
|
+
columnVisibility: {},
|
|
3885
|
+
isPending: !1
|
|
3886
|
+
}), Zn = ie(null), Qn = ie(null), $n = ({ data: e, children: t }) => {
|
|
3887
|
+
let n = W(() => Xn(e), []);
|
|
3888
|
+
return B.useEffect(() => {
|
|
3889
|
+
n.setState((t) => ({
|
|
3890
|
+
...t,
|
|
3891
|
+
data: e
|
|
3892
|
+
}));
|
|
3893
|
+
}, [e, n]), /* @__PURE__ */ Y(Zn.Provider, {
|
|
3894
|
+
value: n,
|
|
3895
|
+
children: t
|
|
3896
|
+
});
|
|
3897
|
+
}, er = (e) => {
|
|
3898
|
+
let t = ae(Zn);
|
|
3899
|
+
if (!t) throw Error("EzTable components must be wrapped in <EzTable.Root>");
|
|
3900
|
+
return He(t, e);
|
|
3901
|
+
}, tr = B.lazy(() => import("./EzGroupingPanel-BVaAJaVU.js").then((e) => ({ default: e.EzGroupingPanel }))), nr = B.lazy(() => import("./EzTableEditDialog-Ccd5XoHm.js").then((e) => ({ default: e.EzTableEditDialog }))), rr = B.lazy(() => import("./EzTableToolbar-BH5z9fSJ.js").then((e) => e.n).then((e) => ({ default: e.EzTableToolbar }))), ir = B.lazy(() => import("./EzTableFooter-DrLoWelo.js").then((e) => e.n).then((e) => ({ default: e.EzTableFooter }))), ar = ({ ref: t, ...r }) => {
|
|
3902
|
+
let i = n(), a = Qt(r), o = G(null);
|
|
3903
|
+
en({
|
|
3904
|
+
containerRef: o,
|
|
3905
|
+
containerSizeRef: G({
|
|
3906
|
+
width: 0,
|
|
3907
|
+
height: 0
|
|
3908
|
+
}),
|
|
3909
|
+
resizeTimeoutRef: G(null),
|
|
3910
|
+
onResize: () => {
|
|
3911
|
+
a.rowVirtualizer && a.rowVirtualizer.measure();
|
|
3912
|
+
}
|
|
3913
|
+
}, [a.rowVirtualizer]);
|
|
3914
|
+
let { state: { rows: s, rangeSelection: l, canUndo: u, canRedo: d, changes: p, batchChanges: m, density: h, isPending: g, focusedCell: _, globalFilter: v, pagerMessage: b }, actions: { undo: x, redo: S, resetData: C, toggleRowEditing: w, autoFitColumn: T, onCellMouseDown: E, onCellMouseEnter: D, setGlobalFilter: O, handleGlobalFilterChange: k, getData: A, onRowClick: j, onRowDoubleClick: ee }, refs: { parentRef: te, rowVirtualizer: M, columnVirtualizer: N }, config: { enableStickyHeader: P, enableChangeTracking: ne, enableEditing: F, editSettings: I, dynamicRowSizing: re }, table: L, dir: R, imperativeAPI: { addRecord: z, updateRecord: ie } } = a, { validate: V, validateForm: ae } = ct({
|
|
3915
|
+
validateField: r.validateField ? ({ fieldName: e, value: t, data: n }) => r.validateField?.({
|
|
3916
|
+
field: e,
|
|
3917
|
+
value: t,
|
|
3918
|
+
row: n,
|
|
3919
|
+
table: L
|
|
3920
|
+
}) ?? !0 : void 0,
|
|
3921
|
+
editSettings: I
|
|
3922
|
+
}), [oe, W] = B.useState(!1);
|
|
3923
|
+
U(() => {
|
|
3924
|
+
if (p.added + p.edited + p.deleted > 0 && F) {
|
|
3925
|
+
let e = (e) => (e.preventDefault(), e.returnValue = "", "");
|
|
3926
|
+
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
3927
|
+
}
|
|
3928
|
+
}, [p, F]), U(() => {
|
|
3929
|
+
r.onDataChange && r.onDataChange(p);
|
|
3930
|
+
}, [p, r.onDataChange]);
|
|
3931
|
+
let { onRowClick: K, onRowDoubleClick: se, onCellClick: ce, onCellDoubleClick: le } = tn({
|
|
3932
|
+
table: L,
|
|
3933
|
+
editSettings: I,
|
|
3934
|
+
toggleRowEditing: w,
|
|
3935
|
+
onRowClickProp: j,
|
|
3936
|
+
onRowDoubleClickProp: ee
|
|
3937
|
+
}), ue = Yn(L), q = lt({ initialMode: "view" });
|
|
3938
|
+
nn({
|
|
3939
|
+
dialogState: q,
|
|
3940
|
+
isDialogMode: I?.mode === "Dialog",
|
|
3941
|
+
rows: s,
|
|
3942
|
+
table: L
|
|
3943
|
+
});
|
|
3944
|
+
let de = H((e) => {
|
|
3945
|
+
q.mode === "create" ? z(e) : (ie(q.meta.index, e), w(q.meta.index, !1)), q.close();
|
|
3946
|
+
}, [
|
|
3947
|
+
q,
|
|
3948
|
+
z,
|
|
3949
|
+
ie,
|
|
3950
|
+
w
|
|
3951
|
+
]), fe = H(() => {
|
|
3952
|
+
I?.mode === "Dialog" ? q.open("create", {}) : z({});
|
|
3953
|
+
}, [I?.mode, z]), pe = H(() => {
|
|
3954
|
+
if (r.onBatchSave) {
|
|
3955
|
+
let e = [...m.addedRecords, ...m.changedRecords], t = L.getVisibleLeafColumns().map((e) => e.id).filter((e) => e !== "select" && e !== "actions");
|
|
3956
|
+
for (let n of e) if (!ae(n, t).__form.isValid) {
|
|
3957
|
+
W(!0);
|
|
3958
|
+
return;
|
|
3959
|
+
}
|
|
3960
|
+
r.onBatchSave(m);
|
|
3961
|
+
let n = i.get("NotificationService");
|
|
3962
|
+
if (n && n.add({
|
|
3963
|
+
type: "success",
|
|
3964
|
+
message: `Successfully saved ${m.addedRecords.length + m.changedRecords.length} changes.`,
|
|
3965
|
+
duration: 5e3
|
|
3966
|
+
}), C(), W(!1), L.options.meta?.toggleRowEditing) {
|
|
3967
|
+
let e = L.options.meta.editingRows || {};
|
|
3968
|
+
Object.keys(e).forEach((e) => {
|
|
3969
|
+
L.options.meta?.toggleRowEditing?.(parseInt(e), !1);
|
|
3970
|
+
});
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
}, [
|
|
3974
|
+
r.onBatchSave,
|
|
3975
|
+
m,
|
|
3976
|
+
C,
|
|
3977
|
+
L.options.meta,
|
|
3978
|
+
ae,
|
|
3979
|
+
L
|
|
3980
|
+
]), me = H(() => {
|
|
3981
|
+
if (r.onBatchDiscard && r.onBatchDiscard(), C(), W(!1), L.options.meta?.toggleRowEditing) {
|
|
3982
|
+
let e = L.options.meta.editingRows || {};
|
|
3983
|
+
Object.keys(e).forEach((e) => {
|
|
3984
|
+
L.options.meta?.toggleRowEditing?.(parseInt(e), !1);
|
|
3985
|
+
});
|
|
3986
|
+
}
|
|
3987
|
+
}, [
|
|
3988
|
+
r.onBatchDiscard,
|
|
3989
|
+
C,
|
|
3990
|
+
L.options.meta
|
|
3991
|
+
]), he = B.useMemo(() => ({
|
|
3992
|
+
...a.imperativeAPI,
|
|
3993
|
+
...a.baseApi,
|
|
3994
|
+
validateField: (e) => {
|
|
3995
|
+
let t = {};
|
|
3996
|
+
if (I?.mode === "Dialog" && q.isOpen) t = q.data;
|
|
3997
|
+
else {
|
|
3998
|
+
let e = L.options.meta?.editingRows || {}, n = Object.keys(e).find((t) => e[t]);
|
|
3999
|
+
if (n) {
|
|
4000
|
+
let e = parseInt(n), r = A();
|
|
4001
|
+
r && r[e] && (t = r[e]);
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
let { isValid: n } = V(e, t[e], t);
|
|
4005
|
+
return n;
|
|
4006
|
+
},
|
|
4007
|
+
validateEditForm: () => {
|
|
4008
|
+
let e = L.getVisibleLeafColumns(), t = !0;
|
|
4009
|
+
return e.forEach((e) => {
|
|
4010
|
+
let n = e.id, r = {};
|
|
4011
|
+
if (I?.mode === "Dialog" && q.isOpen) r = q.data;
|
|
4012
|
+
else {
|
|
4013
|
+
let e = L.options.meta?.editingRows || {}, t = Object.keys(e).find((t) => e[t]);
|
|
4014
|
+
t && A()[parseInt(t)] && (r = A()[parseInt(t)]);
|
|
4015
|
+
}
|
|
4016
|
+
let { isValid: i } = V(n, r[n], r);
|
|
4017
|
+
i || (t = !1);
|
|
4018
|
+
}), t;
|
|
4019
|
+
}
|
|
4020
|
+
}), [
|
|
4021
|
+
a,
|
|
4022
|
+
A,
|
|
4023
|
+
I,
|
|
4024
|
+
q,
|
|
4025
|
+
L,
|
|
4026
|
+
V
|
|
4027
|
+
]);
|
|
4028
|
+
L.options.meta = {
|
|
4029
|
+
...L.options.meta,
|
|
4030
|
+
...r,
|
|
4031
|
+
validate: V,
|
|
4032
|
+
validationAttempted: oe
|
|
4033
|
+
}, f(t, he);
|
|
4034
|
+
let [ge, _e] = B.useState(null), { handleDragEnd: ve, handleKeyDown: ye, handleDragStart: be } = $t({
|
|
4035
|
+
onDragStart: (e) => {
|
|
4036
|
+
_e(e.active.id);
|
|
4037
|
+
},
|
|
4038
|
+
onDragEnd: (e) => {
|
|
4039
|
+
_e(null);
|
|
4040
|
+
let { active: t, over: n } = e;
|
|
4041
|
+
if (!n) return;
|
|
4042
|
+
let i = t.id, a = [...L.getState().grouping];
|
|
4043
|
+
if (n.id === "grouping-panel") !a.includes(i) && r.enableGrouping && L.setGrouping([...a, i]);
|
|
4044
|
+
else if (typeof n.id == "string" && n.id.startsWith("header-")) {
|
|
4045
|
+
let e = n.id.replace("header-", "");
|
|
4046
|
+
if (i !== e) {
|
|
4047
|
+
if (r.enableColumnReorder !== !1) {
|
|
4048
|
+
let t = L.getState().columnOrder.length > 0 ? L.getState().columnOrder : L.getAllLeafColumns().map((e) => e.id), n = t.indexOf(i), r = t.indexOf(e);
|
|
4049
|
+
if (n !== -1 && r !== -1 && n !== r) {
|
|
4050
|
+
let e = [...t];
|
|
4051
|
+
e.splice(n, 1), e.splice(r, 0, i), L.setColumnOrder(e);
|
|
4052
|
+
}
|
|
4053
|
+
} else if (r.enableGrouping) {
|
|
4054
|
+
let t = [...a];
|
|
4055
|
+
t.includes(e) || t.push(e), t.includes(i) && (t = t.filter((e) => e !== i));
|
|
4056
|
+
let n = t.indexOf(e);
|
|
4057
|
+
t.splice(n + 0, 0, i), L.setGrouping(t);
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
},
|
|
4062
|
+
onKeyDown: (e) => {
|
|
4063
|
+
let t = L.options.meta;
|
|
4064
|
+
if (t?.navigateFocus) {
|
|
4065
|
+
if (e.target.tagName === "INPUT") {
|
|
4066
|
+
e.key === "Enter" && (e.preventDefault(), e.target.blur(), t.navigateFocus(1, 0)), e.key === "Tab" && (e.preventDefault(), e.target.blur(), t.navigateFocus(0, e.shiftKey ? -1 : 1));
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
switch (e.key) {
|
|
4070
|
+
case "ArrowUp":
|
|
4071
|
+
e.preventDefault(), t.navigateFocus(-1, 0);
|
|
4072
|
+
break;
|
|
4073
|
+
case "ArrowDown":
|
|
4074
|
+
e.preventDefault(), t.navigateFocus(1, 0);
|
|
4075
|
+
break;
|
|
4076
|
+
case "ArrowLeft":
|
|
4077
|
+
e.preventDefault(), t.navigateFocus(0, -1);
|
|
4078
|
+
break;
|
|
4079
|
+
case "ArrowRight":
|
|
4080
|
+
e.preventDefault(), t.navigateFocus(0, 1);
|
|
4081
|
+
break;
|
|
4082
|
+
case "Tab":
|
|
4083
|
+
e.preventDefault(), t.navigateFocus(0, e.shiftKey ? -1 : 1);
|
|
4084
|
+
break;
|
|
4085
|
+
case "Enter":
|
|
4086
|
+
e.preventDefault(), t.navigateFocus(1, 0);
|
|
4087
|
+
break;
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
}), xe = H((e, t) => {
|
|
4092
|
+
if (!l) return !1;
|
|
4093
|
+
let { start: n, end: r } = l;
|
|
4094
|
+
return e >= Math.min(n.r, r.r) && e <= Math.max(n.r, r.r) && t >= Math.min(n.c, r.c) && t <= Math.max(n.c, r.c);
|
|
4095
|
+
}, [l]), { sensors: Se, onDragEnd: Ce, onDragStart: we } = st({
|
|
4096
|
+
onDragStart: be,
|
|
4097
|
+
onDragEnd: ve,
|
|
4098
|
+
collisionDetection: Le,
|
|
4099
|
+
distance: 5
|
|
4100
|
+
});
|
|
4101
|
+
return /* @__PURE__ */ Y(c, {
|
|
4102
|
+
fallback: /* @__PURE__ */ Y(rn, {}),
|
|
4103
|
+
children: /* @__PURE__ */ Y(y, { children: /* @__PURE__ */ Y(Fe, {
|
|
4104
|
+
sensors: Se,
|
|
4105
|
+
onDragEnd: Ce,
|
|
4106
|
+
onDragStart: we,
|
|
4107
|
+
collisionDetection: Le,
|
|
4108
|
+
children: /* @__PURE__ */ X("div", {
|
|
4109
|
+
className: e(_n, "w-full min-h-0 gap-3 h-full", r.className, r.classNames?.root),
|
|
4110
|
+
dir: R,
|
|
4111
|
+
children: [
|
|
4112
|
+
r.enableGrouping && /* @__PURE__ */ Y(B.Suspense, {
|
|
4113
|
+
fallback: null,
|
|
4114
|
+
children: /* @__PURE__ */ Y(tr, {
|
|
4115
|
+
grouping: L.getState().grouping,
|
|
4116
|
+
onGroupingChange: L.setGrouping,
|
|
4117
|
+
columns: L.getAllColumns()
|
|
4118
|
+
})
|
|
4119
|
+
}),
|
|
4120
|
+
r.slots?.toolbar ? /* @__PURE__ */ Y(r.slots.toolbar, {
|
|
4121
|
+
table: L,
|
|
4122
|
+
globalFilter: v,
|
|
4123
|
+
setGlobalFilter: O,
|
|
4124
|
+
isPending: g,
|
|
4125
|
+
columns: L.getAllColumns(),
|
|
4126
|
+
...r.slotProps?.toolbar || {}
|
|
4127
|
+
}) : /* @__PURE__ */ Y(B.Suspense, {
|
|
4128
|
+
fallback: /* @__PURE__ */ Y("div", { className: "h-10 w-full animate-pulse bg-muted/20 rounded-md" }),
|
|
4129
|
+
children: /* @__PURE__ */ Y(rr, {
|
|
4130
|
+
globalFilter: v,
|
|
4131
|
+
setGlobalFilter: k,
|
|
4132
|
+
enableAdvancedFiltering: r.enableAdvancedFiltering,
|
|
4133
|
+
enableExport: r.enableExport,
|
|
4134
|
+
onExportExcel: r.onExportExcel ? () => r.onExportExcel(L) : void 0,
|
|
4135
|
+
onExportCSV: r.onExportCSV ? () => r.onExportCSV(L) : void 0,
|
|
4136
|
+
onExportPDF: r.onExportPDF ? () => r.onExportPDF(L) : void 0,
|
|
4137
|
+
enableChangeTracking: ne,
|
|
4138
|
+
canUndo: u,
|
|
4139
|
+
canRedo: d,
|
|
4140
|
+
undo: x,
|
|
4141
|
+
redo: S,
|
|
4142
|
+
columns: L.getAllColumns(),
|
|
4143
|
+
isPending: g,
|
|
4144
|
+
onAdd: I?.allowAdding ? fe : void 0,
|
|
4145
|
+
onSave: pe,
|
|
4146
|
+
onDiscard: me,
|
|
4147
|
+
enableEditing: F,
|
|
4148
|
+
enableHiding: r.enableHiding,
|
|
4149
|
+
changes: p,
|
|
4150
|
+
table: L
|
|
4151
|
+
})
|
|
4152
|
+
}),
|
|
4153
|
+
/* @__PURE__ */ Y("div", {
|
|
4154
|
+
ref: (e) => {
|
|
4155
|
+
te.current = e, o.current = e;
|
|
4156
|
+
},
|
|
4157
|
+
id: r.id ? `ez-table-${r.id}` : "ez-table-default",
|
|
4158
|
+
className: e("flex-1 w-full overflow-auto rounded-md bg-background focus:outline-none focus:ring-1 focus:ring-primary/20", vn.default),
|
|
4159
|
+
dir: R,
|
|
4160
|
+
onScroll: (e) => {
|
|
4161
|
+
if (r.enableInfiniteScroll) {
|
|
4162
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: i } = e.currentTarget;
|
|
4163
|
+
n - t - i < 50 && L.getCanNextPage() && !r.isLoading && L.nextPage();
|
|
4164
|
+
}
|
|
4165
|
+
},
|
|
4166
|
+
role: "table",
|
|
4167
|
+
style: {
|
|
4168
|
+
overflowAnchor: "none",
|
|
4169
|
+
scrollBehavior: r.scrollBehavior ?? "smooth",
|
|
4170
|
+
position: "relative",
|
|
4171
|
+
minHeight: "0",
|
|
4172
|
+
WebkitOverflowScrolling: "touch"
|
|
4173
|
+
},
|
|
4174
|
+
onKeyDown: ye,
|
|
4175
|
+
children: /* @__PURE__ */ X("div", {
|
|
4176
|
+
className: "flex flex-col w-full min-w-max",
|
|
4177
|
+
role: "presentation",
|
|
4178
|
+
style: {
|
|
4179
|
+
...ue,
|
|
4180
|
+
minHeight: "100%"
|
|
4181
|
+
},
|
|
4182
|
+
children: [
|
|
4183
|
+
/* @__PURE__ */ Y(Bn, {
|
|
4184
|
+
table: L,
|
|
4185
|
+
enableStickyHeader: P,
|
|
4186
|
+
classNames: r.classNames,
|
|
4187
|
+
density: h,
|
|
4188
|
+
autoFitColumn: T,
|
|
4189
|
+
slots: r.slots,
|
|
4190
|
+
columnPinning: L.getState().columnPinning,
|
|
4191
|
+
columnSizing: L.getState().columnSizing,
|
|
4192
|
+
sorting: L.getState().sorting,
|
|
4193
|
+
grouping: L.getState().grouping,
|
|
4194
|
+
columnVisibility: L.getState().columnVisibility,
|
|
4195
|
+
columnOrder: L.getState().columnOrder
|
|
4196
|
+
}),
|
|
4197
|
+
/* @__PURE__ */ Y(Kn, {
|
|
4198
|
+
table: L,
|
|
4199
|
+
rows: s,
|
|
4200
|
+
rowVirtualizer: M,
|
|
4201
|
+
columnVirtualizer: N,
|
|
4202
|
+
density: h,
|
|
4203
|
+
classNames: r.classNames,
|
|
4204
|
+
isLoading: r.isLoading,
|
|
4205
|
+
enableInfiniteScroll: r.enableInfiniteScroll,
|
|
4206
|
+
isPending: g,
|
|
4207
|
+
renderNoRowsOverlay: r.renderNoRowsOverlay,
|
|
4208
|
+
slots: r.slots,
|
|
4209
|
+
localization: r.localization,
|
|
4210
|
+
enableContextMenu: r.enableContextMenu,
|
|
4211
|
+
onContextMenuItemClick: r.onContextMenuItemClick ? (e, t) => r.onContextMenuItemClick?.({
|
|
4212
|
+
action: e,
|
|
4213
|
+
data: t
|
|
4214
|
+
}) : void 0,
|
|
4215
|
+
isCellSelected: xe,
|
|
4216
|
+
focusedCell: _,
|
|
4217
|
+
onCellMouseDown: E,
|
|
4218
|
+
onCellMouseEnter: D,
|
|
4219
|
+
onCellClick: ce,
|
|
4220
|
+
onCellDoubleClick: le,
|
|
4221
|
+
renderDetailPanel: r.renderDetailPanel,
|
|
4222
|
+
dynamicRowSizing: re,
|
|
4223
|
+
onRowClick: K,
|
|
4224
|
+
onRowDoubleClick: se
|
|
4225
|
+
}),
|
|
4226
|
+
r.slots?.footer ? /* @__PURE__ */ Y(r.slots.footer, {
|
|
4227
|
+
table: L,
|
|
4228
|
+
...r.slotProps?.footer || {}
|
|
4229
|
+
}) : /* @__PURE__ */ Y(B.Suspense, {
|
|
4230
|
+
fallback: null,
|
|
4231
|
+
children: /* @__PURE__ */ Y(ir, {
|
|
4232
|
+
table: L,
|
|
4233
|
+
columnVirtualizer: N,
|
|
4234
|
+
density: h
|
|
4235
|
+
})
|
|
4236
|
+
})
|
|
4237
|
+
]
|
|
4238
|
+
})
|
|
4239
|
+
}),
|
|
4240
|
+
r.pagination && /* @__PURE__ */ Y(Jn, {
|
|
4241
|
+
table: L,
|
|
4242
|
+
pagerMessage: b,
|
|
4243
|
+
enableStickyPagination: r.enableStickyPagination,
|
|
4244
|
+
classNames: r.classNames,
|
|
4245
|
+
localization: r.localization,
|
|
4246
|
+
changes: p
|
|
4247
|
+
}),
|
|
4248
|
+
r.enableStatusBar === !0 && /* @__PURE__ */ Y(bn, {
|
|
4249
|
+
table: L,
|
|
4250
|
+
totalRows: L.options.rowCount ?? L.getPrePaginationRowModel().rows.length,
|
|
4251
|
+
selectionInfo: p.added + p.edited + p.deleted > 0 ? `${p.added + p.edited + p.deleted} pending changes` : void 0,
|
|
4252
|
+
rowSelection: L.getState().rowSelection
|
|
4253
|
+
}),
|
|
4254
|
+
I?.mode === "Dialog" && /* @__PURE__ */ Y(B.Suspense, {
|
|
4255
|
+
fallback: null,
|
|
4256
|
+
children: /* @__PURE__ */ Y(nr, {
|
|
4257
|
+
open: q.isOpen,
|
|
4258
|
+
onClose: () => {
|
|
4259
|
+
q.close(), q.mode !== "create" && q.meta.index !== void 0 && w(q.meta.index, !1);
|
|
4260
|
+
},
|
|
4261
|
+
onSave: de,
|
|
4262
|
+
columns: L.getAllColumns(),
|
|
4263
|
+
initialData: q.data,
|
|
4264
|
+
isNew: q.mode === "create",
|
|
4265
|
+
onFormRender: r.onFormRender
|
|
4266
|
+
})
|
|
4267
|
+
}),
|
|
4268
|
+
/* @__PURE__ */ Y(Z, {
|
|
4269
|
+
dropAnimation: null,
|
|
4270
|
+
children: ge ? /* @__PURE__ */ Y(yn, {
|
|
4271
|
+
header: L.getFlatHeaders().find((e) => e.id === ge) || L.getLeafHeaders().find((e) => e.id === ge),
|
|
4272
|
+
density: h
|
|
4273
|
+
}) : null
|
|
4274
|
+
})
|
|
4275
|
+
]
|
|
4276
|
+
})
|
|
4277
|
+
}) })
|
|
4278
|
+
});
|
|
4279
|
+
}, or = ar, sr = new Ue();
|
|
4280
|
+
function cr({ ref: e, ...t }) {
|
|
4281
|
+
return d(), /* @__PURE__ */ Y(We, {
|
|
4282
|
+
client: sr,
|
|
4283
|
+
children: /* @__PURE__ */ Y(ar, {
|
|
4284
|
+
...t,
|
|
4285
|
+
ref: e
|
|
4286
|
+
})
|
|
4287
|
+
});
|
|
4288
|
+
}
|
|
4289
|
+
//#endregion
|
|
4290
|
+
export { _t as A, Ct as C, vt as D, St as E, yt as O, Dt as S, Tt as T, Pt as _, er as a, Ft as b, Vt as c, zt as d, It as f, kt as g, Mt as h, Qn as i, ft as j, xt as k, Lt as l, jt as m, or as n, Qt as o, Ot as p, $n as r, Bt as s, cr as t, Rt as u, At as v, wt as w, Et as x, Nt as y };
|