@object-ui/app-shell 6.2.2 → 7.0.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/CHANGELOG.md +967 -0
- package/README.md +292 -0
- package/dist/assistant/assistantBus.d.ts +72 -0
- package/dist/assistant/assistantBus.js +133 -0
- package/dist/chrome/CommandPalette.d.ts +1 -1
- package/dist/chrome/CommandPalette.js +26 -22
- package/dist/chrome/ConditionalAuthWrapper.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.js +3 -1
- package/dist/chrome/ErrorBoundary.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.js +16 -5
- package/dist/chrome/LoadingScreen.d.ts +1 -1
- package/dist/chrome/LoadingScreen.js +22 -26
- package/dist/chrome/RouteFader.d.ts +1 -1
- package/dist/chrome/ThemeProvider.d.ts +1 -1
- package/dist/components/ManagedByBadge.d.ts +1 -1
- package/dist/console/AppContent.d.ts +1 -1
- package/dist/console/AppContent.js +170 -37
- package/dist/console/ConsoleShell.d.ts +7 -7
- package/dist/console/ConsoleShell.js +32 -3
- package/dist/console/ai/AiChatPage.d.ts +88 -1
- package/dist/console/ai/AiChatPage.js +743 -66
- package/dist/console/ai/ConversationsSidebar.d.ts +26 -1
- package/dist/console/ai/ConversationsSidebar.js +149 -34
- package/dist/console/ai/LiveCanvas.d.ts +22 -0
- package/dist/console/ai/LiveCanvas.js +78 -0
- package/dist/console/ai/reconcileTurn.d.ts +8 -0
- package/dist/console/ai/reconcileTurn.js +20 -0
- package/dist/console/auth/AuthPageLayout.d.ts +1 -1
- package/dist/console/auth/ForgotPasswordPage.d.ts +1 -1
- package/dist/console/auth/LoginPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.js +23 -3
- package/dist/console/cloud-connection/CloudConnectionPanel.d.ts +1 -0
- package/dist/console/cloud-connection/CloudConnectionPanel.js +169 -0
- package/dist/console/home/AppCard.d.ts +1 -1
- package/dist/console/home/AppCard.js +6 -12
- package/dist/console/home/HomeAppsStrip.d.ts +8 -0
- package/dist/console/home/HomeAppsStrip.js +61 -0
- package/dist/console/home/HomeLayout.d.ts +1 -1
- package/dist/console/home/HomeLayout.js +3 -1
- package/dist/console/home/HomePage.d.ts +1 -2
- package/dist/console/home/HomePage.js +149 -21
- package/dist/console/home/HomeRail.d.ts +22 -0
- package/dist/console/home/HomeRail.js +62 -0
- package/dist/console/home/QuickActions.d.ts +1 -1
- package/dist/console/home/QuickActions.js +3 -11
- package/dist/console/home/RecentApps.d.ts +1 -1
- package/dist/console/home/RecentApps.js +2 -2
- package/dist/console/home/StarredApps.d.ts +1 -1
- package/dist/console/home/StarredApps.js +2 -2
- package/dist/console/marketplace/InstalledListWidget.d.ts +1 -0
- package/dist/console/marketplace/InstalledListWidget.js +93 -0
- package/dist/console/marketplace/MarkdownText.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceAccessDenied.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceInstalledPage.d.ts +8 -14
- package/dist/console/marketplace/MarketplaceInstalledPage.js +14 -66
- package/dist/console/marketplace/MarketplacePackagePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePackagePage.js +249 -8
- package/dist/console/marketplace/MarketplacePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePage.js +60 -3
- package/dist/console/marketplace/PackageIcon.d.ts +1 -1
- package/dist/console/marketplace/PluginDisclosure.d.ts +14 -0
- package/dist/console/marketplace/PluginDisclosure.js +38 -0
- package/dist/console/marketplace/marketplaceApi.d.ts +123 -0
- package/dist/console/marketplace/marketplaceApi.js +254 -1
- package/dist/console/organizations/CreateWorkspaceDialog.d.ts +1 -1
- package/dist/console/organizations/OrganizationsLayout.d.ts +1 -1
- package/dist/console/organizations/OrganizationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/AcceptInvitationPage.d.ts +1 -1
- package/dist/console/organizations/manage/InvitationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/InviteMemberDialog.d.ts +1 -1
- package/dist/console/organizations/manage/MembersPage.d.ts +1 -1
- package/dist/console/organizations/manage/OrganizationLayout.d.ts +1 -1
- package/dist/console/organizations/manage/SettingsPage.d.ts +1 -1
- package/dist/context/CommandPaletteProvider.d.ts +44 -0
- package/dist/context/CommandPaletteProvider.js +71 -0
- package/dist/context/FavoritesProvider.d.ts +1 -1
- package/dist/context/NavigationContext.d.ts +1 -1
- package/dist/context/RecentItemsProvider.d.ts +2 -2
- package/dist/context/UserStateAdapters.d.ts +1 -1
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/useActionModal.d.ts +53 -0
- package/dist/hooks/useActionModal.js +111 -0
- package/dist/hooks/useChatConversation.d.ts +107 -4
- package/dist/hooks/useChatConversation.js +253 -25
- package/dist/hooks/useConsoleActionRuntime.d.ts +70 -0
- package/dist/hooks/useConsoleActionRuntime.js +560 -0
- package/dist/hooks/useConversationList.js +61 -3
- package/dist/hooks/useHomeInbox.d.ts +13 -0
- package/dist/hooks/useHomeInbox.js +142 -0
- package/dist/hooks/useNavPins.js +17 -23
- package/dist/hooks/useNavigationSync.d.ts +33 -0
- package/dist/hooks/useNavigationSync.js +98 -12
- package/dist/hooks/useReconcileOnError.d.ts +40 -0
- package/dist/hooks/useReconcileOnError.js +37 -0
- package/dist/hooks/useRecordApprovals.d.ts +18 -19
- package/dist/hooks/useRecordApprovals.js +24 -40
- package/dist/hooks/useResponsiveSidebar.js +14 -5
- package/dist/hooks/useSettleSignal.d.ts +19 -0
- package/dist/hooks/useSettleSignal.js +20 -0
- package/dist/hooks/useTrackRouteAsRecent.js +35 -0
- package/dist/hooks/useUrlOverlay.d.ts +62 -0
- package/dist/hooks/useUrlOverlay.js +88 -0
- package/dist/index.d.ts +16 -7
- package/dist/index.js +12 -4
- package/dist/layout/ActivityFeed.d.ts +1 -1
- package/dist/layout/AppHeader.d.ts +3 -2
- package/dist/layout/AppHeader.js +237 -72
- package/dist/layout/AppSidebar.d.ts +2 -1
- package/dist/layout/AppSidebar.js +26 -46
- package/dist/layout/AppSwitcher.d.ts +2 -1
- package/dist/layout/AppSwitcher.js +9 -5
- package/dist/layout/AuthPageLayout.d.ts +1 -1
- package/dist/layout/ConnectionStatus.d.ts +1 -1
- package/dist/layout/ConnectionStatus.js +9 -6
- package/dist/layout/ConsoleChatbotFab.d.ts +19 -1
- package/dist/layout/ConsoleChatbotFab.js +16 -2
- package/dist/layout/ConsoleFloatingChatbot.d.ts +32 -2
- package/dist/layout/ConsoleFloatingChatbot.js +374 -41
- package/dist/layout/ConsoleLayout.d.ts +1 -1
- package/dist/layout/ConsoleLayout.js +27 -11
- package/dist/layout/ContextSelectors.d.ts +44 -0
- package/dist/layout/ContextSelectors.js +218 -0
- package/dist/layout/InboxPopover.d.ts +6 -1
- package/dist/layout/InboxPopover.js +25 -6
- package/dist/layout/LocaleSwitcher.d.ts +1 -1
- package/dist/layout/LocalizedSidebarTrigger.d.ts +2 -0
- package/dist/layout/LocalizedSidebarTrigger.js +15 -0
- package/dist/layout/MobileViewSwitcherContext.d.ts +1 -1
- package/dist/layout/ModeToggle.d.ts +1 -1
- package/dist/layout/PageHeader.d.ts +1 -1
- package/dist/layout/UnifiedSidebar.d.ts +2 -1
- package/dist/layout/UnifiedSidebar.js +116 -15
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +1 -0
- package/dist/observability/settleSignal.d.ts +64 -0
- package/dist/observability/settleSignal.js +131 -0
- package/dist/preview/DraftChangesPanel.d.ts +19 -0
- package/dist/preview/DraftChangesPanel.js +114 -0
- package/dist/preview/DraftPreviewBar.d.ts +8 -0
- package/dist/preview/DraftPreviewBar.js +86 -0
- package/dist/preview/PreviewDraftEmptyState.d.ts +16 -0
- package/dist/preview/PreviewDraftEmptyState.js +47 -0
- package/dist/preview/PreviewModeContext.d.ts +57 -0
- package/dist/preview/PreviewModeContext.js +99 -0
- package/dist/preview/UnpublishedAppBar.d.ts +8 -0
- package/dist/preview/UnpublishedAppBar.js +79 -0
- package/dist/preview/draftStatus.d.ts +20 -0
- package/dist/preview/draftStatus.js +27 -0
- package/dist/preview/usePublishAllDrafts.d.ts +18 -0
- package/dist/preview/usePublishAllDrafts.js +106 -0
- package/dist/providers/AdapterProvider.d.ts +1 -1
- package/dist/providers/AdapterProvider.js +6 -1
- package/dist/providers/ExpressionProvider.d.ts +1 -1
- package/dist/providers/MetadataProvider.d.ts +17 -2
- package/dist/providers/MetadataProvider.js +183 -12
- package/dist/runtime-config.d.ts +46 -2
- package/dist/runtime-config.js +39 -2
- package/dist/services/builtinComponents.js +68 -59
- package/dist/skeletons/SkeletonDashboard.d.ts +1 -1
- package/dist/skeletons/SkeletonDetail.d.ts +1 -1
- package/dist/skeletons/SkeletonGrid.d.ts +1 -1
- package/dist/utils/appRoute.d.ts +21 -0
- package/dist/utils/appRoute.js +25 -0
- package/dist/utils/deriveRelatedLists.d.ts +54 -0
- package/dist/utils/deriveRelatedLists.js +91 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/managedByEmptyState.d.ts +8 -1
- package/dist/utils/managedByEmptyState.js +13 -7
- package/dist/utils/preferLocal.d.ts +18 -0
- package/dist/utils/preferLocal.js +24 -0
- package/dist/views/ActionConfirmDialog.d.ts +1 -1
- package/dist/views/ActionConfirmDialog.js +3 -1
- package/dist/views/ActionParamDialog.d.ts +6 -1
- package/dist/views/ActionParamDialog.js +9 -3
- package/dist/views/ActionResultDialog.d.ts +13 -0
- package/dist/views/ActionResultDialog.js +134 -0
- package/dist/views/ComponentNavView.d.ts +14 -1
- package/dist/views/CreateViewDialog.d.ts +1 -1
- package/dist/views/DashboardConfigPanel.d.ts +28 -0
- package/dist/views/DashboardConfigPanel.js +81 -0
- package/dist/views/DashboardView.d.ts +4 -3
- package/dist/views/DashboardView.js +38 -239
- package/dist/views/FlowRunner.d.ts +59 -0
- package/dist/views/FlowRunner.js +153 -0
- package/dist/views/InterfaceListPage.d.ts +49 -0
- package/dist/views/InterfaceListPage.js +347 -0
- package/dist/views/MetadataInspector.d.ts +2 -2
- package/dist/views/ObjectView.d.ts +1 -1
- package/dist/views/ObjectView.js +209 -532
- package/dist/views/PageView.d.ts +8 -3
- package/dist/views/PageView.js +45 -32
- package/dist/views/RecordDetailView.d.ts +1 -1
- package/dist/views/RecordDetailView.js +363 -148
- package/dist/views/RecordFormPage.d.ts +1 -1
- package/dist/views/RecordFormPage.js +26 -1
- package/dist/views/ReportConfigPanel.d.ts +37 -0
- package/dist/views/ReportConfigPanel.js +85 -0
- package/dist/views/ReportView.d.ts +1 -1
- package/dist/views/ReportView.js +116 -7
- package/dist/views/RuntimeDraftBar.d.ts +30 -0
- package/dist/views/RuntimeDraftBar.js +112 -0
- package/dist/views/SearchResultsPage.d.ts +1 -1
- package/dist/views/SearchResultsPage.js +8 -18
- package/dist/views/ViewConfigPanel.d.ts +24 -17
- package/dist/views/ViewConfigPanel.js +121 -77
- package/dist/views/index.d.ts +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/metadata-admin/AuditPanel.d.ts +28 -0
- package/dist/views/metadata-admin/AuditPanel.js +79 -0
- package/dist/views/metadata-admin/DiagnosticsPage.d.ts +20 -0
- package/dist/views/metadata-admin/DiagnosticsPage.js +69 -0
- package/dist/views/metadata-admin/DirectoryPage.d.ts +16 -1
- package/dist/views/metadata-admin/DirectoryPage.js +113 -24
- package/dist/views/metadata-admin/DraftReviewPanel.d.ts +33 -0
- package/dist/views/metadata-admin/DraftReviewPanel.js +77 -0
- package/dist/views/metadata-admin/EmbeddedItemEditor.d.ts +17 -1
- package/dist/views/metadata-admin/EmbeddedItemEditor.js +15 -8
- package/dist/views/metadata-admin/JsonSourceEditor.d.ts +37 -0
- package/dist/views/metadata-admin/JsonSourceEditor.js +178 -0
- package/dist/views/metadata-admin/LayeredDiff.d.ts +39 -1
- package/dist/views/metadata-admin/LayeredDiff.js +171 -5
- package/dist/views/metadata-admin/MetadataDetailDrawer.d.ts +15 -1
- package/dist/views/metadata-admin/MetadataTypeActions.d.ts +48 -0
- package/dist/views/metadata-admin/MetadataTypeActions.js +165 -0
- package/dist/views/metadata-admin/PackagesPage.d.ts +18 -0
- package/dist/views/metadata-admin/PackagesPage.js +395 -0
- package/dist/views/metadata-admin/PageShell.d.ts +1 -1
- package/dist/views/metadata-admin/PageShell.js +9 -4
- package/dist/views/metadata-admin/PermissionMatrixEditor.d.ts +35 -1
- package/dist/views/metadata-admin/QuickFind.d.ts +21 -1
- package/dist/views/metadata-admin/QuickFind.js +6 -3
- package/dist/views/metadata-admin/RelatedPanel.d.ts +24 -1
- package/dist/views/metadata-admin/RelatedPanel.js +20 -18
- package/dist/views/metadata-admin/ResourceEditPage.d.ts +40 -1
- package/dist/views/metadata-admin/ResourceEditPage.js +1223 -60
- package/dist/views/metadata-admin/ResourceHistoryPage.d.ts +39 -1
- package/dist/views/metadata-admin/ResourceHistoryPage.js +66 -16
- package/dist/views/metadata-admin/ResourceListPage.d.ts +13 -1
- package/dist/views/metadata-admin/ResourceListPage.js +266 -30
- package/dist/views/metadata-admin/ResourceRouter.d.ts +23 -1
- package/dist/views/metadata-admin/SchemaForm.d.ts +34 -1
- package/dist/views/metadata-admin/SchemaForm.js +559 -49
- package/dist/views/metadata-admin/StudioHomePage.d.ts +22 -0
- package/dist/views/metadata-admin/StudioHomePage.js +213 -0
- package/dist/views/metadata-admin/anchors.js +237 -24
- package/dist/views/metadata-admin/clientValidation.d.ts +50 -0
- package/dist/views/metadata-admin/clientValidation.js +169 -0
- package/dist/views/metadata-admin/color-variant-field.d.ts +30 -0
- package/dist/views/metadata-admin/color-variant-field.js +38 -0
- package/dist/views/metadata-admin/createDerive.d.ts +75 -0
- package/dist/views/metadata-admin/createDerive.js +179 -0
- package/dist/views/metadata-admin/dashboard-schema.d.ts +12 -0
- package/dist/views/metadata-admin/dashboard-schema.js +80 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.d.ts +35 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.js +327 -0
- package/dist/views/metadata-admin/datasource/register.d.ts +1 -0
- package/dist/views/metadata-admin/datasource/register.js +24 -0
- package/dist/views/metadata-admin/default-inspector-registry.d.ts +49 -0
- package/dist/views/metadata-admin/default-inspector-registry.js +8 -0
- package/dist/views/metadata-admin/default-schemas.js +115 -10
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.d.ts +27 -0
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.js +69 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.d.ts +27 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.js +77 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.d.ts +16 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.js +74 -0
- package/dist/views/metadata-admin/external/ValidationPanel.d.ts +16 -0
- package/dist/views/metadata-admin/external/ValidationPanel.js +68 -0
- package/dist/views/metadata-admin/external/api.d.ts +100 -0
- package/dist/views/metadata-admin/external/api.js +124 -0
- package/dist/views/metadata-admin/i18n.d.ts +1 -0
- package/dist/views/metadata-admin/i18n.js +1166 -2
- package/dist/views/metadata-admin/index.d.ts +8 -5
- package/dist/views/metadata-admin/index.js +12 -2
- package/dist/views/metadata-admin/inspector-registry.d.ts +51 -0
- package/dist/views/metadata-admin/inspector-registry.js +11 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.js +180 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.d.ts +29 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.js +154 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.d.ts +28 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.js +139 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.js +107 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.js +45 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.d.ts +12 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.js +9 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.js +125 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.js +40 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.d.ts +14 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.js +140 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.js +105 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.d.ts +83 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.js +181 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.js +60 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.js +61 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.js +54 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.d.ts +23 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.js +330 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.d.ts +48 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.js +332 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.d.ts +58 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.js +160 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.js +144 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.js +21 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.d.ts +54 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.js +191 -0
- package/dist/views/metadata-admin/inspectors/_shared.d.ts +124 -0
- package/dist/views/metadata-admin/inspectors/_shared.js +113 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.js +66 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.d.ts +143 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.js +461 -0
- package/dist/views/metadata-admin/inspectors/index.d.ts +1 -0
- package/dist/views/metadata-admin/inspectors/index.js +45 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.js +227 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.d.ts +72 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.js +0 -0
- package/dist/views/metadata-admin/mergeServerFields.d.ts +65 -0
- package/dist/views/metadata-admin/mergeServerFields.js +56 -0
- package/dist/views/metadata-admin/preview-registry.d.ts +55 -0
- package/dist/views/metadata-admin/previews/ActionPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ActionPreview.js +238 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.d.ts +12 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.js +56 -0
- package/dist/views/metadata-admin/previews/AgentPreview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/AgentPreview.js +100 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.d.ts +31 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.js +260 -0
- package/dist/views/metadata-admin/previews/AppPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/AppPreview.js +23 -14
- package/dist/views/metadata-admin/previews/BookPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/BookPreview.js +132 -0
- package/dist/views/metadata-admin/previews/DashboardPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/DashboardPreview.js +110 -8
- package/dist/views/metadata-admin/previews/DatasetPreview.d.ts +18 -0
- package/dist/views/metadata-admin/previews/DatasetPreview.js +89 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.d.ts +23 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.js +68 -0
- package/dist/views/metadata-admin/previews/EmailTemplatePreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/FieldStub.d.ts +30 -0
- package/dist/views/metadata-admin/previews/FieldStub.js +104 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.d.ts +50 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.js +97 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.d.ts +43 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.js +328 -0
- package/dist/views/metadata-admin/previews/FlowPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/FlowPreview.js +92 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.d.ts +46 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.js +97 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.d.ts +25 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.js +170 -0
- package/dist/views/metadata-admin/previews/JobPreview.d.ts +28 -0
- package/dist/views/metadata-admin/previews/JobPreview.js +290 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.d.ts +30 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.js +547 -0
- package/dist/views/metadata-admin/previews/ObjectPreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/ObjectPreview.js +5 -30
- package/dist/views/metadata-admin/previews/OutlineStrip.d.ts +32 -0
- package/dist/views/metadata-admin/previews/OutlineStrip.js +8 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.js +510 -0
- package/dist/views/metadata-admin/previews/PagePreview.d.ts +10 -1
- package/dist/views/metadata-admin/previews/PagePreview.js +90 -4
- package/dist/views/metadata-admin/previews/PermissionPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/PermissionPreview.js +115 -0
- package/dist/views/metadata-admin/previews/PreviewShell.d.ts +29 -6
- package/dist/views/metadata-admin/previews/PreviewShell.js +16 -3
- package/dist/views/metadata-admin/previews/ReportPreview.d.ts +18 -1
- package/dist/views/metadata-admin/previews/ReportPreview.js +23 -15
- package/dist/views/metadata-admin/previews/RolePreview.d.ts +19 -0
- package/dist/views/metadata-admin/previews/RolePreview.js +14 -0
- package/dist/views/metadata-admin/previews/SkillPreview.d.ts +22 -0
- package/dist/views/metadata-admin/previews/SkillPreview.js +34 -0
- package/dist/views/metadata-admin/previews/ToolPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ToolPreview.js +122 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.js +52 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.js +110 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.d.ts +62 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.js +140 -0
- package/dist/views/metadata-admin/previews/ViewPreview.d.ts +23 -1
- package/dist/views/metadata-admin/previews/ViewPreview.js +101 -73
- package/dist/views/metadata-admin/previews/block-config.d.ts +82 -0
- package/dist/views/metadata-admin/previews/block-config.js +324 -0
- package/dist/views/metadata-admin/previews/block-types.d.ts +40 -0
- package/dist/views/metadata-admin/previews/block-types.js +110 -0
- package/dist/views/metadata-admin/previews/field-types.d.ts +53 -0
- package/dist/views/metadata-admin/previews/field-types.js +97 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.d.ts +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.js +190 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.d.ts +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.js +358 -0
- package/dist/views/metadata-admin/previews/form-preview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/form-preview.js +29 -0
- package/dist/views/metadata-admin/previews/index.js +43 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.d.ts +66 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.js +171 -0
- package/dist/views/metadata-admin/previews/object-fields-io.d.ts +109 -0
- package/dist/views/metadata-admin/previews/object-fields-io.js +208 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.d.ts +91 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.js +2 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.d.ts +8 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.js +113 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.d.ts +44 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.js +316 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.d.ts +47 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.js +133 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.d.ts +44 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.js +124 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.js +50 -0
- package/dist/views/metadata-admin/previews/useObjectFields.d.ts +23 -0
- package/dist/views/metadata-admin/previews/useObjectFields.js +79 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.js +43 -0
- package/dist/views/metadata-admin/previews/view-column-io.d.ts +42 -0
- package/dist/views/metadata-admin/previews/view-column-io.js +73 -0
- package/dist/views/metadata-admin/previews/widget-types.d.ts +24 -0
- package/dist/views/metadata-admin/previews/widget-types.js +40 -0
- package/dist/views/metadata-admin/registry.d.ts +140 -19
- package/dist/views/metadata-admin/report-schema.d.ts +26 -0
- package/dist/views/metadata-admin/report-schema.js +121 -0
- package/dist/views/metadata-admin/useMetadata.d.ts +100 -2
- package/dist/views/metadata-admin/useMetadata.js +155 -4
- package/dist/views/metadata-admin/view-item-normalize.d.ts +20 -0
- package/dist/views/metadata-admin/view-item-normalize.js +68 -0
- package/dist/views/metadata-admin/view-schema.d.ts +16 -0
- package/dist/views/metadata-admin/view-schema.js +107 -0
- package/dist/views/metadata-admin/view-variant-model.d.ts +23 -0
- package/dist/views/metadata-admin/view-variant-model.js +64 -0
- package/dist/views/metadata-admin/widgets.d.ts +89 -1
- package/dist/views/metadata-admin/widgets.js +491 -17
- package/dist/views/runtime-metadata-persistence.d.ts +78 -0
- package/dist/views/runtime-metadata-persistence.js +89 -0
- package/dist/views/useOpenRecordList.d.ts +18 -0
- package/dist/views/useOpenRecordList.js +36 -0
- package/dist/views/userFilterUrlState.d.ts +15 -0
- package/dist/views/userFilterUrlState.js +53 -0
- package/dist/views/view-config-adapter.d.ts +38 -0
- package/dist/views/view-config-adapter.js +80 -0
- package/package.json +52 -34
- package/dist/views/DesignDrawer.d.ts +0 -28
- package/dist/views/DesignDrawer.js +0 -51
- package/dist/views/metadata-admin/DesignerEditorWrapper.d.ts +0 -68
- package/dist/views/metadata-admin/DesignerEditorWrapper.js +0 -158
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
3
|
+
/**
|
|
4
|
+
* ViewColumnInspector — scoped editor for the selected View column.
|
|
5
|
+
*
|
|
6
|
+
* Selection shape: { kind: 'column', id: '<variant>.columns[<i>]' }
|
|
7
|
+
*
|
|
8
|
+
* SPEC-DRIVEN: the column's detail properties (width / align / pinned /
|
|
9
|
+
* summary / sortable / …) are rendered from the spec's `ListColumn`
|
|
10
|
+
* JSONSchema via the generic {@link SchemaForm}, NOT a hardcoded field
|
|
11
|
+
* list. New ListColumn props in `@objectstack/spec` appear automatically.
|
|
12
|
+
*
|
|
13
|
+
* A thin curated layer stays on top for the column IDENTITY (field key +
|
|
14
|
+
* label) because those round-trip through two shapes: the ObjectStack
|
|
15
|
+
* canonical `{ field, label }` and the legacy TanStack `{ accessorKey,
|
|
16
|
+
* header }`. A column that is a bare string (e.g. a kanban card field) is
|
|
17
|
+
* kept as a string until the author edits a detail prop.
|
|
18
|
+
*/
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import { t } from '../i18n';
|
|
21
|
+
import { InspectorShell, InspectorReorderButtons, InspectorTextField, InspectorSelectField, InspectorRemoveButton, InspectorEmptyState, spliceArray, moveArray, } from './_shared';
|
|
22
|
+
import { SchemaForm } from '../SchemaForm';
|
|
23
|
+
import { getListColumnSchema } from '../view-schema';
|
|
24
|
+
import { useObjectFields } from '../previews/useObjectFields';
|
|
25
|
+
import { FieldsListEditor } from '../previews/FieldsListEditor';
|
|
26
|
+
/** Identity keys owned by the curated layer — hidden from the spec form. */
|
|
27
|
+
const IDENTITY_KEYS = ['field', 'label', 'accessorKey', 'header'];
|
|
28
|
+
function parseId(id) {
|
|
29
|
+
const m = /^([a-zA-Z_][\w]*)\.columns\[(\d+)\]$/.exec(id);
|
|
30
|
+
if (!m)
|
|
31
|
+
return null;
|
|
32
|
+
return { variant: m[1], index: Number(m[2]) };
|
|
33
|
+
}
|
|
34
|
+
/** Read a column entry — handles object shape AND raw string shape (kanban). */
|
|
35
|
+
function readColumn(raw) {
|
|
36
|
+
if (typeof raw === 'string')
|
|
37
|
+
return { field: raw };
|
|
38
|
+
if (raw && typeof raw === 'object')
|
|
39
|
+
return raw;
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
function colFieldKey(c) {
|
|
43
|
+
return c.field ?? c.accessorKey ?? '';
|
|
44
|
+
}
|
|
45
|
+
function colDisplayLabel(c) {
|
|
46
|
+
return c.label ?? c.header ?? colFieldKey(c);
|
|
47
|
+
}
|
|
48
|
+
/** Does the object carry any detail prop beyond its identity keys? */
|
|
49
|
+
function hasDetailProps(c) {
|
|
50
|
+
return Object.keys(c).some((k) => !IDENTITY_KEYS.includes(k));
|
|
51
|
+
}
|
|
52
|
+
/** Resolve the object a variant is bound to (drives field loading). */
|
|
53
|
+
function readVariantObject(v) {
|
|
54
|
+
if (!v)
|
|
55
|
+
return '';
|
|
56
|
+
const data = v.data;
|
|
57
|
+
if (data && typeof data.object === 'string')
|
|
58
|
+
return data.object;
|
|
59
|
+
if (typeof v.object === 'string')
|
|
60
|
+
return v.object;
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
export function ViewColumnInspector({ selection, draft, onPatch, onClearSelection, onSelectionChange, locale, readOnly, }) {
|
|
64
|
+
const parsed = parseId(selection.id);
|
|
65
|
+
const variantSchema = parsed
|
|
66
|
+
? draft[parsed.variant]
|
|
67
|
+
: undefined;
|
|
68
|
+
const rawColumns = parsed && Array.isArray(variantSchema?.columns)
|
|
69
|
+
? variantSchema.columns
|
|
70
|
+
: [];
|
|
71
|
+
const columns = rawColumns.map(readColumn);
|
|
72
|
+
const col = parsed ? columns[parsed.index] ?? null : null;
|
|
73
|
+
const isStringColumn = parsed
|
|
74
|
+
? typeof rawColumns[parsed.index] === 'string'
|
|
75
|
+
: false;
|
|
76
|
+
const columnSchema = React.useMemo(() => getListColumnSchema(), []);
|
|
77
|
+
// Load the bound object's field catalog so the column's field key is a
|
|
78
|
+
// proper picker (dropdown of real fields) instead of a free-text box.
|
|
79
|
+
const objectName = readVariantObject(variantSchema);
|
|
80
|
+
const { fields: objectFields } = useObjectFields(objectName || undefined);
|
|
81
|
+
const currentFieldKey = col ? colFieldKey(col) : '';
|
|
82
|
+
const fieldOptions = React.useMemo(() => {
|
|
83
|
+
const opts = objectFields.map((f) => ({
|
|
84
|
+
value: f.name,
|
|
85
|
+
label: f.label && f.label !== f.name ? `${f.label} · ${f.name}` : f.name,
|
|
86
|
+
}));
|
|
87
|
+
// Keep the current value visible even if it isn't a known object field
|
|
88
|
+
// (computed / virtual / stale columns).
|
|
89
|
+
if (currentFieldKey && !opts.some((o) => o.value === currentFieldKey)) {
|
|
90
|
+
opts.unshift({ value: currentFieldKey, label: `${currentFieldKey} (not in object)` });
|
|
91
|
+
}
|
|
92
|
+
return opts;
|
|
93
|
+
}, [objectFields, currentFieldKey]);
|
|
94
|
+
if (!parsed || !col) {
|
|
95
|
+
return (_jsx(InspectorShell, { kindLabel: t('engine.inspector.viewColumn.kind', locale), title: selection.label ?? selection.id, onClose: onClearSelection, closeLabel: t('engine.inspector.viewColumn.close', locale), children: _jsx(InspectorEmptyState, { message: selection.id }) }));
|
|
96
|
+
}
|
|
97
|
+
/** Write the column array back, preserving string shape when lossless. */
|
|
98
|
+
const writeColumns = (next) => {
|
|
99
|
+
const serialized = next.map((c, i) => {
|
|
100
|
+
const wasString = typeof rawColumns[i] === 'string';
|
|
101
|
+
const fieldKey = colFieldKey(c);
|
|
102
|
+
if (wasString && !hasDetailProps(c) && !c.label && !c.header && fieldKey) {
|
|
103
|
+
return fieldKey;
|
|
104
|
+
}
|
|
105
|
+
return c;
|
|
106
|
+
});
|
|
107
|
+
onPatch({ [parsed.variant]: { ...variantSchema, columns: serialized } });
|
|
108
|
+
};
|
|
109
|
+
/** Patch identity (field/label) honouring whichever shape is in use. */
|
|
110
|
+
const patchIdentity = (updates) => {
|
|
111
|
+
const targetField = 'field' in col || !('accessorKey' in col) ? 'field' : 'accessorKey';
|
|
112
|
+
const targetLabel = 'label' in col || !('header' in col) ? 'label' : 'header';
|
|
113
|
+
const remapped = { ...updates };
|
|
114
|
+
if ('field' in updates) {
|
|
115
|
+
remapped[targetField] = updates.field;
|
|
116
|
+
if (targetField !== 'field')
|
|
117
|
+
delete remapped.field;
|
|
118
|
+
}
|
|
119
|
+
if ('label' in updates) {
|
|
120
|
+
remapped[targetLabel] = updates.label;
|
|
121
|
+
if (targetLabel !== 'label')
|
|
122
|
+
delete remapped.label;
|
|
123
|
+
}
|
|
124
|
+
writeColumns(spliceArray(columns, parsed.index, { ...col, ...remapped }));
|
|
125
|
+
};
|
|
126
|
+
/** Whole-column write from the spec detail form. */
|
|
127
|
+
const writeDetail = (next) => {
|
|
128
|
+
writeColumns(spliceArray(columns, parsed.index, next));
|
|
129
|
+
};
|
|
130
|
+
const remove = () => {
|
|
131
|
+
writeColumns(spliceArray(columns, parsed.index, null));
|
|
132
|
+
onClearSelection();
|
|
133
|
+
};
|
|
134
|
+
const move = (to) => {
|
|
135
|
+
writeColumns(moveArray(columns, parsed.index, to));
|
|
136
|
+
onSelectionChange?.({
|
|
137
|
+
kind: 'column',
|
|
138
|
+
id: `${parsed.variant}.columns[${to}]`,
|
|
139
|
+
label: colDisplayLabel(col) || `columns[${to}]`,
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
return (_jsxs(InspectorShell, { kindLabel: t('engine.inspector.viewColumn.kind', locale), title: colDisplayLabel(col) || selection.id, onClose: onClearSelection, closeLabel: t('engine.inspector.viewColumn.close', locale), headerActions: _jsx(InspectorReorderButtons, { index: parsed.index, total: columns.length, onMove: move, upLabel: t('engine.inspector.reorder.up', locale), downLabel: t('engine.inspector.reorder.down', locale), disabled: readOnly }), footer: _jsx(InspectorRemoveButton, { label: t('engine.inspector.viewColumn.remove', locale), onClick: remove, disabled: readOnly }), children: [variantSchema && (_jsx("div", { className: "pb-1", children: _jsx(FieldsListEditor, { variantKey: parsed.variant, schema: variantSchema, columns: rawColumns, allStrings: rawColumns.length > 0 &&
|
|
143
|
+
rawColumns.every((c) => typeof c === 'string'), objectName: objectName || undefined, selectedIndex: parsed.index, readOnly: readOnly, onPatch: onPatch, onSelectionChange: onSelectionChange }) })), _jsxs("div", { className: "border-t pt-3 space-y-3", children: [fieldOptions.length > 0 ? (_jsx(InspectorSelectField, { label: t('engine.inspector.viewColumn.accessorKey', locale), value: colFieldKey(col), options: fieldOptions, onCommit: (v) => patchIdentity({ field: v }), disabled: readOnly })) : (_jsx(InspectorTextField, { label: t('engine.inspector.viewColumn.accessorKey', locale), value: colFieldKey(col), onCommit: (v) => patchIdentity({ field: v }), disabled: readOnly, mono: true })), _jsx(InspectorTextField, { label: t('engine.inspector.viewColumn.header', locale), value: colDisplayLabel(col) === colFieldKey(col) ? '' : colDisplayLabel(col), onCommit: (v) => patchIdentity({ label: v }), disabled: readOnly }), !isStringColumn && columnSchema ? (_jsx("div", { className: "border-t pt-3", children: _jsx(SchemaForm, { schema: columnSchema, value: col, hiddenFields: IDENTITY_KEYS, readOnly: readOnly, onChange: writeDetail }) })) : null] })] }));
|
|
144
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewInspector — routes the View right-panel to the right sub-inspector.
|
|
3
|
+
*
|
|
4
|
+
* • Scoped (a selection exists):
|
|
5
|
+
* - `{ kind:'column', id:'<variant>.columns[<i>]' }` → ViewColumnInspector
|
|
6
|
+
* - `{ kind:'view', id:'<variant>' }` → ViewVariantInspector
|
|
7
|
+
* • Default (no selection) → ViewVariantInspector for the primary variant
|
|
8
|
+
* ("home" panel: pick view type + manage fields, Airtable-style).
|
|
9
|
+
*
|
|
10
|
+
* Routing is by `selection.kind` FIRST — the column inspector's id regex
|
|
11
|
+
* would not match a bare variant id, so we must dispatch before it runs.
|
|
12
|
+
*/
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import type { MetadataInspectorProps } from '../inspector-registry';
|
|
15
|
+
import type { MetadataDefaultInspectorProps } from '../default-inspector-registry';
|
|
16
|
+
/** Scoped inspector: a selection is always present here. */
|
|
17
|
+
export declare function ViewInspector(props: MetadataInspectorProps): React.JSX.Element;
|
|
18
|
+
/** Default inspector: no selection — the View's "home" panel. */
|
|
19
|
+
export declare function ViewDefaultInspector(props: MetadataDefaultInspectorProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ViewColumnInspector } from './ViewColumnInspector';
|
|
3
|
+
import { ViewVariantInspector } from './ViewVariantInspector';
|
|
4
|
+
import { bindingForStoreKey, primaryVariantBinding } from '../view-variant-model';
|
|
5
|
+
/** Scoped inspector: a selection is always present here. */
|
|
6
|
+
export function ViewInspector(props) {
|
|
7
|
+
const { selection } = props;
|
|
8
|
+
if (selection.kind === 'column') {
|
|
9
|
+
return _jsx(ViewColumnInspector, { ...props });
|
|
10
|
+
}
|
|
11
|
+
// kind === 'view' (or any non-column kind) → variant home, scoped.
|
|
12
|
+
// `selection.id` carries the variant's STORE key (the tab strip emits it).
|
|
13
|
+
const binding = bindingForStoreKey(props.draft, selection.id || undefined) ??
|
|
14
|
+
primaryVariantBinding(props.draft);
|
|
15
|
+
return (_jsx(ViewVariantInspector, { type: props.type, name: props.name, draft: props.draft, onPatch: props.onPatch, onSelectionChange: props.onSelectionChange, onClearSelection: props.onClearSelection, readOnly: props.readOnly, locale: props.locale, variantKey: binding?.storeKey ?? 'list', familyKey: binding?.familyKey ?? binding?.storeKey ?? 'list', isHome: false }));
|
|
16
|
+
}
|
|
17
|
+
/** Default inspector: no selection — the View's "home" panel. */
|
|
18
|
+
export function ViewDefaultInspector(props) {
|
|
19
|
+
const binding = primaryVariantBinding(props.draft);
|
|
20
|
+
return (_jsx(ViewVariantInspector, { ...props, variantKey: binding?.storeKey ?? 'list', familyKey: binding?.familyKey ?? binding?.storeKey ?? 'list', isHome: true }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewVariantInspector — the curated "home" panel for a View variant.
|
|
3
|
+
*
|
|
4
|
+
* Shown:
|
|
5
|
+
* • as the DEFAULT right panel (no selection) for the primary variant, and
|
|
6
|
+
* • as the scoped inspector when a variant tab is selected
|
|
7
|
+
* (`{ kind:'view', id:'<variant>' }`).
|
|
8
|
+
*
|
|
9
|
+
* SPEC-DRIVEN: the per-view-type config fields are NOT hardcoded. They are
|
|
10
|
+
* rendered by feeding the spec's canonical authoring form (`viewForm`) and
|
|
11
|
+
* the spec-derived View JSONSchema into the generic {@link SchemaForm}. The
|
|
12
|
+
* form's type-conditional `visibleOn` sections automatically surface the
|
|
13
|
+
* right fields for grid / kanban / calendar / gallery / gantt / timeline /
|
|
14
|
+
* chart — adding a new view type or prop to `@objectstack/spec` flows
|
|
15
|
+
* through with zero code changes here.
|
|
16
|
+
*
|
|
17
|
+
* The inspector keeps a thin curated layer for two cross-cutting concerns
|
|
18
|
+
* the spec form can't express well on its own:
|
|
19
|
+
* 1. the VIEW TYPE picker (options sourced from the spec `type` enum), and
|
|
20
|
+
* 2. the bound OBJECT (stored at `data.object`, drives field loading).
|
|
21
|
+
*
|
|
22
|
+
* Column add / reorder / select lives in the live column canvas above the
|
|
23
|
+
* grid; per-column properties live in {@link ViewColumnInspector}. Those
|
|
24
|
+
* fields are therefore pruned from the spec form to avoid double-editing.
|
|
25
|
+
*/
|
|
26
|
+
import * as React from 'react';
|
|
27
|
+
import type { MetadataDefaultInspectorProps } from '../default-inspector-registry';
|
|
28
|
+
import { type ObjectFieldInfo } from '../previews/useObjectFields';
|
|
29
|
+
export interface ViewVariantInspectorProps extends MetadataDefaultInspectorProps {
|
|
30
|
+
/**
|
|
31
|
+
* Draft key the variant BODY is stored under — drives reads/writes and
|
|
32
|
+
* column selection ids. 'list' | … for the spec shape, 'config' for the
|
|
33
|
+
* effective ({viewKind,config}) shape.
|
|
34
|
+
*/
|
|
35
|
+
variantKey: string;
|
|
36
|
+
/**
|
|
37
|
+
* Logical family ('list' | 'form' | …). Drives form-vs-list rendering.
|
|
38
|
+
* Defaults to `variantKey` when the two coincide (spec shape).
|
|
39
|
+
*/
|
|
40
|
+
familyKey?: string;
|
|
41
|
+
/** When true, the close (×) button is hidden (home mode). */
|
|
42
|
+
isHome: boolean;
|
|
43
|
+
/** Clear the current selection (scoped mode only). */
|
|
44
|
+
onClearSelection?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Pre-resolved field catalog for the bound object. When supplied, both
|
|
47
|
+
* this inspector and its {@link FieldsListEditor} skip the network fetch
|
|
48
|
+
* (`useObjectFields`) and use this list instead. Hosts that already hold
|
|
49
|
+
* the object definition (e.g. the runtime ViewConfigPanel) pass it to keep
|
|
50
|
+
* the inspector free of any network dependency.
|
|
51
|
+
*/
|
|
52
|
+
objectFieldsOverride?: ObjectFieldInfo[];
|
|
53
|
+
}
|
|
54
|
+
export declare function ViewVariantInspector({ draft, variantKey, familyKey, isHome, onPatch, readOnly, onClearSelection, onSelectionChange, objectFieldsOverride, locale, serverSchema, }: ViewVariantInspectorProps): React.JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
3
|
+
/**
|
|
4
|
+
* ViewVariantInspector — the curated "home" panel for a View variant.
|
|
5
|
+
*
|
|
6
|
+
* Shown:
|
|
7
|
+
* • as the DEFAULT right panel (no selection) for the primary variant, and
|
|
8
|
+
* • as the scoped inspector when a variant tab is selected
|
|
9
|
+
* (`{ kind:'view', id:'<variant>' }`).
|
|
10
|
+
*
|
|
11
|
+
* SPEC-DRIVEN: the per-view-type config fields are NOT hardcoded. They are
|
|
12
|
+
* rendered by feeding the spec's canonical authoring form (`viewForm`) and
|
|
13
|
+
* the spec-derived View JSONSchema into the generic {@link SchemaForm}. The
|
|
14
|
+
* form's type-conditional `visibleOn` sections automatically surface the
|
|
15
|
+
* right fields for grid / kanban / calendar / gallery / gantt / timeline /
|
|
16
|
+
* chart — adding a new view type or prop to `@objectstack/spec` flows
|
|
17
|
+
* through with zero code changes here.
|
|
18
|
+
*
|
|
19
|
+
* The inspector keeps a thin curated layer for two cross-cutting concerns
|
|
20
|
+
* the spec form can't express well on its own:
|
|
21
|
+
* 1. the VIEW TYPE picker (options sourced from the spec `type` enum), and
|
|
22
|
+
* 2. the bound OBJECT (stored at `data.object`, drives field loading).
|
|
23
|
+
*
|
|
24
|
+
* Column add / reorder / select lives in the live column canvas above the
|
|
25
|
+
* grid; per-column properties live in {@link ViewColumnInspector}. Those
|
|
26
|
+
* fields are therefore pruned from the spec form to avoid double-editing.
|
|
27
|
+
*/
|
|
28
|
+
import * as React from 'react';
|
|
29
|
+
import { InspectorShell, InspectorTextField, InspectorSelectField, } from './_shared';
|
|
30
|
+
import { InspectorComboField } from './InspectorComboField';
|
|
31
|
+
import { useObjectOptions } from './useDatasetFields';
|
|
32
|
+
import { SchemaForm } from '../SchemaForm';
|
|
33
|
+
import { useObjectFields } from '../previews/useObjectFields';
|
|
34
|
+
/**
|
|
35
|
+
* Object picker for the view's binding — a searchable dropdown over the live
|
|
36
|
+
* object catalog (custom value still allowed) instead of recalling the API
|
|
37
|
+
* name. The catalog hook lives in a child component so the parent inspector's
|
|
38
|
+
* hook order is unaffected.
|
|
39
|
+
*/
|
|
40
|
+
function ViewObjectPicker({ label, value, onCommit, placeholder, disabled, }) {
|
|
41
|
+
const { options, loading } = useObjectOptions();
|
|
42
|
+
return (_jsx(InspectorComboField, { label: label, value: value, onCommit: onCommit, options: options.map((o) => ({ value: o.name, label: o.label })), loading: loading, placeholder: placeholder, searchPlaceholder: "Search objects\u2026", disabled: disabled, mono: true }));
|
|
43
|
+
}
|
|
44
|
+
import { FieldsListEditor } from '../previews/FieldsListEditor';
|
|
45
|
+
import { getViewForm, getListVariantSchema, getFormVariantSchema, } from '../view-schema';
|
|
46
|
+
import { isFormFamilyKey } from '../view-variant-model';
|
|
47
|
+
import { mergeServerFields } from '../mergeServerFields';
|
|
48
|
+
import { t } from '../i18n';
|
|
49
|
+
/**
|
|
50
|
+
* Variant-body fields this inspector renders with its own controls, pruned
|
|
51
|
+
* from the spec-form graft so they are not double-rendered. Mirrors the
|
|
52
|
+
* `hiddenFields` passed to SchemaForm (`type`/`object`/`label`) plus the
|
|
53
|
+
* canvas-owned `columns`.
|
|
54
|
+
*/
|
|
55
|
+
const VIEW_CURATED_FIELDS = new Set(['type', 'object', 'label', 'columns']);
|
|
56
|
+
/** English fallback labels for the spec `type` enum (used when the i18n
|
|
57
|
+
* catalog has no entry for a view type the spec introduces later). */
|
|
58
|
+
const TYPE_LABELS = {
|
|
59
|
+
grid: 'Table / List',
|
|
60
|
+
kanban: 'Kanban',
|
|
61
|
+
calendar: 'Calendar',
|
|
62
|
+
gallery: 'Gallery',
|
|
63
|
+
gantt: 'Gantt',
|
|
64
|
+
timeline: 'Timeline',
|
|
65
|
+
map: 'Map',
|
|
66
|
+
chart: 'Chart',
|
|
67
|
+
};
|
|
68
|
+
/** Localized label for a view `type`, falling back to the English map (and
|
|
69
|
+
* then the raw value) when the i18n catalog has no entry. */
|
|
70
|
+
function typeLabel(value, locale) {
|
|
71
|
+
const key = `engine.inspector.view.type.${value}`;
|
|
72
|
+
const translated = t(key, locale);
|
|
73
|
+
return translated === key ? (TYPE_LABELS[value] ?? value) : translated;
|
|
74
|
+
}
|
|
75
|
+
/** Keys re-pinned from the live draft after every spec-form edit. */
|
|
76
|
+
const PRESERVED_KEYS = ['columns', 'data', 'name'];
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the object a view is bound to. The canonical ViewItem carries the
|
|
79
|
+
* binding at the TOP LEVEL (`draft.object`) — authoritative for every view
|
|
80
|
+
* kind. A list `config` body additionally denormalizes it into its render
|
|
81
|
+
* data source (`config.data.object`); a form `config` has no such block. We
|
|
82
|
+
* therefore prefer the body's render binding (so the preview stays accurate)
|
|
83
|
+
* but always fall back to the top-level FK, which is the one field guaranteed
|
|
84
|
+
* present across list AND form views.
|
|
85
|
+
*/
|
|
86
|
+
function readObjectBinding(variant, draft) {
|
|
87
|
+
const data = variant.data;
|
|
88
|
+
if (data && typeof data === 'object' && typeof data.object === 'string' && data.object) {
|
|
89
|
+
return { value: data.object, path: 'data.object' };
|
|
90
|
+
}
|
|
91
|
+
if (typeof variant.object === 'string' && variant.object) {
|
|
92
|
+
return { value: variant.object, path: 'object' };
|
|
93
|
+
}
|
|
94
|
+
if (typeof draft.object === 'string' && draft.object) {
|
|
95
|
+
return { value: draft.object, path: 'top' };
|
|
96
|
+
}
|
|
97
|
+
return { value: '', path: 'top' };
|
|
98
|
+
}
|
|
99
|
+
/** Build the View-type <select> options from the spec `type` enum. */
|
|
100
|
+
function useTypeOptions(currentType, locale) {
|
|
101
|
+
return React.useMemo(() => {
|
|
102
|
+
const schema = getListVariantSchema();
|
|
103
|
+
const rawEnum = schema?.properties?.type?.enum;
|
|
104
|
+
const values = Array.isArray(rawEnum) && rawEnum.length
|
|
105
|
+
? rawEnum.filter((v) => typeof v === 'string')
|
|
106
|
+
: ['grid', 'kanban', 'calendar', 'gallery', 'gantt', 'timeline'];
|
|
107
|
+
const opts = values.map((v) => ({ value: v, label: typeLabel(v, locale) }));
|
|
108
|
+
if (!opts.some((o) => o.value === currentType) && currentType) {
|
|
109
|
+
opts.push({ value: currentType, label: typeLabel(currentType, locale) });
|
|
110
|
+
}
|
|
111
|
+
return opts;
|
|
112
|
+
}, [currentType, locale]);
|
|
113
|
+
}
|
|
114
|
+
export function ViewVariantInspector({ draft, variantKey, familyKey, isHome, onPatch, readOnly, onClearSelection, onSelectionChange, objectFieldsOverride, locale, serverSchema, }) {
|
|
115
|
+
const variant = draft[variantKey] ?? {};
|
|
116
|
+
const isFormFamily = isFormFamilyKey(familyKey ?? variantKey);
|
|
117
|
+
const viewType = typeof variant.type === 'string' ? variant.type : 'grid';
|
|
118
|
+
const typeOptions = useTypeOptions(viewType, locale);
|
|
119
|
+
const binding = readObjectBinding(variant, draft);
|
|
120
|
+
// Canonical label lives at the top level (`draft.label`); a list `config`
|
|
121
|
+
// mirrors it, a form `config` does not. Prefer the top-level value.
|
|
122
|
+
const labelValue = (typeof draft.label === 'string' && draft.label) ||
|
|
123
|
+
(typeof variant.label === 'string' ? variant.label : '') ||
|
|
124
|
+
'';
|
|
125
|
+
const rawColumns = Array.isArray(variant.columns)
|
|
126
|
+
? variant.columns
|
|
127
|
+
: [];
|
|
128
|
+
const allStrings = rawColumns.length > 0 && rawColumns.every((c) => typeof c === 'string');
|
|
129
|
+
// Load the bound object's field catalog so field-reference config props
|
|
130
|
+
// (groupByField, startDateField, xAxisField, visibleFields, …) render as
|
|
131
|
+
// object-field pickers rather than free-text inputs.
|
|
132
|
+
const { fields: objectFields } = useObjectFields(binding.value || undefined, objectFieldsOverride);
|
|
133
|
+
const widgetContext = React.useMemo(() => ({
|
|
134
|
+
objectFields: objectFields.map((f) => ({
|
|
135
|
+
name: f.name,
|
|
136
|
+
label: f.label,
|
|
137
|
+
type: f.type,
|
|
138
|
+
})),
|
|
139
|
+
}), [objectFields]);
|
|
140
|
+
// Graft server-only fields onto the bundled variant form so new server
|
|
141
|
+
// fields are editable even when the bundled spec lags (skew root-cure). A
|
|
142
|
+
// View is a nested document: the variant body lives under
|
|
143
|
+
// `serverSchema.properties.{list|form}`, so we pass that sub-schema.
|
|
144
|
+
const serverVariantSchema = (() => {
|
|
145
|
+
const props = serverSchema?.properties;
|
|
146
|
+
return (isFormFamily ? props?.form : props?.list);
|
|
147
|
+
})();
|
|
148
|
+
const { schema, form } = React.useMemo(() => mergeServerFields({
|
|
149
|
+
bundledSchema: isFormFamily ? getFormVariantSchema() : getListVariantSchema(),
|
|
150
|
+
bundledForm: isFormFamily ? undefined : getViewForm(),
|
|
151
|
+
serverSchema: serverVariantSchema,
|
|
152
|
+
excludeFields: VIEW_CURATED_FIELDS,
|
|
153
|
+
sectionTitle: t('engine.inspector.moreFields', locale),
|
|
154
|
+
}), [isFormFamily, serverVariantSchema, locale]);
|
|
155
|
+
/** Shallow-write a curated patch onto the variant. */
|
|
156
|
+
const writeVariant = (patch) => {
|
|
157
|
+
onPatch({ [variantKey]: { ...variant, ...patch } });
|
|
158
|
+
};
|
|
159
|
+
/** Whole-variant write from the spec form; re-pin canvas-owned keys. */
|
|
160
|
+
const writeForm = (next) => {
|
|
161
|
+
const merged = { ...next };
|
|
162
|
+
for (const k of PRESERVED_KEYS) {
|
|
163
|
+
if (k in variant)
|
|
164
|
+
merged[k] = variant[k];
|
|
165
|
+
else
|
|
166
|
+
delete merged[k];
|
|
167
|
+
}
|
|
168
|
+
onPatch({ [variantKey]: merged });
|
|
169
|
+
};
|
|
170
|
+
/** Write the bound object: top-level FK is canonical; mirror the list
|
|
171
|
+
* body's render binding so the preview keeps resolving live data. */
|
|
172
|
+
const setObject = (v) => {
|
|
173
|
+
const patch = { object: v };
|
|
174
|
+
if (variant.data && typeof variant.data === 'object') {
|
|
175
|
+
patch[variantKey] = {
|
|
176
|
+
...variant,
|
|
177
|
+
data: { ...variant.data, object: v },
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
else if (binding.path === 'object') {
|
|
181
|
+
patch[variantKey] = { ...variant, object: v };
|
|
182
|
+
}
|
|
183
|
+
onPatch(patch);
|
|
184
|
+
};
|
|
185
|
+
/** Write the display label: top-level is canonical; mirror it onto the
|
|
186
|
+
* body so the preview / runtime view switcher show the same text. */
|
|
187
|
+
const setLabel = (v) => {
|
|
188
|
+
onPatch({ label: v, [variantKey]: { ...variant, label: v } });
|
|
189
|
+
};
|
|
190
|
+
return (_jsxs(InspectorShell, { kindLabel: t('engine.inspector.view.kind', locale), title: String(labelValue || draft.name || variantKey), onClose: () => onClearSelection?.(), closeLabel: t('engine.inspector.view.close', locale), hideClose: isHome, children: [_jsx(InspectorTextField, { label: t('engine.inspector.view.label', locale), value: labelValue, onCommit: setLabel, placeholder: t('engine.inspector.view.labelPlaceholder', locale), disabled: readOnly }), _jsx(InspectorSelectField, { label: t('engine.inspector.view.type', locale), value: viewType, options: typeOptions, onCommit: (v) => writeVariant({ type: v }), disabled: readOnly }), _jsx(ViewObjectPicker, { label: t('engine.inspector.view.object', locale), value: binding.value, onCommit: setObject, placeholder: t('engine.inspector.view.objectPlaceholder', locale), disabled: readOnly }), !isFormFamily && (_jsx("div", { className: "border-t pt-3", children: _jsx(FieldsListEditor, { variantKey: variantKey, schema: variant, columns: rawColumns, allStrings: allStrings, objectName: binding.value || undefined, objectFieldsOverride: objectFieldsOverride, selectedIndex: null, readOnly: readOnly, onPatch: onPatch, onSelectionChange: onSelectionChange }) })), _jsx("div", { className: "border-t pt-3", children: schema ? (_jsx(SchemaForm, { schema: schema, form: form, value: variant, hiddenFields: ['type', 'object', 'label'], readOnly: readOnly, widgetContext: widgetContext, onChange: writeForm })) : (_jsx("p", { className: "text-[11px] text-muted-foreground", children: t('engine.inspector.view.noSchema', locale) })) })] }));
|
|
191
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared building blocks for scoped metadata inspectors.
|
|
3
|
+
*
|
|
4
|
+
* Every inspector renders the same three regions:
|
|
5
|
+
* • Header strip — kind chip + element label + close button
|
|
6
|
+
* • Scrollable form area — labelled inputs in a single column
|
|
7
|
+
* • Footer — destructive "remove this element" button
|
|
8
|
+
*
|
|
9
|
+
* The widgets below factor those regions out so each per-type
|
|
10
|
+
* inspector can stay focused on field definitions and update logic.
|
|
11
|
+
*
|
|
12
|
+
* All inputs are uncontrolled-from-outside: parent owns the draft
|
|
13
|
+
* record, inspectors call `onCommit(value)` which trips an immutable
|
|
14
|
+
* splice + `onPatch({...})`. Locale-aware via the `useT` hook the
|
|
15
|
+
* caller already has in scope — the shared shell takes raw strings.
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
export interface InspectorShellProps {
|
|
19
|
+
kindLabel: string;
|
|
20
|
+
title: string;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
closeLabel?: string;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
footer?: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Optional reorder controls rendered to the left of the close button.
|
|
27
|
+
* Use {@link InspectorReorderButtons} for the standard ↑/↓ pair.
|
|
28
|
+
*/
|
|
29
|
+
headerActions?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Hide the close (×) button. Used by "home" inspectors that have no
|
|
32
|
+
* better state to fall back to (e.g. the View inspector is the default
|
|
33
|
+
* right-panel for a view, so closing it would just re-open it).
|
|
34
|
+
*/
|
|
35
|
+
hideClose?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function InspectorShell({ kindLabel, title, onClose, closeLabel, children, footer, headerActions, hideClose }: InspectorShellProps): React.JSX.Element;
|
|
38
|
+
export interface InspectorReorderButtonsProps {
|
|
39
|
+
/** Current 0-based index of the selected item. */
|
|
40
|
+
index: number;
|
|
41
|
+
/** Total number of siblings. */
|
|
42
|
+
total: number;
|
|
43
|
+
/** Called with the new index when the user clicks ↑ or ↓. */
|
|
44
|
+
onMove: (toIndex: number) => void;
|
|
45
|
+
/** Localized aria-labels (e.g. tr('engine.inspector.reorder.up', locale)). */
|
|
46
|
+
upLabel?: string;
|
|
47
|
+
downLabel?: string;
|
|
48
|
+
/** Disable both buttons (read-only inspectors). */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Compact ↑/↓ pair sized to fit alongside the close button in the
|
|
53
|
+
* inspector header. Auto-disables boundaries (↑ at index 0, ↓ at
|
|
54
|
+
* `total - 1`) and the whole pair when `total <= 1`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function InspectorReorderButtons({ index, total, onMove, upLabel, downLabel, disabled, }: InspectorReorderButtonsProps): React.JSX.Element | null;
|
|
57
|
+
export declare function InspectorTextField({ label, value, onCommit, placeholder, disabled, mono, }: {
|
|
58
|
+
label: string;
|
|
59
|
+
value: string;
|
|
60
|
+
onCommit: (v: string) => void;
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
mono?: boolean;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
export declare function InspectorNumberField({ label, value, onCommit, placeholder, disabled, }: {
|
|
66
|
+
label: string;
|
|
67
|
+
value: number | undefined;
|
|
68
|
+
onCommit: (v: number | undefined) => void;
|
|
69
|
+
placeholder?: string;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
}): React.JSX.Element;
|
|
72
|
+
export declare function InspectorSelectField({ label, value, options, onCommit, placeholder, disabled, }: {
|
|
73
|
+
label: string;
|
|
74
|
+
value: string | undefined;
|
|
75
|
+
options: Array<{
|
|
76
|
+
value: string;
|
|
77
|
+
label: string;
|
|
78
|
+
}>;
|
|
79
|
+
onCommit: (v: string) => void;
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
}): React.JSX.Element;
|
|
83
|
+
export declare function InspectorCheckboxField({ label, value, onCommit, disabled, }: {
|
|
84
|
+
label: string;
|
|
85
|
+
value: boolean;
|
|
86
|
+
onCommit: (v: boolean) => void;
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
}): React.JSX.Element;
|
|
89
|
+
export declare function InspectorRemoveButton({ label, onClick, disabled }: {
|
|
90
|
+
label: string;
|
|
91
|
+
onClick: () => void;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
}): React.JSX.Element;
|
|
94
|
+
export declare function InspectorEmptyState({ message }: {
|
|
95
|
+
message: string;
|
|
96
|
+
}): React.JSX.Element;
|
|
97
|
+
/**
|
|
98
|
+
* Helper to immutably splice an item in an array on a draft.
|
|
99
|
+
* Returns a new array; never mutates input.
|
|
100
|
+
*/
|
|
101
|
+
export declare function spliceArray<T>(arr: T[] | undefined, index: number, replacement: T | null): T[];
|
|
102
|
+
/**
|
|
103
|
+
* Insert `item` at `index` immutably. Index out of range clamps to
|
|
104
|
+
* [0, length]. Returns a new array; never mutates input.
|
|
105
|
+
*/
|
|
106
|
+
export declare function insertArray<T>(arr: T[] | undefined, index: number, item: T): T[];
|
|
107
|
+
/**
|
|
108
|
+
* Append `item` to the end immutably. Convenience wrapper over
|
|
109
|
+
* insertArray for the common "+ Add at end" case.
|
|
110
|
+
*/
|
|
111
|
+
export declare function appendArray<T>(arr: T[] | undefined, item: T): T[];
|
|
112
|
+
/**
|
|
113
|
+
* Move an item from `from` to `to` immutably. Out-of-range or no-op
|
|
114
|
+
* moves return a new copy unchanged. Useful for ↑/↓ reorder buttons.
|
|
115
|
+
*/
|
|
116
|
+
export declare function moveArray<T>(arr: T[] | undefined, from: number, to: number): T[];
|
|
117
|
+
/**
|
|
118
|
+
* Generate a snake_case id that doesn't collide with `existing`. Used
|
|
119
|
+
* by Add helpers that need a stable identifier (Flow nodes, App nav,
|
|
120
|
+
* Dashboard widgets) before the user fills in a meaningful name.
|
|
121
|
+
*
|
|
122
|
+
* uniqueId('node', ['node_1', 'node_3']) -> 'node_2'
|
|
123
|
+
*/
|
|
124
|
+
export declare function uniqueId(prefix: string, existing: ReadonlyArray<string | undefined | null>): string;
|