@hedhog/blog 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/frontend/author/components/author.screen.ts +104 -0
  2. package/frontend/author/components/update-panel.tsx +2 -0
  3. package/frontend/author/react-query/requests.ts +2 -1
  4. package/frontend/category/components/category.screen.ts +104 -0
  5. package/frontend/category/components/update-panel.tsx +2 -0
  6. package/frontend/category/react-query/requests.ts +2 -1
  7. package/frontend/post/components/post.screen.ts +104 -0
  8. package/frontend/post/components/update-panel.tsx +2 -0
  9. package/frontend/post/react-query/requests.ts +2 -1
  10. package/package.json +1 -1
  11. package/frontend/author/components/create-panel.d.ts +0 -9
  12. package/frontend/author/components/create-panel.d.ts.map +0 -1
  13. package/frontend/author/components/create-panel.js +0 -42
  14. package/frontend/author/components/create-panel.js.map +0 -1
  15. package/frontend/author/components/update-panel.d.ts +0 -7
  16. package/frontend/author/components/update-panel.d.ts.map +0 -1
  17. package/frontend/author/components/update-panel.js +0 -52
  18. package/frontend/author/components/update-panel.js.map +0 -1
  19. package/frontend/author/react-query/handlers.d.ts +0 -5
  20. package/frontend/author/react-query/handlers.d.ts.map +0 -1
  21. package/frontend/author/react-query/handlers.js +0 -30
  22. package/frontend/author/react-query/handlers.js.map +0 -1
  23. package/frontend/author/react-query/requests.d.ts +0 -10
  24. package/frontend/author/react-query/requests.d.ts.map +0 -1
  25. package/frontend/author/react-query/requests.js +0 -48
  26. package/frontend/author/react-query/requests.js.map +0 -1
  27. package/frontend/category/components/create-panel.d.ts +0 -9
  28. package/frontend/category/components/create-panel.d.ts.map +0 -1
  29. package/frontend/category/components/create-panel.js +0 -48
  30. package/frontend/category/components/create-panel.js.map +0 -1
  31. package/frontend/category/components/update-panel.d.ts +0 -7
  32. package/frontend/category/components/update-panel.d.ts.map +0 -1
  33. package/frontend/category/components/update-panel.js +0 -61
  34. package/frontend/category/components/update-panel.js.map +0 -1
  35. package/frontend/category/react-query/handlers.d.ts +0 -5
  36. package/frontend/category/react-query/handlers.d.ts.map +0 -1
  37. package/frontend/category/react-query/handlers.js +0 -30
  38. package/frontend/category/react-query/handlers.js.map +0 -1
  39. package/frontend/category/react-query/requests.d.ts +0 -10
  40. package/frontend/category/react-query/requests.d.ts.map +0 -1
  41. package/frontend/category/react-query/requests.js +0 -49
  42. package/frontend/category/react-query/requests.js.map +0 -1
  43. package/frontend/post/components/create-panel.d.ts +0 -9
  44. package/frontend/post/components/create-panel.d.ts.map +0 -1
  45. package/frontend/post/components/create-panel.js +0 -54
  46. package/frontend/post/components/create-panel.js.map +0 -1
  47. package/frontend/post/components/update-panel.d.ts +0 -7
  48. package/frontend/post/components/update-panel.d.ts.map +0 -1
  49. package/frontend/post/components/update-panel.js +0 -64
  50. package/frontend/post/components/update-panel.js.map +0 -1
  51. package/frontend/post/react-query/handlers.d.ts +0 -5
  52. package/frontend/post/react-query/handlers.d.ts.map +0 -1
  53. package/frontend/post/react-query/handlers.js +0 -30
  54. package/frontend/post/react-query/handlers.js.map +0 -1
  55. package/frontend/post/react-query/requests.d.ts +0 -10
  56. package/frontend/post/react-query/requests.d.ts.map +0 -1
  57. package/frontend/post/react-query/requests.js +0 -48
  58. package/frontend/post/react-query/requests.js.map +0 -1
@@ -0,0 +1,104 @@
1
+ import DataPanel from "@/components/panels/data-panel";
2
+ import { PageTitle } from "@/components/custom/page-title";
3
+ import { useAuthorDelete } from "@/features/author";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Author } 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 { AuthorCreatePanel, AuthorUpdatePanel } from "./components";
11
+
12
+ export default function Page() {
13
+ const [selectedItems, setSelectedItems] = useState<Author[]>([]);
14
+ const { mutate: deleteAuthor } = useAuthorDelete();
15
+ const { openSheet, confirm, closeSheet } = useApp();
16
+ const { t } = useTranslation(["author", "modules", "actions"]);
17
+
18
+ const openCreate = () => {
19
+ const id = openSheet({
20
+ title: t("create", { ns: "actions" }),
21
+ description: t("createText", { ns: "author" }),
22
+ children: () => <AuthorCreatePanel onCreated={() => closeSheet(id)} />,
23
+ });
24
+
25
+ return id;
26
+ };
27
+
28
+ const openDelete = (items: Author[]) => {
29
+ return confirm({
30
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
31
+ description: t("deleteText", { ns: "author" }),
32
+ })
33
+ .then(() =>
34
+ deleteAuthor(
35
+ items.map((item) => item.id).filter((id) => id !== undefined),
36
+ ),
37
+ )
38
+ .catch(() => setSelectedItems(items));
39
+ };
40
+
41
+ const openUpdate = (item: Author) => {
42
+ const id = openSheet({
43
+ children: () => (
44
+ <AuthorUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
45
+ ),
46
+ title: t("edit", { ns: "author" }),
47
+ description: t("editText", { ns: "author" }),
48
+ });
49
+
50
+ return id;
51
+ };
52
+
53
+ return (
54
+ <>
55
+ <PageTitle title={t("author", { ns: "modules" })} />
56
+ <DataPanel
57
+ url="/author"
58
+ layout="table"
59
+ id="author"
60
+ selectable
61
+ columns={[
62
+ { key: "id", header: "ID", width: 64 },
63
+ { key: "name", header: t("name", { ns: "author" }) },
64
+ ]}
65
+ selected={selectedItems as Author[]}
66
+ multiple
67
+ hasSearch
68
+ sortable
69
+ onItemDoubleClick={(item) => openUpdate(item)}
70
+ menuActions={[
71
+ {
72
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
73
+ label: t("edit", { ns: "actions" }),
74
+ tooltip: t("editTooltip", { ns: "author" }),
75
+ handler: (items: Author[]) => {
76
+ if (items.length === 1) openUpdate(items[0]);
77
+ },
78
+ show: "once",
79
+ },
80
+ {
81
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
82
+ label: t("delete", { ns: "actions" }),
83
+ tooltip: t("deleteTooltip", { ns: "author" }),
84
+ variant: "destructive",
85
+ handler: (items: Author[]) => {
86
+ openDelete(items);
87
+ },
88
+ show: "some",
89
+ },
90
+ {
91
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
92
+ label: t("create", { ns: "actions" }),
93
+ tooltip: t("createTooltip", { ns: "author" }),
94
+ variant: "default",
95
+ handler: () => {
96
+ openCreate();
97
+ },
98
+ show: "none",
99
+ },
100
+ ]}
101
+ />
102
+ </>
103
+ );
104
+ }
@@ -7,6 +7,7 @@ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
7
7
  import { Author } from "@/types/models";
8
8
  import { t } from "i18next";
9
9
  import { forwardRef, useImperativeHandle, useRef } from "react";
10
+ import { useTranslation } from "react-i18next";
10
11
 
11
12
  export type AuthorUpdatePanelProps = {
12
13
  data: Author;
@@ -15,6 +16,7 @@ export type AuthorUpdatePanelProps = {
15
16
 
16
17
  export const AuthorUpdatePanel = forwardRef(
17
18
  ({ data, onUpdated }: AuthorUpdatePanelProps, ref) => {
19
+ const { t } = useTranslation(["person-types", "actions"]);
18
20
  const { data: item, isLoading } = useAuthorGet(data.id as number);
19
21
  const { mutate: authorUpdate } = useAuthorUpdate();
20
22
  const formRef = useRef<FormPanelRef>(null);
@@ -35,7 +35,8 @@ export function requests() {
35
35
  });
36
36
  };
37
37
 
38
- const authorUpdate = async (id: number, data: Author) => {
38
+ const authorUpdate = async (params: { id: number; data: Author }) => {
39
+ const { id, data } = params;
39
40
  return request<Author>({
40
41
  url: `/author/${id}`,
41
42
  method: HttpMethod.PATCH,
@@ -0,0 +1,104 @@
1
+ import DataPanel from "@/components/panels/data-panel";
2
+ import { PageTitle } from "@/components/custom/page-title";
3
+ import { useCategoryDelete } from "@/features/category";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Category } 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 { CategoryCreatePanel, CategoryUpdatePanel } from "./components";
11
+
12
+ export default function Page() {
13
+ const [selectedItems, setSelectedItems] = useState<Category[]>([]);
14
+ const { mutate: deleteCategory } = useCategoryDelete();
15
+ const { openSheet, confirm, closeSheet } = useApp();
16
+ const { t } = useTranslation(["category", "modules", "actions"]);
17
+
18
+ const openCreate = () => {
19
+ const id = openSheet({
20
+ title: t("create", { ns: "actions" }),
21
+ description: t("createText", { ns: "category" }),
22
+ children: () => <CategoryCreatePanel onCreated={() => closeSheet(id)} />,
23
+ });
24
+
25
+ return id;
26
+ };
27
+
28
+ const openDelete = (items: Category[]) => {
29
+ return confirm({
30
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
31
+ description: t("deleteText", { ns: "category" }),
32
+ })
33
+ .then(() =>
34
+ deleteCategory(
35
+ items.map((item) => item.id).filter((id) => id !== undefined),
36
+ ),
37
+ )
38
+ .catch(() => setSelectedItems(items));
39
+ };
40
+
41
+ const openUpdate = (item: Category) => {
42
+ const id = openSheet({
43
+ children: () => (
44
+ <CategoryUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
45
+ ),
46
+ title: t("edit", { ns: "category" }),
47
+ description: t("editText", { ns: "category" }),
48
+ });
49
+
50
+ return id;
51
+ };
52
+
53
+ return (
54
+ <>
55
+ <PageTitle title={t("category", { ns: "modules" })} />
56
+ <DataPanel
57
+ url="/category"
58
+ layout="table"
59
+ id="category"
60
+ selectable
61
+ columns={[
62
+ { key: "id", header: "ID", width: 64 },
63
+ { key: "name", header: t("name", { ns: "category" }) },
64
+ ]}
65
+ selected={selectedItems as Category[]}
66
+ multiple
67
+ hasSearch
68
+ sortable
69
+ onItemDoubleClick={(item) => openUpdate(item)}
70
+ menuActions={[
71
+ {
72
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
73
+ label: t("edit", { ns: "actions" }),
74
+ tooltip: t("editTooltip", { ns: "category" }),
75
+ handler: (items: Category[]) => {
76
+ if (items.length === 1) openUpdate(items[0]);
77
+ },
78
+ show: "once",
79
+ },
80
+ {
81
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
82
+ label: t("delete", { ns: "actions" }),
83
+ tooltip: t("deleteTooltip", { ns: "category" }),
84
+ variant: "destructive",
85
+ handler: (items: Category[]) => {
86
+ openDelete(items);
87
+ },
88
+ show: "some",
89
+ },
90
+ {
91
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
92
+ label: t("create", { ns: "actions" }),
93
+ tooltip: t("createTooltip", { ns: "category" }),
94
+ variant: "default",
95
+ handler: () => {
96
+ openCreate();
97
+ },
98
+ show: "none",
99
+ },
100
+ ]}
101
+ />
102
+ </>
103
+ );
104
+ }
@@ -10,6 +10,7 @@ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
10
10
  import { Category } from "@/types/models";
11
11
  import { t } from "i18next";
12
12
  import { forwardRef, useImperativeHandle, useRef } from "react";
13
+ import { useTranslation } from "react-i18next";
13
14
 
14
15
  export type CategoryUpdatePanelProps = {
15
16
  data: Category;
@@ -18,6 +19,7 @@ export type CategoryUpdatePanelProps = {
18
19
 
19
20
  export const CategoryUpdatePanel = forwardRef(
20
21
  ({ data, onUpdated }: CategoryUpdatePanelProps, ref) => {
22
+ const { t } = useTranslation(["person-types", "actions"]);
21
23
  const { data: item, isLoading } = useCategoryGet(data.id as number);
22
24
  const { mutate: categoryUpdate } = useCategoryUpdate();
23
25
  const formRef = useRef<FormPanelRef>(null);
@@ -36,7 +36,8 @@ export function requests() {
36
36
  });
37
37
  };
38
38
 
39
- const categoryUpdate = async (id: number, data: Category) => {
39
+ const categoryUpdate = async (params: { id: number; data: Category }) => {
40
+ const { id, data } = params;
40
41
  return request<Category>({
41
42
  url: `/category/${id}`,
42
43
  method: HttpMethod.PATCH,
@@ -0,0 +1,104 @@
1
+ import DataPanel from "@/components/panels/data-panel";
2
+ import { PageTitle } from "@/components/custom/page-title";
3
+ import { usePostDelete } from "@/features/post";
4
+ import { useApp } from "@/hooks/use-app";
5
+ import { isPlural } from "@/lib/utils";
6
+ import { Post } 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 { PostCreatePanel, PostUpdatePanel } from "./components";
11
+
12
+ export default function Page() {
13
+ const [selectedItems, setSelectedItems] = useState<Post[]>([]);
14
+ const { mutate: deletePost } = usePostDelete();
15
+ const { openSheet, confirm, closeSheet } = useApp();
16
+ const { t } = useTranslation(["post", "modules", "actions"]);
17
+
18
+ const openCreate = () => {
19
+ const id = openSheet({
20
+ title: t("create", { ns: "actions" }),
21
+ description: t("createText", { ns: "post" }),
22
+ children: () => <PostCreatePanel onCreated={() => closeSheet(id)} />,
23
+ });
24
+
25
+ return id;
26
+ };
27
+
28
+ const openDelete = (items: Post[]) => {
29
+ return confirm({
30
+ title: `${t("delete", { ns: "actions" })} ${items.length} ${isPlural(items.length) ? t("items", { ns: "actions" }) : t("item", { ns: "actions" })}`,
31
+ description: t("deleteText", { ns: "post" }),
32
+ })
33
+ .then(() =>
34
+ deletePost(
35
+ items.map((item) => item.id).filter((id) => id !== undefined),
36
+ ),
37
+ )
38
+ .catch(() => setSelectedItems(items));
39
+ };
40
+
41
+ const openUpdate = (item: Post) => {
42
+ const id = openSheet({
43
+ children: () => (
44
+ <PostUpdatePanel data={item} onUpdated={() => closeSheet(id)} />
45
+ ),
46
+ title: t("edit", { ns: "post" }),
47
+ description: t("editText", { ns: "post" }),
48
+ });
49
+
50
+ return id;
51
+ };
52
+
53
+ return (
54
+ <>
55
+ <PageTitle title={t("post", { ns: "modules" })} />
56
+ <DataPanel
57
+ url="/post"
58
+ layout="table"
59
+ id="post"
60
+ selectable
61
+ columns={[
62
+ { key: "id", header: "ID", width: 64 },
63
+ { key: "name", header: t("name", { ns: "post" }) },
64
+ ]}
65
+ selected={selectedItems as Post[]}
66
+ multiple
67
+ hasSearch
68
+ sortable
69
+ onItemDoubleClick={(item) => openUpdate(item)}
70
+ menuActions={[
71
+ {
72
+ icon: <IconEdit className="mr-1 w-8 cursor-pointer" />,
73
+ label: t("edit", { ns: "actions" }),
74
+ tooltip: t("editTooltip", { ns: "post" }),
75
+ handler: (items: Post[]) => {
76
+ if (items.length === 1) openUpdate(items[0]);
77
+ },
78
+ show: "once",
79
+ },
80
+ {
81
+ icon: <IconTrash className="mr-1 w-8 cursor-pointer" />,
82
+ label: t("delete", { ns: "actions" }),
83
+ tooltip: t("deleteTooltip", { ns: "post" }),
84
+ variant: "destructive",
85
+ handler: (items: Post[]) => {
86
+ openDelete(items);
87
+ },
88
+ show: "some",
89
+ },
90
+ {
91
+ icon: <IconPlus className="mr-1 w-8 cursor-pointer" />,
92
+ label: t("create", { ns: "actions" }),
93
+ tooltip: t("createTooltip", { ns: "post" }),
94
+ variant: "default",
95
+ handler: () => {
96
+ openCreate();
97
+ },
98
+ show: "none",
99
+ },
100
+ ]}
101
+ />
102
+ </>
103
+ );
104
+ }
@@ -7,6 +7,7 @@ import useEffectAfterFirstUpdate from "@/hooks/use-effect-after-first-update";
7
7
  import { Post } from "@/types/models";
8
8
  import { t } from "i18next";
9
9
  import { forwardRef, useImperativeHandle, useRef } from "react";
10
+ import { useTranslation } from "react-i18next";
10
11
 
11
12
  export type PostUpdatePanelProps = {
12
13
  data: Post;
@@ -15,6 +16,7 @@ export type PostUpdatePanelProps = {
15
16
 
16
17
  export const PostUpdatePanel = forwardRef(
17
18
  ({ data, onUpdated }: PostUpdatePanelProps, ref) => {
19
+ const { t } = useTranslation(["person-types", "actions"]);
18
20
  const { data: item, isLoading } = usePostGet(data.id as number);
19
21
  const { mutate: postUpdate } = usePostUpdate();
20
22
  const formRef = useRef<FormPanelRef>(null);
@@ -35,7 +35,8 @@ export function requests() {
35
35
  });
36
36
  };
37
37
 
38
- const postUpdate = async (id: number, data: Post) => {
38
+ const postUpdate = async (params: { id: number; data: Post }) => {
39
+ const { id, data } = params;
39
40
  return request<Post>({
40
41
  url: `/post/${id}`,
41
42
  method: HttpMethod.PATCH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/blog",
3
- "version": "0.0.1",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,9 +0,0 @@
1
- import { Author } from "@/types/models";
2
- export type AuthorCreatePanelRef = {
3
- submit: () => void;
4
- };
5
- export type AuthorCreatePanelProps = {
6
- onCreated?: (data: Author) => void;
7
- };
8
- export declare const AuthorCreatePanel: any;
9
- //# sourceMappingURL=create-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.d.ts","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,KA4C7B,CAAC"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AuthorCreatePanel = void 0;
7
- const form_panel_1 = __importDefault(require("@/components/custom/form-panel"));
8
- const EnumFieldType_1 = require("@/enums/EnumFieldType");
9
- const person_type_1 = require("@/features/person-type");
10
- const react_1 = require("react");
11
- const react_i18next_1 = require("react-i18next");
12
- exports.AuthorCreatePanel = (0, react_1.forwardRef)(({ onCreated }, ref) => {
13
- const formRef = (0, react_1.useRef)(null);
14
- const { t } = (0, react_i18next_1.useTranslation)(["author", "actions"]);
15
- const { mutateAsync: createAuthor } = (0, person_type_1.useAuthorCreate)();
16
- (0, react_1.useImperativeHandle)(ref, () => ({
17
- submit: () => {
18
- var _a;
19
- (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit();
20
- },
21
- }), [formRef]);
22
- return (<form_panel_1.default ref={formRef} fields={[
23
- {
24
- name: "name",
25
- label: { text: t("name", { ns: "translation" }) },
26
- type: EnumFieldType_1.EnumFieldType.TEXT,
27
- required: true,
28
- },
29
- {
30
- name: "email",
31
- label: { text: t("email", { ns: "translation" }) },
32
- type: EnumFieldType_1.EnumFieldType.TEXT,
33
- required: true,
34
- },
35
- ]} button={{ text: t("create", { ns: "actions" }) }} onSubmit={async (data) => {
36
- const createdData = await createAuthor(data);
37
- if (typeof onCreated === "function") {
38
- onCreated(createdData);
39
- }
40
- }}/>);
41
- });
42
- //# sourceMappingURL=create-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.js","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":";;;;;;AAAA,gFAAyE;AACzE,yDAAsD;AACtD,wDAAyD;AAEzD,iCAAgE;AAChE,iDAA+C;AAUlC,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EACzC,CAAC,EAAE,SAAS,EAA0B,EAAE,GAAG,EAAE,EAAE;IAC7C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,EAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IACpD,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAA,6BAAe,GAAE,CAAC;IAExD,IAAA,2BAAmB,EACjB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,MAAM,EAAE,GAAG,EAAE;;YACX,MAAA,OAAO,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC;YACN;gBACE,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBACjD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;YAED;gBACE,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBAClD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;SACF,CAAC,CACF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CACjD,QAAQ,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;YAC7C,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpC,SAAS,CAAC,WAAW,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { Author } from "@/types/models";
2
- export type AuthorUpdatePanelProps = {
3
- data: Author;
4
- onUpdated?: (data: Author) => void;
5
- };
6
- export declare const AuthorUpdatePanel: any;
7
- //# sourceMappingURL=update-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.d.ts","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,KAsD7B,CAAC"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AuthorUpdatePanel = void 0;
7
- const form_panel_1 = __importDefault(require("@/components/custom/form-panel"));
8
- const overlay_1 = require("@/components/custom/overlay");
9
- const tab_panel_1 = require("@/components/custom/tab-panel");
10
- const EnumFieldType_1 = require("@/enums/EnumFieldType");
11
- const author_1 = require("@/features/author");
12
- const use_effect_after_first_update_1 = __importDefault(require("@/hooks/use-effect-after-first-update"));
13
- const i18next_1 = require("i18next");
14
- const react_1 = require("react");
15
- exports.AuthorUpdatePanel = (0, react_1.forwardRef)(({ data, onUpdated }, ref) => {
16
- const { data: item, isLoading } = (0, author_1.useAuthorGet)(data.id);
17
- const { mutate: authorUpdate } = (0, author_1.useAuthorUpdate)();
18
- const formRef = (0, react_1.useRef)(null);
19
- (0, use_effect_after_first_update_1.default)(() => {
20
- if (item && formRef.current) {
21
- formRef.current.setValuesFromItem(item);
22
- }
23
- }, [item]);
24
- (0, react_1.useImperativeHandle)(ref, () => ({}));
25
- return (<tab_panel_1.TabPanel activeTabIndex={0} tabs={[
26
- {
27
- title: (0, i18next_1.t)("details", { ns: "actions" }),
28
- children: (<overlay_1.Overlay loading={isLoading}>
29
- <form_panel_1.default ref={formRef} fields={[
30
- {
31
- name: "name",
32
- label: { text: (0, i18next_1.t)("name", { ns: "translation" }) },
33
- type: EnumFieldType_1.EnumFieldType.TEXT,
34
- required: true,
35
- },
36
- {
37
- name: "email",
38
- label: { text: (0, i18next_1.t)("email", { ns: "translation" }) },
39
- type: EnumFieldType_1.EnumFieldType.TEXT,
40
- required: true,
41
- },
42
- ]} button={{ text: (0, i18next_1.t)("save", { ns: "actions" }) }} onSubmit={(data) => {
43
- authorUpdate({ id: data.id, data });
44
- if (typeof onUpdated === "function") {
45
- onUpdated(data);
46
- }
47
- }}/>
48
- </overlay_1.Overlay>),
49
- },
50
- ]}/>);
51
- });
52
- //# sourceMappingURL=update-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.js","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":";;;;;;AAAA,gFAAyE;AACzE,yDAAsD;AACtD,6DAAyD;AACzD,yDAAsD;AACtD,8CAAkE;AAClE,0GAA8E;AAE9E,qCAA4B;AAC5B,iCAAgE;AAOnD,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EACzC,CAAC,EAAE,IAAI,EAAE,SAAS,EAA0B,EAAE,GAAG,EAAE,EAAE;IACnD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,EAAY,CAAC,CAAC;IAClE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,wBAAe,GAAE,CAAC;IACnD,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAE3C,IAAA,uCAAyB,EAAC,GAAG,EAAE;QAC7B,IAAI,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAErC,OAAO,CACL,CAAC,oBAAQ,CACP,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,IAAI,CAAC,CAAC;YACJ;gBACE,KAAK,EAAE,IAAA,WAAC,EAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;gBACtC,QAAQ,EAAE,CACR,CAAC,iBAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAC1B;gBAAA,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC;wBACN;4BACE,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,MAAM,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BACjD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;wBAED;4BACE,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,OAAO,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BAClD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;qBACF,CAAC,CACF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAC/C,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjB,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;wBACpC,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;4BACpC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAClB,CAAC;oBACH,CAAC,CAAC,EAEN;cAAA,EAAE,iBAAO,CAAC,CACX;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare function useAuthorCreate(): any;
2
- export declare function useAuthorDelete(): any;
3
- export declare function useAuthorUpdate(): any;
4
- export declare function useAuthorGet(id: number): any;
5
- //# sourceMappingURL=handlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,QAG9B;AAED,wBAAgB,eAAe,QAG9B;AAED,wBAAgB,eAAe,QAG9B;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,OAMtC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAuthorCreate = useAuthorCreate;
4
- exports.useAuthorDelete = useAuthorDelete;
5
- exports.useAuthorUpdate = useAuthorUpdate;
6
- exports.useAuthorGet = useAuthorGet;
7
- const use_default_mutation_1 = require("@/hooks/use-default-mutation");
8
- const react_query_1 = require("@tanstack/react-query");
9
- const requests_1 = require("./requests");
10
- const scope = "author";
11
- function useAuthorCreate() {
12
- const { authorCreate } = (0, requests_1.requests)();
13
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "create", authorCreate);
14
- }
15
- function useAuthorDelete() {
16
- const { authorDelete } = (0, requests_1.requests)();
17
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "delete", authorDelete);
18
- }
19
- function useAuthorUpdate() {
20
- const { authorUpdate } = (0, requests_1.requests)();
21
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "update", authorUpdate);
22
- }
23
- function useAuthorGet(id) {
24
- const { authorGet } = (0, requests_1.requests)();
25
- return (0, react_query_1.useQuery)({
26
- queryKey: [scope, "get"],
27
- queryFn: () => authorGet(id),
28
- });
29
- }
30
- //# sourceMappingURL=handlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":";;AAMA,0CAGC;AAED,0CAGC;AAED,0CAGC;AAED,oCAMC;AA3BD,uEAAkE;AAClE,uDAAiD;AACjD,yCAAsC;AAEtC,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,SAAgB,eAAe;IAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACpC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC3D,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACpC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC3D,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACpC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC3D,CAAC;AAED,SAAgB,YAAY,CAAC,EAAU;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACjC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACxB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;KAC7B,CAAC,CAAC;AACL,CAAC"}
@@ -1,10 +0,0 @@
1
- import { PaginationParams } from "@/types";
2
- import { Author } from "@/types/models";
3
- export declare function requests(): {
4
- authorCreate: (data: Author) => Promise<any>;
5
- authorUpdate: (id: number, data: Author) => Promise<any>;
6
- authorDelete: (ids: number[]) => Promise<any>;
7
- authorList: (params: PaginationParams) => Promise<any>;
8
- authorGet: (id: number) => Promise<any>;
9
- };
10
- //# sourceMappingURL=requests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,wBAAgB,QAAQ;yBAgBY,MAAM;uBAgBR,MAAM,QAAQ,MAAM;wBARnB,MAAM,EAAE;yBArBP,gBAAgB;oBAOrB,MAAM;EAqCpC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requests = requests;
4
- const use_app_1 = require("@/hooks/use-app");
5
- const http_method_1 = require("@/types/http-method");
6
- function requests() {
7
- const { request } = (0, use_app_1.useApp)();
8
- const authorList = async (params) => {
9
- return request({
10
- url: "/author",
11
- params,
12
- });
13
- };
14
- const authorGet = async (id) => {
15
- return request({
16
- url: `/author/${id}`,
17
- });
18
- };
19
- const authorCreate = async (data) => {
20
- return request({
21
- url: "/author",
22
- method: http_method_1.HttpMethod.POST,
23
- data: data,
24
- });
25
- };
26
- const authorDelete = async (ids) => {
27
- return request({
28
- url: "/author",
29
- data: { ids },
30
- method: http_method_1.HttpMethod.DELETE,
31
- });
32
- };
33
- const authorUpdate = async (id, data) => {
34
- return request({
35
- url: `/author/${id}`,
36
- method: http_method_1.HttpMethod.PATCH,
37
- data: data,
38
- });
39
- };
40
- return {
41
- authorCreate,
42
- authorUpdate,
43
- authorDelete,
44
- authorList,
45
- authorGet,
46
- };
47
- }
48
- //# sourceMappingURL=requests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.js","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":";;AAKA,4BA+CC;AApDD,6CAAyC;AAGzC,qDAAiD;AAEjD,SAAgB,QAAQ;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IAE7B,MAAM,UAAU,GAAG,KAAK,EAAE,MAAwB,EAAE,EAAE;QACpD,OAAO,OAAO,CAA2B;YACvC,GAAG,EAAE,SAAS;YACd,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;QACrC,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,WAAW,EAAE,EAAE;SACrB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;QAC1C,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,SAAS;YACd,MAAM,EAAE,wBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,EAAE,GAAa,EAAE,EAAE;QAC3C,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,MAAM,EAAE,wBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,EAAE,EAAU,EAAE,IAAY,EAAE,EAAE;QACtD,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,WAAW,EAAE,EAAE;YACpB,MAAM,EAAE,wBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Category } from "@/types/models";
2
- export type CategoryCreatePanelRef = {
3
- submit: () => void;
4
- };
5
- export type CategoryCreatePanelProps = {
6
- onCreated?: (data: Category) => void;
7
- };
8
- export declare const CategoryCreatePanel: any;
9
- //# sourceMappingURL=create-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.d.ts","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,mBAAmB,KA8B/B,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CategoryCreatePanel = void 0;
27
- const form_panel_1 = __importStar(require("@/components/custom/form-panel"));
28
- const person_type_1 = require("@/features/person-type");
29
- const react_1 = require("react");
30
- const react_i18next_1 = require("react-i18next");
31
- exports.CategoryCreatePanel = (0, react_1.forwardRef)(({ onCreated }, ref) => {
32
- const formRef = (0, react_1.useRef)(null);
33
- const { t } = (0, react_i18next_1.useTranslation)(["category", "actions"]);
34
- const { mutateAsync: createCategory } = (0, person_type_1.useCategoryCreate)();
35
- (0, react_1.useImperativeHandle)(ref, () => ({
36
- submit: () => {
37
- var _a;
38
- (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit();
39
- },
40
- }), [formRef]);
41
- return (<form_panel_1.default ref={formRef} fields={[...(0, form_panel_1.getFieldsLocale)([{ name: "name" }])]} button={{ text: t("create", { ns: "actions" }) }} onSubmit={async (data) => {
42
- const createdData = await createCategory(data);
43
- if (typeof onCreated === "function") {
44
- onCreated(createdData);
45
- }
46
- }}/>);
47
- });
48
- //# sourceMappingURL=create-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.js","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAGwC;AAExC,wDAA2D;AAE3D,iCAAgE;AAChE,iDAA+C;AAUlC,QAAA,mBAAmB,GAAG,IAAA,kBAAU,EAC3C,CAAC,EAAE,SAAS,EAA4B,EAAE,GAAG,EAAE,EAAE;IAC/C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,EAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAA,+BAAiB,GAAE,CAAC;IAE5D,IAAA,2BAAmB,EACjB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,MAAM,EAAE,GAAG,EAAE;;YACX,MAAA,OAAO,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC,CAAC,GAAG,IAAA,4BAAe,EAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CACjD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CACjD,QAAQ,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpC,SAAS,CAAC,WAAW,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { Category } from "@/types/models";
2
- export type CategoryUpdatePanelProps = {
3
- data: Category;
4
- onUpdated?: (data: Category) => void;
5
- };
6
- export declare const CategoryUpdatePanel: any;
7
- //# sourceMappingURL=update-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.d.ts","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,mBAAmB,KAwC/B,CAAC"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.CategoryUpdatePanel = void 0;
30
- const form_panel_1 = __importStar(require("@/components/custom/form-panel"));
31
- const overlay_1 = require("@/components/custom/overlay");
32
- const tab_panel_1 = require("@/components/custom/tab-panel");
33
- const category_1 = require("@/features/category");
34
- const use_effect_after_first_update_1 = __importDefault(require("@/hooks/use-effect-after-first-update"));
35
- const i18next_1 = require("i18next");
36
- const react_1 = require("react");
37
- exports.CategoryUpdatePanel = (0, react_1.forwardRef)(({ data, onUpdated }, ref) => {
38
- const { data: item, isLoading } = (0, category_1.useCategoryGet)(data.id);
39
- const { mutate: categoryUpdate } = (0, category_1.useCategoryUpdate)();
40
- const formRef = (0, react_1.useRef)(null);
41
- (0, use_effect_after_first_update_1.default)(() => {
42
- if (item && formRef.current) {
43
- formRef.current.setValuesFromItem(item);
44
- }
45
- }, [item]);
46
- (0, react_1.useImperativeHandle)(ref, () => ({}));
47
- return (<tab_panel_1.TabPanel activeTabIndex={0} tabs={[
48
- {
49
- title: (0, i18next_1.t)("details", { ns: "actions" }),
50
- children: (<overlay_1.Overlay loading={isLoading}>
51
- <form_panel_1.default ref={formRef} fields={[...(0, form_panel_1.getFieldsLocale)([{ name: "name" }])]} button={{ text: (0, i18next_1.t)("save", { ns: "actions" }) }} onSubmit={(data) => {
52
- categoryUpdate({ id: data.id, data });
53
- if (typeof onUpdated === "function") {
54
- onUpdated(data);
55
- }
56
- }}/>
57
- </overlay_1.Overlay>),
58
- },
59
- ]}/>);
60
- });
61
- //# sourceMappingURL=update-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.js","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAGwC;AACxC,yDAAsD;AACtD,6DAAyD;AAEzD,kDAAwE;AACxE,0GAA8E;AAE9E,qCAA4B;AAC5B,iCAAgE;AAOnD,QAAA,mBAAmB,GAAG,IAAA,kBAAU,EAC3C,CAAC,EAAE,IAAI,EAAE,SAAS,EAA4B,EAAE,GAAG,EAAE,EAAE;IACrD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,EAAY,CAAC,CAAC;IACpE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,4BAAiB,GAAE,CAAC;IACvD,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAE3C,IAAA,uCAAyB,EAAC,GAAG,EAAE;QAC7B,IAAI,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAErC,OAAO,CACL,CAAC,oBAAQ,CACP,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,IAAI,CAAC,CAAC;YACJ;gBACE,KAAK,EAAE,IAAA,WAAC,EAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;gBACtC,QAAQ,EAAE,CACR,CAAC,iBAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAC1B;gBAAA,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC,CAAC,GAAG,IAAA,4BAAe,EAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CACjD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAC/C,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjB,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;wBACtC,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;4BACpC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAClB,CAAC;oBACH,CAAC,CAAC,EAEN;cAAA,EAAE,iBAAO,CAAC,CACX;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare function useCategoryCreate(): any;
2
- export declare function useCategoryDelete(): any;
3
- export declare function useCategoryUpdate(): any;
4
- export declare function useCategoryGet(id: number): any;
5
- //# sourceMappingURL=handlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,QAGhC;AAED,wBAAgB,iBAAiB,QAGhC;AAED,wBAAgB,iBAAiB,QAGhC;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,OAMxC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCategoryCreate = useCategoryCreate;
4
- exports.useCategoryDelete = useCategoryDelete;
5
- exports.useCategoryUpdate = useCategoryUpdate;
6
- exports.useCategoryGet = useCategoryGet;
7
- const use_default_mutation_1 = require("@/hooks/use-default-mutation");
8
- const react_query_1 = require("@tanstack/react-query");
9
- const requests_1 = require("./requests");
10
- const scope = "category";
11
- function useCategoryCreate() {
12
- const { categoryCreate } = (0, requests_1.requests)();
13
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "create", categoryCreate);
14
- }
15
- function useCategoryDelete() {
16
- const { categoryDelete } = (0, requests_1.requests)();
17
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "delete", categoryDelete);
18
- }
19
- function useCategoryUpdate() {
20
- const { categoryUpdate } = (0, requests_1.requests)();
21
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "update", categoryUpdate);
22
- }
23
- function useCategoryGet(id) {
24
- const { categoryGet } = (0, requests_1.requests)();
25
- return (0, react_query_1.useQuery)({
26
- queryKey: [scope, "get"],
27
- queryFn: () => categoryGet(id),
28
- });
29
- }
30
- //# sourceMappingURL=handlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":";;AAMA,8CAGC;AAED,8CAGC;AAED,8CAGC;AAED,wCAMC;AA3BD,uEAAkE;AAClE,uDAAiD;AACjD,yCAAsC;AAEtC,MAAM,KAAK,GAAG,UAAU,CAAC;AAEzB,SAAgB,iBAAiB;IAC/B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACtC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,iBAAiB;IAC/B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACtC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,iBAAiB;IAC/B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACtC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,cAAc,CAAC,EAAU;IACvC,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACnC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACxB,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;KAC/B,CAAC,CAAC;AACL,CAAC"}
@@ -1,10 +0,0 @@
1
- import { PaginationParams } from "@/types";
2
- import { Category } from "@/types/models";
3
- export declare function requests(): {
4
- categoryCreate: (data: Category) => Promise<any>;
5
- categoryUpdate: (id: number, data: Category) => Promise<any>;
6
- categoryDelete: (ids: number[]) => Promise<any>;
7
- categoryList: (params: PaginationParams) => Promise<any>;
8
- categoryGet: (id: number) => Promise<any>;
9
- };
10
- //# sourceMappingURL=requests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,wBAAgB,QAAQ;2BAgBc,QAAQ;yBAgBV,MAAM,QAAQ,QAAQ;0BARrB,MAAM,EAAE;2BArBP,gBAAgB;sBAOrB,MAAM;EAqCtC"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requests = requests;
4
- const use_app_1 = require("@/hooks/use-app");
5
- const http_method_1 = require("@/types/http-method");
6
- const utils_1 = require("@hedhog/utils");
7
- function requests() {
8
- const { request } = (0, use_app_1.useApp)();
9
- const categoryList = async (params) => {
10
- return request({
11
- url: "/category",
12
- params,
13
- });
14
- };
15
- const categoryGet = async (id) => {
16
- return request({
17
- url: `/category/${id}`,
18
- });
19
- };
20
- const categoryCreate = async (data) => {
21
- return request({
22
- url: "/category",
23
- method: http_method_1.HttpMethod.POST,
24
- data: (0, utils_1.formatDataWithLocale)(data),
25
- });
26
- };
27
- const categoryDelete = async (ids) => {
28
- return request({
29
- url: "/category",
30
- data: { ids },
31
- method: http_method_1.HttpMethod.DELETE,
32
- });
33
- };
34
- const categoryUpdate = async (id, data) => {
35
- return request({
36
- url: `/category/${id}`,
37
- method: http_method_1.HttpMethod.PATCH,
38
- data: (0, utils_1.formatDataWithLocale)(data),
39
- });
40
- };
41
- return {
42
- categoryCreate,
43
- categoryUpdate,
44
- categoryDelete,
45
- categoryList,
46
- categoryGet,
47
- };
48
- }
49
- //# sourceMappingURL=requests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.js","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":";;AAMA,4BA+CC;AArDD,6CAAyC;AAGzC,qDAAiD;AACjD,yCAAqD;AAErD,SAAgB,QAAQ;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,KAAK,EAAE,MAAwB,EAAE,EAAE;QACtD,OAAO,OAAO,CAA6B;YACzC,GAAG,EAAE,WAAW;YAChB,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;QACvC,OAAO,OAAO,CAAW;YACvB,GAAG,EAAE,aAAa,EAAE,EAAE;SACvB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;QAC9C,OAAO,OAAO,CAAW;YACvB,GAAG,EAAE,WAAW;YAChB,MAAM,EAAE,wBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAA,4BAAoB,EAAC,IAAI,CAAC;SACjC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,KAAK,EAAE,GAAa,EAAE,EAAE;QAC7C,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,WAAW;YAChB,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,MAAM,EAAE,wBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,KAAK,EAAE,EAAU,EAAE,IAAc,EAAE,EAAE;QAC1D,OAAO,OAAO,CAAW;YACvB,GAAG,EAAE,aAAa,EAAE,EAAE;YACtB,MAAM,EAAE,wBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,IAAA,4BAAoB,EAAC,IAAI,CAAC;SACjC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,cAAc;QACd,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Post } from "@/types/models";
2
- export type PostCreatePanelRef = {
3
- submit: () => void;
4
- };
5
- export type PostCreatePanelProps = {
6
- onCreated?: (data: Post) => void;
7
- };
8
- export declare const PostCreatePanel: any;
9
- //# sourceMappingURL=create-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.d.ts","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAItC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,eAAe,KA0D3B,CAAC"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PostCreatePanel = void 0;
7
- const form_panel_1 = __importDefault(require("@/components/custom/form-panel"));
8
- const EnumFieldType_1 = require("@/enums/EnumFieldType");
9
- const person_type_1 = require("@/features/person-type");
10
- const react_1 = require("react");
11
- const react_i18next_1 = require("react-i18next");
12
- exports.PostCreatePanel = (0, react_1.forwardRef)(({ onCreated }, ref) => {
13
- const formRef = (0, react_1.useRef)(null);
14
- const { t } = (0, react_i18next_1.useTranslation)(["post", "actions"]);
15
- const { mutateAsync: createPost } = (0, person_type_1.usePostCreate)();
16
- (0, react_1.useImperativeHandle)(ref, () => ({
17
- submit: () => {
18
- var _a;
19
- (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit();
20
- },
21
- }), [formRef]);
22
- return (<form_panel_1.default ref={formRef} fields={[
23
- {
24
- name: "title",
25
- label: { text: t("title", { ns: "translation" }) },
26
- type: EnumFieldType_1.EnumFieldType.TEXT,
27
- required: true,
28
- },
29
- {
30
- name: "content",
31
- label: { text: t("content", { ns: "translation" }) },
32
- type: EnumFieldType_1.EnumFieldType.TEXT,
33
- required: true,
34
- },
35
- {
36
- name: "author_id",
37
- label: { text: t("author_id", { ns: "translation" }) },
38
- type: EnumFieldType_1.EnumFieldType.TEXT,
39
- required: true,
40
- },
41
- {
42
- name: "category_id",
43
- label: { text: t("category_id", { ns: "translation" }) },
44
- type: EnumFieldType_1.EnumFieldType.TEXT,
45
- required: true,
46
- },
47
- ]} button={{ text: t("create", { ns: "actions" }) }} onSubmit={async (data) => {
48
- const createdData = await createPost(data);
49
- if (typeof onCreated === "function") {
50
- onCreated(createdData);
51
- }
52
- }}/>);
53
- });
54
- //# sourceMappingURL=create-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-panel.js","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":";;;;;;AAAA,gFAAyE;AACzE,yDAAsD;AACtD,wDAAuD;AAEvD,iCAAgE;AAChE,iDAA+C;AAUlC,QAAA,eAAe,GAAG,IAAA,kBAAU,EACvC,CAAC,EAAE,SAAS,EAAwB,EAAE,GAAG,EAAE,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,EAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAClD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAA,2BAAa,GAAE,CAAC;IAEpD,IAAA,2BAAmB,EACjB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,MAAM,EAAE,GAAG,EAAE;;YACX,MAAA,OAAO,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC;YACN;gBACE,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBAClD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;YAED;gBACE,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBACpD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;YAED;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBACtD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;YAED;gBACE,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;gBACxD,IAAI,EAAE,6BAAa,CAAC,IAAI;gBACxB,QAAQ,EAAE,IAAI;aACf;SACF,CAAC,CACF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CACjD,QAAQ,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpC,SAAS,CAAC,WAAW,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { Post } from "@/types/models";
2
- export type PostUpdatePanelProps = {
3
- data: Post;
4
- onUpdated?: (data: Post) => void;
5
- };
6
- export declare const PostUpdatePanel: any;
7
- //# sourceMappingURL=update-panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.d.ts","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAItC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,eAAe,KAoE3B,CAAC"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PostUpdatePanel = void 0;
7
- const form_panel_1 = __importDefault(require("@/components/custom/form-panel"));
8
- const overlay_1 = require("@/components/custom/overlay");
9
- const tab_panel_1 = require("@/components/custom/tab-panel");
10
- const EnumFieldType_1 = require("@/enums/EnumFieldType");
11
- const post_1 = require("@/features/post");
12
- const use_effect_after_first_update_1 = __importDefault(require("@/hooks/use-effect-after-first-update"));
13
- const i18next_1 = require("i18next");
14
- const react_1 = require("react");
15
- exports.PostUpdatePanel = (0, react_1.forwardRef)(({ data, onUpdated }, ref) => {
16
- const { data: item, isLoading } = (0, post_1.usePostGet)(data.id);
17
- const { mutate: postUpdate } = (0, post_1.usePostUpdate)();
18
- const formRef = (0, react_1.useRef)(null);
19
- (0, use_effect_after_first_update_1.default)(() => {
20
- if (item && formRef.current) {
21
- formRef.current.setValuesFromItem(item);
22
- }
23
- }, [item]);
24
- (0, react_1.useImperativeHandle)(ref, () => ({}));
25
- return (<tab_panel_1.TabPanel activeTabIndex={0} tabs={[
26
- {
27
- title: (0, i18next_1.t)("details", { ns: "actions" }),
28
- children: (<overlay_1.Overlay loading={isLoading}>
29
- <form_panel_1.default ref={formRef} fields={[
30
- {
31
- name: "title",
32
- label: { text: (0, i18next_1.t)("title", { ns: "translation" }) },
33
- type: EnumFieldType_1.EnumFieldType.TEXT,
34
- required: true,
35
- },
36
- {
37
- name: "content",
38
- label: { text: (0, i18next_1.t)("content", { ns: "translation" }) },
39
- type: EnumFieldType_1.EnumFieldType.TEXT,
40
- required: true,
41
- },
42
- {
43
- name: "author_id",
44
- label: { text: (0, i18next_1.t)("author_id", { ns: "translation" }) },
45
- type: EnumFieldType_1.EnumFieldType.TEXT,
46
- required: true,
47
- },
48
- {
49
- name: "category_id",
50
- label: { text: (0, i18next_1.t)("category_id", { ns: "translation" }) },
51
- type: EnumFieldType_1.EnumFieldType.TEXT,
52
- required: true,
53
- },
54
- ]} button={{ text: (0, i18next_1.t)("save", { ns: "actions" }) }} onSubmit={(data) => {
55
- postUpdate({ id: data.id, data });
56
- if (typeof onUpdated === "function") {
57
- onUpdated(data);
58
- }
59
- }}/>
60
- </overlay_1.Overlay>),
61
- },
62
- ]}/>);
63
- });
64
- //# sourceMappingURL=update-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-panel.js","sourceRoot":"","sources":["update-panel.tsx"],"names":[],"mappings":";;;;;;AAAA,gFAAyE;AACzE,yDAAsD;AACtD,6DAAyD;AACzD,yDAAsD;AACtD,0CAA4D;AAC5D,0GAA8E;AAE9E,qCAA4B;AAC5B,iCAAgE;AAOnD,QAAA,eAAe,GAAG,IAAA,kBAAU,EACvC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAwB,EAAE,GAAG,EAAE,EAAE;IACjD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAA,iBAAU,EAAC,IAAI,CAAC,EAAY,CAAC,CAAC;IAChE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,oBAAa,GAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAe,IAAI,CAAC,CAAC;IAE3C,IAAA,uCAAyB,EAAC,GAAG,EAAE;QAC7B,IAAI,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAA,2BAAmB,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAErC,OAAO,CACL,CAAC,oBAAQ,CACP,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,IAAI,CAAC,CAAC;YACJ;gBACE,KAAK,EAAE,IAAA,WAAC,EAAC,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;gBACtC,QAAQ,EAAE,CACR,CAAC,iBAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAC1B;gBAAA,CAAC,oBAAS,CACR,GAAG,CAAC,CAAC,OAAO,CAAC,CACb,MAAM,CAAC,CAAC;wBACN;4BACE,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,OAAO,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BAClD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;wBAED;4BACE,IAAI,EAAE,SAAS;4BACf,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,SAAS,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BACpD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;wBAED;4BACE,IAAI,EAAE,WAAW;4BACjB,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,WAAW,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BACtD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;wBAED;4BACE,IAAI,EAAE,aAAa;4BACnB,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,aAAa,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;4BACxD,IAAI,EAAE,6BAAa,CAAC,IAAI;4BACxB,QAAQ,EAAE,IAAI;yBACf;qBACF,CAAC,CACF,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAA,WAAC,EAAC,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAC/C,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjB,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;wBAClC,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;4BACpC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAClB,CAAC;oBACH,CAAC,CAAC,EAEN;cAAA,EAAE,iBAAO,CAAC,CACX;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare function usePostCreate(): any;
2
- export declare function usePostDelete(): any;
3
- export declare function usePostUpdate(): any;
4
- export declare function usePostGet(id: number): any;
5
- //# sourceMappingURL=handlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,QAG5B;AAED,wBAAgB,aAAa,QAG5B;AAED,wBAAgB,aAAa,QAG5B;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,OAMpC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePostCreate = usePostCreate;
4
- exports.usePostDelete = usePostDelete;
5
- exports.usePostUpdate = usePostUpdate;
6
- exports.usePostGet = usePostGet;
7
- const use_default_mutation_1 = require("@/hooks/use-default-mutation");
8
- const react_query_1 = require("@tanstack/react-query");
9
- const requests_1 = require("./requests");
10
- const scope = "post";
11
- function usePostCreate() {
12
- const { postCreate } = (0, requests_1.requests)();
13
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "create", postCreate);
14
- }
15
- function usePostDelete() {
16
- const { postDelete } = (0, requests_1.requests)();
17
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "delete", postDelete);
18
- }
19
- function usePostUpdate() {
20
- const { postUpdate } = (0, requests_1.requests)();
21
- return (0, use_default_mutation_1.useDefaultMutation)(scope, "update", postUpdate);
22
- }
23
- function usePostGet(id) {
24
- const { postGet } = (0, requests_1.requests)();
25
- return (0, react_query_1.useQuery)({
26
- queryKey: [scope, "get"],
27
- queryFn: () => postGet(id),
28
- });
29
- }
30
- //# sourceMappingURL=handlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["handlers.ts"],"names":[],"mappings":";;AAMA,sCAGC;AAED,sCAGC;AAED,sCAGC;AAED,gCAMC;AA3BD,uEAAkE;AAClE,uDAAiD;AACjD,yCAAsC;AAEtC,MAAM,KAAK,GAAG,MAAM,CAAC;AAErB,SAAgB,aAAa;IAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAClC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAClC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAClC,OAAO,IAAA,yCAAkB,EAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAC/B,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACxB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC"}
@@ -1,10 +0,0 @@
1
- import { PaginationParams } from "@/types";
2
- import { Post } from "@/types/models";
3
- export declare function requests(): {
4
- postCreate: (data: Post) => Promise<any>;
5
- postUpdate: (id: number, data: Post) => Promise<any>;
6
- postDelete: (ids: number[]) => Promise<any>;
7
- postList: (params: PaginationParams) => Promise<any>;
8
- postGet: (id: number) => Promise<any>;
9
- };
10
- //# sourceMappingURL=requests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,wBAAgB,QAAQ;uBAgBU,IAAI;qBAgBN,MAAM,QAAQ,IAAI;sBARjB,MAAM,EAAE;uBArBP,gBAAgB;kBAOrB,MAAM;EAqClC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requests = requests;
4
- const use_app_1 = require("@/hooks/use-app");
5
- const http_method_1 = require("@/types/http-method");
6
- function requests() {
7
- const { request } = (0, use_app_1.useApp)();
8
- const postList = async (params) => {
9
- return request({
10
- url: "/post",
11
- params,
12
- });
13
- };
14
- const postGet = async (id) => {
15
- return request({
16
- url: `/post/${id}`,
17
- });
18
- };
19
- const postCreate = async (data) => {
20
- return request({
21
- url: "/post",
22
- method: http_method_1.HttpMethod.POST,
23
- data: data,
24
- });
25
- };
26
- const postDelete = async (ids) => {
27
- return request({
28
- url: "/post",
29
- data: { ids },
30
- method: http_method_1.HttpMethod.DELETE,
31
- });
32
- };
33
- const postUpdate = async (id, data) => {
34
- return request({
35
- url: `/post/${id}`,
36
- method: http_method_1.HttpMethod.PATCH,
37
- data: data,
38
- });
39
- };
40
- return {
41
- postCreate,
42
- postUpdate,
43
- postDelete,
44
- postList,
45
- postGet,
46
- };
47
- }
48
- //# sourceMappingURL=requests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requests.js","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":";;AAKA,4BA+CC;AApDD,6CAAyC;AAGzC,qDAAiD;AAEjD,SAAgB,QAAQ;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IAE7B,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAwB,EAAE,EAAE;QAClD,OAAO,OAAO,CAAyB;YACrC,GAAG,EAAE,OAAO;YACZ,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;QACnC,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,SAAS,EAAE,EAAE;SACnB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,IAAU,EAAE,EAAE;QACtC,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,wBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,GAAa,EAAE,EAAE;QACzC,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,OAAO;YACZ,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,MAAM,EAAE,wBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,EAAU,EAAE,IAAU,EAAE,EAAE;QAClD,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,SAAS,EAAE,EAAE;YAClB,MAAM,EAAE,wBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,UAAU;QACV,UAAU;QACV,UAAU;QACV,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC"}