@alepha/ui 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/$pageAccount.js +1 -2
- package/dist/account/AccountBackToSiteMenuItem.js +1 -2
- package/dist/account/AccountBrand.js +1 -2
- package/dist/account/AccountConnections.js +1 -2
- package/dist/account/AccountDeleteDialog.js +2 -3
- package/dist/account/AccountKeys.js +3 -4
- package/dist/account/AccountLayout.js +4 -5
- package/dist/account/AccountMfaDialog.js +2 -3
- package/dist/account/AccountPage.js +1 -2
- package/dist/account/AccountPasswordDialog.js +2 -3
- package/dist/account/AccountProfile.js +3 -4
- package/dist/account/AccountRecoveryCodes.js +2 -3
- package/dist/account/AccountRecoveryCodesDialog.js +1 -2
- package/dist/account/AccountRouter.js +1 -2
- package/dist/account/AccountRouterOptions.js +1 -2
- package/dist/account/AccountSecurity.js +6 -7
- package/dist/account/AccountSessions.js +1 -2
- package/dist/account/ApiKeyCreateDialog.js +2 -3
- package/dist/account/ApiKeyScopeMatrix.js +1 -2
- package/dist/account/ApiKeyScopeSummary.js +1 -2
- package/dist/account/ApiKeyStatusBadge.js +1 -2
- package/dist/account/index.js +5 -5
- package/dist/admin/$pageAdmin.js +1 -2
- package/dist/admin/AdminAnalytics.js +1 -2
- package/dist/admin/AdminAudits.js +2 -3
- package/dist/admin/AdminAudits.js.map +1 -1
- package/dist/admin/AdminDashboard.js +2 -3
- package/dist/admin/AdminDashboardCountCard.js +1 -2
- package/dist/admin/AdminFiles.js +5 -6
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminFilesUsage.d.ts.map +1 -1
- package/dist/admin/AdminFilesUsage.js +1 -2
- package/dist/admin/AdminFilesUsage.js.map +1 -1
- package/dist/admin/AdminFilesUsageCard.js +2 -3
- package/dist/admin/AdminJobDetail.js +1 -2
- package/dist/admin/AdminJobDetailAside.js +1 -2
- package/dist/admin/AdminJobDetailExecutions.js +2 -3
- package/dist/admin/AdminJobExecutionLogs.js +1 -2
- package/dist/admin/AdminJobExecutionSheet.js +3 -4
- package/dist/admin/AdminJobs.js +2 -3
- package/dist/admin/AdminJobsPayloadBody.js +1 -2
- package/dist/admin/AdminJobsPayloadDialog.js +1 -2
- package/dist/admin/AdminJobsStatusBadge.js +1 -2
- package/dist/admin/AdminJobsTypeIcon.js +1 -2
- package/dist/admin/AdminKeys.js +6 -7
- package/dist/admin/AdminKeysTokenDialog.js +2 -3
- package/dist/admin/AdminLayout.js +1 -2
- package/dist/admin/AdminNotifications.d.ts.map +1 -1
- package/dist/admin/AdminNotifications.js +6 -7
- package/dist/admin/AdminNotifications.js.map +1 -1
- package/dist/admin/AdminNotificationsDetail.js +1 -2
- package/dist/admin/AdminNotificationsDetailTabs.js +1 -2
- package/dist/admin/AdminNotificationsPreviewBody.js +1 -2
- package/dist/admin/AdminNotificationsPreviewTab.js +1 -2
- package/dist/admin/AdminNotificationsPreviewTab.js.map +1 -1
- package/dist/admin/AdminNotificationsRawTab.js +1 -2
- package/dist/admin/AdminNotificationsStatusBadge.js +1 -2
- package/dist/admin/AdminPage.js +1 -2
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +5 -6
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersEditorForm.js +1 -2
- package/dist/admin/AdminParametersEditorForm.js.map +1 -1
- package/dist/admin/AdminParametersEditorPane.js +3 -4
- package/dist/admin/AdminParametersEditorPane.js.map +1 -1
- package/dist/admin/AdminParametersHistoryPane.js +2 -3
- package/dist/admin/AdminParametersTreeFooterActions.js +1 -2
- package/dist/admin/AdminParametersTreeNodeView.js +2 -3
- package/dist/admin/AdminParametersTreePane.js +1 -2
- package/dist/admin/AdminPayments.js +2 -3
- package/dist/admin/AdminPaymentsStatusBadge.js +1 -2
- package/dist/admin/AdminRouter.d.ts +3 -2
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminRouter.js +1 -2
- package/dist/admin/AdminRouterOptions.js +1 -2
- package/dist/admin/AdminSessions.js +1 -2
- package/dist/admin/AdminUserAvatarControl.js +1 -2
- package/dist/admin/AdminUserCell.js +1 -2
- package/dist/admin/AdminUserDetail.js +2 -3
- package/dist/admin/AdminUserDetailAuditsTab.js +2 -3
- package/dist/admin/AdminUserDetailIdentityAside.js +1 -2
- package/dist/admin/AdminUserDetailOverviewTab.js +1 -2
- package/dist/admin/AdminUserDetailPasswordDialog.js +1 -2
- package/dist/admin/AdminUserDetailSecurityTab.js +3 -4
- package/dist/admin/AdminUserDetailSessionsTab.js +1 -2
- package/dist/admin/AdminUsers.js +3 -4
- package/dist/admin/AdminUsersRolesPicker.js +1 -2
- package/dist/admin/AdminUsersStatusBadge.js +1 -2
- package/dist/admin/EmailBodyFrame.js +1 -2
- package/dist/admin/ParameterDiffDialog.js +2 -3
- package/dist/admin/ParameterHistoryItem.d.ts.map +1 -1
- package/dist/admin/ParameterHistoryItem.js +4 -5
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/admin/ParameterJsonDialog.js +2 -3
- package/dist/admin/ParameterSaveDialog.js +1 -2
- package/dist/admin/adminJobsStatusTones.js +1 -2
- package/dist/admin/adminNotificationsChannelLabel.js +1 -2
- package/dist/admin/adminNotificationsStatusTones.js +1 -2
- package/dist/admin/adminNotificationsTemplateLabel.js +1 -2
- package/dist/admin/adminParametersTree.js +1 -2
- package/dist/admin/adminPaymentsStatusTones.js +1 -2
- package/dist/admin/adminUserDetailPasswordSchema.d.ts +2 -1
- package/dist/admin/adminUserDetailPasswordSchema.d.ts.map +1 -1
- package/dist/admin/adminUserDetailPasswordSchema.js +1 -2
- package/dist/admin/adminUserDetailProfilePolicy.js +1 -2
- package/dist/admin/adminUserDetailProfileSchema.d.ts +7 -7
- package/dist/admin/adminUserDetailProfileSchema.d.ts.map +1 -1
- package/dist/admin/adminUserDetailProfileSchema.js +1 -2
- package/dist/admin/analytics/AdvancedSection.js +2 -3
- package/dist/admin/analytics/AnalyticsChart.js +1 -2
- package/dist/admin/analytics/AnalyticsChartBars.js +1 -2
- package/dist/admin/analytics/AnalyticsChartDonut.js +1 -2
- package/dist/admin/analytics/AnalyticsChartHeader.js +1 -2
- package/dist/admin/analytics/AnalyticsChartHeat.js +1 -2
- package/dist/admin/analytics/AnalyticsChartLegend.js +1 -2
- package/dist/admin/analytics/AnalyticsChartLine.js +1 -2
- package/dist/admin/analytics/AnalyticsChartRank.js +1 -2
- package/dist/admin/analytics/AnalyticsChartTicks.js +1 -2
- package/dist/admin/analytics/AnalyticsEmpty.js +1 -2
- package/dist/admin/analytics/ClauseLabel.js +1 -2
- package/dist/admin/analytics/CoarsenedBadge.js +1 -2
- package/dist/admin/analytics/CompareNote.js +1 -2
- package/dist/admin/analytics/DatasetSelect.js +1 -2
- package/dist/admin/analytics/FilterEditor.js +1 -2
- package/dist/admin/analytics/FilterValuePicker.js +2 -3
- package/dist/admin/analytics/GroupByChips.js +1 -2
- package/dist/admin/analytics/MeasureChips.js +1 -2
- package/dist/admin/analytics/QueryPanel.js +2 -3
- package/dist/admin/analytics/RangeControl.js +2 -3
- package/dist/admin/analytics/RequestDialog.js +1 -2
- package/dist/admin/analytics/ResultsPane.js +6 -7
- package/dist/admin/analytics/ResultsTable.js +3 -4
- package/dist/admin/analytics/RunFooter.js +1 -2
- package/dist/admin/analytics/SamplingBadge.js +1 -2
- package/dist/admin/analytics/ToggleChip.js +2 -3
- package/dist/admin/analytics/TotalsCards.js +1 -2
- package/dist/admin/analytics/TruncationBanner.js +1 -2
- package/dist/admin/analytics/analyticsModel.js +1 -2
- package/dist/admin/analytics/chartModel.js +1 -2
- package/dist/admin/analytics/instantRangeSchema.d.ts +3 -2
- package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -1
- package/dist/admin/analytics/instantRangeSchema.js +1 -2
- package/dist/admin/analytics/useAnalyticsQuery.js +1 -2
- package/dist/admin/analytics/useDismissable.js +1 -2
- package/dist/admin/analytics/useFilterValues.js +1 -2
- package/dist/admin/analytics/usePanelWidth.js +1 -2
- package/dist/admin/analytics/useShapeLabels.js +1 -2
- package/dist/admin/diffLines.js +1 -2
- package/dist/admin/downloadJson.js +1 -2
- package/dist/admin/index.js +5 -5
- package/dist/admin/useConfirmedAction.js +1 -2
- package/dist/admin/useJobRetentionLabels.js +1 -2
- package/dist/admin/useJobStatusLabels.js +1 -2
- package/dist/admin/useNotificationStatusLabels.js +1 -2
- package/dist/admin/useParameterHistoryCollapsed.js +1 -2
- package/dist/ai/AiChat.js +3 -4
- package/dist/ai/AiChatConfirmCard.js +1 -2
- package/dist/ai/AiChatHistory.js +2 -3
- package/dist/ai/AiChatMessage.js +1 -2
- package/dist/ai/AiFormRegistry.js +1 -2
- package/dist/ai/aiChatMessageFormSchema.d.ts +2 -1
- package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -1
- package/dist/ai/aiChatMessageFormSchema.js +1 -2
- package/dist/ai/aiContextAtom.d.ts +6 -5
- package/dist/ai/aiContextAtom.d.ts.map +1 -1
- package/dist/ai/aiContextAtom.js +1 -2
- package/dist/ai/index.js +1 -1
- package/dist/ai/useAiChat.js +1 -2
- package/dist/ai/useAiContext.js +1 -2
- package/dist/auth/AuthLogin.js +5 -6
- package/dist/auth/AuthMfaStep.js +2 -3
- package/dist/auth/AuthRegister.d.ts.map +1 -1
- package/dist/auth/AuthRegister.js +4 -5
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthRegisterCentered.js +1 -2
- package/dist/auth/AuthRegisterFormPhase.js +5 -6
- package/dist/auth/AuthRegisterPasswordRules.js +1 -2
- package/dist/auth/AuthRegisterRealmHeader.js +1 -2
- package/dist/auth/AuthRegisterRealmLogo.js +1 -2
- package/dist/auth/AuthResetPassword.js +4 -5
- package/dist/auth/AuthRouter.js +1 -2
- package/dist/auth/AuthVerifyEmail.js +2 -3
- package/dist/auth/AuthVerifyEmailStateful.js +1 -2
- package/dist/auth/AuthVerifyEmailView.js +2 -3
- package/dist/auth/TurnstileWidget.js +1 -2
- package/dist/auth/index.js +3 -3
- package/dist/auth/providerLabels.js +1 -2
- package/dist/auth/safeRedirect.js +1 -2
- package/dist/calendar/Calendar.js +2 -3
- package/dist/calendar/LazyCalendar.js +1 -2
- package/dist/calendar/index.js +1 -2
- package/dist/chart/Chart.js +1 -2
- package/dist/chart/index.js +1 -2
- package/dist/command/Command.js +2 -3
- package/dist/command/commandScore.js +1 -2
- package/dist/command/index.js +1 -1
- package/dist/command/rankCommandItems.js +1 -2
- package/dist/core/Alert.js +1 -2
- package/dist/core/AlertDialog.js +2 -3
- package/dist/core/Avatar.js +1 -2
- package/dist/core/Badge.js +1 -2
- package/dist/core/BrandIcon.js +1 -2
- package/dist/core/Breadcrumb.js +1 -2
- package/dist/core/Button.js +1 -2
- package/dist/core/ButtonGroup.js +2 -3
- package/dist/core/Card.js +1 -2
- package/dist/core/Checkbox.js +1 -2
- package/dist/core/Combobox.js +2 -3
- package/dist/core/ContextMenu.js +1 -2
- package/dist/core/Dialog.js +2 -3
- package/dist/core/Drawer.js +1 -2
- package/dist/core/DropdownMenu.js +1 -2
- package/dist/core/Empty.js +1 -2
- package/dist/core/FileImage.js +1 -2
- package/dist/core/FilterSlot.js +1 -2
- package/dist/core/Highlight.js +2 -3
- package/dist/core/HoverCard.js +1 -2
- package/dist/core/Input.js +1 -2
- package/dist/core/InputGroup.js +2 -3
- package/dist/core/Kbd.js +1 -2
- package/dist/core/Label.js +1 -2
- package/dist/core/Menubar.js +2 -3
- package/dist/core/Pagination.js +2 -3
- package/dist/core/PaneRail.js +1 -2
- package/dist/core/Popover.js +1 -2
- package/dist/core/Progress.js +1 -2
- package/dist/core/Segmented.js +1 -2
- package/dist/core/Separator.js +1 -2
- package/dist/core/Sheet.js +2 -3
- package/dist/core/Sidebar.js +5 -6
- package/dist/core/Skeleton.js +1 -2
- package/dist/core/Slider.js +1 -2
- package/dist/core/Spinner.js +1 -2
- package/dist/core/Switch.js +1 -2
- package/dist/core/Table.js +1 -2
- package/dist/core/Tabs.js +1 -2
- package/dist/core/Textarea.js +1 -2
- package/dist/core/TimeAgo.js +1 -2
- package/dist/core/Toaster.js +1 -2
- package/dist/core/Tooltip.js +1 -2
- package/dist/core/UserAvatar.js +2 -3
- package/dist/core/highlightRanges.js +1 -2
- package/dist/core/index.js +37 -37
- package/dist/core/useDialog.js +1 -2
- package/dist/core/useIsMobile.js +1 -2
- package/dist/core/useToast.js +1 -2
- package/dist/core/utils.js +1 -2
- package/dist/form/AutoForm.js +6 -7
- package/dist/form/AutoFormBottomBar.js +2 -3
- package/dist/form/AutoFormErrorPopover.js +1 -2
- package/dist/form/AutoFormGroupBlock.js +3 -4
- package/dist/form/AutoFormGroupGridField.js +2 -3
- package/dist/form/Control.js +5 -6
- package/dist/form/ControlArray.js +2 -3
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlDate.js +1 -2
- package/dist/form/ControlDatePopover.js +3 -4
- package/dist/form/ControlDateRange.js +2 -3
- package/dist/form/ControlMonthPopover.js +2 -3
- package/dist/form/ControlNumber.js +2 -3
- package/dist/form/ControlObject.js +2 -3
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.js +1 -2
- package/dist/form/ControlSelect.js +3 -4
- package/dist/form/ControlSelectCombobox.js +3 -4
- package/dist/form/ControlUpload.js +4 -5
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/ControlUploadItemThumb.js +1 -2
- package/dist/form/FormField.js +2 -3
- package/dist/form/FormFieldAutoSaveProvider.js +1 -2
- package/dist/form/FormFieldLayoutProvider.js +1 -2
- package/dist/form/FormFieldRequiredMarkerProvider.js +1 -2
- package/dist/form/autoFormGroups.js +1 -2
- package/dist/form/controlSelectOptions.js +1 -2
- package/dist/form/dateOnly.js +1 -2
- package/dist/form/fieldI18n.js +1 -2
- package/dist/form/fieldTrigger.js +1 -2
- package/dist/form/grid.js +1 -2
- package/dist/form/iconHint.js +1 -2
- package/dist/form/index.js +7 -7
- package/dist/form/resizeImage.js +1 -2
- package/dist/i18n/fr/index.js +1 -2
- package/dist/i18n/fr/uiFr.js +1 -2
- package/dist/markdown/MarkdownView.js +1 -2
- package/dist/markdown/SpoilerSpan.js +1 -2
- package/dist/markdown/diagram/DiagramErrorBoundary.js +1 -2
- package/dist/markdown/diagram/DiagramLabel.js +1 -2
- package/dist/markdown/diagram/FlowchartDiagram.js +2 -3
- package/dist/markdown/diagram/FlowchartDiagramCluster.js +2 -3
- package/dist/markdown/diagram/FlowchartDiagramEdge.js +1 -2
- package/dist/markdown/diagram/FlowchartDiagramNode.js +1 -2
- package/dist/markdown/diagram/MermaidFence.js +3 -4
- package/dist/markdown/diagram/SequenceDiagram.js +2 -3
- package/dist/markdown/diagram/SequenceDiagramFragment.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramMessage.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramNote.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramParticipant.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramParticipantActor.js +2 -3
- package/dist/markdown/diagram/diagramKind.js +1 -2
- package/dist/markdown/diagram/flowchartParser.js +1 -2
- package/dist/markdown/diagram/layoutFlowchart.js +1 -2
- package/dist/markdown/diagram/layoutFlowchart.js.map +1 -1
- package/dist/markdown/diagram/layoutSequence.js +1 -2
- package/dist/markdown/diagram/sequenceParser.js +1 -2
- package/dist/markdown/diagram/textMetrics.js +1 -2
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/rehypeHighlight.js +1 -2
- package/dist/markdown/remarkSpoiler.js +1 -2
- package/dist/organizations/MyOrganizationInvitations.js +2 -3
- package/dist/organizations/MyOrganizations.js +2 -3
- package/dist/organizations/OrganizationInviteDialog.js +2 -3
- package/dist/organizations/OrganizationMemberIdentity.js +2 -3
- package/dist/organizations/OrganizationMemberRankPicker.js +1 -2
- package/dist/organizations/OrganizationMembers.js +3 -4
- package/dist/organizations/OrganizationPendingInvitations.js +3 -4
- package/dist/organizations/OrganizationRankColumnHeader.js +2 -3
- package/dist/organizations/OrganizationRanks.js +5 -6
- package/dist/organizations/OrganizationTransferOwnershipDialog.js +2 -3
- package/dist/organizations/index.js +6 -6
- package/dist/organizations/useInviteOrganizationMember.js +1 -2
- package/dist/organizations/useRevokeOrganizationInvitation.js +1 -2
- package/dist/otp/InputOTP.js +1 -2
- package/dist/otp/index.js +1 -2
- package/dist/resizable/Resizable.js +1 -2
- package/dist/resizable/index.js +1 -2
- package/dist/settings/SettingsDangerSection.js +2 -3
- package/dist/settings/SettingsHeading.js +1 -2
- package/dist/settings/SettingsLayout.js +1 -2
- package/dist/settings/SettingsNav.js +1 -2
- package/dist/settings/SettingsRow.js +2 -3
- package/dist/settings/SettingsSection.js +3 -4
- package/dist/settings/index.js +3 -3
- package/dist/settings/settingsCardEdge.js +1 -2
- package/dist/shell/$pageNav.js +1 -2
- package/dist/shell/ActionErrorToaster.js +1 -2
- package/dist/shell/AppActions.js +2 -3
- package/dist/shell/AppShell.js +3 -4
- package/dist/shell/AppShellNavCollapse.js +1 -2
- package/dist/shell/AppShellNavDropdownItems.js +1 -2
- package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js +4 -3
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js +1 -2
- package/dist/shell/ButtonDark.js +1 -2
- package/dist/shell/ButtonInbox.js +3 -4
- package/dist/shell/ButtonLanguage.js +2 -3
- package/dist/shell/ButtonLanguage.js.map +1 -1
- package/dist/shell/ButtonSettings.js +2 -3
- package/dist/shell/ButtonSettingsColorModeMenu.js +1 -2
- package/dist/shell/ButtonSettingsLanguageMenu.js +1 -2
- package/dist/shell/ButtonSettingsLanguageMenu.js.map +1 -1
- package/dist/shell/ButtonSettingsThemeMenu.js +1 -2
- package/dist/shell/ButtonTheme.js +3 -4
- package/dist/shell/ButtonThemeSwatch.js +1 -2
- package/dist/shell/ButtonUser.js +2 -3
- package/dist/shell/ButtonUserAccountMenuItem.js +1 -2
- package/dist/shell/ButtonUserAdminMenuItem.js +1 -2
- package/dist/shell/ButtonUserContent.js +3 -4
- package/dist/shell/ButtonUserDefaultMenu.js +1 -2
- package/dist/shell/ButtonUserEmail.js +1 -2
- package/dist/shell/ButtonUserLogoutMenuItem.js +1 -2
- package/dist/shell/ButtonUserPlaceholder.js +1 -2
- package/dist/shell/DetailAside.js +3 -4
- package/dist/shell/DetailLayout.js +2 -3
- package/dist/shell/NavShell.js +1 -2
- package/dist/shell/NavigationProgress.js +1 -2
- package/dist/shell/PlateLayout.js +1 -2
- package/dist/shell/PlateTabBar.d.ts +5 -0
- package/dist/shell/PlateTabBar.d.ts.map +1 -1
- package/dist/shell/PlateTabBar.js +2 -2
- package/dist/shell/PlateTabBar.js.map +1 -1
- package/dist/shell/SidebarNavAutoClose.js +1 -2
- package/dist/shell/Spotlight.js +2 -3
- package/dist/shell/appShellNav.d.ts +6 -0
- package/dist/shell/appShellNav.d.ts.map +1 -1
- package/dist/shell/appShellNav.js +1 -2
- package/dist/shell/appShellNav.js.map +1 -1
- package/dist/shell/inboxUnreadAtom.js +1 -2
- package/dist/shell/index.js +10 -10
- package/dist/shell/navTreeUtil.js +1 -2
- package/dist/shell/spotlightSearchText.js +1 -2
- package/dist/shell/useDetailTab.js +1 -2
- package/dist/shell/useNavBreadcrumbs.js +1 -2
- package/dist/shell/useNavEntries.js +1 -2
- package/dist/shell/useNavTree.js +1 -2
- package/dist/table/DataTable.js +2 -3
- package/dist/table/DataTableBody.js +3 -4
- package/dist/table/DataTableBulkBar.js +1 -2
- package/dist/table/DataTableBulkMenu.js +2 -3
- package/dist/table/DataTableColumnPicker.js +3 -4
- package/dist/table/DataTableFilterAdd.js +2 -3
- package/dist/table/DataTableFilterBar.js +2 -3
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableFilterControl.js +2 -3
- package/dist/table/DataTableFilterDialog.js +1 -2
- package/dist/table/DataTableFilterMenu.js +2 -3
- package/dist/table/DataTableFilterOperator.js +1 -2
- package/dist/table/DataTableFooter.js +2 -3
- package/dist/table/DataTableHeaderRow.js +3 -4
- package/dist/table/DataTableHelpButton.js +1 -2
- package/dist/table/DataTableRowActionItem.js +1 -2
- package/dist/table/DataTableRowActionsMenu.js +2 -3
- package/dist/table/DataTableSkeletonRows.js +2 -3
- package/dist/table/DataTableSummaryCard.js +1 -2
- package/dist/table/DataTableSummaryPanel.js +2 -3
- package/dist/table/DataTableToolbar.js +2 -3
- package/dist/table/PermissionMatrix.js +2 -3
- package/dist/table/PermissionMatrixGroupRows.js +3 -4
- package/dist/table/PermissionMatrixRowLabel.js +1 -2
- package/dist/table/dataTableCellPadding.js +1 -2
- package/dist/table/dataTableFilterFields.js +1 -2
- package/dist/table/dataTablePersistence.js +1 -2
- package/dist/table/dataTableSquareRight.js +1 -2
- package/dist/table/index.js +4 -4
- package/dist/table/paginateLocal.js +1 -2
- package/dist/table/queryFilters.js +1 -2
- package/dist/table/queryFilters.js.map +1 -1
- package/dist/table/useDataTableColumns.js +1 -2
- package/dist/table/useDataTableData.d.ts +2 -2
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +1 -2
- package/dist/table/useDataTableFilterForm.js +2 -3
- package/dist/table/useDataTableFilterVisibility.js +1 -2
- package/dist/table/useDataTableRefresh.js +1 -2
- package/dist/table/useDataTableSummary.js +1 -2
- package/dist/table/useTableSelection.js +1 -2
- package/dist/tree/TreeView.js +1 -2
- package/dist/tree/TreeViewRenameInput.js +1 -2
- package/dist/tree/TreeViewResizer.js +1 -2
- package/dist/tree/TreeViewRow.js +2 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/treeModel.js +1 -2
- package/dist/tree/useTreeState.js +1 -2
- package/package.json +16 -16
- package/src/account/__tests__/AccountLayout.browser.spec.tsx +2 -2
- package/src/account/__tests__/AccountRouter.spec.ts +1 -1
- package/src/admin/AdminAudits.tsx +1 -1
- package/src/admin/AdminFiles.tsx +1 -1
- package/src/admin/AdminFilesUsage.tsx +1 -2
- package/src/admin/AdminNotifications.tsx +2 -5
- package/src/admin/AdminNotificationsPreviewTab.tsx +2 -2
- package/src/admin/AdminParameters.tsx +1 -3
- package/src/admin/AdminParametersEditorForm.tsx +1 -1
- package/src/admin/AdminParametersEditorPane.tsx +1 -1
- package/src/admin/ParameterHistoryItem.tsx +1 -3
- package/src/admin/__tests__/AdminNavI18n.browser.spec.tsx +1 -1
- package/src/admin/__tests__/AdminStatusLabels.browser.spec.tsx +1 -1
- package/src/admin/analytics/analyticsModel.spec.ts +6 -6
- package/src/auth/AuthRegister.tsx +1 -3
- package/src/form/ControlArray.tsx +1 -1
- package/src/form/ControlObject.tsx +1 -1
- package/src/form/ControlUpload.tsx +1 -1
- package/src/form/__tests__/ControlDateLanguage.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlDateRange.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlObjectClear.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectClearLabel.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlSelectDeselect.browser.spec.tsx +1 -3
- package/src/form/__tests__/ControlSelectMulti.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectSearchable.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlSelectSizeMinimal.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectTriggerProps.browser.spec.tsx +1 -3
- package/src/markdown/diagram/layoutFlowchart.ts +1 -1
- package/src/organizations/__tests__/OrganizationRanks.browser.spec.tsx +1 -1
- package/src/organizations/__tests__/OrganizationTransferOwnershipDialog.browser.spec.tsx +1 -1
- package/src/shell/AppShellSidebarNavItem.tsx +8 -0
- package/src/shell/ButtonLanguage.tsx +1 -1
- package/src/shell/ButtonSettingsLanguageMenu.tsx +1 -1
- package/src/shell/PlateTabBar.tsx +6 -0
- package/src/shell/__tests__/AppActions.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonSettings.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonUserAvatar.browser.spec.tsx +1 -1
- package/src/shell/__tests__/SidebarNavAutoClose.browser.spec.tsx +1 -1
- package/src/shell/appShellNav.tsx +6 -0
- package/src/table/DataTableFilterBar.tsx +1 -1
- package/src/table/queryFilters.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableFilterBar.js","names":[],"sources":["../../src/table/DataTableFilterBar.tsx"],"sourcesContent":["import { type ZObject, type ZType, z } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useFormValues } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Calendar, List, Search, Type } from \"lucide-react\";\nimport { useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { FilterSlot } from \"../core/FilterSlot.tsx\";\nimport { Control } from \"../form/Control.tsx\";\nimport type { SelectOption } from \"../form/ControlSelect.tsx\";\nimport type { DataTableFilterAddType } from \"./DataTableFilterAdd.tsx\";\nimport { DataTableFilterAdd } from \"./DataTableFilterAdd.tsx\";\nimport { DataTableFilterControl } from \"./DataTableFilterControl.tsx\";\nimport type { DataTableFilterOperatorOption } from \"./DataTableFilterOperator.tsx\";\nimport {\n DATA_TABLE_FILTER_OPERATORS,\n DataTableFilterOperator,\n} from \"./DataTableFilterOperator.tsx\";\nimport type {\n DataTableFilterFieldOptions,\n DataTableFilterMode,\n DataTableFilterPreset,\n} from \"./dataTableTypes.ts\";\n\nexport interface DataTableFilterBarProps {\n /**\n * The table's filter form. Every `key` below names one of its fields, and\n * so does every operator key.\n */\n form: FormModel<ZObject>;\n\n /**\n * Every filter, in declaration order: the order the bar draws them in and\n * the add menu lists them in.\n */\n fields: DataTableFilterBarField[];\n\n /**\n * Which filters are on the bar. The table's state, not the bar's, because\n * three things write it: this bar, Reset filters and persistence.\n *\n * A locked field is drawn whether or not it is in here.\n */\n shown: readonly string[];\n\n /**\n * The shown filters changed. `act` is true for the reader's own add or\n * remove, and false when a filter joined the bar because it holds a value:\n * that is not the reader choosing anything, and must not be stored.\n */\n onShownChange: (shown: string[], act: boolean) => void;\n\n /**\n * `\"dialog\"` draws every filter, each like a locked field, and no add menu:\n * the phone dialog is already the on-demand step, and a menu per filter\n * behind that button would be a second one.\n */\n variant?: \"bar\" | \"dialog\";\n}\n\n/**\n * The filter bar `DataTable` draws from `filters.fields`: the locked filters\n * (the search box), then the filters the reader put on the bar, then the menu\n * that adds one.\n *\n * **Which filters start on the bar is the field's `mode`.** An `optional`\n * field, the default, is off it until the reader adds it; a `default` field\n * is on it from the start and removable; a `locked` field is always there and\n * never removable. Showing every filter a table supports spends the width of\n * the bar on questions nobody has asked; four boxes reading \"Any status\",\n * \"Any team\", \"Any role\" say only that those columns exist.\n *\n * ⚠️ **A filter holding a value, or a non-default operator, is always on the\n * bar**, whatever its mode and however it got the value: restored from\n * persistence, read from a shared link, carried across a remount. Keyed on\n * the shown state alone, the bar came back empty while the table stayed\n * filtered, and \"Add filters\" handed back a filter that was already set. The\n * same holds for `hidden`: an empty hidden field is off the bar and out of the\n * menu, and a hidden field narrowing the list is still drawn, or the list\n * would be narrowed with nothing on screen saying why.\n *\n * **Operators** are optional per field, and each is a field of its own in the\n * filters schema, `<key>Op` unless `operatorKey` says otherwise. The backend\n * must declare the same key and values; a default operator sends no key at\n * all. See `DataTableFilterOperator` for why it is one switch rather than an\n * EQUAL toggle beside an OR/AND one.\n *\n * Internal to the table: a table given `fields` and no `filters.render`\n * mounts it, in the toolbar and in the phone dialog.\n *\n * Built and settled on the `apps/ui` showcase (`/blocks/data-table/basic`) in #Q2308.\n */\nexport const DataTableFilterBar = (props: DataTableFilterBarProps) => {\n const { tr } = useI18n();\n const values = useFormValues(props.form) as Record<string, unknown>;\n const dialog = props.variant === \"dialog\";\n const modeOf = (field: DataTableFilterBarField): DataTableFilterMode =>\n field.mode ?? (field.preset === \"search\" ? \"locked\" : \"optional\");\n const shown = props.shown;\n const root = useRef<HTMLDivElement>(null);\n // The filter to open once React has put it on screen. A REF, not state: the\n // effect below both reads and clears it, and clearing it with `setState`\n // inside an effect is a cascading render. Nothing renders from it.\n const pendingOpen = useRef<string | undefined>(undefined);\n // Which filters held a value at the last commit - see the operator effect.\n const heldValue = useRef<Record<string, boolean>>({});\n\n const inputs = props.form.input as unknown as Record<\n string,\n { set: (value: unknown) => void } | undefined\n >;\n\n const isSet = (key: string): boolean => {\n const value = values[key];\n return Array.isArray(value) ? value.length > 0 : Boolean(value);\n };\n\n const operatorKeyOf = (field: DataTableFilterBarField) =>\n field.operatorKey ?? `${field.key}Op`;\n\n // Narrowing the list, by a value or by an operator standing on its own.\n const holds = (field: DataTableFilterBarField): boolean =>\n isSet(field.key) || values[operatorKeyOf(field)] !== undefined;\n\n const isLocked = (field: DataTableFilterBarField) =>\n modeOf(field) === \"locked\";\n\n const operatorsOf = (\n field: DataTableFilterBarField,\n ): DataTableFilterOperatorOption[] | undefined => {\n if (!field.operators || typeof field.operators !== \"string\") {\n return field.operators as DataTableFilterOperatorOption[] | undefined;\n }\n // The values come from the one table the filter schema is built from; only\n // the words are this bar's. A value is labelled the same in every preset\n // it appears in, so one entry per value covers all three.\n const not = tr(\"dataTable.operator.prefixNot\", { default: \"not\" });\n const labels: Record<\n string,\n Omit<DataTableFilterOperatorOption, \"value\">\n > = {\n is: { label: tr(\"dataTable.operator.is\", { default: \"is\" }) },\n not: {\n label: tr(\"dataTable.operator.isNot\", { default: \"is not\" }),\n prefix: not,\n },\n any: { label: tr(\"dataTable.operator.anyOf\", { default: \"any of\" }) },\n all: {\n label: tr(\"dataTable.operator.allOf\", { default: \"all of\" }),\n prefix: tr(\"dataTable.operator.prefixAll\", { default: \"all\" }),\n },\n none: {\n label: tr(\"dataTable.operator.noneOf\", { default: \"none of\" }),\n prefix: not,\n },\n };\n return DATA_TABLE_FILTER_OPERATORS[field.operators].map((value) => ({\n value,\n label: labels[value]?.label ?? value,\n prefix: labels[value]?.prefix,\n }));\n };\n\n const operatorOf = (field: DataTableFilterBarField) => {\n const operators = operatorsOf(field);\n return (\n operators?.find(\n (operator) => operator.value === values[operatorKeyOf(field)],\n ) ?? operators?.[0]\n );\n };\n\n /**\n * The schema a field is read with, stripped of `.optional()`: its own, or\n * `z.string()` for the search preset.\n */\n const schemaOf = (field: DataTableFilterBarField): ZType | undefined =>\n field.schema\n ? z.schema.unwrap(field.schema)\n : field.preset === \"search\"\n ? z.string()\n : undefined;\n\n /**\n * The values an enum schema, or an array of one, allows. Empty for any\n * other schema.\n */\n const enumValuesOf = (field: DataTableFilterBarField): string[] => {\n const schema = schemaOf(field);\n if (!schema) return [];\n if (z.schema.isEnum(schema)) return z.schema.enumOptions(schema);\n if (z.schema.isArray(schema)) {\n const element = z.schema.unwrap(z.schema.element(schema));\n if (z.schema.isEnum(element)) return z.schema.enumOptions(element);\n }\n return [];\n };\n\n // Live data first, then the enum the schema declares. A bare string falls\n // back to the select's own label for it.\n const itemsOf = (\n field: DataTableFilterBarField,\n ): SelectOption[] | undefined => {\n if (typeof field.items === \"function\") return field.items(values);\n if (field.items) return field.items;\n const options = enumValuesOf(field);\n if (options.length === 0) return undefined;\n const optionLabel = field.optionLabel;\n return optionLabel\n ? options.map((value) => ({ value, label: optionLabel(value) }))\n : options;\n };\n\n // Classified in `Control`'s own order, so the menu names the control the\n // filter will actually draw.\n const kindOf = (field: DataTableFilterBarField): DataTableFilterAddType => {\n const schema = schemaOf(field);\n // Before the list test, as `Control` orders it: a range IS an array, and\n // tested as one it would be offered as a list and drawn as a calendar.\n if (schema && z.schema.isDateRange(schema)) return \"date\";\n if (\n field.items ||\n (schema && (z.schema.isEnum(schema) || z.schema.isArray(schema)))\n ) {\n return \"list\";\n }\n return \"text\";\n };\n\n const placeholderOf = (field: DataTableFilterBarField) =>\n field.placeholder ??\n field.control?.placeholder ??\n (field.preset === \"search\"\n ? tr(\"dataTable.search\", { default: \"Search\" })\n : undefined);\n\n const labelOf = (field: DataTableFilterBarField) =>\n field.label ?? placeholderOf(field) ?? field.key;\n\n // Every filter has an icon, as every `Control` does: the caller's, the\n // search glyph for the search preset, else its kind's (the same glyphs the\n // controls fall back to). Without the last step a filter the caller gave no\n // icon was the one bare row of the add menu (\"When\", beside \"Resource\" and\n // \"What\").\n const iconOf = (field: DataTableFilterBarField) => {\n if (field.icon) return field.icon;\n if (field.preset === \"search\") return Search;\n const kind = kindOf(field);\n if (kind === \"date\") return Calendar;\n if (kind === \"list\") return List;\n return Type;\n };\n\n // A filter goes back to its default operator as its value goes: an\n // operator standing with nothing to qualify still counts as a filter in the\n // table's reset button and badge, while narrowing nothing.\n const clearField = (field: DataTableFilterBarField) => {\n inputs[field.key]?.set(undefined);\n if (field.operators) inputs[operatorKeyOf(field)]?.set(undefined);\n };\n\n useEffect(() => {\n const key = pendingOpen.current;\n if (!key) return;\n pendingOpen.current = undefined;\n // ⚠️ Opening the new filter has to happen from OUT HERE, after the render\n // that mounts it: inside the menu's click handler the control does not\n // exist yet. Driven through the DOM because `Control` exposes no\n // imperative \"open\" - a combobox owns that state, and a date range's\n // popover owns its own. A text filter has no list, so it is focused\n // instead. Scoped to this bar, so two tables on one page cannot open each\n // other's filters.\n const slot = root.current?.querySelector(`[data-filter=\"${key}\"]`);\n const trigger = slot?.querySelector<HTMLElement>(\n '[data-slot=\"combobox-trigger\"], [data-slot=\"date-trigger\"]',\n );\n if (trigger) {\n trigger.click();\n return;\n }\n slot?.querySelector<HTMLInputElement>('[data-slot=\"input\"]')?.focus();\n }, [shown]);\n\n useEffect(() => {\n // The other way a value empties: unticked inside the list, or cleared by\n // a locked field's own cross, rather than cleared by the button. Only on\n // the transition from set to empty, so a reader who picks \"is not\" BEFORE\n // picking a value keeps it, and a persisted operator survives the mount\n // it is restored on.\n for (const field of props.fields) {\n const set = isSet(field.key);\n const operatorKey = operatorKeyOf(field);\n if (\n field.operators &&\n heldValue.current[field.key] &&\n !set &&\n values[operatorKey] !== undefined\n ) {\n inputs[operatorKey]?.set(undefined);\n }\n heldValue.current[field.key] = set;\n }\n }, [values]);\n\n // A field holding a value or an operator joins `shown` the moment it is\n // seen - see the docblock. Folded INTO `shown` rather than drawn as\n // `shown ∪ set`, because a filter visible only for holding a value would\n // unmount the instant the reader emptied it, list open and cursor on it.\n // Locked fields are drawn regardless and never join it, and the dialog\n // draws every field.\n const unshown = dialog\n ? []\n : props.fields\n .filter(\n (field) =>\n !isLocked(field) && holds(field) && !shown.includes(field.key),\n )\n .map((field) => field.key);\n\n // The table's state cannot be set from this component's render, so it is\n // set in a LAYOUT effect: React flushes that update synchronously, before\n // the browser paints, so no frame shows the bar without the filter. The\n // guard stops it looping - it only fires while something is missing, and\n // the update adds exactly that.\n useLayoutEffect(() => {\n if (unshown.length > 0) {\n props.onShownChange([...shown, ...unshown], false);\n }\n });\n\n const drawn = (field: DataTableFilterBarField): boolean => {\n if (field.hidden && !holds(field)) return false;\n if (dialog || isLocked(field)) return true;\n return shown.includes(field.key);\n };\n\n // Locked first, in declaration order, then the shown ones in the order they\n // joined the bar: an added filter goes to the END, beside the \"+\" that\n // brought it, not back to its declared slot. Added D, C, B, A reads\n // D C B A. The dialog keeps the declaration as it is: nothing there is\n // added or removed.\n const rank = (field: DataTableFilterBarField) => {\n const index = shown.indexOf(field.key);\n return index === -1 ? Number.MAX_SAFE_INTEGER : index;\n };\n const ordered = dialog\n ? props.fields\n : [\n ...props.fields.filter((field) => isLocked(field)),\n ...props.fields\n .filter((field) => !isLocked(field))\n .sort((a, b) => rank(a) - rank(b)),\n ];\n\n return (\n // `contents`, so the slots are items of the table's own wrapping row (and\n // of the phone dialog's grid) exactly as a caller's bare fragment is.\n <div ref={root} className=\"contents\">\n {ordered\n .filter((field) => drawn(field))\n .map((field) => {\n // In the dialog every filter is drawn like a locked one: no\n // clear-and-remove button, the control's own cross resets it.\n const removable = !dialog && !isLocked(field);\n const operators = operatorsOf(field);\n const operator = operatorOf(field);\n const label = labelOf(field);\n return (\n <FilterSlot key={field.key}>\n <div data-filter={field.key}>\n <DataTableFilterControl\n label={label}\n active={isSet(field.key)}\n // A cross empties a filter holding a value; a funnel-x\n // removes an empty one. `active` picks between the two.\n // A locked filter is given neither, so it keeps the cross\n // inside its own field.\n onClear={removable ? () => clearField(field) : undefined}\n onRemove={\n removable\n ? () => {\n clearField(field);\n props.onShownChange(\n shown.filter((key) => key !== field.key),\n true,\n );\n }\n : undefined\n }\n >\n <Control\n {...field.control}\n input={inputs[field.key] as never}\n label=\"\"\n icon={iconOf(field)}\n clearable\n placeholder={placeholderOf(field)}\n items={itemsOf(field) as never}\n // The filter's name, as the control's accessible name:\n // an empty select says only its placeholder, and a set\n // one only its value. A name the caller gave wins.\n inputProps={{\n \"aria-label\": label,\n // A text filter is as wide as its placeholder. The slot\n // grows from its content, and an input's content width\n // is its `size` in characters (20 by default), so a\n // long placeholder was cut at the slot's minimum.\n ...(kindOf(field) === \"text\"\n ? {\n size: Math.max(\n 20,\n placeholderOf(field)?.length ?? 0,\n ),\n }\n : {}),\n ...field.control?.inputProps,\n }}\n // The filter's name, and a non-default operator, muted in\n // front of the value: \"Status: not Active\". An empty\n // select draws no prefix; its placeholder names it. The\n // colon is a catalog entry because French spaces it.\n triggerPrefix={[\n tr(\"dataTable.filterName\", {\n default: `${label}:`,\n args: [label],\n }),\n operator?.prefix,\n ]\n .filter(Boolean)\n .join(\" \")}\n // Sized from its content, not the trigger: the trigger\n // grows as the reader picks, and a popup tied to it would\n // widen under the cursor.\n popupClassName=\"w-max min-w-48\"\n popupHeader={\n operators && (\n <DataTableFilterOperator\n options={operators}\n value={operator?.value}\n onChange={(value) =>\n inputs[operatorKeyOf(field)]?.set(value)\n }\n />\n )\n }\n />\n </DataTableFilterControl>\n </div>\n </FilterSlot>\n );\n })}\n\n {!dialog && (\n <DataTableFilterAdd\n labeled={!ordered.some((field) => drawn(field))}\n items={props.fields\n .filter(\n (field) =>\n !isLocked(field) && !field.hidden && !shown.includes(field.key),\n )\n .map((field) => ({\n key: field.key,\n label: labelOf(field),\n icon: iconOf(field),\n type: kindOf(field),\n }))}\n onAdd={(key) => {\n pendingOpen.current = key;\n props.onShownChange([...shown, key], true);\n }}\n />\n )}\n </div>\n );\n};\n\n/**\n * One filter of the bar: a field of `filters.fields` with its key, as the\n * table hands it over. `schema` is the one the table read at mount, and gives\n * the options of an enum and the kind the add menu names.\n */\nexport interface DataTableFilterBarField extends DataTableFilterFieldOptions {\n /**\n * The form field this filter writes.\n */\n key: string;\n schema?: ZType;\n preset?: DataTableFilterPreset;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAa,sBAAsB,UAAmC;CACpE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,SAAS,cAAc,MAAM,IAAI;CACvC,MAAM,SAAS,MAAM,YAAY;CACjC,MAAM,UAAU,UACd,MAAM,SAAS,MAAM,WAAW,WAAW,WAAW;CACxD,MAAM,QAAQ,MAAM;CACpB,MAAM,OAAO,OAAuB,IAAI;CAIxC,MAAM,cAAc,OAA2B,KAAA,CAAS;CAExD,MAAM,YAAY,OAAgC,CAAC,CAAC;CAEpD,MAAM,SAAS,MAAM,KAAK;CAK1B,MAAM,SAAS,QAAyB;EACtC,MAAM,QAAQ,OAAO;EACrB,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS,IAAI,QAAQ,KAAK;CAChE;CAEA,MAAM,iBAAiB,UACrB,MAAM,eAAe,GAAG,MAAM,IAAI;CAGpC,MAAM,SAAS,UACb,MAAM,MAAM,GAAG,KAAK,OAAO,cAAc,KAAK,OAAO,KAAA;CAEvD,MAAM,YAAY,UAChB,OAAO,KAAK,MAAM;CAEpB,MAAM,eACJ,UACgD;EAChD,IAAI,CAAC,MAAM,aAAa,OAAO,MAAM,cAAc,UACjD,OAAO,MAAM;EAKf,MAAM,MAAM,GAAG,gCAAgC,EAAE,SAAS,MAAM,CAAC;EACjE,MAAM,SAGF;GACF,IAAI,EAAE,OA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,UACA,oBAAC,oBAAD;GACE,SAAS,CAAC,QAAQ,MAAM,UAAU,MAAM,KAAK,CAAC;GAC9C,OAAO,MAAM,OACV,QACE,UACC,CAAC,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,GAAG,CAClE,CAAC,CACA,KAAK,WAAW;IACf,KAAK,MAAM;IACX,OAAO,QAAQ,KAAK;IACpB,MAAM,OAAO,KAAK;IAClB,MAAM,OAAO,KAAK;GACpB,EAAE;GACJ,QAAQ,QAAQ;IACd,YAAY,UAAU;IACtB,MAAM,cAAc,CAAC,GAAG,OAAO,GAAG,GAAG,IAAI;GAC3C;EACD,CAAA,CAEA;;AAET"}
|
|
1
|
+
{"version":3,"file":"DataTableFilterBar.js","names":[],"sources":["../../src/table/DataTableFilterBar.tsx"],"sourcesContent":["import { type ZObject, type ZType, z } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useFormValues } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Calendar, List, Search, Type } from \"lucide-react\";\nimport { useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { FilterSlot } from \"../core/FilterSlot.tsx\";\nimport { Control } from \"../form/Control.tsx\";\nimport type { SelectOption } from \"../form/ControlSelect.tsx\";\nimport type { DataTableFilterAddType } from \"./DataTableFilterAdd.tsx\";\nimport { DataTableFilterAdd } from \"./DataTableFilterAdd.tsx\";\nimport { DataTableFilterControl } from \"./DataTableFilterControl.tsx\";\nimport type { DataTableFilterOperatorOption } from \"./DataTableFilterOperator.tsx\";\nimport {\n DATA_TABLE_FILTER_OPERATORS,\n DataTableFilterOperator,\n} from \"./DataTableFilterOperator.tsx\";\nimport type {\n DataTableFilterFieldOptions,\n DataTableFilterMode,\n DataTableFilterPreset,\n} from \"./dataTableTypes.ts\";\n\nexport interface DataTableFilterBarProps {\n /**\n * The table's filter form. Every `key` below names one of its fields, and\n * so does every operator key.\n */\n form: FormModel<ZObject>;\n\n /**\n * Every filter, in declaration order: the order the bar draws them in and\n * the add menu lists them in.\n */\n fields: DataTableFilterBarField[];\n\n /**\n * Which filters are on the bar. The table's state, not the bar's, because\n * three things write it: this bar, Reset filters and persistence.\n *\n * A locked field is drawn whether or not it is in here.\n */\n shown: readonly string[];\n\n /**\n * The shown filters changed. `act` is true for the reader's own add or\n * remove, and false when a filter joined the bar because it holds a value:\n * that is not the reader choosing anything, and must not be stored.\n */\n onShownChange: (shown: string[], act: boolean) => void;\n\n /**\n * `\"dialog\"` draws every filter, each like a locked field, and no add menu:\n * the phone dialog is already the on-demand step, and a menu per filter\n * behind that button would be a second one.\n */\n variant?: \"bar\" | \"dialog\";\n}\n\n/**\n * The filter bar `DataTable` draws from `filters.fields`: the locked filters\n * (the search box), then the filters the reader put on the bar, then the menu\n * that adds one.\n *\n * **Which filters start on the bar is the field's `mode`.** An `optional`\n * field, the default, is off it until the reader adds it; a `default` field\n * is on it from the start and removable; a `locked` field is always there and\n * never removable. Showing every filter a table supports spends the width of\n * the bar on questions nobody has asked; four boxes reading \"Any status\",\n * \"Any team\", \"Any role\" say only that those columns exist.\n *\n * ⚠️ **A filter holding a value, or a non-default operator, is always on the\n * bar**, whatever its mode and however it got the value: restored from\n * persistence, read from a shared link, carried across a remount. Keyed on\n * the shown state alone, the bar came back empty while the table stayed\n * filtered, and \"Add filters\" handed back a filter that was already set. The\n * same holds for `hidden`: an empty hidden field is off the bar and out of the\n * menu, and a hidden field narrowing the list is still drawn, or the list\n * would be narrowed with nothing on screen saying why.\n *\n * **Operators** are optional per field, and each is a field of its own in the\n * filters schema, `<key>Op` unless `operatorKey` says otherwise. The backend\n * must declare the same key and values; a default operator sends no key at\n * all. See `DataTableFilterOperator` for why it is one switch rather than an\n * EQUAL toggle beside an OR/AND one.\n *\n * Internal to the table: a table given `fields` and no `filters.render`\n * mounts it, in the toolbar and in the phone dialog.\n *\n * Built and settled on the `apps/ui` showcase (`/blocks/data-table/basic`) in #Q2308.\n */\nexport const DataTableFilterBar = (props: DataTableFilterBarProps) => {\n const { tr } = useI18n();\n const values = useFormValues(props.form) as Record<string, unknown>;\n const dialog = props.variant === \"dialog\";\n const modeOf = (field: DataTableFilterBarField): DataTableFilterMode =>\n field.mode ?? (field.preset === \"search\" ? \"locked\" : \"optional\");\n const shown = props.shown;\n const root = useRef<HTMLDivElement>(null);\n // The filter to open once React has put it on screen. A REF, not state: the\n // effect below both reads and clears it, and clearing it with `setState`\n // inside an effect is a cascading render. Nothing renders from it.\n const pendingOpen = useRef<string | undefined>(undefined);\n // Which filters held a value at the last commit - see the operator effect.\n const heldValue = useRef<Record<string, boolean>>({});\n\n const inputs = props.form.input as unknown as Record<\n string,\n { set: (value: unknown) => void } | undefined\n >;\n\n const isSet = (key: string): boolean => {\n const value = values[key];\n return Array.isArray(value) ? value.length > 0 : Boolean(value);\n };\n\n const operatorKeyOf = (field: DataTableFilterBarField) =>\n field.operatorKey ?? `${field.key}Op`;\n\n // Narrowing the list, by a value or by an operator standing on its own.\n const holds = (field: DataTableFilterBarField): boolean =>\n isSet(field.key) || values[operatorKeyOf(field)] !== undefined;\n\n const isLocked = (field: DataTableFilterBarField) =>\n modeOf(field) === \"locked\";\n\n const operatorsOf = (\n field: DataTableFilterBarField,\n ): DataTableFilterOperatorOption[] | undefined => {\n if (!field.operators || typeof field.operators !== \"string\") {\n return field.operators as DataTableFilterOperatorOption[] | undefined;\n }\n // The values come from the one table the filter schema is built from; only\n // the words are this bar's. A value is labelled the same in every preset\n // it appears in, so one entry per value covers all three.\n const not = tr(\"dataTable.operator.prefixNot\", { default: \"not\" });\n const labels: Record<\n string,\n Omit<DataTableFilterOperatorOption, \"value\">\n > = {\n is: { label: tr(\"dataTable.operator.is\", { default: \"is\" }) },\n not: {\n label: tr(\"dataTable.operator.isNot\", { default: \"is not\" }),\n prefix: not,\n },\n any: { label: tr(\"dataTable.operator.anyOf\", { default: \"any of\" }) },\n all: {\n label: tr(\"dataTable.operator.allOf\", { default: \"all of\" }),\n prefix: tr(\"dataTable.operator.prefixAll\", { default: \"all\" }),\n },\n none: {\n label: tr(\"dataTable.operator.noneOf\", { default: \"none of\" }),\n prefix: not,\n },\n };\n return DATA_TABLE_FILTER_OPERATORS[field.operators].map((value) => ({\n value,\n label: labels[value]?.label ?? value,\n prefix: labels[value]?.prefix,\n }));\n };\n\n const operatorOf = (field: DataTableFilterBarField) => {\n const operators = operatorsOf(field);\n return (\n operators?.find(\n (operator) => operator.value === values[operatorKeyOf(field)],\n ) ?? operators?.[0]\n );\n };\n\n /**\n * The schema a field is read with, stripped of `.optional()`: its own, or\n * `z.string()` for the search preset.\n */\n const schemaOf = (field: DataTableFilterBarField): ZType | undefined =>\n field.schema\n ? z.schema.unwrap(field.schema)\n : field.preset === \"search\"\n ? z.string()\n : undefined;\n\n /**\n * The values an enum schema, or an array of one, allows. Empty for any\n * other schema.\n */\n const enumValuesOf = (field: DataTableFilterBarField): string[] => {\n const schema = schemaOf(field);\n if (!schema) return [];\n if (z.schema.isEnum(schema)) return z.schema.enumOptions(schema);\n if (z.schema.isArray(schema)) {\n const element = z.schema.unwrap(z.schema.element(schema));\n if (z.schema.isEnum(element)) return z.schema.enumOptions(element);\n }\n return [];\n };\n\n // Live data first, then the enum the schema declares. A bare string falls\n // back to the select's own label for it.\n const itemsOf = (\n field: DataTableFilterBarField,\n ): SelectOption[] | undefined => {\n if (typeof field.items === \"function\") return field.items(values);\n if (field.items) return field.items;\n const options = enumValuesOf(field);\n if (options.length === 0) return undefined;\n const optionLabel = field.optionLabel;\n return optionLabel\n ? options.map((value) => ({ value, label: optionLabel(value) }))\n : options;\n };\n\n // Classified in `Control`'s own order, so the menu names the control the\n // filter will actually draw.\n const kindOf = (field: DataTableFilterBarField): DataTableFilterAddType => {\n const schema = schemaOf(field);\n // Before the list test, as `Control` orders it: a range IS an array, and\n // tested as one it would be offered as a list and drawn as a calendar.\n if (schema && z.schema.isDateRange(schema)) return \"date\";\n if (\n field.items ||\n (schema && (z.schema.isEnum(schema) || z.schema.isArray(schema)))\n ) {\n return \"list\";\n }\n return \"text\";\n };\n\n const placeholderOf = (field: DataTableFilterBarField) =>\n field.placeholder ??\n field.control?.placeholder ??\n (field.preset === \"search\"\n ? tr(\"dataTable.search\", { default: \"Search\" })\n : undefined);\n\n const labelOf = (field: DataTableFilterBarField) =>\n field.label ?? placeholderOf(field) ?? field.key;\n\n // Every filter has an icon, as every `Control` does: the caller's, the\n // search glyph for the search preset, else its kind's (the same glyphs the\n // controls fall back to). Without the last step a filter the caller gave no\n // icon was the one bare row of the add menu (\"When\", beside \"Resource\" and\n // \"What\").\n const iconOf = (field: DataTableFilterBarField) => {\n if (field.icon) return field.icon;\n if (field.preset === \"search\") return Search;\n const kind = kindOf(field);\n if (kind === \"date\") return Calendar;\n if (kind === \"list\") return List;\n return Type;\n };\n\n // A filter goes back to its default operator as its value goes: an\n // operator standing with nothing to qualify still counts as a filter in the\n // table's reset button and badge, while narrowing nothing.\n const clearField = (field: DataTableFilterBarField) => {\n inputs[field.key]?.set(undefined);\n if (field.operators) inputs[operatorKeyOf(field)]?.set(undefined);\n };\n\n useEffect(() => {\n const key = pendingOpen.current;\n if (!key) return;\n pendingOpen.current = undefined;\n // ⚠️ Opening the new filter has to happen from OUT HERE, after the render\n // that mounts it: inside the menu's click handler the control does not\n // exist yet. Driven through the DOM because `Control` exposes no\n // imperative \"open\" - a combobox owns that state, and a date range's\n // popover owns its own. A text filter has no list, so it is focused\n // instead. Scoped to this bar, so two tables on one page cannot open each\n // other's filters.\n const slot = root.current?.querySelector(`[data-filter=\"${key}\"]`);\n const trigger = slot?.querySelector<HTMLElement>(\n '[data-slot=\"combobox-trigger\"], [data-slot=\"date-trigger\"]',\n );\n if (trigger) {\n trigger.click();\n return;\n }\n slot?.querySelector<HTMLInputElement>('[data-slot=\"input\"]')?.focus();\n }, [shown]);\n\n useEffect(() => {\n // The other way a value empties: unticked inside the list, or cleared by\n // a locked field's own cross, rather than cleared by the button. Only on\n // the transition from set to empty, so a reader who picks \"is not\" BEFORE\n // picking a value keeps it, and a persisted operator survives the mount\n // it is restored on.\n for (const field of props.fields) {\n const set = isSet(field.key);\n const operatorKey = operatorKeyOf(field);\n if (\n field.operators &&\n heldValue.current[field.key] &&\n !set &&\n values[operatorKey] !== undefined\n ) {\n inputs[operatorKey]?.set(undefined);\n }\n heldValue.current[field.key] = set;\n }\n }, [values]);\n\n // A field holding a value or an operator joins `shown` the moment it is\n // seen - see the docblock. Folded INTO `shown` rather than drawn as\n // `shown ∪ set`, because a filter visible only for holding a value would\n // unmount the instant the reader emptied it, list open and cursor on it.\n // Locked fields are drawn regardless and never join it, and the dialog\n // draws every field.\n const unshown = dialog\n ? []\n : props.fields\n .filter(\n (field) =>\n !isLocked(field) && holds(field) && !shown.includes(field.key),\n )\n .map((field) => field.key);\n\n // The table's state cannot be set from this component's render, so it is\n // set in a LAYOUT effect: React flushes that update synchronously, before\n // the browser paints, so no frame shows the bar without the filter. The\n // guard stops it looping - it only fires while something is missing, and\n // the update adds exactly that.\n useLayoutEffect(() => {\n if (unshown.length > 0) {\n props.onShownChange([...shown, ...unshown], false);\n }\n });\n\n const drawn = (field: DataTableFilterBarField): boolean => {\n if (field.hidden && !holds(field)) return false;\n if (dialog || isLocked(field)) return true;\n return shown.includes(field.key);\n };\n\n // Locked first, in declaration order, then the shown ones in the order they\n // joined the bar: an added filter goes to the END, beside the \"+\" that\n // brought it, not back to its declared slot. Added D, C, B, A reads\n // D C B A. The dialog keeps the declaration as it is: nothing there is\n // added or removed.\n const rank = (field: DataTableFilterBarField) => {\n const index = shown.indexOf(field.key);\n return index === -1 ? Number.MAX_SAFE_INTEGER : index;\n };\n const ordered = dialog\n ? props.fields\n : [\n ...props.fields.filter((field) => isLocked(field)),\n ...props.fields\n .filter((field) => !isLocked(field))\n .sort((a, b) => rank(a) - rank(b)),\n ];\n\n return (\n // `contents`, so the slots are items of the table's own wrapping row (and\n // of the phone dialog's grid) exactly as a caller's bare fragment is.\n <div ref={root} className=\"contents\">\n {ordered\n .filter((field) => drawn(field))\n .map((field) => {\n // In the dialog every filter is drawn like a locked one: no\n // clear-and-remove button, the control's own cross resets it.\n const removable = !dialog && !isLocked(field);\n const operators = operatorsOf(field);\n const operator = operatorOf(field);\n const label = labelOf(field);\n return (\n <FilterSlot key={field.key}>\n <div data-filter={field.key}>\n <DataTableFilterControl\n label={label}\n active={isSet(field.key)}\n // A cross empties a filter holding a value; a funnel-x\n // removes an empty one. `active` picks between the two.\n // A locked filter is given neither, so it keeps the cross\n // inside its own field.\n onClear={removable ? () => clearField(field) : undefined}\n onRemove={\n removable\n ? () => {\n clearField(field);\n props.onShownChange(\n shown.filter((key) => key !== field.key),\n true,\n );\n }\n : undefined\n }\n >\n <Control\n {...field.control}\n input={inputs[field.key] as never}\n label=\"\"\n icon={iconOf(field)}\n clearable\n placeholder={placeholderOf(field)}\n items={itemsOf(field)}\n // The filter's name, as the control's accessible name:\n // an empty select says only its placeholder, and a set\n // one only its value. A name the caller gave wins.\n inputProps={{\n \"aria-label\": label,\n // A text filter is as wide as its placeholder. The slot\n // grows from its content, and an input's content width\n // is its `size` in characters (20 by default), so a\n // long placeholder was cut at the slot's minimum.\n ...(kindOf(field) === \"text\"\n ? {\n size: Math.max(\n 20,\n placeholderOf(field)?.length ?? 0,\n ),\n }\n : {}),\n ...field.control?.inputProps,\n }}\n // The filter's name, and a non-default operator, muted in\n // front of the value: \"Status: not Active\". An empty\n // select draws no prefix; its placeholder names it. The\n // colon is a catalog entry because French spaces it.\n triggerPrefix={[\n tr(\"dataTable.filterName\", {\n default: `${label}:`,\n args: [label],\n }),\n operator?.prefix,\n ]\n .filter(Boolean)\n .join(\" \")}\n // Sized from its content, not the trigger: the trigger\n // grows as the reader picks, and a popup tied to it would\n // widen under the cursor.\n popupClassName=\"w-max min-w-48\"\n popupHeader={\n operators && (\n <DataTableFilterOperator\n options={operators}\n value={operator?.value}\n onChange={(value) =>\n inputs[operatorKeyOf(field)]?.set(value)\n }\n />\n )\n }\n />\n </DataTableFilterControl>\n </div>\n </FilterSlot>\n );\n })}\n\n {!dialog && (\n <DataTableFilterAdd\n labeled={!ordered.some((field) => drawn(field))}\n items={props.fields\n .filter(\n (field) =>\n !isLocked(field) && !field.hidden && !shown.includes(field.key),\n )\n .map((field) => ({\n key: field.key,\n label: labelOf(field),\n icon: iconOf(field),\n type: kindOf(field),\n }))}\n onAdd={(key) => {\n pendingOpen.current = key;\n props.onShownChange([...shown, key], true);\n }}\n />\n )}\n </div>\n );\n};\n\n/**\n * One filter of the bar: a field of `filters.fields` with its key, as the\n * table hands it over. `schema` is the one the table read at mount, and gives\n * the options of an enum and the kind the add menu names.\n */\nexport interface DataTableFilterBarField extends DataTableFilterFieldOptions {\n /**\n * The form field this filter writes.\n */\n key: string;\n schema?: ZType;\n preset?: DataTableFilterPreset;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,MAAa,sBAAsB,UAAmC;CACpE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,SAAS,cAAc,MAAM,IAAI;CACvC,MAAM,SAAS,MAAM,YAAY;CACjC,MAAM,UAAU,UACd,MAAM,SAAS,MAAM,WAAW,WAAW,WAAW;CACxD,MAAM,QAAQ,MAAM;CACpB,MAAM,OAAO,OAAuB,IAAI;CAIxC,MAAM,cAAc,OAA2B,KAAA,CAAS;CAExD,MAAM,YAAY,OAAgC,CAAC,CAAC;CAEpD,MAAM,SAAS,MAAM,KAAK;CAK1B,MAAM,SAAS,QAAyB;EACtC,MAAM,QAAQ,OAAO;EACrB,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,SAAS,IAAI,QAAQ,KAAK;CAChE;CAEA,MAAM,iBAAiB,UACrB,MAAM,eAAe,GAAG,MAAM,IAAI;CAGpC,MAAM,SAAS,UACb,MAAM,MAAM,GAAG,KAAK,OAAO,cAAc,KAAK,OAAO,KAAA;CAEvD,MAAM,YAAY,UAChB,OAAO,KAAK,MAAM;CAEpB,MA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;OACT,OAAO,UAAU;OACjB,WAAW,UACT,OAAO,cAAc,KAAK,EAAE,EAAE,IAAI,KAAK;MAE1C,CAAA;KAGN,CAAA;IACqB,CAAA;GACrB,CAAA,EACK,GAhFK,MAAM,GAgFX;EAEhB,CAAC,GAEF,CAAC,UACA,oBAAC,oBAAD;GACE,SAAS,CAAC,QAAQ,MAAM,UAAU,MAAM,KAAK,CAAC;GAC9C,OAAO,MAAM,OACV,QACE,UACC,CAAC,SAAS,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,GAAG,CAClE,CAAC,CACA,KAAK,WAAW;IACf,KAAK,MAAM;IACX,OAAO,QAAQ,KAAK;IACpB,MAAM,OAAO,KAAK;IAClB,MAAM,OAAO,KAAK;GACpB,EAAE;GACJ,QAAQ,QAAQ;IACd,YAAY,UAAU;IACtB,MAAM,cAAc,CAAC,GAAG,OAAO,GAAG,GAAG,IAAI;GAC3C;EACD,CAAA,CAEA;;AAET"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
|
|
2
|
+
import { cn } from "../core/utils.js";
|
|
3
3
|
import { useI18n } from "alepha/react/i18n";
|
|
4
4
|
import { FunnelX, X } from "lucide-react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/table/DataTableFilterControl.tsx
|
|
7
7
|
/**
|
|
8
8
|
* One filter's slot in a `DataTable` filter bar: the control, and the
|
|
9
9
|
* cross that removes it.
|
|
@@ -83,7 +83,6 @@ const DataTableFilterControl = (props) => {
|
|
|
83
83
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: label })] })] })]
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
//#endregion
|
|
87
86
|
export { DataTableFilterControl };
|
|
88
87
|
|
|
89
88
|
//# sourceMappingURL=DataTableFilterControl.js.map
|
|
@@ -5,7 +5,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
5
5
|
import { Funnel, Share2 } from "lucide-react";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/table/DataTableFilterDialog.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The filter bar, on a phone.
|
|
11
11
|
*
|
|
@@ -82,7 +82,6 @@ const DataTableFilterDialog = (props) => {
|
|
|
82
82
|
] })]
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
//#endregion
|
|
86
85
|
export { DataTableFilterDialog };
|
|
87
86
|
|
|
88
87
|
//# sourceMappingURL=DataTableFilterDialog.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
2
1
|
import { Button } from "../core/Button.js";
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
3
3
|
import { useI18n } from "alepha/react/i18n";
|
|
4
4
|
import { Funnel, FunnelX, Share2 } from "lucide-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/table/DataTableFilterMenu.tsx
|
|
7
7
|
/**
|
|
8
8
|
* The filter menu in the toolbar, on anything wider than a phone.
|
|
9
9
|
*
|
|
@@ -59,7 +59,6 @@ const DataTableFilterMenu = (props) => {
|
|
|
59
59
|
})]
|
|
60
60
|
})] });
|
|
61
61
|
};
|
|
62
|
-
//#endregion
|
|
63
62
|
export { DataTableFilterMenu };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=DataTableFilterMenu.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Segmented } from "../core/Segmented.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/table/DataTableFilterOperator.tsx
|
|
4
4
|
/**
|
|
5
5
|
* The operator switch a filter's list carries at its top: "is / is not",
|
|
6
6
|
* "any of / all of / none of".
|
|
@@ -50,7 +50,6 @@ const DATA_TABLE_FILTER_OPERATORS = {
|
|
|
50
50
|
"none"
|
|
51
51
|
]
|
|
52
52
|
};
|
|
53
|
-
//#endregion
|
|
54
53
|
export { DATA_TABLE_FILTER_OPERATORS, DataTableFilterOperator };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=DataTableFilterOperator.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "../core/Pagination.js";
|
|
2
|
+
import { cn } from "../core/utils.js";
|
|
3
3
|
import { Control } from "../form/Control.js";
|
|
4
4
|
import { useI18n } from "alepha/react/i18n";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/table/DataTableFooter.tsx
|
|
7
7
|
/**
|
|
8
8
|
* The footer under the rows: the page-size picker, where the reader is, and
|
|
9
9
|
* the page links.
|
|
@@ -107,7 +107,6 @@ const PAGE_SIZES = [
|
|
|
107
107
|
50,
|
|
108
108
|
100
|
|
109
109
|
];
|
|
110
|
-
//#endregion
|
|
111
110
|
export { DataTableFooter, PAGE_SIZES };
|
|
112
111
|
|
|
113
112
|
//# sourceMappingURL=DataTableFooter.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
|
-
import { TableHead, TableRow } from "../core/Table.js";
|
|
3
1
|
import { Checkbox } from "../core/Checkbox.js";
|
|
4
2
|
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger } from "../core/ContextMenu.js";
|
|
3
|
+
import { TableHead, TableRow } from "../core/Table.js";
|
|
4
|
+
import { cn } from "../core/utils.js";
|
|
5
5
|
import { useI18n } from "alepha/react/i18n";
|
|
6
6
|
import { ArrowDown, ArrowDownAZ, ArrowUp, ArrowUpAZ, ChevronLeft, ChevronRight, ChevronsUpDown, EyeOff } from "lucide-react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/table/DataTableHeaderRow.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The header row: the select-all checkbox, one header per visible column with
|
|
11
11
|
* its sort control and context menu, and the cell above the row actions.
|
|
@@ -91,7 +91,6 @@ const DataTableHeaderRow = (props) => {
|
|
|
91
91
|
hasRowActions && /* @__PURE__ */ jsx(TableHead, { className: cn(props.headClassName, "w-10") })
|
|
92
92
|
] });
|
|
93
93
|
};
|
|
94
|
-
//#endregion
|
|
95
94
|
export { DataTableHeaderRow };
|
|
96
95
|
|
|
97
96
|
//# sourceMappingURL=DataTableHeaderRow.js.map
|
|
@@ -4,7 +4,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
4
4
|
import { CircleHelp } from "lucide-react";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/DataTableHelpButton.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The `?` at the end of the toolbar's icon group, opening a hover card with
|
|
10
10
|
* the page's explanation.
|
|
@@ -41,7 +41,6 @@ const DataTableHelpButton = (props) => {
|
|
|
41
41
|
})]
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
//#endregion
|
|
45
44
|
export { DataTableHelpButton };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=DataTableHelpButton.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DropdownMenuCheckboxItem, DropdownMenuItem } from "../core/DropdownMenu.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/table/DataTableRowActionItem.tsx
|
|
4
4
|
/**
|
|
5
5
|
* One menu entry, wherever it sits: at the top level of the row menu or
|
|
6
6
|
* inside a group's submenu. Both render the same way, which is what keeps a
|
|
@@ -23,7 +23,6 @@ const DataTableRowActionItem = (props) => {
|
|
|
23
23
|
children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "mr-2 size-4" }), action.label]
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { DataTableRowActionItem };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=DataTableRowActionItem.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
2
1
|
import { Button } from "../core/Button.js";
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
3
3
|
import { DataTableRowActionItem } from "./DataTableRowActionItem.js";
|
|
4
4
|
import { useI18n } from "alepha/react/i18n";
|
|
5
5
|
import { MoreVertical } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/DataTableRowActionsMenu.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The three-dots menu at the end of a row, with one level of submenus for
|
|
10
10
|
* groups. Renders nothing when no entry survives.
|
|
@@ -42,7 +42,6 @@ const DataTableRowActionsMenu = (props) => {
|
|
|
42
42
|
function isRowActionGroup(entry) {
|
|
43
43
|
return "children" in entry;
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { DataTableRowActionsMenu };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=DataTableRowActionsMenu.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TableCell, TableRow } from "../core/Table.js";
|
|
2
1
|
import { Skeleton } from "../core/Skeleton.js";
|
|
2
|
+
import { TableCell, TableRow } from "../core/Table.js";
|
|
3
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/table/DataTableSkeletonRows.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Placeholder rows, shown while the first page loads.
|
|
7
7
|
*/
|
|
@@ -11,7 +11,6 @@ const DataTableSkeletonRows = (props) => {
|
|
|
11
11
|
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" })
|
|
12
12
|
}, j)) }, i)) });
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { DataTableSkeletonRows };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=DataTableSkeletonRows.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../core/utils.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/table/DataTableSummaryCard.tsx
|
|
4
4
|
/**
|
|
5
5
|
* One tile of the summary panel: the label, the figure, the hint.
|
|
6
6
|
*
|
|
@@ -51,7 +51,6 @@ const DATA_TABLE_STAT_TONE = {
|
|
|
51
51
|
warning: "border-amber-500/40 bg-linear-to-b from-amber-500/10 to-amber-500/10",
|
|
52
52
|
danger: "border-red-500/40 bg-linear-to-b from-red-500/10 to-red-500/10"
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { DataTableSummaryCard };
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=DataTableSummaryCard.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Skeleton } from "../core/Skeleton.js";
|
|
2
|
+
import { cn } from "../core/utils.js";
|
|
3
3
|
import { DataTableSummaryCard } from "./DataTableSummaryCard.js";
|
|
4
4
|
import { ChevronRight } from "lucide-react";
|
|
5
5
|
import { useId } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/DataTableSummaryPanel.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The collapsible band at the top of the table: a disclosure button, then the
|
|
10
10
|
* stat cards and the caller's content.
|
|
@@ -62,7 +62,6 @@ const PLACEHOLDER_TILES = [
|
|
|
62
62
|
"c",
|
|
63
63
|
"d"
|
|
64
64
|
];
|
|
65
|
-
//#endregion
|
|
66
65
|
export { DataTableSummaryPanel };
|
|
67
66
|
|
|
68
67
|
//# sourceMappingURL=DataTableSummaryPanel.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Button } from "../core/Button.js";
|
|
3
2
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../core/Tooltip.js";
|
|
3
|
+
import { cn } from "../core/utils.js";
|
|
4
4
|
import { DataTableColumnPicker } from "./DataTableColumnPicker.js";
|
|
5
5
|
import { DataTableFilterBar } from "./DataTableFilterBar.js";
|
|
6
6
|
import { DataTableFilterDialog } from "./DataTableFilterDialog.js";
|
|
@@ -10,7 +10,7 @@ import { DataTableHelpButton } from "./DataTableHelpButton.js";
|
|
|
10
10
|
import { useI18n } from "alepha/react/i18n";
|
|
11
11
|
import { RefreshCw } from "lucide-react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
|
|
13
|
+
// src/table/DataTableToolbar.tsx
|
|
14
14
|
/**
|
|
15
15
|
* The bar above the rows: the caller's `leading` slot, the filter form (or its
|
|
16
16
|
* dialog on a phone), the caller's `toolbar` slot and `actions`, then the
|
|
@@ -125,7 +125,6 @@ const DataTableToolbar = (props) => {
|
|
|
125
125
|
]
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
|
-
//#endregion
|
|
129
128
|
export { DataTableToolbar };
|
|
130
129
|
|
|
131
130
|
//# sourceMappingURL=DataTableToolbar.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Table, TableBody, TableHead, TableHeader, TableRow } from "../core/Table.js";
|
|
2
|
+
import { cn } from "../core/utils.js";
|
|
3
3
|
import { PermissionMatrixGroupRows, permissionChecked } from "./PermissionMatrixGroupRows.js";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/table/PermissionMatrix.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Who may do what, as a table: permissions down the left, one column per rank,
|
|
8
8
|
* a checkbox at each crossing.
|
|
@@ -107,7 +107,6 @@ const PermissionMatrix = (props) => {
|
|
|
107
107
|
}, group.key)) })] })
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
|
-
//#endregion
|
|
111
110
|
export { PermissionMatrix };
|
|
112
111
|
|
|
113
112
|
//# sourceMappingURL=PermissionMatrix.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
|
-
import { TableCell, TableRow } from "../core/Table.js";
|
|
3
1
|
import { Checkbox } from "../core/Checkbox.js";
|
|
2
|
+
import { TableCell, TableRow } from "../core/Table.js";
|
|
3
|
+
import { cn } from "../core/utils.js";
|
|
4
4
|
import { PermissionMatrixRowLabel } from "./PermissionMatrixRowLabel.js";
|
|
5
5
|
import { Lock } from "lucide-react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/PermissionMatrixGroupRows.tsx
|
|
8
8
|
/**
|
|
9
9
|
* One group's heading row and the permission rows under it.
|
|
10
10
|
*
|
|
@@ -78,7 +78,6 @@ const PermissionMatrixGroupRows = (props) => {
|
|
|
78
78
|
* the opposite of what it means.
|
|
79
79
|
*/
|
|
80
80
|
const permissionChecked = (column, permission, granted) => column.readOnly ? true : permission.lock === "on" ? true : permission.lock === "off" ? false : granted(column.key, permission.name);
|
|
81
|
-
//#endregion
|
|
82
81
|
export { PermissionMatrixGroupRows, permissionChecked };
|
|
83
82
|
|
|
84
83
|
//# sourceMappingURL=PermissionMatrixGroupRows.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/table/PermissionMatrixRowLabel.tsx
|
|
4
4
|
/**
|
|
5
5
|
* A permission's label, carrying its `description` as a tooltip.
|
|
6
6
|
*
|
|
@@ -26,7 +26,6 @@ const PermissionMatrixRowLabel = (props) => {
|
|
|
26
26
|
children: props.permission.label
|
|
27
27
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: props.permission.description })] });
|
|
28
28
|
};
|
|
29
|
-
//#endregion
|
|
30
29
|
export { PermissionMatrixRowLabel };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=PermissionMatrixRowLabel.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/table/dataTableCellPadding.ts
|
|
2
2
|
/**
|
|
3
3
|
* The classes each size puts on the cells: `cell` on every body cell and
|
|
4
4
|
* skeleton cell, `head` on every header cell.
|
|
@@ -22,7 +22,6 @@ const DATA_TABLE_CELL_PADDING = {
|
|
|
22
22
|
head: "h-11 px-3"
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { DATA_TABLE_CELL_PADDING };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=dataTableCellPadding.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATA_TABLE_FILTER_OPERATORS } from "./DataTableFilterOperator.js";
|
|
2
2
|
import { AlephaError, z } from "alepha";
|
|
3
|
-
|
|
3
|
+
// src/table/dataTableFilterFields.ts
|
|
4
4
|
/**
|
|
5
5
|
* Every key a table's filters are stored, sent and linked under: each field's
|
|
6
6
|
* own key, followed by its operator key when it has operators.
|
|
@@ -93,7 +93,6 @@ const dataTableFilterBarFields = (fields, definition) => {
|
|
|
93
93
|
mode: definition.modes[key]
|
|
94
94
|
}));
|
|
95
95
|
};
|
|
96
|
-
//#endregion
|
|
97
96
|
export { buildDataTableFilterSchema, dataTableFilterBarFields, dataTableFilterFieldSchema, dataTableFilterKeys, dataTableFilterMode, dataTableFilterOperatorKey, dataTableFilterOperatorValues };
|
|
98
97
|
|
|
99
98
|
//# sourceMappingURL=dataTableFilterFields.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "alepha";
|
|
2
|
-
|
|
2
|
+
// src/table/dataTablePersistence.ts
|
|
3
3
|
/**
|
|
4
4
|
* Synchronous localStorage read. Returns undefined on miss or error.
|
|
5
5
|
*/
|
|
@@ -154,7 +154,6 @@ const filterVisibilityChange = (shown, modes) => {
|
|
|
154
154
|
removed
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
|
-
//#endregion
|
|
158
157
|
export { declaredShownFilters, filterVisibilityChange, persistedColumns, persistedOrder, persistedShownFilters, persistedSize, persistedSort, persistedSummaryOpen, readPersisted, reconcileOrder, reconcilePersistedFilters, writePersisted };
|
|
159
158
|
|
|
160
159
|
//# sourceMappingURL=dataTablePersistence.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/table/dataTableSquareRight.ts
|
|
2
2
|
/**
|
|
3
3
|
* The classes that square a table's right corners, per breakpoint: `top` for
|
|
4
4
|
* the band that opens the table (the toolbar, or the rows when there is
|
|
@@ -35,7 +35,6 @@ const DATA_TABLE_SQUARE_RIGHT = {
|
|
|
35
35
|
bottom: "2xl:rounded-br-none"
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
//#endregion
|
|
39
38
|
export { DATA_TABLE_SQUARE_RIGHT };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=dataTableSquareRight.js.map
|
package/dist/table/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DataTableBulkMenu } from "./DataTableBulkMenu.js";
|
|
2
1
|
import { PAGE_SIZES } from "./DataTableFooter.js";
|
|
3
|
-
import {
|
|
2
|
+
import { DataTable } from "./DataTable.js";
|
|
3
|
+
import { DataTableBulkMenu } from "./DataTableBulkMenu.js";
|
|
4
4
|
import { dataTableFilterKeys } from "./dataTableFilterFields.js";
|
|
5
|
+
import { DataTableFilterDialog } from "./DataTableFilterDialog.js";
|
|
5
6
|
import { DataTableFilterMenu } from "./DataTableFilterMenu.js";
|
|
6
7
|
import { paginateLocal } from "./paginateLocal.js";
|
|
7
|
-
import { useTableSelection } from "./useTableSelection.js";
|
|
8
|
-
import { DataTable } from "./DataTable.js";
|
|
9
8
|
import { PermissionMatrix } from "./PermissionMatrix.js";
|
|
9
|
+
import { useTableSelection } from "./useTableSelection.js";
|
|
10
10
|
export { DataTable, DataTableBulkMenu, DataTableFilterDialog, DataTableFilterMenu, PAGE_SIZES, PermissionMatrix, dataTableFilterKeys, paginateLocal, useTableSelection };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/table/paginateLocal.ts
|
|
2
2
|
/**
|
|
3
3
|
* Does one filter value match the same-named property of a row?
|
|
4
4
|
*
|
|
@@ -78,7 +78,6 @@ const paginateLocal = (items, options) => {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
//#endregion
|
|
82
81
|
export { paginateLocal };
|
|
83
82
|
|
|
84
83
|
//# sourceMappingURL=paginateLocal.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { coerceScalar, z } from "alepha";
|
|
2
|
-
|
|
2
|
+
// src/table/queryFilters.ts
|
|
3
3
|
/**
|
|
4
4
|
* The two halves of a shareable filter link.
|
|
5
5
|
*
|
|
@@ -112,7 +112,6 @@ const cleanFilterValues = (values) => {
|
|
|
112
112
|
}
|
|
113
113
|
return out;
|
|
114
114
|
};
|
|
115
|
-
//#endregion
|
|
116
115
|
export { cleanFilterValues, filtersToQuery, queryToFilters, shareFiltersUrl };
|
|
117
116
|
|
|
118
117
|
//# sourceMappingURL=queryFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryFilters.js","names":[],"sources":["../../src/table/queryFilters.ts"],"sourcesContent":["import { type Alepha, type ZObject, coerceScalar, z } from \"alepha\";\n\n/**\n * The two halves of a shareable filter link.\n *\n * `queryToFilters` reads the URL into filter values on arrival;\n * `filtersToQuery` writes the current values back out when the reader asks\n * for a link. Nothing here runs on its own: the table seeds from the query\n * once, at mount, and only ever writes on an explicit Share.\n *\n * ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps\n * the address bar in step with the filters is the shape Lore incident #156\n * was about (see `AppRouter.projectQuests`): the router state is a global\n * store, so the render on the way OUT of a page sees the next route's query\n * and writes against it.\n */\n\n/**\n * Read the filter values a URL carries.\n *\n * Only keys declared by the filter `schema` are read, so query params the\n * page owns (a tab, a locale, a tracking param) never reach the fetch\n * payload. `keys` narrows that further when a table wants only some of its\n * filters to be linkable.\n *\n * Values arrive as strings and are coerced then decoded per field, the same\n * pair the server applies to its own query strings, which is what turns\n * `?limit=25` into a number and `?archived=true` into a boolean. A value the\n * schema refuses is DROPPED rather than thrown: a stale bookmark has to\n * degrade to the unfiltered list, never to an error page.\n *\n * Multi-value filters are comma-joined (`?status=new,triaged`). Repeated\n * params are not an option: `ReactBrowserRouterProvider` builds its query\n * from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`\n * arrives as `triaged` alone.\n *\n * Returns `undefined` rather than `{}` when nothing matches, because the\n * caller hands this to the table's seed slot, and an empty seed still\n * outranks the filters the reader chose last time.\n */\nexport const queryToFilters = (\n alepha: Alepha,\n schema: ZObject,\n query: Record<string, any>,\n keys?: readonly string[],\n): Record<string, any> | undefined => {\n const shape = z.schema.shape(schema);\n const out: Record<string, any> = {};\n\n for (const [key, field] of Object.entries(shape)) {\n if (keys && !keys.includes(key)) continue;\n const raw = query[key];\n if (typeof raw !== \"string\" || raw === \"\") continue;\n\n const base = z.schema.unwrap(field);\n const input = z.schema.isArray(base)\n ? raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\")\n : raw;\n\n try {\n out[key] = alepha.codec.decode(field
|
|
1
|
+
{"version":3,"file":"queryFilters.js","names":[],"sources":["../../src/table/queryFilters.ts"],"sourcesContent":["import { type Alepha, type ZObject, coerceScalar, z } from \"alepha\";\n\n/**\n * The two halves of a shareable filter link.\n *\n * `queryToFilters` reads the URL into filter values on arrival;\n * `filtersToQuery` writes the current values back out when the reader asks\n * for a link. Nothing here runs on its own: the table seeds from the query\n * once, at mount, and only ever writes on an explicit Share.\n *\n * ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps\n * the address bar in step with the filters is the shape Lore incident #156\n * was about (see `AppRouter.projectQuests`): the router state is a global\n * store, so the render on the way OUT of a page sees the next route's query\n * and writes against it.\n */\n\n/**\n * Read the filter values a URL carries.\n *\n * Only keys declared by the filter `schema` are read, so query params the\n * page owns (a tab, a locale, a tracking param) never reach the fetch\n * payload. `keys` narrows that further when a table wants only some of its\n * filters to be linkable.\n *\n * Values arrive as strings and are coerced then decoded per field, the same\n * pair the server applies to its own query strings, which is what turns\n * `?limit=25` into a number and `?archived=true` into a boolean. A value the\n * schema refuses is DROPPED rather than thrown: a stale bookmark has to\n * degrade to the unfiltered list, never to an error page.\n *\n * Multi-value filters are comma-joined (`?status=new,triaged`). Repeated\n * params are not an option: `ReactBrowserRouterProvider` builds its query\n * from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`\n * arrives as `triaged` alone.\n *\n * Returns `undefined` rather than `{}` when nothing matches, because the\n * caller hands this to the table's seed slot, and an empty seed still\n * outranks the filters the reader chose last time.\n */\nexport const queryToFilters = (\n alepha: Alepha,\n schema: ZObject,\n query: Record<string, any>,\n keys?: readonly string[],\n): Record<string, any> | undefined => {\n const shape = z.schema.shape(schema);\n const out: Record<string, any> = {};\n\n for (const [key, field] of Object.entries(shape)) {\n if (keys && !keys.includes(key)) continue;\n const raw = query[key];\n if (typeof raw !== \"string\" || raw === \"\") continue;\n\n const base = z.schema.unwrap(field);\n const input = z.schema.isArray(base)\n ? raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\")\n : raw;\n\n try {\n out[key] = alepha.codec.decode(field, coerceScalar(field, input));\n } catch {\n // A value this schema no longer accepts, from a link written against\n // an older shape. The rest of the link still applies.\n }\n }\n\n return Object.keys(out).length > 0 ? out : undefined;\n};\n\n/**\n * Serialize filter values into query params for a shareable link.\n *\n * Strings, numbers, booleans and arrays of those. Anything else is dropped:\n * a link carrying some of the filters is honest, and one carrying\n * `[object Object]` is not.\n */\nexport const filtersToQuery = (\n values: Record<string, any>,\n): Record<string, string> => {\n const out: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (value === undefined || value === null || value === \"\") continue;\n\n if (Array.isArray(value)) {\n const parts = value.filter((item) => isScalar(item)).map(String);\n if (parts.length > 0) out[key] = parts.join(\",\");\n continue;\n }\n\n if (isScalar(value)) out[key] = String(value);\n }\n\n return out;\n};\n\nconst isScalar = (value: unknown): boolean =>\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\";\n\n/**\n * The link the toolbar's Share item copies.\n *\n * Built on the page's own URL, so query params the table knows nothing about\n * (a tab, a locale, a campaign) survive into the shared link. Every filter\n * key is cleared first, which is what makes a filter the reader has since\n * removed disappear from the link rather than linger from the URL they\n * arrived on.\n *\n * Commas are written literally. `URLSearchParams` percent-encodes them, and\n * `?status=new%2Ctriaged` defeats the point of a link somebody reads before\n * clicking it. A comma is a legal sub-delimiter in a query, and it round-trips\n * back through `queryToFilters` either way.\n */\nexport const shareFiltersUrl = (\n href: string,\n keys: readonly string[],\n values: Record<string, any>,\n): string => {\n const url = new URL(href);\n\n for (const key of keys) {\n url.searchParams.delete(key);\n }\n for (const [key, value] of Object.entries(filtersToQuery(values))) {\n url.searchParams.set(key, value);\n }\n\n url.search = url.search.replace(/%2C/g, \",\");\n return url.toString();\n};\n\n/**\n * The filter values that are actually narrowing the list.\n *\n * Empty is not a filter: an untouched text input holds `\"\"` and a\n * multi-select the reader emptied holds `[]`, and neither should be stored,\n * counted on the toolbar badge, or written into a shared link. One\n * definition rather than three, because the three used to disagree on\n * nothing at all and that is exactly how they would drift.\n */\nexport const cleanFilterValues = (\n values: Record<string, any>,\n): Record<string, any> => {\n const out: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (value === undefined || value === null || value === \"\") continue;\n if (Array.isArray(value) && value.length === 0) continue;\n out[key] = value;\n }\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,kBACX,QACA,QACA,OACA,SACoC;CACpC,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM;CACnC,MAAM,MAA2B,CAAC;CAElC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,QAAQ,CAAC,KAAK,SAAS,GAAG,GAAG;EACjC,MAAM,MAAM,MAAM;EAClB,IAAI,OAAO,QAAQ,YAAY,QAAQ,IAAI;EAE3C,MAAM,OAAO,EAAE,OAAO,OAAO,KAAK;EAClC,MAAM,QAAQ,EAAE,OAAO,QAAQ,IAAI,IAC/B,IACG,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,QAAQ,SAAS,SAAS,EAAE,IAC/B;EAEJ,IAAI;GACF,IAAI,OAAO,OAAO,MAAM,OAAO,OAAO,aAAa,OAAO,KAAK,CAAC;EAClE,QAAQ,CAGR;CACF;CAEA,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,IAAI,MAAM,KAAA;AAC7C;;;;;;;;AASA,MAAa,kBACX,WAC2B;CAC3B,MAAM,MAA8B,CAAC;CAErC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;EAE3D,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,MAAM,QAAQ,MAAM,QAAQ,SAAS,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM;GAC/D,IAAI,MAAM,SAAS,GAAG,IAAI,OAAO,MAAM,KAAK,GAAG;GAC/C;EACF;EAEA,IAAI,SAAS,KAAK,GAAG,IAAI,OAAO,OAAO,KAAK;CAC9C;CAEA,OAAO;AACT;AAEA,MAAM,YAAY,UAChB,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;;;;;;;;;;;;;;;AAgBnB,MAAa,mBACX,MACA,MACA,WACW;CACX,MAAM,MAAM,IAAI,IAAI,IAAI;CAExB,KAAK,MAAM,OAAO,MAChB,IAAI,aAAa,OAAO,GAAG;CAE7B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,eAAe,MAAM,CAAC,GAC9D,IAAI,aAAa,IAAI,KAAK,KAAK;CAGjC,IAAI,SAAS,IAAI,OAAO,QAAQ,QAAQ,GAAG;CAC3C,OAAO,IAAI,SAAS;AACtB;;;;;;;;;;AAWA,MAAa,qBACX,WACwB;CACxB,MAAM,MAA2B,CAAC;CAElC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;EAC3D,IAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;EAChD,IAAI,OAAO;CACb;CAEA,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { persistedColumns, persistedOrder, reconcileOrder, writePersisted } from "./dataTablePersistence.js";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
-
|
|
3
|
+
// src/table/useDataTableColumns.ts
|
|
4
4
|
/**
|
|
5
5
|
* Which columns `DataTable` shows, and in what order: the visible set, the
|
|
6
6
|
* reader's order reconciled against the declared columns, and the moves and
|
|
@@ -100,7 +100,6 @@ const useDataTableColumns = (options) => {
|
|
|
100
100
|
orderAnnouncement
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
//#endregion
|
|
104
103
|
export { useDataTableColumns };
|
|
105
104
|
|
|
106
105
|
//# sourceMappingURL=useDataTableColumns.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Alepha, type ZObject } from "alepha";
|
|
1
|
+
import { type Alepha, type ZObject, z } from "alepha";
|
|
2
2
|
import { type FormModel } from "alepha/react/form";
|
|
3
3
|
import { type Dispatch, type SetStateAction } from "react";
|
|
4
4
|
import type { DataTableBaseProps } from "./dataTableBaseProps.ts";
|
|
@@ -31,7 +31,7 @@ export declare const useDataTableData: <T>(options: UseDataTableDataOptions<T>)
|
|
|
31
31
|
page: number;
|
|
32
32
|
setPage: Dispatch<SetStateAction<number>>;
|
|
33
33
|
sizeForm: FormModel<import("zod").ZodObject<{
|
|
34
|
-
size:
|
|
34
|
+
size: z.ZodNumber;
|
|
35
35
|
}, import("zod/v4/core").$strip>>;
|
|
36
36
|
sort: SortState | null;
|
|
37
37
|
setSort: Dispatch<SetStateAction<SortState | null>>;
|