@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.
@@ -12,6 +12,7 @@ export interface QuestionsProps {
12
12
  showCheckbox?: boolean;
13
13
  handleChanges: any;
14
14
  responseTypeOptions: any;
15
+ hasHeader?: boolean;
15
16
  }
16
17
 
17
18
  export const Questions = (props: QuestionsProps) => {
@@ -19,7 +20,8 @@ export const Questions = (props: QuestionsProps) => {
19
20
  showGrade = true,
20
21
  showCheckbox,
21
22
  handleChanges,
22
- responseTypeOptions
23
+ responseTypeOptions,
24
+ hasHeader
23
25
  } = props;
24
26
 
25
27
  const formContext = useContext(FieldContext);
@@ -60,7 +62,8 @@ export const Questions = (props: QuestionsProps) => {
60
62
  showGrade={showGrade}
61
63
  showCheckbox={showCheckbox}
62
64
  handleChanges={handleChanges}
63
- responseTypeOptions={responseTypeOptions}
65
+ responseTypeOptions={responseTypeOptions}
66
+ hasHeader={hasHeader}
64
67
  />
65
68
  </>
66
69
  )}
@@ -20,6 +20,10 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
20
20
  // For example, trigger an API call
21
21
  };
22
22
 
23
+ const getButtonLabel = (record: any) => {
24
+ return (record as any)?.type === "Efetivo" ? "Pog" : "Nao";
25
+ };
26
+
23
27
  return <ResponsiveTable
24
28
  scroll={{ x: 4000 }}
25
29
  columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo}
@@ -34,7 +38,7 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
34
38
  key: '3', label: 'label 3'
35
39
  }
36
40
  ]}
37
- fixedColumns={[{ dataIndex: 'action', side: 'right' }]} buttonActionName="POG" {...args}>
41
+ fixedColumns={[{ dataIndex: 'action', side: 'right' }]} buttonActionMethod={() => handleSortByColumnChange} buttonActionLabel={getButtonLabel} {...args}>
38
42
  </ResponsiveTable>;
39
43
  };
40
44
 
@@ -57,7 +61,7 @@ Primary.args = {
57
61
  mecanographicNumber: "32",
58
62
  store: `Levi's Sta Catarina`,
59
63
  role: `Comercial`,
60
- type: `Efetivo`
64
+ type: `NEfetivo`
61
65
  },
62
66
  {
63
67
  id: `3`,
@@ -65,7 +69,7 @@ Primary.args = {
65
69
  mecanographicNumber: "3212",
66
70
  store: `Levi's Sta Catarina`,
67
71
  role: `Funcionário`,
68
- type: `Efetivo`
72
+ type: `NEfetivo`
69
73
  },
70
74
  {
71
75
  id: `4`,
@@ -48,6 +48,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
48
48
  fixedColumns?: { dataIndex: string; side: 'left' | 'right' }[];
49
49
  customColumnWidths?: { columnName: string; width: string }[];
50
50
  buttonActionName?: string;
51
+ buttonActionLabel?: (record: any) => string;
51
52
  buttonActionMethod?: () => void;
52
53
  buttonActionStyle?: string;
53
54
  }
@@ -77,7 +78,8 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
77
78
  customColumnWidths,
78
79
  buttonActionName,
79
80
  buttonActionMethod,
80
- buttonActionStyle
81
+ buttonActionStyle,
82
+ buttonActionLabel
81
83
  } = props;
82
84
 
83
85
  const [customFilters, setCustomFilters] = useState<any>([]);
@@ -201,12 +203,14 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
201
203
  dataIndex: 'action',
202
204
  ellipsis: false,
203
205
  align: 'right',
204
- render: () => {
205
- if (!items?.[0]) return null;
206
+ render: (_: any, record: any) => {
207
+ if (!items?.[0]) return null;
208
+ const buttonLabel = buttonActionLabel ? buttonActionLabel(record) : null;
209
+
206
210
  return (
207
211
  <Space size="middle">
208
- {buttonActionName &&
209
- <Button customClass={buttonActionStyle} onClick={() => buttonActionMethod?.()}>{buttonActionName}</Button>
212
+ {(buttonActionName || buttonActionLabel) &&
213
+ <Button customClass={buttonActionStyle} onClick={() => buttonActionMethod?.()}>{buttonActionName || buttonLabel}</Button>
210
214
  }
211
215
 
212
216
  <Dropdown menu={{ items }}>
@@ -48,7 +48,8 @@
48
48
  "mandatoryAnswer": "Mandatory answer",
49
49
  "emphasisAnswer": "Highlight",
50
50
  "responseType": "Response Type",
51
- "errorResponseType": "Response type missing"
51
+ "errorResponseType": "Response type missing",
52
+ "header": "Header"
52
53
  },
53
54
  "categorySidBar": {
54
55
  "addCategory": "Add Category",
@@ -57,8 +58,10 @@
57
58
  "categoryContent": {
58
59
  "message": "Please select a category in the sidebar",
59
60
  "categoryName": "Category Name",
61
+ "tamplateName": "Template Name",
60
62
  "editCategory": "Edit Category",
61
63
  "categoryNameError": "Error/Missing Category Name",
64
+ "templateNameError": "Error/Missing Template Name",
62
65
  "weighting": "Weighting",
63
66
  "openAnswer": "Open Answer",
64
67
  "yesNoAnswer": "Yes/No Answer",
@@ -48,7 +48,8 @@
48
48
  "mandatoryAnswer": "Respuesta obligatoria",
49
49
  "emphasisAnswer": "Resaltar",
50
50
  "responseType": "Tipo de respuesta",
51
- "errorResponseType": "Tipo de respuesta faltante"
51
+ "errorResponseType": "Tipo de respuesta faltante",
52
+ "header": "Cabecera"
52
53
  },
53
54
  "categorySidBar": {
54
55
  "addCategory": "Agregar Categoría",
@@ -57,8 +58,10 @@
57
58
  "categoryContent": {
58
59
  "message": "Por favor, seleccione una categoría en la barra lateral",
59
60
  "categoryName": "Nombre de la Categoría",
61
+ "tamplateName": "Nome de la plantilla",
60
62
  "editCategory": "Editar Categoría",
61
63
  "categoryNameError": "Error/Nombre de Categoría Faltante",
64
+ "templateNameError": "Error/Nombre de la plantilla",
62
65
  "weighting": "Ponderación",
63
66
  "openAnswer": "Respuesta Abierta",
64
67
  "yesNoAnswer": "Respuesta Si/No",
@@ -48,7 +48,8 @@
48
48
  "mandatoryAnswer": "Resposta obrigatória",
49
49
  "emphasisAnswer": "Destaque",
50
50
  "responseType": "Tipo de resposta",
51
- "errorResponseType": "Tipo de resposta em falta"
51
+ "errorResponseType": "Tipo de resposta em falta",
52
+ "header": "Cabeçalho"
52
53
  },
53
54
  "categorySidBar": {
54
55
  "addCategory": "Adicionar categoria",
@@ -57,8 +58,10 @@
57
58
  "categoryContent": {
58
59
  "message": "Por favor selecione uma categoria na barra lateral",
59
60
  "categoryName": "Nome da categoria",
61
+ "tamplateName": "Nome do template",
60
62
  "editCategory": "Editar Categoria",
61
63
  "categoryNameError": "Nome categoria em falta",
64
+ "templateNameError": "Nome da template em falta",
62
65
  "weighting": "Ponderação",
63
66
  "openAnswer": "Resposta aberta",
64
67
  "yesNoAnswer": "Resposta Sim/Não",