@hedhog/blog 0.0.1 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/frontend/author/components/author.screen.ts +105 -0
  2. package/frontend/author/components/create-panel.tsx +10 -3
  3. package/frontend/author/components/update-panel.tsx +7 -2
  4. package/frontend/author/react-query/requests.ts +7 -6
  5. package/frontend/category/components/category.screen.ts +105 -0
  6. package/frontend/category/components/create-panel.tsx +10 -3
  7. package/frontend/category/components/update-panel.tsx +7 -2
  8. package/frontend/category/react-query/requests.ts +7 -6
  9. package/frontend/post/components/create-panel.tsx +10 -3
  10. package/frontend/post/components/post.screen.ts +105 -0
  11. package/frontend/post/components/update-panel.tsx +7 -2
  12. package/frontend/post/react-query/requests.ts +7 -6
  13. package/package.json +1 -1
  14. package/frontend/author/components/create-panel.d.ts +0 -9
  15. package/frontend/author/components/create-panel.d.ts.map +0 -1
  16. package/frontend/author/components/create-panel.js +0 -42
  17. package/frontend/author/components/create-panel.js.map +0 -1
  18. package/frontend/author/components/update-panel.d.ts +0 -7
  19. package/frontend/author/components/update-panel.d.ts.map +0 -1
  20. package/frontend/author/components/update-panel.js +0 -52
  21. package/frontend/author/components/update-panel.js.map +0 -1
  22. package/frontend/author/react-query/handlers.d.ts +0 -5
  23. package/frontend/author/react-query/handlers.d.ts.map +0 -1
  24. package/frontend/author/react-query/handlers.js +0 -30
  25. package/frontend/author/react-query/handlers.js.map +0 -1
  26. package/frontend/author/react-query/requests.d.ts +0 -10
  27. package/frontend/author/react-query/requests.d.ts.map +0 -1
  28. package/frontend/author/react-query/requests.js +0 -48
  29. package/frontend/author/react-query/requests.js.map +0 -1
  30. package/frontend/category/components/create-panel.d.ts +0 -9
  31. package/frontend/category/components/create-panel.d.ts.map +0 -1
  32. package/frontend/category/components/create-panel.js +0 -48
  33. package/frontend/category/components/create-panel.js.map +0 -1
  34. package/frontend/category/components/update-panel.d.ts +0 -7
  35. package/frontend/category/components/update-panel.d.ts.map +0 -1
  36. package/frontend/category/components/update-panel.js +0 -61
  37. package/frontend/category/components/update-panel.js.map +0 -1
  38. package/frontend/category/react-query/handlers.d.ts +0 -5
  39. package/frontend/category/react-query/handlers.d.ts.map +0 -1
  40. package/frontend/category/react-query/handlers.js +0 -30
  41. package/frontend/category/react-query/handlers.js.map +0 -1
  42. package/frontend/category/react-query/requests.d.ts +0 -10
  43. package/frontend/category/react-query/requests.d.ts.map +0 -1
  44. package/frontend/category/react-query/requests.js +0 -49
  45. package/frontend/category/react-query/requests.js.map +0 -1
  46. package/frontend/post/components/create-panel.d.ts +0 -9
  47. package/frontend/post/components/create-panel.d.ts.map +0 -1
  48. package/frontend/post/components/create-panel.js +0 -54
  49. package/frontend/post/components/create-panel.js.map +0 -1
  50. package/frontend/post/components/update-panel.d.ts +0 -7
  51. package/frontend/post/components/update-panel.d.ts.map +0 -1
  52. package/frontend/post/components/update-panel.js +0 -64
  53. package/frontend/post/components/update-panel.js.map +0 -1
  54. package/frontend/post/react-query/handlers.d.ts +0 -5
  55. package/frontend/post/react-query/handlers.d.ts.map +0 -1
  56. package/frontend/post/react-query/handlers.js +0 -30
  57. package/frontend/post/react-query/handlers.js.map +0 -1
  58. package/frontend/post/react-query/requests.d.ts +0 -10
  59. package/frontend/post/react-query/requests.d.ts.map +0 -1
  60. package/frontend/post/react-query/requests.js +0 -48
  61. package/frontend/post/react-query/requests.js.map +0 -1
@@ -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,yDAAs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): 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;SAC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