@hedhog/admin 0.51.26 → 0.51.27

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 (39) hide show
  1. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +11 -11
  2. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +11 -11
  3. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
  4. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
  5. package/dist/menu/menu.controller.d.ts +3 -3
  6. package/dist/menu/menu.service.d.ts +3 -3
  7. package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
  8. package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
  9. package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
  10. package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
  11. package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
  12. package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
  13. package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
  14. package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
  15. package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
  16. package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
  17. package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
  18. package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
  19. package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
  20. package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
  21. package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
  22. package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
  23. package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
  24. package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
  25. package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
  26. package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
  27. package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
  28. package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
  29. package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
  30. package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
  31. package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
  32. package/hedhog.yaml +7 -0
  33. package/package.json +1 -1
  34. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
  35. package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
  36. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
  37. package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
  38. package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
  39. package/src/dashboard/index.ts +1 -1
@@ -3,17 +3,6 @@ export declare class DashboardCoreController {
3
3
  private readonly dashboardCoreService;
4
4
  constructor(dashboardCoreService: DashboardCoreService);
5
5
  fromSlug(slug: string, locale: any): Promise<({
6
- dashboard_user: {
7
- id: number;
8
- created_at: Date;
9
- updated_at: Date;
10
- user_id: number;
11
- width: number;
12
- height: number;
13
- x_axis: number;
14
- y_axis: number;
15
- item_id: number;
16
- }[];
17
6
  dashboard_component: {
18
7
  dashboard_component_locale: {
19
8
  name: string;
@@ -36,6 +25,17 @@ export declare class DashboardCoreController {
36
25
  height: number;
37
26
  is_resizable: boolean;
38
27
  };
28
+ dashboard_user: {
29
+ id: number;
30
+ created_at: Date;
31
+ updated_at: Date;
32
+ width: number;
33
+ height: number;
34
+ x_axis: number;
35
+ y_axis: number;
36
+ item_id: number;
37
+ user_id: number;
38
+ }[];
39
39
  } & {
40
40
  id: number;
41
41
  created_at: Date;
@@ -3,17 +3,6 @@ export declare class DashboardCoreService {
3
3
  private readonly prismaService;
4
4
  constructor(prismaService: PrismaService);
5
5
  fromSlug(slug: string, code: string): Promise<({
6
- dashboard_user: {
7
- id: number;
8
- created_at: Date;
9
- updated_at: Date;
10
- user_id: number;
11
- width: number;
12
- height: number;
13
- x_axis: number;
14
- y_axis: number;
15
- item_id: number;
16
- }[];
17
6
  dashboard_component: {
18
7
  dashboard_component_locale: {
19
8
  name: string;
@@ -36,6 +25,17 @@ export declare class DashboardCoreService {
36
25
  height: number;
37
26
  is_resizable: boolean;
38
27
  };
28
+ dashboard_user: {
29
+ id: number;
30
+ created_at: Date;
31
+ updated_at: Date;
32
+ width: number;
33
+ height: number;
34
+ x_axis: number;
35
+ y_axis: number;
36
+ item_id: number;
37
+ user_id: number;
38
+ }[];
39
39
  } & {
40
40
  id: number;
41
41
  created_at: Date;
@@ -18,34 +18,34 @@ export declare class DashboardUserController {
18
18
  id: number;
19
19
  created_at: Date;
20
20
  updated_at: Date;
21
- user_id: number;
22
21
  width: number;
23
22
  height: number;
24
23
  x_axis: number;
25
24
  y_axis: number;
26
25
  item_id: number;
26
+ user_id: number;
27
27
  }>;
28
28
  create(data: CreateDTO): Promise<{
29
29
  id: number;
30
30
  created_at: Date;
31
31
  updated_at: Date;
32
- user_id: number;
33
32
  width: number;
34
33
  height: number;
35
34
  x_axis: number;
36
35
  y_axis: number;
37
36
  item_id: number;
37
+ user_id: number;
38
38
  }>;
39
39
  update(id: number, data: UpdateDTO): Promise<{
40
40
  id: number;
41
41
  created_at: Date;
42
42
  updated_at: Date;
43
- user_id: number;
44
43
  width: number;
45
44
  height: number;
46
45
  x_axis: number;
47
46
  y_axis: number;
48
47
  item_id: number;
48
+ user_id: number;
49
49
  }>;
50
50
  delete(data: DeleteDTO): Promise<import(".prisma/client").Prisma.BatchPayload>;
51
51
  }
@@ -22,23 +22,23 @@ export declare class DashboardUserService {
22
22
  id: number;
23
23
  created_at: Date;
24
24
  updated_at: Date;
25
- user_id: number;
26
25
  width: number;
27
26
  height: number;
28
27
  x_axis: number;
29
28
  y_axis: number;
30
29
  item_id: number;
30
+ user_id: number;
31
31
  }>;
32
32
  create(data: CreateDTO): Promise<{
33
33
  id: number;
34
34
  created_at: Date;
35
35
  updated_at: Date;
36
- user_id: number;
37
36
  width: number;
38
37
  height: number;
39
38
  x_axis: number;
40
39
  y_axis: number;
41
40
  item_id: number;
41
+ user_id: number;
42
42
  }>;
43
43
  update({ id, data }: {
44
44
  id: number;
@@ -47,12 +47,12 @@ export declare class DashboardUserService {
47
47
  id: number;
48
48
  created_at: Date;
49
49
  updated_at: Date;
50
- user_id: number;
51
50
  width: number;
52
51
  height: number;
53
52
  x_axis: number;
54
53
  y_axis: number;
55
54
  item_id: number;
55
+ user_id: number;
56
56
  }>;
57
57
  delete({ ids }: DeleteDTO): Promise<import(".prisma/client").Prisma.BatchPayload>;
58
58
  }
@@ -43,8 +43,8 @@ export declare class MenuController {
43
43
  id: number;
44
44
  created_at: Date;
45
45
  updated_at: Date;
46
- menu_id: number | null;
47
46
  slug: string;
47
+ menu_id: number | null;
48
48
  url: string | null;
49
49
  order: number;
50
50
  icon: string | null;
@@ -53,8 +53,8 @@ export declare class MenuController {
53
53
  id: number;
54
54
  created_at: Date;
55
55
  updated_at: Date;
56
- menu_id: number | null;
57
56
  slug: string;
57
+ menu_id: number | null;
58
58
  url: string | null;
59
59
  order: number;
60
60
  icon: string | null;
@@ -63,8 +63,8 @@ export declare class MenuController {
63
63
  id: number;
64
64
  created_at: Date;
65
65
  updated_at: Date;
66
- menu_id: number | null;
67
66
  slug: string;
67
+ menu_id: number | null;
68
68
  url: string | null;
69
69
  order: number;
70
70
  icon: string | null;
@@ -44,8 +44,8 @@ export declare class MenuService {
44
44
  id: number;
45
45
  created_at: Date;
46
46
  updated_at: Date;
47
- menu_id: number | null;
48
47
  slug: string;
48
+ menu_id: number | null;
49
49
  url: string | null;
50
50
  order: number;
51
51
  icon: string | null;
@@ -54,8 +54,8 @@ export declare class MenuService {
54
54
  id: number;
55
55
  created_at: Date;
56
56
  updated_at: Date;
57
- menu_id: number | null;
58
57
  slug: string;
58
+ menu_id: number | null;
59
59
  url: string | null;
60
60
  order: number;
61
61
  icon: string | null;
@@ -67,8 +67,8 @@ export declare class MenuService {
67
67
  id: number;
68
68
  created_at: Date;
69
69
  updated_at: Date;
70
- menu_id: number | null;
71
70
  slug: string;
71
+ menu_id: number | null;
72
72
  url: string | null;
73
73
  order: number;
74
74
  icon: string | null;
@@ -1,63 +1,63 @@
1
- import FormPanel, {
2
- FormPanelRef,
3
- getFieldsLocale,
4
- } from '@/components/panels/form-panel'
5
- import { EnumFieldType } from '@/enums/EnumFieldType'
6
- import { useDashboardCreate } from '@/features/admin/dashboard'
7
- import { Dashboard } from '@/types/models'
8
- import { forwardRef, useImperativeHandle, useRef } from 'react'
9
- import { useTranslation } from 'react-i18next'
10
-
11
- export type DashboardCreatePanelRef = {
12
- submit: () => void
13
- }
14
-
15
- export type DashboardCreatePanelProps = {
16
- onCreated?: (data: Dashboard) => void
17
- }
18
-
19
- const DashboardCreatePanel = forwardRef(
20
- ({ onCreated }: DashboardCreatePanelProps, ref) => {
21
- const formRef = useRef<FormPanelRef>(null)
22
- const { t } = useTranslation(['actions', 'fields', 'translations'])
23
- const { mutateAsync: createDashboard } = useDashboardCreate()
24
-
25
- useImperativeHandle(
26
- ref,
27
- () => ({
28
- submit: () => {
29
- formRef.current?.submit()
30
- },
31
- }),
32
- [formRef]
33
- )
34
-
35
- return (
36
- <FormPanel
37
- ref={formRef}
38
- fields={[
39
- {
40
- name: 'slug',
41
- label: { text: t('dashboard.slug', { ns: 'fields' }) },
42
- type: EnumFieldType.TEXT,
43
- required: true,
44
- },
45
- ...getFieldsLocale([{ name: 'name' }]),
46
- ]}
47
- button={{ text: t('create', { ns: 'actions' }) }}
48
- onSubmit={async (data) => {
49
- const createdData = await createDashboard({
50
- data,
51
- })
52
- if (typeof onCreated === 'function') {
53
- onCreated(createdData as any)
54
- }
55
- }}
56
- />
57
- )
58
- }
59
- )
60
-
61
- DashboardCreatePanel.displayName = 'DashboardCreatePanel'
62
-
63
- export default DashboardCreatePanel
1
+ import FormPanel, {
2
+ FormPanelRef,
3
+ getFieldsLocale,
4
+ } from '@/components/panels/form-panel'
5
+ import { EnumFieldType } from '@/enums/EnumFieldType'
6
+ import { useDashboardCreate } from '@/features/admin/dashboard'
7
+ import { Dashboard } from '@/types/models'
8
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
9
+ import { useTranslation } from 'react-i18next'
10
+
11
+ export type DashboardCreatePanelRef = {
12
+ submit: () => void
13
+ }
14
+
15
+ export type DashboardCreatePanelProps = {
16
+ onCreated?: (data: Dashboard) => void
17
+ }
18
+
19
+ const DashboardCreatePanel = forwardRef(
20
+ ({ onCreated }: DashboardCreatePanelProps, ref) => {
21
+ const formRef = useRef<FormPanelRef>(null)
22
+ const { t } = useTranslation(['actions', 'fields', 'translations'])
23
+ const { mutateAsync: createDashboard } = useDashboardCreate()
24
+
25
+ useImperativeHandle(
26
+ ref,
27
+ () => ({
28
+ submit: () => {
29
+ formRef.current?.submit()
30
+ },
31
+ }),
32
+ [formRef]
33
+ )
34
+
35
+ return (
36
+ <FormPanel
37
+ ref={formRef}
38
+ fields={[
39
+ {
40
+ name: 'slug',
41
+ label: { text: t('dashboard.slug', { ns: 'fields' }) },
42
+ type: EnumFieldType.TEXT,
43
+ required: true,
44
+ },
45
+ ...getFieldsLocale([{ name: 'name' }]),
46
+ ]}
47
+ button={{ text: t('create', { ns: 'actions' }) }}
48
+ onSubmit={async (data) => {
49
+ const createdData = await createDashboard({
50
+ data,
51
+ })
52
+ if (typeof onCreated === 'function') {
53
+ onCreated(createdData as any)
54
+ }
55
+ }}
56
+ />
57
+ )
58
+ }
59
+ )
60
+
61
+ DashboardCreatePanel.displayName = 'DashboardCreatePanel'
62
+
63
+ export default DashboardCreatePanel
@@ -1,116 +1,116 @@
1
- import { PageTitle } from '@/components/custom/page-title'
2
- import DataPanel from '@/components/panels/data-panel'
3
- import { useDashboardDelete } from '@/features/admin/dashboard'
4
- import { useApp } from '@/hooks/use-app'
5
- import { isPlural } from '@/lib/utils'
6
- import { Dashboard } from '@/types/models'
7
- import { IconEdit, IconPlus, IconTrash } from '@tabler/icons-react'
8
- import { useState } from 'react'
9
- import { useTranslation } from 'react-i18next'
10
- import DashboardCreatePanel from './components/dashboard-create-panel'
11
- import DashboardUpdatePanel from './components/dashboard-update-panel'
12
- import DashboardCard from '@/components/cards/dashboard-card'
13
-
14
- export default function Page() {
15
- const [selectedItems, setSelectedItems] = useState<Dashboard[]>([])
16
- const { mutate: deleteDashboard } = useDashboardDelete()
17
- const { openSheet, confirm, closeSheet } = useApp()
18
- const { t } = useTranslation([
19
- 'dashboard.dashboard',
20
- 'modules',
21
- 'actions',
22
- 'fields',
23
- ])
24
-
25
- const openCreate = () => {
26
- const id = openSheet({
27
- title: t('create', { ns: 'dashboard.dashboard' }),
28
- description: t('createText', { ns: 'dashboard.dashboard' }),
29
- children: () => <DashboardCreatePanel onCreated={() => closeSheet(id)} />,
30
- })
31
-
32
- return id
33
- }
34
-
35
- const openDelete = (items: Dashboard[]) => {
36
- return confirm({
37
- title: `${t('delete', { ns: 'dashboard.dashboard' })} ${items.length} ${isPlural(items.length) ? t('items', { ns: 'actions' }) : t('item', { ns: 'actions' })}`,
38
- description: t('deleteText', { ns: 'dashboard.dashboard' }),
39
- })
40
- .then(() =>
41
- deleteDashboard(
42
- items
43
- .map((item) => (item as any).dashboard_id)
44
- .filter((id) => id !== undefined)
45
- )
46
- )
47
- .catch(() => setSelectedItems(items))
48
- }
49
-
50
- const openUpdate = (item: Dashboard) => {
51
- const id = openSheet({
52
- children: () => (
53
- <DashboardUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
54
- ),
55
- title: t('edit', { ns: 'dashboard.dashboard' }),
56
- description: t('editText', { ns: 'dashboard.dashboard' }),
57
- })
58
-
59
- return id
60
- }
61
-
62
- return (
63
- <>
64
- <PageTitle title={t('dashboard', { ns: 'modules' })} />
65
- <DataPanel
66
- url='/dashboard'
67
- layout='grid'
68
- id='dashboard'
69
- selectable
70
- render={(item: Dashboard) => <DashboardCard item={item} />}
71
- responsiveColumns={{
72
- default: 1,
73
- sm: 2,
74
- md: 1,
75
- lg: 2,
76
- xl: 3,
77
- }}
78
- selected={selectedItems as Dashboard[]}
79
- multiple
80
- hasSearch
81
- onItemDoubleClick={(item) => openUpdate(item)}
82
- menuActions={[
83
- {
84
- icon: <IconEdit className='mr-1 w-8 cursor-pointer' />,
85
- label: t('edit', { ns: 'actions' }),
86
- tooltip: t('editTooltip', { ns: 'contact.dashboard' }),
87
- handler: (items: Dashboard[]) => {
88
- if (items.length === 1) openUpdate(items[0])
89
- },
90
- show: 'once',
91
- },
92
- {
93
- icon: <IconTrash className='mr-1 w-8 cursor-pointer' />,
94
- label: t('delete', { ns: 'actions' }),
95
- tooltip: t('deleteTooltip', { ns: 'contact.dashboard' }),
96
- variant: 'destructive',
97
- handler: (items: Dashboard[]) => {
98
- openDelete(items)
99
- },
100
- show: 'some',
101
- },
102
- {
103
- icon: <IconPlus className='mr-1 w-8 cursor-pointer' />,
104
- label: t('create', { ns: 'actions' }),
105
- tooltip: t('createTooltip', { ns: 'contact.dashboard' }),
106
- variant: 'default',
107
- handler: () => {
108
- openCreate()
109
- },
110
- show: 'none',
111
- },
112
- ]}
113
- />
114
- </>
115
- )
116
- }
1
+ import { PageTitle } from '@/components/custom/page-title'
2
+ import DataPanel from '@/components/panels/data-panel'
3
+ import { useDashboardDelete } from '@/features/admin/dashboard'
4
+ import { useApp } from '@/hooks/use-app'
5
+ import { isPlural } from '@/lib/utils'
6
+ import { Dashboard } from '@/types/models'
7
+ import { IconEdit, IconPlus, IconTrash } from '@tabler/icons-react'
8
+ import { useState } from 'react'
9
+ import { useTranslation } from 'react-i18next'
10
+ import DashboardCreatePanel from './components/dashboard-create-panel'
11
+ import DashboardUpdatePanel from './components/dashboard-update-panel'
12
+ import DashboardCard from '@/components/cards/dashboard-card'
13
+
14
+ export default function Page() {
15
+ const [selectedItems, setSelectedItems] = useState<Dashboard[]>([])
16
+ const { mutate: deleteDashboard } = useDashboardDelete()
17
+ const { openSheet, confirm, closeSheet } = useApp()
18
+ const { t } = useTranslation([
19
+ 'dashboard.dashboard',
20
+ 'modules',
21
+ 'actions',
22
+ 'fields',
23
+ ])
24
+
25
+ const openCreate = () => {
26
+ const id = openSheet({
27
+ title: t('create', { ns: 'dashboard.dashboard' }),
28
+ description: t('createText', { ns: 'dashboard.dashboard' }),
29
+ children: () => <DashboardCreatePanel onCreated={() => closeSheet(id)} />,
30
+ })
31
+
32
+ return id
33
+ }
34
+
35
+ const openDelete = (items: Dashboard[]) => {
36
+ return confirm({
37
+ title: `${t('delete', { ns: 'dashboard.dashboard' })} ${items.length} ${isPlural(items.length) ? t('items', { ns: 'actions' }) : t('item', { ns: 'actions' })}`,
38
+ description: t('deleteText', { ns: 'dashboard.dashboard' }),
39
+ })
40
+ .then(() =>
41
+ deleteDashboard(
42
+ items
43
+ .map((item) => (item as any).dashboard_id)
44
+ .filter((id) => id !== undefined)
45
+ )
46
+ )
47
+ .catch(() => setSelectedItems(items))
48
+ }
49
+
50
+ const openUpdate = (item: Dashboard) => {
51
+ const id = openSheet({
52
+ children: () => (
53
+ <DashboardUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
54
+ ),
55
+ title: t('edit', { ns: 'dashboard.dashboard' }),
56
+ description: t('editText', { ns: 'dashboard.dashboard' }),
57
+ })
58
+
59
+ return id
60
+ }
61
+
62
+ return (
63
+ <>
64
+ <PageTitle title={t('dashboard', { ns: 'modules' })} />
65
+ <DataPanel
66
+ url='/dashboard'
67
+ layout='grid'
68
+ id='dashboard'
69
+ selectable
70
+ render={(item: Dashboard) => <DashboardCard item={item} />}
71
+ responsiveColumns={{
72
+ default: 1,
73
+ sm: 2,
74
+ md: 1,
75
+ lg: 2,
76
+ xl: 3,
77
+ }}
78
+ selected={selectedItems as Dashboard[]}
79
+ multiple
80
+ hasSearch
81
+ onItemDoubleClick={(item) => openUpdate(item)}
82
+ menuActions={[
83
+ {
84
+ icon: <IconEdit className='mr-1 w-8 cursor-pointer' />,
85
+ label: t('edit', { ns: 'actions' }),
86
+ tooltip: t('editTooltip', { ns: 'contact.dashboard' }),
87
+ handler: (items: Dashboard[]) => {
88
+ if (items.length === 1) openUpdate(items[0])
89
+ },
90
+ show: 'once',
91
+ },
92
+ {
93
+ icon: <IconTrash className='mr-1 w-8 cursor-pointer' />,
94
+ label: t('delete', { ns: 'actions' }),
95
+ tooltip: t('deleteTooltip', { ns: 'contact.dashboard' }),
96
+ variant: 'destructive',
97
+ handler: (items: Dashboard[]) => {
98
+ openDelete(items)
99
+ },
100
+ show: 'some',
101
+ },
102
+ {
103
+ icon: <IconPlus className='mr-1 w-8 cursor-pointer' />,
104
+ label: t('create', { ns: 'actions' }),
105
+ tooltip: t('createTooltip', { ns: 'contact.dashboard' }),
106
+ variant: 'default',
107
+ handler: () => {
108
+ openCreate()
109
+ },
110
+ show: 'none',
111
+ },
112
+ ]}
113
+ />
114
+ </>
115
+ )
116
+ }