@omniumretail/component-library 1.1.67 → 1.1.68

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.
@@ -6,7 +6,7 @@ interface CategoryResponse {
6
6
  onNextCategoryAvailabilityChange: (hasNext: boolean) => void;
7
7
  onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
8
8
  selectYesNoOption?: any;
9
- addAction?: () => void;
9
+ addAction?: (questionId: string) => void;
10
10
  addButtons?: boolean;
11
11
  fileList?: React.Dispatch<React.SetStateAction<Record<string, UploadFile<any>[]>>>;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.67",
3
+ "version": "1.1.68",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -32,6 +32,11 @@ const Template: Story<any> = (args) => {
32
32
  (categoryResponseRef.current as any).handlePreviousClick();
33
33
  }
34
34
 
35
+ const handleAddAction = (questionId: string) => {
36
+ console.log(`Ação adicionada para a pergunta com ID: ${questionId}`);
37
+ // Sua lógica para adicionar a ação, como uma chamada de API ou atualização de estado
38
+ };
39
+
35
40
  useEffect(() => {
36
41
  // console.log(serverData);
37
42
  }, [serverData])
@@ -47,6 +52,7 @@ const Template: Story<any> = (args) => {
47
52
  onPreviousCategoryAvailabilityChange={handlePreviousCategoryAvailabilityChange}
48
53
  addButtons
49
54
  fileList={setFileLists}
55
+ addAction={handleAddAction}
50
56
  >
51
57
  </CategoryResponse>
52
58
  </div>
@@ -16,7 +16,7 @@ interface CategoryResponse {
16
16
  onNextCategoryAvailabilityChange: (hasNext: boolean) => void;
17
17
  onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
18
18
  selectYesNoOption?: any;
19
- addAction?: () => void;
19
+ addAction?: (questionId: string) => void;
20
20
  addButtons?: boolean;
21
21
  fileList?: React.Dispatch<React.SetStateAction<Record<string, UploadFile<any>[]>>>;
22
22
  };
@@ -162,6 +162,13 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
162
162
  imgWindow?.document.write(image.outerHTML);
163
163
  };
164
164
 
165
+ const handleAddAction = (questionId: string) => {
166
+ if (props.addAction) {
167
+ console.log(questionId);
168
+ props.addAction(questionId);
169
+ }
170
+ };
171
+
165
172
  const onFinish = (values: any) => {
166
173
  const updatedQuestions = initialValues.Questions.map((question: any, index: number) => {
167
174
  return {
@@ -250,10 +257,6 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
250
257
  props.onPreviousCategoryAvailabilityChange(hasPrevious);
251
258
  }, [currentKey, localData.CategoryAnswers, props]);
252
259
 
253
- const questionWrapper = classNames({
254
- [styles.questionWrapperOpenAnswer]: (selectedCategory.Data.OpenAnswer),
255
- }, [styles.questionWrapper]);
256
-
257
260
  // This gets the scale we use for each select from the database using a key based variable,if
258
261
  // any new generalEvaluationLevel is added to the backend we need to update our own without
259
262
  // deleting any of the previous so we dont mess up the project history.
@@ -343,7 +346,9 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
343
346
  {form.getFieldValue(`Questions`)?.[index].Note ? t('components.categoryResponse.editNote') : t('components.categoryResponse.addNote')}
344
347
  </Button>
345
348
 
346
- <Button customClass={styles.actionsButtons} onClick={props.addAction}>{t('components.categoryResponse.createAction')}</Button>
349
+ <Button customClass={styles.actionsButtons} onClick={() => handleAddAction(question.Id)}>
350
+ {t('components.categoryResponse.createAction')}
351
+ </Button>
347
352
  </div>
348
353
  </>
349
354
  }