@omniumretail/component-library 1.1.74 → 1.1.76

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
@@ -18,7 +18,7 @@
18
18
  .gER2xKwlnobsIz4BLhGJ{background-color:var(--color-grey) !important}.gER2xKwlnobsIz4BLhGJ[aria-checked=true]{background:var(--color-orange) !important}
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
- .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}.BAso_dbeoowN7VtxWiKx.W120L8cnn6ydwOqHngty{max-width:650px}.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}@media(max-width: 768px){.GbZVOtcaUURjn4CweVjF{gap:12px}}.C3Qrjv76hDipL39fyfzf{display:flex;align-items:center;gap:8px}@media(max-width: 768px){.C3Qrjv76hDipL39fyfzf{width:100%}}.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}
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}.BAso_dbeoowN7VtxWiKx.W120L8cnn6ydwOqHngty{max-width:650px}.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}@media(max-width: 768px){.GbZVOtcaUURjn4CweVjF{gap:12px}}.C3Qrjv76hDipL39fyfzf{display:flex;align-items:center;gap:8px}@media(max-width: 768px){.C3Qrjv76hDipL39fyfzf{width:100%}}.kknDal3CIbUXI7Lu2wPV{display:flex;align-items:center;justify-content:flex-start;gap:20px}.CIMvcFtQWcBY31wttg2C{min-width:200px}@media(max-width: 768px){.CIMvcFtQWcBY31wttg2C{min-width:100px}}.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
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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.74",
3
+ "version": "1.1.76",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -46,6 +46,7 @@ const Template: Story<any> = (args) => {
46
46
  "IsNumeric": false,
47
47
  "HasGrade": false,
48
48
  "IsEmphasis": false,
49
+ "IsMultipleChoise": true,
49
50
  "State": "Draft",
50
51
  "Grade": 0,
51
52
  "Options": [
@@ -75,6 +76,7 @@ const Template: Story<any> = (args) => {
75
76
  "IsNumeric": false,
76
77
  "HasGrade": false,
77
78
  "IsEmphasis": false,
79
+ "IsMultipleChoise": true,
78
80
  "State": "Draft",
79
81
  "Grade": 0,
80
82
  "Options": [
@@ -104,6 +106,7 @@ const Template: Story<any> = (args) => {
104
106
  "IsNumeric": false,
105
107
  "HasGrade": false,
106
108
  "IsEmphasis": false,
109
+ "IsMultipleChoise": false,
107
110
  "State": "Finished",
108
111
  "Grade": 0,
109
112
  "Options": [
@@ -127,13 +130,7 @@ const Template: Story<any> = (args) => {
127
130
  }
128
131
  ]
129
132
 
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>
133
+ return <Category {...args} chooseResponse serverReadyData={setServerData} responseTypeOptions={getAnswerTypeOptions} hasHeader data={[]}></Category>
137
134
  };
138
135
 
139
136
  export const Primary = Template.bind({});
@@ -38,7 +38,7 @@ const Template: Story<any> = (args) => {
38
38
  };
39
39
 
40
40
  useEffect(() => {
41
- // console.log(serverData);
41
+ console.log(serverData);
42
42
  }, [serverData])
43
43
 
44
44
  return (
@@ -175,7 +175,8 @@ Primary.args = {
175
175
  "Subject": "This is a Subject",
176
176
  "Description": "This is a description",
177
177
  "Grade": "25",
178
- "Answer": null
178
+ "Answer": null,
179
+ "IsMultipleChoise": false
179
180
  },
180
181
  {
181
182
  "Id": "35562A64-A24B-425A-A345-560238CA2468",
@@ -183,7 +184,8 @@ Primary.args = {
183
184
  "Subject": "This is a Subject",
184
185
  "Description": "This is a description",
185
186
  "Grade": "25",
186
- "Answer": null
187
+ "Answer": null,
188
+ "IsMultipleChoise": true
187
189
  }
188
190
  ]
189
191
  }
@@ -233,7 +235,7 @@ Primary.args = {
233
235
  "Id": "97A06838-67F9-4726-BC36-719A0C797484",
234
236
  "CategoryId": "CATEGORYID3",
235
237
  "CategoryName": "Category 3",
236
- "OpenAnswer": true,
238
+ "OpenAnswer": false,
237
239
  "GeneralEvaluationLevel": 0,
238
240
  "Grade": "0",
239
241
  "Description": "This is a description",
@@ -245,7 +247,8 @@ Primary.args = {
245
247
  "Subject": "This is a Subject",
246
248
  "Description": "This is a description",
247
249
  "Grade": "0",
248
- "Answer": "dwjdiwjdiwjdi"
250
+ "Answer": "dwjdiwjdiwjdi",
251
+ "IsOpenAnswer": true
249
252
  },
250
253
  {
251
254
  "Id": "93862A64-A24B-425A-A345-560238CA2468",
@@ -253,7 +256,8 @@ Primary.args = {
253
256
  "Subject": "This is a Subject",
254
257
  "Description": "This is a description",
255
258
  "Grade": "0",
256
- "Answer": null
259
+ "Answer": null,
260
+ "IsMultipleChoise": true
257
261
  }
258
262
  ]
259
263
  }
@@ -16,7 +16,7 @@ interface CategoryResponse {
16
16
  onNextCategoryAvailabilityChange: (hasNext: boolean) => void;
17
17
  onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
18
18
  selectYesNoOption?: any;
19
- addAction?: (questionId: string, questionAnswerId:string) => void;
19
+ addAction?: (questionId: string, questionAnswerId: string) => void;
20
20
  addButtons?: boolean;
21
21
  fileList?: React.Dispatch<React.SetStateAction<Record<string, UploadFile<any>[]>>>;
22
22
  };
@@ -117,7 +117,8 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
117
117
  Subject: question.Subject,
118
118
  Description: question.Description,
119
119
  Answer: question.Answer || "",
120
- Note: question.Note || ""
120
+ Note: question.Note || "",
121
+ IsMultipleChoise: question.IsMultipleChoise || false
121
122
  })),
122
123
  OpenAnswer: OpenAnswer,
123
124
  IsYesOrNo: IsYesOrNo
@@ -174,6 +175,7 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
174
175
  ...question,
175
176
  Answer: values.Questions[index].Answer,
176
177
  Note: values.Questions[index].Note,
178
+ IsMultipleChoise: values.Questions[index].IsMultipleChoise,
177
179
  Files: fileLists[`${selectedCategory.Data.CategoryId}_${index}`] || [], // Include files in the form data
178
180
  };
179
181
  });
@@ -347,7 +349,7 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
347
349
 
348
350
  <Button customClass={styles.actionsButtons} onClick={() => handleAddAction(question.QuestionId, question.Id)}>
349
351
  {t('components.categoryResponse.createAction')}
350
- </Button>
352
+ </Button>
351
353
  </div>
352
354
  </>
353
355
  }
@@ -371,6 +373,7 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
371
373
  : evaluationOptions[selectedEvaluationOption]
372
374
  }
373
375
  // style={{ minWidth: '100%' }}
376
+ mode={form.getFieldValue(`Questions`)?.[index]?.IsMultipleChoise ? "multiple" : undefined}
374
377
  customClass={styles.selectAnswerStyle}
375
378
  />
376
379
  </Form.Item>
@@ -2,9 +2,10 @@ import { DeleteOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/
2
2
  import { Checkbox, ColorPicker, Form, Input, Space } from 'antd';
3
3
  import { t } from 'i18next';
4
4
  import styles from './styles.module.scss';
5
- import { useState } from 'react';
5
+ import { useContext, useState } from 'react';
6
6
  import { Select } from 'antd';
7
7
  import classnames from 'classnames';
8
+ import { FieldContext } from 'rc-field-form';
8
9
 
9
10
  export const SingleQuestion = ({
10
11
  key,
@@ -22,6 +23,25 @@ export const SingleQuestion = ({
22
23
  }: any) => {
23
24
  const [mandatoryCheckbox, setMandatoryCheckbox] = useState<boolean>(false);
24
25
  const [emphasisCheckbox, setEmphasisCheckbox] = useState<boolean>(false);
26
+ const [multipleChoiseCheckbox, setMultipleChoiseCheckbox] = useState<boolean>(false);
27
+
28
+ const formContext = useContext(FieldContext);
29
+
30
+ const filteredIds = responseTypeOptions
31
+ .filter((item: { IsMultipleChoise: any; }) => item.IsMultipleChoise)
32
+ .map((item: { Id: any; }) => item.Id);
33
+
34
+ const answerTypeOptions = responseTypeOptions?.map((answerType: any) => ({
35
+ value: answerType?.Id,
36
+ label: answerType?.Name
37
+ }));
38
+
39
+ console.log(filteredIds);
40
+
41
+ const onCheckboxMultipeChoiseHandler = (checked: boolean) => {
42
+ setMultipleChoiseCheckbox(checked);
43
+ handleChanges();
44
+ }
25
45
 
26
46
  const onCheckboxMandatoryHandler = (checked: boolean) => {
27
47
  setMandatoryCheckbox(checked);
@@ -138,6 +158,21 @@ export const SingleQuestion = ({
138
158
 
139
159
  <span>{t('components.category.emphasisAnswer')}</span>
140
160
  </div>
161
+
162
+ {filteredIds.includes(formContext.getFieldsValue().questions?.[name]?.responseType) &&
163
+ < div className={styles.checkboxContainer}>
164
+ <Form.Item
165
+ {...restField}
166
+ name={[name, 'multipleChoise']}
167
+ valuePropName='checked'
168
+ >
169
+ <Checkbox onChange={(e) => onCheckboxMultipeChoiseHandler(e.target.checked)} checked={multipleChoiseCheckbox} />
170
+ </Form.Item>
171
+
172
+ <span>{t('components.category.multipleChoise')}</span>
173
+ </div>
174
+ }
175
+
141
176
  </>
142
177
  }
143
178
 
@@ -148,7 +183,7 @@ export const SingleQuestion = ({
148
183
  rules={[{ required: true, message: t('components.category.errorResponseType')! }]}
149
184
  >
150
185
  <Select
151
- options={responseTypeOptions}
186
+ options={answerTypeOptions}
152
187
  onBlur={handleChanges}
153
188
  className={styles.selectResponseType}
154
189
  />
@@ -159,7 +194,8 @@ export const SingleQuestion = ({
159
194
  </div>
160
195
  }
161
196
 
162
- {responseTypeComponent &&
197
+ {
198
+ responseTypeComponent &&
163
199
  <div className={styles.questionFooter}>
164
200
  <div />
165
201
 
@@ -200,7 +236,7 @@ export const SingleQuestion = ({
200
236
  </div>
201
237
  </div>
202
238
  }
203
- </Space>
204
- </div>
239
+ </Space >
240
+ </div >
205
241
  );
206
242
  };
@@ -78,10 +78,10 @@ $questionAndInformationGap: 20px;
78
78
  }
79
79
 
80
80
  .selectResponseType {
81
- min-width: 250px;
81
+ min-width: 200px;
82
82
 
83
83
  @media(max-width: 768px) {
84
- min-width: 150px;
84
+ min-width: 100px;
85
85
  }
86
86
  }
87
87
 
@@ -54,6 +54,7 @@
54
54
  "header": "Header",
55
55
  "color": "Assigned colour",
56
56
  "flagged": "Flagged",
57
+ "multipleChoise": "Multiple selection",
57
58
  "placeholderScore": "Score",
58
59
  "answerNameIsMissing": "Missing name",
59
60
  "typeResponseNameIsMissing": "Name of the missing answer type",
@@ -54,6 +54,7 @@
54
54
  "header": "Cabecera",
55
55
  "color": "Color asignado",
56
56
  "flagged": "Marcado",
57
+ "multipleChoise": "Selección múltiple",
57
58
  "placeholderScore": "Puntuación",
58
59
  "answerNameIsMissing": "Falta el nombre",
59
60
  "typeResponseNameIsMissing": "Nombre del tipo de respuesta que falta",
@@ -55,6 +55,7 @@
55
55
  "header": "Cabeçalho",
56
56
  "color": "Cor atribuída",
57
57
  "flagged": "Sinalizado",
58
+ "multipleChoise": "Seleção múltipla",
58
59
  "placeholderScore": "Pontuação",
59
60
  "typeResponseNameIsMissing": "Nome do tipo de resposta em falta",
60
61
  "responseTypeName": "Nome do tipo de resposta"