Navigation Problem giderildii

This commit is contained in:
Sedat Öztürk 2025-08-13 23:29:27 +03:00
parent bac78eec46
commit e21c5979b0
4 changed files with 18 additions and 12 deletions

View file

@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812" "revision": "3ca0b8505b4bec776b69afdba2768812"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.u7hl29mc92g" "revision": "0.172lu27b4eg"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

View file

@ -41,6 +41,7 @@ import {
Tooltip, Tooltip,
Upload, Upload,
} from '../components/ui' } from '../components/ui'
import axios from 'axios'
interface ComponentProps { interface ComponentProps {
[key: string]: unknown [key: string]: unknown
@ -157,7 +158,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
// Create a function that returns an object with all components // Create a function that returns an object with all components
const bundledCode = ` const bundledCode = `
(function(React, Alert, Avatar, Badge, Button, Calendar, Card, Checkbox, ConfigProvider, DatePicker, Dialog, Drawer, Dropdown, FormItem, FormContainer, Input, InputGroup, Menu, MenuItem, Notification, Pagination, Progress, Radio, RangeCalendar, ScrollBar, Segment, Select, Skeleton, Spinner, Steps, Switcher, Table, Tabs, Tag, TimeInput, Timeline, toast, Tooltip, Upload) { (function(React, Alert, Avatar, Badge, Button, Calendar, Card, Checkbox, ConfigProvider, DatePicker, Dialog, Drawer, Dropdown, FormItem, FormContainer, Input, InputGroup, Menu, MenuItem, Notification, Pagination, Progress, Radio, RangeCalendar, ScrollBar, Segment, Select, Skeleton, Spinner, Steps, Switcher, Table, Tabs, Tag, TimeInput, Timeline, toast, Tooltip, Upload, axios) {
// Global components and hooks available to all custom components // Global components and hooks available to all custom components
const { useState, useEffect, useCallback, useMemo, useRef, createContext, useContext } = React; const { useState, useEffect, useCallback, useMemo, useRef, createContext, useContext } = React;
@ -202,7 +203,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
.join('\n')} .join('\n')}
return componentRegistry; return componentRegistry;
})(React, Alert, Avatar, Badge, Button, Calendar, Card, Checkbox, ConfigProvider, DatePicker, Dialog, Drawer, Dropdown, FormItem, FormContainer, Input, InputGroup, Menu, MenuItem, Notification, Pagination, Progress, Radio, RangeCalendar, ScrollBar, Segment, Select, Skeleton, Spinner, Steps, Switcher, Table, Tabs, Tag, TimeInput, Timeline, toast, Tooltip, Upload) })(React, Alert, Avatar, Badge, Button, Calendar, Card, Checkbox, ConfigProvider, DatePicker, Dialog, Drawer, Dropdown, FormItem, FormContainer, Input, InputGroup, Menu, MenuItem, Notification, Pagination, Progress, Radio, RangeCalendar, ScrollBar, Segment, Select, Skeleton, Spinner, Steps, Switcher, Table, Tabs, Tag, TimeInput, Timeline, toast, Tooltip, Upload, axios)
` `
// Compile the bundle // Compile the bundle
@ -256,6 +257,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
'toast', 'toast',
'Tooltip', 'Tooltip',
'Upload', 'Upload',
'axios',
`return ${compiledBundle}`, `return ${compiledBundle}`,
) )
const compiledComponentsRegistry = componentsFactory( const compiledComponentsRegistry = componentsFactory(
@ -298,6 +300,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
toast, toast,
Tooltip, Tooltip,
Upload, Upload,
axios,
) )
setCompiledComponents(compiledComponentsRegistry) setCompiledComponents(compiledComponentsRegistry)
@ -335,7 +338,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
// Transform code to a component factory that wraps the component to provide dynamic component access // Transform code to a component factory that wraps the component to provide dynamic component access
const transformedCode = ` const transformedCode = `
(function createComponent(React, componentsRegistry) { (function createComponent(React, componentsRegistry, axios) {
// Define a component wrapper function that will handle component references // Define a component wrapper function that will handle component references
function DynamicComponentRenderer(name, props) { function DynamicComponentRenderer(name, props) {
// Check if the name exists in the registry // Check if the name exists in the registry
@ -463,7 +466,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
React.createElement = originalCreateElement; React.createElement = originalCreateElement;
throw error; throw error;
} }
})(React, compiledComponentsObj) })(React, compiledComponentsObj, axios)
` `
// Compile the code // Compile the code
@ -480,6 +483,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
const ComponentFactory = new Function( const ComponentFactory = new Function(
'React', 'React',
'compiledComponentsObj', 'compiledComponentsObj',
'axios',
` `
try { try {
// Create a local variable to ensure it exists // Create a local variable to ensure it exists
@ -521,7 +525,7 @@ const ComponentRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ ch
) )
// Create the component with our registry of all other components // Create the component with our registry of all other components
const Component = ComponentFactory(React, compiledComponents) const Component = ComponentFactory(React, compiledComponents, axios)
if (!Component || typeof Component !== 'function') { if (!Component || typeof Component !== 'function') {
throw new Error('Invalid component definition') throw new Error('Invalid component definition')

View file

@ -4,13 +4,13 @@ import {
NAV_ITEM_TYPE_ITEM, NAV_ITEM_TYPE_ITEM,
NAV_ITEM_TYPE_TITLE, NAV_ITEM_TYPE_TITLE,
} from '@/constants/navigation.constant' } from '@/constants/navigation.constant'
import { MenuDto } from '@/proxy/menus' import { MenuDto } from '@/proxy/menus/models'
export default function getChildren(menu: MenuDto[], parentCode: string | null): NavigationTree[] { export default function getChildren(menu: MenuDto[], parentCode: string | null): NavigationTree[] {
const menus: NavigationTree[] = [] const menus: NavigationTree[] = []
for (const child of menu.filter((a) => a.parentCode === parentCode)) { for (const child of menu.filter((a) => a.parentCode === parentCode)) {
const item: NavigationTree = { const item: NavigationTree = {
key: child.url ?? child.code ?? '', key: child.url?.length ? child.url : child.code ?? '',
path: child.url ?? '', path: child.url ?? '',
title: child.displayName ?? '', title: child.displayName ?? '',
icon: child.icon ?? '', icon: child.icon ?? '',
@ -19,6 +19,7 @@ export default function getChildren(menu: MenuDto[], parentCode: string | null):
authority: [child.requiredPermissionName ?? ''], authority: [child.requiredPermissionName ?? ''],
subMenu: [], subMenu: [],
} }
if (child.code) { if (child.code) {
const subMenu = getChildren(menu, child.code) const subMenu = getChildren(menu, child.code)
if (subMenu.length) { if (subMenu.length) {

View file

@ -56,11 +56,12 @@ import { FaFolder, FaMinusCircle, FaPlusCircle, FaTrash } from 'react-icons/fa'
import { HiBadgeCheck, HiUser } from 'react-icons/hi' import { HiBadgeCheck, HiUser } from 'react-icons/hi'
import { import {
MdAccountTree, MdAccountTree,
MdAddModerator,
MdAdUnits,
MdDelete, MdDelete,
MdEdit, MdEdit,
MdGroup, MdGroup,
MdPersonAdd, MdPersonAdd,
MdRadioButtonUnchecked,
MdSupervisedUserCircle, MdSupervisedUserCircle,
} from 'react-icons/md' } from 'react-icons/md'
import { object, string } from 'yup' import { object, string } from 'yup'
@ -459,7 +460,7 @@ const OrganizationUnits = () => {
<Container> <Container>
<div className="flex flex-col lg:flex-row gap-4"> <div className="flex flex-col lg:flex-row gap-4">
<Card <Card
className="md:w-2/12 min-w-fit" className="md:w-3/12 min-w-fit"
header={translate('::Abp.Identity.OrganizationUnits')} header={translate('::Abp.Identity.OrganizationUnits')}
headerExtra={ headerExtra={
<div className="flex gap-1"> <div className="flex gap-1">
@ -475,7 +476,7 @@ const OrganizationUnits = () => {
}) })
}} }}
> >
{activeOu ? <MdAccountTree /> : <MdRadioButtonUnchecked />} {activeOu ? <MdAccountTree /> : <MdAdUnits />}
</Button> </Button>
<Button <Button
@ -524,7 +525,7 @@ const OrganizationUnits = () => {
{Node} {Node}
</Tree> </Tree>
</Card> </Card>
<Card className="md:w-10/12 w-full"> <Card className="md:w-9/12 w-full">
<Tabs defaultValue="users"> <Tabs defaultValue="users">
<TabList> <TabList>
<TabNav value="users" icon={<HiUser />}> <TabNav value="users" icon={<HiUser />}>