@omniumretail/component-library 1.1.85 → 1.1.87
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/bundle.js +1 -1
- package/dist/types/components/CategoryResponse/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +15 -1
- package/src/components/CategoryResponse/index.tsx +6 -5
- package/src/components/Questions/SingleQuestion/index.tsx +4 -4
- package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +1 -1
- package/src/components/ResponsiveTable/index.tsx +3 -1
|
@@ -7,6 +7,7 @@ interface CategoryResponse {
|
|
|
7
7
|
onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
|
|
8
8
|
selectYesNoOption?: any;
|
|
9
9
|
addAction?: (questionId: string, questionAnswerId: string) => void;
|
|
10
|
+
openAction?: (actionId: string) => void;
|
|
10
11
|
addButtons?: boolean;
|
|
11
12
|
fileList?: React.Dispatch<React.SetStateAction<Record<string, UploadFile<any>[]>>>;
|
|
12
13
|
}
|
package/package.json
CHANGED
|
@@ -37,6 +37,10 @@ const Template: Story<any> = (args) => {
|
|
|
37
37
|
// Sua lógica para adicionar a ação, como uma chamada de API ou atualização de estado
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
const handleOpenAction = (questionId: string) => {
|
|
41
|
+
console.log(`Ação adicionada para a pergunta com ID: ${questionId}`);
|
|
42
|
+
};
|
|
43
|
+
|
|
40
44
|
useEffect(() => {
|
|
41
45
|
console.log(serverData);
|
|
42
46
|
}, [serverData])
|
|
@@ -53,6 +57,7 @@ const Template: Story<any> = (args) => {
|
|
|
53
57
|
addButtons
|
|
54
58
|
fileList={setFileLists}
|
|
55
59
|
addAction={handleAddAction}
|
|
60
|
+
openAction={handleOpenAction}
|
|
56
61
|
>
|
|
57
62
|
</CategoryResponse>
|
|
58
63
|
</div>
|
|
@@ -103,7 +108,16 @@ Primary.args = {
|
|
|
103
108
|
"Grade": "0",
|
|
104
109
|
"Note": "Lorem ipsum dolor sit amet, consectetur adipiscing elit Lorem ipsum dolor sit amet, consectetur adipiscing elit",
|
|
105
110
|
"Answer": null,
|
|
106
|
-
"
|
|
111
|
+
"Actions": [
|
|
112
|
+
{
|
|
113
|
+
"Id": "05D49F7B-C293-48AD-980F-D6ED5B3C0DAB",
|
|
114
|
+
"Name": "ettttt"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"Id": "15D49F7B-C293-48AD-980F-D6ED5B3C0DAB",
|
|
118
|
+
"Name": "uttttt"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
107
121
|
"IsOpenAnswer": true,
|
|
108
122
|
"IsNumeric": true
|
|
109
123
|
},
|
|
@@ -18,6 +18,7 @@ interface CategoryResponse {
|
|
|
18
18
|
onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
|
|
19
19
|
selectYesNoOption?: any;
|
|
20
20
|
addAction?: (questionId: string, questionAnswerId: string) => void;
|
|
21
|
+
openAction?: (actionId: string) => void;
|
|
21
22
|
addButtons?: boolean;
|
|
22
23
|
fileList?: React.Dispatch<React.SetStateAction<Record<string, UploadFile<any>[]>>>;
|
|
23
24
|
};
|
|
@@ -333,15 +334,15 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
333
334
|
|
|
334
335
|
}
|
|
335
336
|
|
|
336
|
-
{question?.
|
|
337
|
+
{question?.Actions?.length > 0 &&
|
|
337
338
|
<div className={styles.actionContainer}>
|
|
338
339
|
<span className={styles.note}>{t('components.categoryResponse.actions')}: </span>
|
|
339
340
|
|
|
340
|
-
{question?.
|
|
341
|
-
<
|
|
342
|
-
{action}
|
|
341
|
+
{question?.Actions?.map((action: any, index: number) => (
|
|
342
|
+
<a onClick={() => props.openAction!(action.Id)} key={action.Id} className={index > 0 ? styles.action : ''}>
|
|
343
|
+
{action.Name}
|
|
343
344
|
<br />
|
|
344
|
-
</
|
|
345
|
+
</a>
|
|
345
346
|
))}
|
|
346
347
|
</div>
|
|
347
348
|
}
|
|
@@ -2,7 +2,7 @@ import { DeleteOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/
|
|
|
2
2
|
import { Checkbox, ColorPicker, Form, Input, Select, Space } from 'antd';
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
|
|
8
8
|
export const SingleQuestion = ({
|
|
@@ -66,8 +66,9 @@ export const SingleQuestion = ({
|
|
|
66
66
|
(option: any) => option.NeedsAction === true
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
setEmphasisCheckbox(hasNeedsAction);
|
|
69
|
+
// setEmphasisCheckbox(hasNeedsAction);
|
|
70
70
|
}
|
|
71
|
+
handleChanges();
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
const onCheckboxMultipeChoiseHandler = (checked: boolean) => {
|
|
@@ -85,7 +86,6 @@ export const SingleQuestion = ({
|
|
|
85
86
|
handleChanges();
|
|
86
87
|
};
|
|
87
88
|
|
|
88
|
-
|
|
89
89
|
const questionStyle = classnames({
|
|
90
90
|
[styles.responseTypeQuestion]: responseTypeComponent
|
|
91
91
|
}, [styles.question]);
|
|
@@ -222,7 +222,7 @@ export const SingleQuestion = ({
|
|
|
222
222
|
<Select
|
|
223
223
|
options={answerTypeOptions}
|
|
224
224
|
className={styles.selectResponseType}
|
|
225
|
-
|
|
225
|
+
onChange={handleResponseType}
|
|
226
226
|
dropdownStyle={{ minWidth: 500 }}
|
|
227
227
|
/>
|
|
228
228
|
</Form.Item>
|
|
@@ -21,7 +21,7 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const getButtonLabel = (record: any) => {
|
|
24
|
-
return (record as any)?.type === "Efetivo" ? "Pog" :
|
|
24
|
+
return (record as any)?.type === "Efetivo" ? "Pog" : null;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
return <ResponsiveTable
|
|
@@ -197,6 +197,8 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
197
197
|
|
|
198
198
|
}).filter(el => el !== undefined) as any;
|
|
199
199
|
|
|
200
|
+
console.log();
|
|
201
|
+
|
|
200
202
|
const columnActions = {
|
|
201
203
|
key: 'action',
|
|
202
204
|
title: headingTranslationsKey ? t(`${headingTranslationsKey}.${'action'}`) : 'action',
|
|
@@ -209,7 +211,7 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
209
211
|
|
|
210
212
|
return (
|
|
211
213
|
<Space size="middle">
|
|
212
|
-
{(buttonActionName ||
|
|
214
|
+
{(buttonActionName || buttonLabel) &&
|
|
213
215
|
<Button customClass={buttonActionStyle} onClick={() => buttonActionMethod?.()}>{buttonActionName || buttonLabel}</Button>
|
|
214
216
|
}
|
|
215
217
|
|