@oondemand/oon-core-front 0.3.48 → 0.3.49
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/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2098,6 +2098,14 @@ function fieldsForTab(fields, selected) {
|
|
|
2098
2098
|
function relationFrom(input, relations) {
|
|
2099
2099
|
return typeof input === "string" ? relations?.[input] : input;
|
|
2100
2100
|
}
|
|
2101
|
+
function resolveInitialDetailTab(config, recordId, initialTab) {
|
|
2102
|
+
if (initialTab) return initialTab;
|
|
2103
|
+
const configuredId = config.defaultTab ?? config.tabs[0]?.id ?? "dados";
|
|
2104
|
+
const configuredTab = config.tabs.find((tab) => tab.id === configuredId);
|
|
2105
|
+
if (recordId) return configuredTab?.id ?? config.tabs[0]?.id ?? "dados";
|
|
2106
|
+
if (configuredTab?.type === "form") return configuredTab.id;
|
|
2107
|
+
return config.tabs.find((tab) => tab.type === "form")?.id ?? configuredTab?.id ?? config.tabs[0]?.id ?? "dados";
|
|
2108
|
+
}
|
|
2101
2109
|
|
|
2102
2110
|
// src/components/internal/CoreSummaryCards.tsx
|
|
2103
2111
|
import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -3089,7 +3097,9 @@ function CoreDetailModal({
|
|
|
3089
3097
|
const resource = useOonResource(schema?.basePath ?? `/${model.toLowerCase()}s`);
|
|
3090
3098
|
const queryClient = useQueryClient2();
|
|
3091
3099
|
const [parent, setParent] = useState9(initialRecord);
|
|
3092
|
-
const [activeTab, setActiveTab] = useState9(
|
|
3100
|
+
const [activeTab, setActiveTab] = useState9(
|
|
3101
|
+
resolveInitialDetailTab(config, recordId, initialTab)
|
|
3102
|
+
);
|
|
3093
3103
|
const [refreshTokens, setRefreshTokens] = useState9({});
|
|
3094
3104
|
const parentQuery = useQuery6({
|
|
3095
3105
|
queryKey: ["oon", "detail", model, recordId],
|