@orbe-agro/client-core 5.6.145 → 5.6.146

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.
Files changed (68) hide show
  1. package/dist/@ecme/components/layouts/PostLoginLayout/components/CollapsibleSide.stories.js +25 -0
  2. package/dist/@ecme/components/layouts/PostLoginLayout/components/CollapsibleSide.stories.js.map +1 -0
  3. package/dist/@ecme/components/layouts/PostLoginLayout/components/ContentOverlay.stories.js +22 -0
  4. package/dist/@ecme/components/layouts/PostLoginLayout/components/ContentOverlay.stories.js.map +1 -0
  5. package/dist/@ecme/components/layouts/PostLoginLayout/components/FrameLessSide.stories.js +22 -0
  6. package/dist/@ecme/components/layouts/PostLoginLayout/components/FrameLessSide.stories.js.map +1 -0
  7. package/dist/@ecme/components/layouts/PostLoginLayout/components/StackedSide.stories.js +25 -0
  8. package/dist/@ecme/components/layouts/PostLoginLayout/components/StackedSide.stories.js.map +1 -0
  9. package/dist/@ecme/components/layouts/PostLoginLayout/components/TopBarClassic.stories.js +25 -0
  10. package/dist/@ecme/components/layouts/PostLoginLayout/components/TopBarClassic.stories.js.map +1 -0
  11. package/dist/@ecme/components/template/Footer.js +1 -1
  12. package/dist/@ecme/components/template/Header.stories.js +42 -0
  13. package/dist/@ecme/components/template/Header.stories.js.map +1 -0
  14. package/dist/@ecme/components/template/Search.js +32 -2
  15. package/dist/@ecme/components/template/Search.js.map +1 -1
  16. package/dist/@ecme/components/template/Search.stories.js +61 -0
  17. package/dist/@ecme/components/template/Search.stories.js.map +1 -0
  18. package/dist/@ecme/index.js +3 -0
  19. package/dist/@ecme/index.js.map +1 -1
  20. package/dist/@ecme/locales/index.js +4 -1
  21. package/dist/@ecme/locales/index.js.map +1 -1
  22. package/dist/@ecme/locales/initAll.js +26 -0
  23. package/dist/@ecme/locales/initAll.js.map +1 -0
  24. package/dist/@ecme/locales/lang/en/common.js +43 -0
  25. package/dist/@ecme/locales/lang/en/common.js.map +1 -1
  26. package/dist/@ecme/locales/lang/en/index.js +3 -1
  27. package/dist/@ecme/locales/lang/en/index.js.map +1 -1
  28. package/dist/@ecme/locales/lang/ptBR/common.js +43 -0
  29. package/dist/@ecme/locales/lang/ptBR/common.js.map +1 -1
  30. package/dist/@ecme/locales/lang/ptBR/index.js +3 -1
  31. package/dist/@ecme/locales/lang/ptBR/index.js.map +1 -1
  32. package/dist/@ecme/locales/lang/ptBR/nav.js +307 -4
  33. package/dist/@ecme/locales/lang/ptBR/nav.js.map +1 -1
  34. package/dist/@ecme/views/auth/lang/index.js +2 -2
  35. package/dist/@ecme/views/auth/lang/index.js.map +1 -1
  36. package/dist/@types/@ecme/components/template/Search.d.ts.map +1 -1
  37. package/dist/@types/@ecme/locales/index.d.ts +1 -0
  38. package/dist/@types/@ecme/locales/index.d.ts.map +1 -1
  39. package/dist/@types/@ecme/locales/initAll.d.ts +3 -0
  40. package/dist/@types/@ecme/locales/initAll.d.ts.map +1 -0
  41. package/dist/@types/@ecme/locales/lang/en/common.d.ts +43 -0
  42. package/dist/@types/@ecme/locales/lang/en/common.d.ts.map +1 -1
  43. package/dist/@types/@ecme/locales/lang/en/index.d.ts +98 -0
  44. package/dist/@types/@ecme/locales/lang/en/index.d.ts.map +1 -1
  45. package/dist/@types/@ecme/locales/lang/ptBR/common.d.ts.map +1 -1
  46. package/dist/@types/@ecme/locales/lang/ptBR/index.d.ts +98 -0
  47. package/dist/@types/@ecme/locales/lang/ptBR/index.d.ts.map +1 -1
  48. package/dist/@types/@ecme/locales/lang/ptBR/nav.d.ts.map +1 -1
  49. package/dist/base/locales/index.js +2 -2
  50. package/dist/base/locales/index.js.map +1 -1
  51. package/lib/@ecme/components/layouts/PostLoginLayout/components/CollapsibleSide.stories.tsx +38 -0
  52. package/lib/@ecme/components/layouts/PostLoginLayout/components/ContentOverlay.stories.tsx +35 -0
  53. package/lib/@ecme/components/layouts/PostLoginLayout/components/FrameLessSide.stories.tsx +35 -0
  54. package/lib/@ecme/components/layouts/PostLoginLayout/components/StackedSide.stories.tsx +38 -0
  55. package/lib/@ecme/components/layouts/PostLoginLayout/components/TopBarClassic.stories.tsx +38 -0
  56. package/lib/@ecme/components/template/Header.stories.tsx +46 -0
  57. package/lib/@ecme/components/template/Search.stories.tsx +79 -0
  58. package/lib/@ecme/components/template/Search.tsx +41 -14
  59. package/lib/@ecme/locales/index.ts +4 -0
  60. package/lib/@ecme/locales/initAll.ts +25 -0
  61. package/lib/@ecme/locales/lang/en/common.ts +43 -0
  62. package/lib/@ecme/locales/lang/en/index.ts +2 -0
  63. package/lib/@ecme/locales/lang/ptBR/common.ts +44 -1
  64. package/lib/@ecme/locales/lang/ptBR/index.ts +2 -0
  65. package/lib/@ecme/locales/lang/ptBR/nav.ts +308 -5
  66. package/lib/@ecme/views/auth/lang/index.ts +2 -2
  67. package/lib/base/locales/index.ts +2 -2
  68. package/package.json +1 -1
@@ -1,4 +1,59 @@
1
1
  declare const _default: {
2
+ base: {
3
+ layout: {
4
+ search: {
5
+ results: {
6
+ navTree: string;
7
+ };
8
+ };
9
+ profile: {
10
+ dropdown: {
11
+ title: string;
12
+ options: {
13
+ profile: string;
14
+ settings: string;
15
+ activity: string;
16
+ signOut: string;
17
+ };
18
+ };
19
+ };
20
+ themeConfig: {
21
+ title: string;
22
+ options: {
23
+ darkMode: string;
24
+ darkModeDesc: string;
25
+ direction: string;
26
+ directionDesc: string;
27
+ theme: string;
28
+ layout: string;
29
+ layoutCollapsible: string;
30
+ layoutStacked: string;
31
+ layoutTopbar: string;
32
+ layoutFrameless: string;
33
+ layoutOverlay: string;
34
+ layoutBlank: string;
35
+ };
36
+ buttons: {
37
+ copyConfig: string;
38
+ };
39
+ };
40
+ notifications: {
41
+ title: string;
42
+ actions: {
43
+ readAll: string;
44
+ };
45
+ status: {
46
+ empty: string;
47
+ };
48
+ buttons: {
49
+ viewAll: string;
50
+ };
51
+ };
52
+ footer: {
53
+ notice: string;
54
+ };
55
+ };
56
+ };
2
57
  pages: {
3
58
  auth: {
4
59
  forgotPassword: {
@@ -105,6 +160,49 @@ declare const _default: {
105
160
  of: string;
106
161
  all: string;
107
162
  };
163
+ layout: {
164
+ search: {
165
+ results: {
166
+ navTree: string;
167
+ };
168
+ };
169
+ profile: {
170
+ dropdown: {
171
+ options: {
172
+ profile: string;
173
+ settings: string;
174
+ activity: string;
175
+ signOut: string;
176
+ };
177
+ };
178
+ };
179
+ themeConfig: {
180
+ title: string;
181
+ options: {
182
+ darkMode: string;
183
+ darkModeDesc: string;
184
+ direction: string;
185
+ directionDesc: string;
186
+ theme: string;
187
+ layout: string;
188
+ layoutCollapsible: string;
189
+ layoutStacked: string;
190
+ layoutTopbar: string;
191
+ layoutFrameless: string;
192
+ layoutOverlay: string;
193
+ layoutBlank: string;
194
+ };
195
+ buttons: {
196
+ copyConfig: string;
197
+ };
198
+ };
199
+ notifications: {
200
+ title: string;
201
+ actions: {
202
+ readAll: string;
203
+ };
204
+ };
205
+ };
108
206
  };
109
207
  nav: {
110
208
  modules: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/en/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAIC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/en/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKC"}
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/common.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAA;wBA6F9B,OAAO,QAAQ;AA1FpB,wBA0FoB"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/common.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAA;wBAwI9B,OAAO,QAAQ;AArIpB,wBAqIoB"}
@@ -1,4 +1,59 @@
1
1
  declare const _default: {
2
+ base: {
3
+ layout: {
4
+ search: {
5
+ results: {
6
+ navTree: string;
7
+ };
8
+ };
9
+ profile: {
10
+ dropdown: {
11
+ title: string;
12
+ options: {
13
+ profile: string;
14
+ settings: string;
15
+ activity: string;
16
+ signOut: string;
17
+ };
18
+ };
19
+ };
20
+ themeConfig: {
21
+ title: string;
22
+ options: {
23
+ darkMode: string;
24
+ darkModeDesc: string;
25
+ direction: string;
26
+ directionDesc: string;
27
+ theme: string;
28
+ layout: string;
29
+ layoutCollapsible: string;
30
+ layoutStacked: string;
31
+ layoutTopbar: string;
32
+ layoutFrameless: string;
33
+ layoutOverlay: string;
34
+ layoutBlank: string;
35
+ };
36
+ buttons: {
37
+ copyConfig: string;
38
+ };
39
+ };
40
+ notifications: {
41
+ title: string;
42
+ actions: {
43
+ readAll: string;
44
+ };
45
+ status: {
46
+ empty: string;
47
+ };
48
+ buttons: {
49
+ viewAll: string;
50
+ };
51
+ };
52
+ footer: {
53
+ notice: string;
54
+ };
55
+ };
56
+ };
2
57
  pages: {
3
58
  auth: {
4
59
  forgotPassword: {
@@ -105,6 +160,49 @@ declare const _default: {
105
160
  of: string;
106
161
  all: string;
107
162
  };
163
+ layout: {
164
+ search: {
165
+ results: {
166
+ navTree: string;
167
+ };
168
+ };
169
+ profile: {
170
+ dropdown: {
171
+ options: {
172
+ profile: string;
173
+ settings: string;
174
+ activity: string;
175
+ signOut: string;
176
+ };
177
+ };
178
+ };
179
+ themeConfig: {
180
+ title: string;
181
+ options: {
182
+ darkMode: string;
183
+ darkModeDesc: string;
184
+ direction: string;
185
+ directionDesc: string;
186
+ theme: string;
187
+ layout: string;
188
+ layoutCollapsible: string;
189
+ layoutStacked: string;
190
+ layoutTopbar: string;
191
+ layoutFrameless: string;
192
+ layoutOverlay: string;
193
+ layoutBlank: string;
194
+ };
195
+ buttons: {
196
+ copyConfig: string;
197
+ };
198
+ };
199
+ notifications: {
200
+ title: string;
201
+ actions: {
202
+ readAll: string;
203
+ };
204
+ };
205
+ };
108
206
  };
109
207
  nav: {
110
208
  modules: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAIC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKC"}
@@ -1 +1 @@
1
- {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,WAAW,CAAA;wBA+BxB,OAAO,KAAK;AAvBjB,wBAuBiB"}
1
+ {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/locales/lang/ptBR/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,WAAW,CAAA;wBA8UxB,OAAO,KAAK;AAtUjB,wBAsUiB"}
@@ -3,8 +3,8 @@ import en from "./lang/en/index.js";
3
3
  import ptBR from "./lang/ptBR/index.js";
4
4
  import i18n from "i18next";
5
5
  function addBaseLocaleResources() {
6
- i18n.addResourceBundle("en", "translation", en);
7
- i18n.addResourceBundle("ptBR", "translation", ptBR);
6
+ i18n.addResourceBundle("en", "translation", en, true, true);
7
+ i18n.addResourceBundle("ptBR", "translation", ptBR, true, true);
8
8
  }
9
9
  addBaseLocaleResources();
10
10
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../lib/base/locales/index.ts"],"sourcesContent":["import i18n from '@/locales'\nimport en from './lang/en'\nimport ptBR from './lang/ptBR'\n\nexport function addBaseLocaleResources() {\n i18n.addResourceBundle('en', 'translation', en)\n i18n.addResourceBundle('ptBR', 'translation', ptBR)\n}\n\naddBaseLocaleResources()\n"],"names":[],"mappings":";;;;AAIO,SAAS,yBAAyB;AACrC,OAAK,kBAAkB,MAAM,eAAe,EAAE;AAC9C,OAAK,kBAAkB,QAAQ,eAAe,IAAI;AACtD;AAEA,uBAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../lib/base/locales/index.ts"],"sourcesContent":["import i18n from '@/locales'\nimport en from './lang/en'\nimport ptBR from './lang/ptBR'\n\nexport function addBaseLocaleResources() {\n i18n.addResourceBundle('en', 'translation', en, true, true)\n i18n.addResourceBundle('ptBR', 'translation', ptBR, true, true)\n}\n\naddBaseLocaleResources()\n"],"names":[],"mappings":";;;;AAIO,SAAS,yBAAyB;AACrC,OAAK,kBAAkB,MAAM,eAAe,IAAI,MAAM,IAAI;AAC1D,OAAK,kBAAkB,QAAQ,eAAe,MAAM,MAAM,IAAI;AAClE;AAEA,uBAAA;"}
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { BrowserRouter } from 'react-router-dom'
3
+ import CollapsibleSide from './CollapsibleSide'
4
+
5
+ const meta = {
6
+ title: '@ecme/Layouts/PostLogin/CollapsibleSide',
7
+ component: CollapsibleSide,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ (Story) => (
14
+ <BrowserRouter>
15
+ <Story />
16
+ </BrowserRouter>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof CollapsibleSide>
20
+
21
+ export default meta
22
+
23
+ type TStory = StoryObj<typeof meta>
24
+
25
+ export const Default: TStory = {
26
+ args: {
27
+ pageTitle: 'Dashboard',
28
+ },
29
+ render: (args) => (
30
+ <CollapsibleSide {...args}>
31
+ <div className="p-4">
32
+ <div className="rounded border border-gray-200 p-4">
33
+ Conteudo da pagina
34
+ </div>
35
+ </div>
36
+ </CollapsibleSide>
37
+ ),
38
+ }
@@ -0,0 +1,35 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { BrowserRouter } from 'react-router-dom'
3
+ import ContentOverlay from './ContentOverlay'
4
+
5
+ const meta = {
6
+ title: '@ecme/Layouts/PostLogin/ContentOverlay',
7
+ component: ContentOverlay,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ (Story) => (
14
+ <BrowserRouter>
15
+ <Story />
16
+ </BrowserRouter>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof ContentOverlay>
20
+
21
+ export default meta
22
+
23
+ type TStory = StoryObj<typeof meta>
24
+
25
+ export const Default: TStory = {
26
+ render: () => (
27
+ <ContentOverlay>
28
+ <div className="p-4">
29
+ <div className="rounded border border-gray-200 bg-white p-4 dark:bg-gray-900">
30
+ Conteudo da pagina
31
+ </div>
32
+ </div>
33
+ </ContentOverlay>
34
+ ),
35
+ }
@@ -0,0 +1,35 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { BrowserRouter } from 'react-router-dom'
3
+ import FrameLessSide from './FrameLessSide'
4
+
5
+ const meta = {
6
+ title: '@ecme/Layouts/PostLogin/FrameLessSide',
7
+ component: FrameLessSide,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ (Story) => (
14
+ <BrowserRouter>
15
+ <Story />
16
+ </BrowserRouter>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof FrameLessSide>
20
+
21
+ export default meta
22
+
23
+ type TStory = StoryObj<typeof meta>
24
+
25
+ export const Default: TStory = {
26
+ render: () => (
27
+ <FrameLessSide>
28
+ <div className="p-4">
29
+ <div className="rounded border border-gray-200 bg-white p-4 dark:bg-gray-900">
30
+ Conteudo da pagina
31
+ </div>
32
+ </div>
33
+ </FrameLessSide>
34
+ ),
35
+ }
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { BrowserRouter } from 'react-router-dom'
3
+ import StackedSide from './StackedSide'
4
+
5
+ const meta = {
6
+ title: '@ecme/Layouts/PostLogin/StackedSide',
7
+ component: StackedSide,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ (Story) => (
14
+ <BrowserRouter>
15
+ <Story />
16
+ </BrowserRouter>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof StackedSide>
20
+
21
+ export default meta
22
+
23
+ type TStory = StoryObj<typeof meta>
24
+
25
+ export const Default: TStory = {
26
+ args: {
27
+ pageTitle: 'Dashboard',
28
+ },
29
+ render: (args) => (
30
+ <StackedSide {...args}>
31
+ <div className="p-4">
32
+ <div className="rounded border border-gray-200 p-4">
33
+ Conteudo da pagina
34
+ </div>
35
+ </div>
36
+ </StackedSide>
37
+ ),
38
+ }
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { BrowserRouter } from 'react-router-dom'
3
+ import TopBarClassic from './TopBarClassic'
4
+
5
+ const meta = {
6
+ title: '@ecme/Layouts/PostLogin/TopBarClassic',
7
+ component: TopBarClassic,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ },
11
+ tags: ['autodocs'],
12
+ decorators: [
13
+ (Story) => (
14
+ <BrowserRouter>
15
+ <Story />
16
+ </BrowserRouter>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof TopBarClassic>
20
+
21
+ export default meta
22
+
23
+ type TStory = StoryObj<typeof meta>
24
+
25
+ export const Default: TStory = {
26
+ args: {
27
+ pageTitle: 'Dashboard',
28
+ },
29
+ render: (args) => (
30
+ <TopBarClassic {...args}>
31
+ <div className="p-4">
32
+ <div className="rounded border border-gray-200 p-4">
33
+ Conteudo da pagina
34
+ </div>
35
+ </div>
36
+ </TopBarClassic>
37
+ ),
38
+ }
@@ -0,0 +1,46 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import Header from './Header'
3
+
4
+ const meta = {
5
+ title: '@ecme/Template/Header',
6
+ component: Header,
7
+ parameters: {
8
+ layout: 'fullscreen',
9
+ },
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ container: {
13
+ control: 'boolean',
14
+ },
15
+ className: {
16
+ control: 'text',
17
+ },
18
+ wrapperClass: {
19
+ control: 'text',
20
+ },
21
+ },
22
+ } satisfies Meta<typeof Header>
23
+
24
+ export default meta
25
+
26
+ type TStory = StoryObj<typeof meta>
27
+
28
+ export const Default: TStory = {
29
+ args: {
30
+ container: false,
31
+ className: '',
32
+ wrapperClass: '',
33
+ },
34
+ render: (args) => (
35
+ <Header
36
+ {...args}
37
+ headerStart={
38
+ <div className="px-4 text-sm font-semibold">Minha Marca</div>
39
+ }
40
+ headerMiddle={<div className="text-sm">Área central</div>}
41
+ headerEnd={
42
+ <div className="px-4 text-sm text-gray-600">Usuário</div>
43
+ }
44
+ />
45
+ ),
46
+ }
@@ -0,0 +1,79 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import { useEffect } from 'react'
3
+ import { BrowserRouter } from 'react-router-dom'
4
+ import navigationConfig from '@/configs/navigation.config'
5
+ import type { NavigationTree } from '@/@types/navigation'
6
+ import { useSessionUser } from '@/store/authStore'
7
+ import Search from './Search'
8
+
9
+ const collectAuthorityPaths = (navTree: NavigationTree[]): string[] => {
10
+ return navTree.reduce((acc: string[], node) => {
11
+ if (node.path) {
12
+ acc.push(node.path)
13
+ }
14
+
15
+ if (node.subMenu?.length) {
16
+ acc.push(...collectAuthorityPaths(node.subMenu))
17
+ }
18
+
19
+ return acc
20
+ }, [])
21
+ }
22
+
23
+ const allAuthority = Array.from(new Set(collectAuthorityPaths(navigationConfig)))
24
+
25
+ const WithSimulatedAuthorities = ({
26
+ children,
27
+ }: {
28
+ children: React.ReactNode
29
+ }) => {
30
+ useEffect(() => {
31
+ const previousUser = useSessionUser.getState().user
32
+
33
+ useSessionUser.setState({
34
+ user: {
35
+ ...previousUser,
36
+ authority: allAuthority,
37
+ },
38
+ })
39
+
40
+ return () => {
41
+ useSessionUser.setState({ user: previousUser })
42
+ }
43
+ }, [])
44
+
45
+ return <>{children}</>
46
+ }
47
+
48
+ const meta = {
49
+ title: '@ecme/Template/Search',
50
+ component: Search,
51
+ parameters: {
52
+ layout: 'padded',
53
+ },
54
+ tags: ['autodocs'],
55
+ decorators: [
56
+ (Story) => (
57
+ <BrowserRouter>
58
+ <WithSimulatedAuthorities>
59
+ <Story />
60
+ </WithSimulatedAuthorities>
61
+ </BrowserRouter>
62
+ ),
63
+ ],
64
+ argTypes: {
65
+ className: {
66
+ control: 'text',
67
+ },
68
+ },
69
+ } satisfies Meta<typeof Search>
70
+
71
+ export default meta
72
+
73
+ type TStory = StoryObj<typeof meta>
74
+
75
+ export const Default: TStory = {
76
+ args: {
77
+ className: '',
78
+ },
79
+ }
@@ -2,22 +2,11 @@ import { NavigationTree } from '@/@types/navigation'
2
2
  import Button from '@/components/ui/Button'
3
3
  import Dialog from '@/components/ui/Dialog'
4
4
  import ScrollBar from '@/components/ui/ScrollBar'
5
- import navigationIcon from '@/configs/navigation-icon.config'
6
5
  import navigationConfig from '@/configs/navigation.config'
7
6
  import { NAV_ITEM_TYPE_ITEM } from '@/constants/navigation.constant'
8
- import {
9
- GUIDE_PREFIX_PATH,
10
- UI_COMPONENTS_PREFIX_PATH,
11
- } from '@/constants/route.constant'
7
+ import { useSessionUser } from '@/store/authStore'
12
8
  import classNames from '@/utils/classNames'
13
9
  import withHeaderItem from '@/utils/hoc/withHeaderItem'
14
- import {
15
- filterDeep,
16
- findDeep,
17
- findPathDeep,
18
- findValueDeep,
19
- } from 'deepdash-es/standalone'
20
- import { flatten, flattenDeep } from 'lodash'
21
10
  import debounce from 'lodash/debounce'
22
11
  import { useEffect, useMemo, useRef, useState } from 'react'
23
12
  import Highlighter from 'react-highlight-words'
@@ -42,6 +31,38 @@ type SearchResult = {
42
31
  data: SearchData[]
43
32
  }
44
33
 
34
+ const filterNavigationByAuthority = (
35
+ navTree: NavigationTree[],
36
+ userAuthority: string[],
37
+ ): NavigationTree[] => {
38
+ return navTree.reduce((acc: NavigationTree[], nav) => {
39
+ if (nav.excludeWhenHasPaths && nav.excludeWhenHasPaths.length > 0) {
40
+ const shouldExclude = nav.excludeWhenHasPaths.some((path) =>
41
+ userAuthority.includes(path),
42
+ )
43
+
44
+ if (shouldExclude) {
45
+ return acc
46
+ }
47
+ }
48
+
49
+ if (nav.subMenu && nav.subMenu.length > 0) {
50
+ const filteredSubMenu = filterNavigationByAuthority(
51
+ nav.subMenu,
52
+ userAuthority,
53
+ )
54
+
55
+ if (filteredSubMenu.length > 0) {
56
+ acc.push({ ...nav, subMenu: filteredSubMenu })
57
+ }
58
+ } else if ((nav.path && userAuthority.includes(nav.path)) || !nav.path) {
59
+ acc.push(nav)
60
+ }
61
+
62
+ return acc
63
+ }, [])
64
+ }
65
+
45
66
  const ListItem = (props: {
46
67
  icon: string
47
68
  label: string
@@ -98,6 +119,7 @@ const _Search = ({ className }: { className?: string }) => {
98
119
  const [searchDialogOpen, setSearchDialogOpen] = useState(false)
99
120
  const [searchResult, setSearchResult] = useState<SearchResult[]>([])
100
121
  const [noResult, setNoResult] = useState(false)
122
+ const userAuthority = useSessionUser((state) => state.user.authority)
101
123
 
102
124
  const inputRef = useRef<HTMLInputElement>(null)
103
125
 
@@ -121,6 +143,10 @@ const _Search = ({ className }: { className?: string }) => {
121
143
 
122
144
  const flatNavTree = useMemo(() => {
123
145
  const arr: NavigationTreeFlat[] = []
146
+ const filteredNavigationTree = filterNavigationByAuthority(
147
+ navigationConfig,
148
+ userAuthority || [],
149
+ )
124
150
 
125
151
  const makeflat = (item: NavigationTree, parents: string[]) => {
126
152
  if (Array.isArray(item.subMenu) && item.subMenu.length > 0) {
@@ -131,11 +157,12 @@ const _Search = ({ className }: { className?: string }) => {
131
157
  arr.push({ ...item, parents })
132
158
  }
133
159
 
134
- navigationConfig.forEach(function f(item) {
160
+ filteredNavigationTree.forEach(function f(item) {
135
161
  makeflat(item, [t(item.translateKey)])
136
162
  })
163
+
137
164
  return arr
138
- }, [navigationConfig, t])
165
+ }, [userAuthority, t])
139
166
 
140
167
  const filterNavigationTreeFlat = (
141
168
  text: string,
@@ -1,4 +1,8 @@
1
1
  import i18n from './locales'
2
2
 
3
3
  export { dateLocales } from './locales'
4
+ export {
5
+ ensureAppLocaleResourcesLoaded,
6
+ initAllAppLocaleResources,
7
+ } from './initAll'
4
8
  export default i18n