@omniumretail/component-library 1.1.56 → 1.1.58

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.
package/dist/main.css CHANGED
@@ -19,7 +19,7 @@
19
19
  .lOKzfPUFf3ukLT2wGZaY{display:grid;grid-template-columns:300px auto;gap:16px}.OIrZOBn2f036M5MGzc61,.adDQP_uvIYgNFVC4VdHj{background:#fff;padding:20px;overflow:auto}
20
20
  .yBjbWkudwA_AOwhHrnlc .ant-tree-title{font-weight:var(--font-weight-semibold)}.yBjbWkudwA_AOwhHrnlc button{margin-top:32px;width:100%}.yBjbWkudwA_AOwhHrnlc button:nth-child(3){margin-top:12px}.je000VEfsPqZupGr8ymu{font-size:var(--font-size-body-4);font-weight:600;line-height:100%;color:var(--color-blue);text-transform:uppercase}.tUDGWNXopUejF6zWJloy{margin-top:20px}
21
21
  .O0Juh2loT1HHb612gOA4 .ant-form-item{margin-bottom:0}.O0Juh2loT1HHb612gOA4 .ant-space{display:flex;flex-direction:column;gap:12px;border-bottom:1px solid var(--color-blue);padding:16px 10px}.O0Juh2loT1HHb612gOA4 .ant-space-item{width:100%}.hg7oiINfKCZSUt6dEq4A{display:none}.BAso_dbeoowN7VtxWiKx{display:grid;grid-template-columns:minmax(18px, auto) 1fr 90px;gap:20px;color:var(--color-black);font-size:var(--font-size-body-4);line-height:100%;font-weight:var(--font-weight-medium);align-items:center}.qg_bZXG9dQdJvLBRGuqw{display:grid;grid-template-columns:minmax(18px, auto) 1fr 90px;gap:20px;color:var(--color-grey-dark);font-size:var(--font-size-body-3);align-items:center}.GbZVOtcaUURjn4CweVjF{display:flex;gap:40px;font-size:var(--font-size-body-3);align-items:center}.C3Qrjv76hDipL39fyfzf{display:flex;align-items:center;gap:8px}.y8UJFmCyGQzEQk4XjnI9{display:none}.kknDal3CIbUXI7Lu2wPV{display:flex;align-items:center;justify-content:flex-start;gap:20px}.CIMvcFtQWcBY31wttg2C{min-width:250px}@media(max-width: 768px){.CIMvcFtQWcBY31wttg2C{min-width:150px}}.upuPapYjj1uGowukEEIi{display:none;align-items:center;justify-content:center}.KfrJPVKxY4b6bmXeJL5U{display:flex;align-items:center;justify-content:center;gap:16px}.zRPlv7rfSSACHPLZLs16,.EHyxN8DmDHOLkQDROSV5,.NLIlnBPfo09cpWYzpZ_J{font-size:var(--font-size-body-5);cursor:pointer}.AHIc83P7PkYUr3no83sO{margin-top:24px}
22
- .vw302ajYc4_7bIROncyM{font-size:var(--font-size-body-4);font-weight:600;line-height:100%;color:var(--color-blue);text-transform:uppercase;margin-bottom:32px}.DrsaZTs1Ny6wZ76RwDR9{font-size:var(--font-size-body-2);color:var(--color-black);font-weight:700;text-transform:uppercase}.HVSssNqaNxLcYT_1lxBL{display:grid;grid-template-columns:minmax(200px, 1fr) auto auto auto auto;gap:46px}.ACPbYsV0wNkissVLHcFh{margin-top:16px}Label{margin-bottom:8px}.mIHYAri6ebHm4Oeb1ogj{min-width:200px}@media(max-width: 768px){.mIHYAri6ebHm4Oeb1ogj{min-width:150px}}.g19LZsD26yzPPjBtV31w .ant-select{width:100%}.g19LZsD26yzPPjBtV31w .ant-select-selector{border-color:rgba(var(--color-black-rgb), 0.5) !important;height:50px !important;display:flex;align-items:center}.g19LZsD26yzPPjBtV31w .ant-select-arrow{color:var(--color-black)}.g19LZsD26yzPPjBtV31w .ant-switch{width:30px}
22
+ .vw302ajYc4_7bIROncyM{font-size:var(--font-size-body-4);font-weight:600;line-height:100%;color:var(--color-blue);text-transform:uppercase;margin-bottom:32px}.k3OGGGQwXB0zmX0T61yt{display:flex;gap:32px}.JHuRhb2cRXyGWESiQ2TQ{width:100%}.DrsaZTs1Ny6wZ76RwDR9{font-size:var(--font-size-body-2);color:var(--color-black);font-weight:700;text-transform:uppercase}.HVSssNqaNxLcYT_1lxBL{display:grid;grid-template-columns:minmax(200px, 1fr) auto auto auto auto;gap:46px}.ACPbYsV0wNkissVLHcFh{margin-top:16px}Label{margin-bottom:8px}.mIHYAri6ebHm4Oeb1ogj{min-width:200px}@media(max-width: 768px){.mIHYAri6ebHm4Oeb1ogj{min-width:150px}}.g19LZsD26yzPPjBtV31w .ant-select{width:100%}.g19LZsD26yzPPjBtV31w .ant-select-selector{border-color:rgba(var(--color-black-rgb), 0.5) !important;height:50px !important;display:flex;align-items:center}.g19LZsD26yzPPjBtV31w .ant-select-arrow{color:var(--color-black)}.g19LZsD26yzPPjBtV31w .ant-switch{width:30px}
23
23
  .j8_c3JHTX0JOkT36fF6A{contain:inline-size}.j8_c3JHTX0JOkT36fF6A .HgmGSts5FIH3osmekIYG{height:50px;width:300px}@media(min-width: 1024px){.j8_c3JHTX0JOkT36fF6A .HgmGSts5FIH3osmekIYG{width:450px}}.j8_c3JHTX0JOkT36fF6A .xlaG0XsJDRR9AClqXzzC .ant-tag{background-color:var(--color-orange);color:var(--color-white);padding:6px 16px;max-width:240px}.j8_c3JHTX0JOkT36fF6A .xlaG0XsJDRR9AClqXzzC .anticon-close{color:var(--color-white);font-size:12px}.j8_c3JHTX0JOkT36fF6A .xlaG0XsJDRR9AClqXzzC .anticon-close:hover{color:var(--color-black)}
24
24
  .BWmwZ5nFKyctBZyOAXzg{width:100%}.GWTSauaAl_v9W8o4YPxW{background:rgba(44,45,46,.0509803922);height:100%;position:relative}.GWTSauaAl_v9W8o4YPxW .ant-menu-light{background-color:rgba(0,0,0,0) !important;border-inline-end:none !important}.GWTSauaAl_v9W8o4YPxW .ant-menu-title-content{font-size:17px;line-height:20px;font-weight:var(--font-weight-semibold)}.GWTSauaAl_v9W8o4YPxW .ant-menu-title-content:hover{color:var(--color-orange)}.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-title-content{font-size:15px;line-height:18px;font-weight:var(--font-weight-medium)}.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-item{height:30px;line-height:30px;margin-bottom:16px}.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-item:first-child{margin-top:-10px}.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu{border-top:1px solid var(--color-orange);border-radius:0}.GWTSauaAl_v9W8o4YPxW .ant-menu-item:hover{background-color:initial !important}.GWTSauaAl_v9W8o4YPxW .ant-menu-item-selected,.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-selected>.ant-menu-submenu-title{color:var(--color-orange);background-color:initial}.GWTSauaAl_v9W8o4YPxW .ant-menu-inline .ant-menu-sub.ant-menu-inline{background:initial}.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title{height:50px !important;line-height:50px !important}.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title:hover{background-color:initial !important}.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title .anticon{color:var(--color-orange)}.GWTSauaAl_v9W8o4YPxW .ant-menu-inline.ant-menu-root .ant-menu-item>.ant-menu-title-content{overflow-x:auto;text-overflow:unset}.hWGer1IJ7RdkfQWwYfsw{position:absolute;top:24px;left:24px;right:24px;height:144px}.MD1FhirslDDwd2izGwai{font-size:var(--font-size-body-2);line-height:14px;font-weight:var(--font-weight-light);display:inline-block;padding:12px;cursor:pointer;position:absolute;right:0;top:60px}.RxGn4c38kNq8Ai4ypW_x{position:absolute;top:144px;left:24px;right:24px;bottom:0;overflow-y:auto;overflow-x:hidden;padding-bottom:24px}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{border-radius:10px;background:rgba(0,0,0,.1)}::-webkit-scrollbar-thumb{border-radius:10px;background:rgba(0,0,0,.2)}::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.4)}::-webkit-scrollbar-thumb:active{background:rgba(0,0,0,.9)}
25
25
  .rdjN4ln3xiUoa6Q0NMMm{display:flex;flex-direction:column;gap:16px;height:100%}@media(min-width: 600px){.rdjN4ln3xiUoa6Q0NMMm{display:grid;grid-template-columns:220px auto}}@media(min-width: 768px){.rdjN4ln3xiUoa6Q0NMMm{grid-template-columns:300px auto}}.Q4flbvKEPN6Jx9Cob22I{background:#ebeced;overflow:auto;padding:20px}@media(max-width: 599px){.Q4flbvKEPN6Jx9Cob22I{padding:20px 20px 0 20px;max-height:80px}}.hK3soC6m563VuiLnNutq{background:var(--color-white);overflow:auto;padding:20px}@media(max-width: 599px){.hK3soC6m563VuiLnNutq{height:100%}}.guqqOMHeZE56Bg2p5Ad8{font-size:var(--font-size-body-2);color:var(--color-blue);margin-bottom:12px;font-weight:var(--font-weight-semibold);text-transform:uppercase}@media(min-width: 768px){.guqqOMHeZE56Bg2p5Ad8{font-size:var(--font-size-body-4);margin-bottom:36px}}.wRCQxnQc_MZGDeiY1bcL{padding-bottom:15px;font-weight:var(--font-weight-bold);font-size:var(--font-size-body-2)}@media(min-width: 768px){.wRCQxnQc_MZGDeiY1bcL{font-size:var(--font-size-body-4)}}.JRmeFBsSP1f1HJwarMpc{cursor:pointer}.Y6yF3VITdrKdQzDtqTZX{padding-left:16px}.Y6yF3VITdrKdQzDtqTZX .wRCQxnQc_MZGDeiY1bcL{font-weight:var(--font-weight-semibold)}.Y6yF3VITdrKdQzDtqTZX .aKZCkmPsc0LiPdj3sEeG .Y6yF3VITdrKdQzDtqTZX .wRCQxnQc_MZGDeiY1bcL{font-weight:var(--font-weight-light)}.aKZCkmPsc0LiPdj3sEeG{display:block}.U_3frSKmaOQyTCb9oBkg{color:var(--color-orange)}.GEZDeWAneRLnZQyf4y9l{margin-bottom:16px}@media(min-width: 768px){.GEZDeWAneRLnZQyf4y9l{margin-bottom:24px}}.YcOvMLXE7vKR2Y0_BPRr{font-size:var(--font-size-body-3);color:var(--color-blue);font-weight:var(--font-weight-semibold);margin-bottom:8px}@media(min-width: 768px){.YcOvMLXE7vKR2Y0_BPRr{font-size:var(--font-size-body-4)}}.vlMh_CCr45wbKV4fMhJx{font-size:var(--font-size-body-2);font-weight:var(--font-weight-light);color:var(--color-black)}@media(min-width: 768px){.vlMh_CCr45wbKV4fMhJx{font-size:var(--font-size-body-3)}}.NZ_ohAxNxhxZsCBr2PRA{display:flex;flex-direction:row;gap:12px;margin-bottom:24px}@media(min-width: 768px){.NZ_ohAxNxhxZsCBr2PRA{margin-bottom:36px}}.CArVrMs2ac6JvM1VGLSw{flex-direction:column;border-bottom:1px solid rgba(var(--color-blue-rgb), 0.2);margin-bottom:24px}.CArVrMs2ac6JvM1VGLSw .OpqJ6gab6fPIq3KyckPO{width:100%;border-bottom:none}.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV{width:100%;height:auto}.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV .ant-input{min-height:140px}.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV .ant-form-item{margin-bottom:16px}.OpqJ6gab6fPIq3KyckPO{width:100%;border-bottom:1px solid rgba(var(--color-blue-rgb), 0.2)}.E9TXHxbgaI6LGMZHG9bV{width:100px;height:50px;align-self:flex-end}.xdLvKgnXC4tm2aa6tAap{font-size:var(--font-size-body-2);font-weight:var(--font-weight-semibold);margin-bottom:8px}@media(min-width: 768px){.xdLvKgnXC4tm2aa6tAap{font-size:var(--font-size-body-3)}}.r5obiTduSUBq1uL7oceW{font-weight:var(--font-weight-light);margin-bottom:4px}.CHFuXtnqohUXV_oCAEKD{font-weight:var(--font-weight-light);margin-top:20px;display:flex;gap:4px}._Bw2YaPxzqqQRpeCMde6{word-wrap:break-word;white-space:pre-wrap;max-height:100px;overflow:auto}.bIiuhNuRh643knAaSeyC{font-weight:var(--font-weight-semibold)}.DdqSfNoeh7KPEQiD0Zpe{margin-bottom:unset;width:100%}.sZh7rUlP4vu0LIE2fcab{font-weight:var(--font-weight-light);margin-bottom:4px;margin-top:16px}.mdSJ5YgFou8MwSkVypYb{margin-left:46px;margin-top:12px}.AvKaftoXc2t7E53rqtq6{display:flex;flex-direction:row;gap:4px;margin-top:12px;margin-bottom:12px;width:100%}.SgT02NKW7ogui8ih5ehj{color:var(--color-black);background-color:var(--color-white);border:1px var(--color-black) solid;min-width:100px;height:20px;font-size:10px;padding:unset}@media(max-width: 767px){.SgT02NKW7ogui8ih5ehj{min-width:0px}}.SgT02NKW7ogui8ih5ehj:hover{background-color:var(--color-grey-light);color:var(--color-black) !important;border:1px var(--color-black) solid !important}.WPOztO5lxS5PXlAz75dE{color:var(--color-black);background-color:var(--color-white);border:1px var(--color-black) solid;min-width:100px;height:20px;font-size:10px;padding:unset}@media(max-width: 767px){.WPOztO5lxS5PXlAz75dE{min-width:0px}}.WPOztO5lxS5PXlAz75dE:hover{background-color:var(--color-grey-light);color:var(--color-black) !important;border:1px var(--color-black) solid !important}.ant-upload-wrapper{line-height:12px}.ant-upload-wrapper .ant-upload-list .ant-upload-list-item{max-width:100px}
@@ -4,6 +4,7 @@ interface categoryContent {
4
4
  categorySidebarData: any;
5
5
  chooseResponseType?: boolean;
6
6
  responseTypeOptions?: any;
7
+ hasHeader?: boolean;
7
8
  }
8
9
  export declare const CategoryContent: (props: categoryContent) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -1,7 +1,8 @@
1
1
  export interface Questions {
2
2
  grade: string;
3
- questions: string;
3
+ question: string;
4
4
  info: string;
5
+ responseType?: string;
5
6
  }
6
7
  export interface Data {
7
8
  categoryName: string;
@@ -21,6 +22,7 @@ interface SidebarProps {
21
22
  categorySidebarInfo: any;
22
23
  categoryContentFinalData: any;
23
24
  data: DataNode[];
25
+ hasHeader?: boolean;
24
26
  }
25
27
  export declare const CategorySidebar: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
26
28
  export {};
@@ -4,6 +4,7 @@ interface Category {
4
4
  serverReadyData: any;
5
5
  chooseResponse?: boolean;
6
6
  responseTypeOptions?: any;
7
+ hasHeader?: boolean;
7
8
  }
8
9
  export declare const Category: (props: Category) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -1 +1 @@
1
- export declare const SingleQuestion: ({ key, provided, snapshot, remove, name, showGrade, handleChanges, showCheckbox, responseTypeOptions, ...restField }: any) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const SingleQuestion: ({ key, provided, snapshot, remove, name, showGrade, handleChanges, showCheckbox, responseTypeOptions, hasHeader, ...restField }: any) => import("react/jsx-runtime").JSX.Element;
@@ -3,5 +3,6 @@ export interface QuestionsProps {
3
3
  showCheckbox?: boolean;
4
4
  handleChanges: any;
5
5
  responseTypeOptions: any;
6
+ hasHeader?: boolean;
6
7
  }
7
8
  export declare const Questions: (props: QuestionsProps) => import("react/jsx-runtime").JSX.Element;
@@ -42,6 +42,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
42
42
  width: string;
43
43
  }[];
44
44
  buttonActionName?: string;
45
+ buttonActionLabel?: (record: any) => string;
45
46
  buttonActionMethod?: () => void;
46
47
  buttonActionStyle?: string;
47
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.56",
3
+ "version": "1.1.58",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -14,95 +14,126 @@ const Template: Story<any> = (args) => {
14
14
  console.log(serverData);
15
15
  }, [serverData])
16
16
 
17
- return <Category {...args} chooseResponse serverReadyData={setServerData} data={[
17
+ const getAnswerTypeOptions = [
18
18
  {
19
- "title": "2 (Q: 0) (G: 2)",
20
- "key": "0",
21
- "data": {
22
- "categoryName": "2",
23
- "openAnswer": false,
24
- "isYesOrNo": true,
25
- "generalEvaluationLevel": "0",
26
- "grade": "2",
27
- "questions": [
28
- {
29
- "emphasis": true,
30
- "info": "lol",
31
- "mandatory": false,
32
- "question": ""
33
- }
34
- ]
35
- },
36
- "children": []
37
- },
38
- {
39
- "title": "1 (Q: 0) (G: 1)",
40
- "key": "1",
41
- "data": {
42
- "categoryName": "1",
43
- "openAnswer": false,
44
- "isYesOrNo": false,
45
- "generalEvaluationLevel": "0",
46
- "grade": "1",
47
- "questions": []
48
- },
49
- "children": [
19
+ "Id": "CD8D0F30-6229-4BA9-9888-4398CB21D392",
20
+ "Name": "Resposta Numérica",
21
+ "IsOpenAnswer": false,
22
+ "IsCheckBox": false,
23
+ "IsNumeric": true,
24
+ "HasGrade": true,
25
+ "IsEmphasis": false,
26
+ "State": "Finished",
27
+ "Grade": 4,
28
+ "Options": [
50
29
  {
51
- "title": "1.1 (Q: 0) (G: 1.1)",
52
- "key": "1.0",
53
- "data": {
54
- "categoryName": "1.1",
55
- "openAnswer": false,
56
- "isYesOrNo": false,
57
- "generalEvaluationLevel": "0",
58
- "grade": "1.1",
59
- "questions": []
60
- },
61
- "children": [
62
- {
63
- "title": "1.1.1 (Q: 0) (G: 1.1.1)",
64
- "key": "1.0.0",
65
- "data": {
66
- "categoryName": "1.1.1",
67
- "openAnswer": false,
68
- "isYesOrNo": false,
69
- "generalEvaluationLevel": "0",
70
- "grade": "1.1.1",
71
- "questions": []
72
- },
73
- "children": []
74
- }
75
- ]
30
+ "Value": "string",
31
+ "Grade": 5,
32
+ "Color": "string",
33
+ "NeedsAction": true
76
34
  }
77
- ]
35
+ ],
36
+ "CreateDate": "2024-02-29T10:21:18.448Z",
37
+ "UpdateDate": "2024-06-04T14:51:29.942Z",
38
+ "StartDate": "2024-06-04T14:51:29.942Z",
39
+ "Status": "A"
78
40
  },
79
41
  {
80
- "title": "3 (Q: 0) (G: 3)",
81
- "key": "2",
82
- "data": {
83
- "categoryName": "3",
84
- "openAnswer": true,
85
- "isYesOrNo": false,
86
- "generalEvaluationLevel": "0",
87
- "grade": "3",
88
- "questions": []
89
- },
90
- "children": []
91
- }
92
- ]} responseTypeOptions={[
93
- {
94
- "value": "B867BEA8-E0A4-44D2-BBDA-7CB89334D80E",
95
- "label": "teste3Update",
42
+ "Id": "DF873E84-1941-45E1-84C5-D2D12A0E305D",
43
+ "Name": "Sim ou Não",
44
+ "IsOpenAnswer": false,
45
+ "IsCheckBox": false,
46
+ "IsNumeric": false,
47
+ "HasGrade": false,
48
+ "IsEmphasis": false,
49
+ "State": "Draft",
50
+ "Grade": 0,
51
+ "Options": [
52
+ {
53
+ "Value": "Sim",
54
+ "Grade": 5,
55
+ "Color": "5B95E5D8-6E78-4B53-8196-CD6996BB824A",
56
+ "NeedsAction": false
57
+ },
58
+ {
59
+ "Value": "Nao",
60
+ "Grade": 10,
61
+ "Color": "",
62
+ "NeedsAction": true
63
+ }
64
+ ],
65
+ "CreateDate": "2024-04-12T14:58:32.085Z",
66
+ "UpdateDate": "2024-04-12T14:58:32.085Z",
67
+ "StartDate": "0001-01-01T00:00:00Z",
68
+ "Status": "A"
96
69
  },
97
70
  {
98
- "value": "B8267BEA8-E0A4-44D2-BBDA-7CB89334D80E",
99
- "label": "test2eUpdate",
71
+ "Id": "B867BEA8-E0A4-44D2-BBDA-7CB89334D80E",
72
+ "Name": null,
73
+ "IsOpenAnswer": false,
74
+ "IsCheckBox": false,
75
+ "IsNumeric": false,
76
+ "HasGrade": false,
77
+ "IsEmphasis": false,
78
+ "State": "Draft",
79
+ "Grade": 0,
80
+ "Options": [
81
+ {
82
+ "Value": "Sim",
83
+ "Grade": 5,
84
+ "Color": "5B95E5D8-6E78-4B53-8196-CD6996BB824A",
85
+ "NeedsAction": false
86
+ },
87
+ {
88
+ "Value": "Nao",
89
+ "Grade": 10,
90
+ "Color": "",
91
+ "NeedsAction": true
92
+ }
93
+ ],
94
+ "CreateDate": "2024-04-12T14:58:32.085Z",
95
+ "UpdateDate": "2024-04-12T14:58:32.085Z",
96
+ "StartDate": "0001-01-01T00:00:00Z",
97
+ "Status": "A"
100
98
  },
101
99
  {
102
- "value": "B867B4EA8-E0A4-44D2-BBDA-7CB89334D80E",
103
- "label": "testeU4pdate",
100
+ "Id": "058D4541-8739-49C2-85D0-A6BF3BA19E4E",
101
+ "Name": "Verdade ou mentira",
102
+ "IsOpenAnswer": false,
103
+ "IsCheckBox": false,
104
+ "IsNumeric": false,
105
+ "HasGrade": false,
106
+ "IsEmphasis": false,
107
+ "State": "Finished",
108
+ "Grade": 0,
109
+ "Options": [
110
+ {
111
+ "Value": "Verdadeiro",
112
+ "Grade": 1,
113
+ "Color": "5B95E5D8-6E78-4B53-8196-CD6996BB824A",
114
+ "NeedsAction": false
115
+ },
116
+ {
117
+ "Value": "Mentira",
118
+ "Grade": 0,
119
+ "Color": "5B95E5D8-6E78-4B53-8196-CD6996BB824A",
120
+ "NeedsAction": true
121
+ }
122
+ ],
123
+ "CreateDate": "2024-04-18T16:11:59.622Z",
124
+ "UpdateDate": "2024-04-18T16:12:13.135Z",
125
+ "StartDate": "2024-04-18T16:12:13.135Z",
126
+ "Status": "A"
104
127
  }
105
- ]}></Category>
128
+ ]
129
+
130
+ const answerTypeOptions = getAnswerTypeOptions?.map((answerType) => ({
131
+ value: answerType?.Id,
132
+ label: answerType?.Name
133
+ }));
134
+
135
+
136
+ return <Category {...args} chooseResponse serverReadyData={setServerData} responseTypeOptions={answerTypeOptions} hasHeader data={[]}></Category>
106
137
  };
107
138
 
108
139
  export const Primary = Template.bind({});
@@ -15,6 +15,7 @@ interface categoryContent {
15
15
  categorySidebarData: any;
16
16
  chooseResponseType?: boolean;
17
17
  responseTypeOptions?: any;
18
+ hasHeader?: boolean;
18
19
  }
19
20
 
20
21
  const defaultInitialValues = {
@@ -30,7 +31,8 @@ export const CategoryContent = (props: categoryContent) => {
30
31
  categoryContentShow,
31
32
  categorySidebarData,
32
33
  chooseResponseType,
33
- responseTypeOptions
34
+ responseTypeOptions,
35
+ hasHeader
34
36
  } = props;
35
37
 
36
38
  const [contentInfo, setContentInfo] = useState<any>(defaultInitialValues);
@@ -79,6 +81,8 @@ export const CategoryContent = (props: categoryContent) => {
79
81
  setSwitchYesOrNoAnswStatus(initialValues?.isYesOrNo || false);
80
82
  }, [form, initialValues]);
81
83
 
84
+ console.log();
85
+
82
86
  return (
83
87
  <div className={styles.categoryContent}>
84
88
  <div className={styles.title}>{t('components.categoryContent.editCategory')}</div>
@@ -98,17 +102,41 @@ export const CategoryContent = (props: categoryContent) => {
98
102
  form={form}
99
103
  >
100
104
  <div className={styles.formHeader}>
101
- <div className={styles.category}>
102
- <Label isUppercase>
103
- {t('components.categoryContent.categoryName')}
104
- </Label>
105
- <Form.Item
106
- name={['categoryName']}
107
- rules={[{ required: true, message: t('components.categoryContent.categoryNameError')! }]}
108
- validateTrigger="onBlur"
109
- >
110
- <InputField placeholder={t('components.categoryContent.categoryName')!} onBlur={handleInputChange} />
111
- </Form.Item>
105
+ <div className={styles.categoryNameContainer}>
106
+ <div className={styles.categoryName}>
107
+ <Label isUppercase>
108
+ {t('components.categoryContent.categoryName')}
109
+ </Label>
110
+ <Form.Item
111
+ name={['categoryName']}
112
+ rules={[{ required: true, message: t('components.categoryContent.categoryNameError')! }]}
113
+ validateTrigger="onBlur"
114
+ >
115
+ <InputField
116
+ disabled={categorySidebarData?.data?.key === "0" && hasHeader}
117
+ placeholder={t('components.categoryContent.categoryName')!}
118
+ onBlur={handleInputChange}
119
+ />
120
+ </Form.Item>
121
+ </div>
122
+
123
+ { categorySidebarData?.data?.key === "0" && hasHeader &&
124
+ <div className={styles.categoryName}>
125
+ <Label isUppercase>
126
+ {t('components.categoryContent.tamplateName')}
127
+ </Label>
128
+ <Form.Item
129
+ name={['name']}
130
+ rules={[{ required: true, message: t('components.categoryContent.templateNameError')! }]}
131
+ validateTrigger="onBlur"
132
+ >
133
+ <InputField
134
+ placeholder={t('components.categoryContent.tamplateName')!}
135
+ onBlur={handleInputChange}
136
+ />
137
+ </Form.Item>
138
+ </div>
139
+ }
112
140
  </div>
113
141
 
114
142
  {categorySidebarData?.data?.children?.length > 0 &&
@@ -214,6 +242,7 @@ export const CategoryContent = (props: categoryContent) => {
214
242
  showCheckbox={chooseResponseType && true}
215
243
  handleChanges={handleInputChange}
216
244
  responseTypeOptions={responseTypeOptions}
245
+ hasHeader={categorySidebarData?.data?.key === "0" && hasHeader}
217
246
  />
218
247
  </Form.Item>
219
248
  </div>
@@ -7,6 +7,15 @@
7
7
  margin-bottom: 32px;
8
8
  }
9
9
 
10
+ .categoryNameContainer {
11
+ display: flex;
12
+ gap: 32px;
13
+ }
14
+
15
+ .categoryName {
16
+ width: 100%;
17
+ }
18
+
10
19
  .uncheckedCategory {
11
20
  font-size: var(--font-size-body-2);
12
21
  color: var(--color-black);
@@ -8,8 +8,9 @@ import { t } from 'i18next';
8
8
 
9
9
  export interface Questions {
10
10
  grade: string;
11
- questions: string;
11
+ question: string;
12
12
  info: string;
13
+ responseType?: string;
13
14
  }
14
15
  export interface Data {
15
16
  categoryName: string;
@@ -30,6 +31,7 @@ interface SidebarProps {
30
31
  categorySidebarInfo: any;
31
32
  categoryContentFinalData: any;
32
33
  data: DataNode[];
34
+ hasHeader?: boolean;
33
35
  }
34
36
 
35
37
  function get_element_by_index(data: DataNode[], index: string | number): DataNode | null {
@@ -81,10 +83,49 @@ export const CategorySidebar = (props: SidebarProps) => {
81
83
  const {
82
84
  categoryContentData,
83
85
  categoryContentFinalData,
84
- data
86
+ data,
87
+ hasHeader
85
88
  } = props;
86
89
 
87
- const [gData, setGData] = useState(data);
90
+ const [gData, setGData] = useState<DataNode[]>(() => {
91
+ // Adiciona a categoria "Header" se hasHeader for true
92
+ if (hasHeader && data?.length === 0) {
93
+ const headerCategory: DataNode = {
94
+ title: t('components.category.header'),
95
+ key: '0',
96
+ data: {
97
+ categoryName: t('components.category.header'),
98
+ generalEvaluationLevel: '',
99
+ grade: '',
100
+ openAnswer: false,
101
+ questions: [
102
+ {
103
+ grade: '',
104
+ question: 'Loja',
105
+ info: '',
106
+ responseType: '-1'
107
+ },
108
+ {
109
+ grade: '',
110
+ question: 'Autor',
111
+ info: '',
112
+ responseType: '-1'
113
+ },
114
+ {
115
+ grade: '',
116
+ question: 'Localidade',
117
+ info: '',
118
+ responseType: '-1'
119
+ }
120
+ ]
121
+ },
122
+ children: []
123
+ };
124
+ return [headerCategory, ...data];
125
+ }
126
+ return data;
127
+ });
128
+
88
129
  const [expandedKeys] = useState([]);
89
130
  const [sidebarInfo, setSidebarInfo] = useState<any>(undefined);
90
131
 
@@ -100,6 +141,10 @@ export const CategorySidebar = (props: SidebarProps) => {
100
141
  const { data: nodeData } = info.node as DataNode;
101
142
  const questions: Questions[] | undefined = nodeData?.questions;
102
143
 
144
+ if (hasHeader && (dragKey === '0' || dropKey === '0')) {
145
+ return;
146
+ }
147
+
103
148
  if (questions && questions.length > 0) {
104
149
  // console.log('you cant add a subcategory to a category with questions');
105
150
  return;
@@ -166,15 +211,22 @@ export const CategorySidebar = (props: SidebarProps) => {
166
211
  }
167
212
  }
168
213
 
169
- function generateCategoryKeys(categories: any[], parentKey: string = ''): any[] {
170
- let keyCounter = 0;
171
- return categories.map((category: any, index: number) => {
172
- const categoryKey = `${parentKey}${parentKey ? '.' : ''}${keyCounter++}`;
173
- let children: any = [];
214
+ function generateCategoryKeys(categories: DataNode[], parentKey: string = ''): DataNode[] {
215
+ let keyCounter = parentKey === '' ? 1 : parseInt(parentKey, 10) + 1; // Inicia o contador de chaves
216
+
217
+ return categories.map((category: DataNode) => {
218
+ if (hasHeader && (category.key === '0')) {
219
+ return category; // Mantém a chave do Header fixa
220
+ }
221
+
222
+ const categoryKey = `${keyCounter++}`; // Incrementa o contador para cada categoria
223
+
224
+ let children: DataNode[] = [];
174
225
  if (category.children) {
175
- children = generateCategoryKeys(category.children, categoryKey);
226
+ children = generateCategoryKeys(category.children, categoryKey); // Gera chaves para os filhos recursivamente
176
227
  }
177
- return { ...category, key: categoryKey, children };
228
+
229
+ return { ...category, key: categoryKey, children }; // Atualiza a chave e os filhos
178
230
  });
179
231
  }
180
232
 
@@ -240,15 +292,15 @@ export const CategorySidebar = (props: SidebarProps) => {
240
292
  <div className={styles.categorySidebar}>
241
293
  <div className={styles.title}>Categorias</div>
242
294
  <Button icon={<PlusOutlined />} onClick={addCategory}>
243
- { t('components.categorySidBar.addCategory') }
295
+ {t('components.categorySidBar.addCategory')}
244
296
  </Button>
245
297
 
246
298
  {
247
- sidebarInfo &&
248
- <Button icon={<MinusOutlined />} onClick={removeCategory}>
249
- { t('components.categorySidBar.removeCategory') }
250
- </Button>
251
- }
299
+ sidebarInfo && (hasHeader ? sidebarInfo[0] !== '0' : true) && (
300
+ <Button icon={<MinusOutlined />} onClick={removeCategory}>
301
+ {t('components.categorySidBar.removeCategory')}
302
+ </Button>
303
+ )}
252
304
 
253
305
 
254
306
  <div className={styles.categoryViewer}>
@@ -8,13 +8,15 @@ interface Category {
8
8
  serverReadyData: any;
9
9
  chooseResponse?: boolean;
10
10
  responseTypeOptions?: any;
11
+ hasHeader?: boolean;
11
12
  }
12
13
 
13
14
  export const Category = (props: Category) => {
14
15
  const {
15
16
  data,
16
17
  chooseResponse,
17
- responseTypeOptions
18
+ responseTypeOptions,
19
+ hasHeader
18
20
  } = props;
19
21
 
20
22
  const [categoryContentInfo, setCategoryContentInfo] = useState<any>();
@@ -38,6 +40,7 @@ export const Category = (props: Category) => {
38
40
  categoryContentData={categoryContentInfo}
39
41
  data={data}
40
42
  categoryContentFinalData={setFinalData}
43
+ hasHeader={hasHeader}
41
44
  />
42
45
  </div>
43
46
  <div className={styles.contentWrapper}>
@@ -47,6 +50,7 @@ export const Category = (props: Category) => {
47
50
  categoryContentInfo={setCategoryContentInfo}
48
51
  categoryContentShow={showContent}
49
52
  categorySidebarData={categorySidebarInfo}
53
+ hasHeader={hasHeader}
50
54
  />
51
55
  </div>
52
56
  </div>
@@ -5,7 +5,7 @@ import styles from './styles.module.scss';
5
5
  import { useState } from 'react';
6
6
  import { Select } from 'antd';
7
7
 
8
- export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, handleChanges, showCheckbox, responseTypeOptions, ...restField }: any) => {
8
+ export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, handleChanges, showCheckbox, responseTypeOptions, hasHeader, ...restField }: any) => {
9
9
  const [mandatoryCheckbox, setMandatoryCheckbox] = useState<boolean>(false);
10
10
  const [emphasisCheckbox, setEmphasisCheckbox] = useState<boolean>(false);
11
11
 
@@ -88,29 +88,34 @@ export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrad
88
88
  <div className={styles.questionFooter}>
89
89
  <div />
90
90
 
91
- <div className={styles.checkboxContainer}>
92
- <Form.Item
93
- {...restField}
94
- name={[name, 'mandatory']}
95
- valuePropName='checked'
96
- >
97
- <Checkbox onChange={(e) => onCheckboxMandatoryHandler(e.target.checked)} checked={mandatoryCheckbox} />
98
- </Form.Item>
99
-
100
- <span>{t('components.category.mandatoryAnswer')}</span>
101
- </div>
102
-
103
- <div className={styles.checkboxContainer}>
104
- <Form.Item
105
- {...restField}
106
- name={[name, 'emphasis']}
107
- valuePropName='checked'
108
- >
109
- <Checkbox onChange={(e) => onCheckboxEmphasisHandler(e.target.checked)} checked={emphasisCheckbox} />
110
- </Form.Item>
111
-
112
- <span>{t('components.category.emphasisAnswer')}</span>
113
- </div>
91
+ {!hasHeader &&
92
+ <>
93
+
94
+ <div className={styles.checkboxContainer}>
95
+ <Form.Item
96
+ {...restField}
97
+ name={[name, 'mandatory']}
98
+ valuePropName='checked'
99
+ >
100
+ <Checkbox onChange={(e) => onCheckboxMandatoryHandler(e.target.checked)} checked={mandatoryCheckbox} />
101
+ </Form.Item>
102
+
103
+ <span>{t('components.category.mandatoryAnswer')}</span>
104
+ </div>
105
+
106
+ <div className={styles.checkboxContainer}>
107
+ <Form.Item
108
+ {...restField}
109
+ name={[name, 'emphasis']}
110
+ valuePropName='checked'
111
+ >
112
+ <Checkbox onChange={(e) => onCheckboxEmphasisHandler(e.target.checked)} checked={emphasisCheckbox} />
113
+ </Form.Item>
114
+
115
+ <span>{t('components.category.emphasisAnswer')}</span>
116
+ </div>
117
+ </>
118
+ }
114
119
 
115
120
  <div className={styles.checkboxContainer}>
116
121
  <Form.Item