@omniumretail/component-library 1.1.94 → 1.1.95
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/ResponsiveTable/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Category/Category.stories.tsx +1 -1
- package/src/components/Questions/SingleQuestion/index.tsx +21 -15
- package/src/components/ResponsiveTable/index.tsx +5 -2
- package/src/locales/en.json +1 -1
- package/src/locales/es.json +1 -1
- package/src/locales/pt.json +1 -1
|
@@ -44,6 +44,6 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
44
44
|
buttonActionName?: string;
|
|
45
45
|
buttonActionLabel?: (record: any) => string | null;
|
|
46
46
|
buttonActionMethod?: () => void;
|
|
47
|
-
buttonActionStyle?: string;
|
|
47
|
+
buttonActionStyle?: string | ((record: any) => any);
|
|
48
48
|
}
|
|
49
49
|
export declare const ResponsiveTable: (props: ResponsiveTableCustomProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -24,10 +24,14 @@ export const SingleQuestion = ({
|
|
|
24
24
|
const [emphasisCheckbox, setEmphasisCheckbox] = useState<boolean>(false);
|
|
25
25
|
const [multipleChoiseCheckbox, setMultipleChoiseCheckbox] = useState<boolean>(false);
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const filteredResponsesMultiple = responseTypeOptions
|
|
28
28
|
?.filter((item: { IsMultipleChoise: any; }) => item.IsMultipleChoise)
|
|
29
29
|
?.map((item: { Id: any; }) => item.Id);
|
|
30
30
|
|
|
31
|
+
const filteredResponsesEmphasised = responseTypeOptions
|
|
32
|
+
?.filter((item: { IsEmphasis: any; }) => item.IsEmphasis)
|
|
33
|
+
?.map((item: { Id: any; }) => item.Id);
|
|
34
|
+
|
|
31
35
|
const sortedAnswerTypeOptions = responseTypeOptions?.sort((a: any, b: any) => {
|
|
32
36
|
return Number(a.IsMultipleChoise) - Number(b.IsMultipleChoise);
|
|
33
37
|
});
|
|
@@ -180,23 +184,25 @@ export const SingleQuestion = ({
|
|
|
180
184
|
<span>{t('components.category.mandatoryAnswer')}</span>
|
|
181
185
|
</div>
|
|
182
186
|
|
|
183
|
-
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
{filteredResponsesEmphasised?.includes(form.getFieldsValue().questions?.[name]?.responseType) &&
|
|
188
|
+
<div className={styles.checkboxContainer}>
|
|
189
|
+
<Form.Item
|
|
190
|
+
{...restField}
|
|
191
|
+
name={[name, 'emphasis']}
|
|
192
|
+
valuePropName='checked'
|
|
188
193
|
// getValueProps={() => ({ checked: emphasisCheckbox })}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
>
|
|
195
|
+
<Checkbox
|
|
196
|
+
onChange={(e) => onCheckboxEmphasisHandler(e.target.checked)}
|
|
197
|
+
checked={emphasisCheckbox}
|
|
198
|
+
/>
|
|
199
|
+
</Form.Item>
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
<span>{t('components.category.emphasisAnswer')}</span>
|
|
202
|
+
</div>
|
|
203
|
+
}
|
|
198
204
|
|
|
199
|
-
{
|
|
205
|
+
{filteredResponsesMultiple?.includes(form.getFieldsValue().questions?.[name]?.responseType) &&
|
|
200
206
|
< div className={styles.checkboxContainer}>
|
|
201
207
|
<Form.Item
|
|
202
208
|
{...restField}
|
|
@@ -50,7 +50,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
50
50
|
buttonActionName?: string;
|
|
51
51
|
buttonActionLabel?: (record: any) => string | null;
|
|
52
52
|
buttonActionMethod?: () => void;
|
|
53
|
-
buttonActionStyle?: string;
|
|
53
|
+
buttonActionStyle?: string | ((record: any) => any);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
@@ -206,11 +206,14 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
206
206
|
render: (_: any, record: any) => {
|
|
207
207
|
if (!items?.[0]) return null;
|
|
208
208
|
const buttonLabel = buttonActionLabel ? buttonActionLabel(record) : null;
|
|
209
|
+
const buttonClass = typeof buttonActionStyle === 'function'
|
|
210
|
+
? buttonActionStyle(record) // Se for uma função, chama com o `record`
|
|
211
|
+
: buttonActionStyle || ''; // Se for string, usa diretamente
|
|
209
212
|
|
|
210
213
|
return (
|
|
211
214
|
<Space size="middle">
|
|
212
215
|
{(buttonActionName || buttonLabel) &&
|
|
213
|
-
<Button customClass={
|
|
216
|
+
<Button customClass={buttonClass} onClick={() => buttonActionMethod?.()}>{buttonActionName || buttonLabel}</Button>
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
<Dropdown menu={{ items }}>
|
package/src/locales/en.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"errorResponseType": "Response type missing",
|
|
54
54
|
"header": "Header",
|
|
55
55
|
"color": "Assigned colour",
|
|
56
|
-
"flagged": "
|
|
56
|
+
"flagged": "Emphasise",
|
|
57
57
|
"multipleChoise": "Multiple selection",
|
|
58
58
|
"placeholderScore": "Score",
|
|
59
59
|
"answerNameIsMissing": "Missing name",
|
package/src/locales/es.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"errorResponseType": "Tipo de respuesta faltante",
|
|
54
54
|
"header": "Cabecera",
|
|
55
55
|
"color": "Color asignado",
|
|
56
|
-
"flagged": "
|
|
56
|
+
"flagged": "Destacar",
|
|
57
57
|
"multipleChoise": "Selección múltiple",
|
|
58
58
|
"placeholderScore": "Puntuación",
|
|
59
59
|
"answerNameIsMissing": "Falta el nombre",
|
package/src/locales/pt.json
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"answerNameIsMissing": "Nome em falta",
|
|
55
55
|
"header": "Cabeçalho",
|
|
56
56
|
"color": "Cor atribuída",
|
|
57
|
-
"flagged": "
|
|
57
|
+
"flagged": "Destacar",
|
|
58
58
|
"multipleChoise": "Seleção múltipla",
|
|
59
59
|
"placeholderScore": "Pontuação",
|
|
60
60
|
"typeResponseNameIsMissing": "Nome do tipo de resposta em falta",
|