@omniumretail/component-library 1.1.35 → 1.1.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.35",
3
+ "version": "1.1.37",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -10,9 +10,9 @@ export default {
10
10
  const Template: Story<any> = (args) => {
11
11
  const [serverData, setServerData] = useState<any>();
12
12
 
13
- // useEffect(() => {
14
- // console.log(serverData);
15
- // }, [serverData])
13
+ useEffect(() => {
14
+ console.log(serverData);
15
+ }, [serverData])
16
16
 
17
17
  return <Category {...args} serverReadyData={setServerData} data={[
18
18
  {
@@ -21,6 +21,7 @@ const Template: Story<any> = (args) => {
21
21
  "data": {
22
22
  "categoryName": "2",
23
23
  "openAnswer": false,
24
+ "isYesOrNo": true,
24
25
  "generalEvaluationLevel": "0",
25
26
  "grade": "2",
26
27
  "questions": []
@@ -33,6 +34,7 @@ const Template: Story<any> = (args) => {
33
34
  "data": {
34
35
  "categoryName": "1",
35
36
  "openAnswer": false,
37
+ "isYesOrNo": false,
36
38
  "generalEvaluationLevel": "0",
37
39
  "grade": "1",
38
40
  "questions": []
@@ -44,6 +46,7 @@ const Template: Story<any> = (args) => {
44
46
  "data": {
45
47
  "categoryName": "1.1",
46
48
  "openAnswer": false,
49
+ "isYesOrNo": false,
47
50
  "generalEvaluationLevel": "0",
48
51
  "grade": "1.1",
49
52
  "questions": []
@@ -55,6 +58,7 @@ const Template: Story<any> = (args) => {
55
58
  "data": {
56
59
  "categoryName": "1.1.1",
57
60
  "openAnswer": false,
61
+ "isYesOrNo": false,
58
62
  "generalEvaluationLevel": "0",
59
63
  "grade": "1.1.1",
60
64
  "questions": []
@@ -70,7 +74,8 @@ const Template: Story<any> = (args) => {
70
74
  "key": "2",
71
75
  "data": {
72
76
  "categoryName": "3",
73
- "openAnswer": false,
77
+ "openAnswer": true,
78
+ "isYesOrNo": false,
74
79
  "generalEvaluationLevel": "0",
75
80
  "grade": "3",
76
81
  "questions": []
@@ -35,7 +35,8 @@ export const CategoryContent = (props: categoryContent) => {
35
35
  const [form] = useForm();
36
36
 
37
37
  const onFinish = (values: any) => {
38
- setContentInfo(values);
38
+ const combinedValues = { ...initialValues, ...values };
39
+ setContentInfo(combinedValues);
39
40
  };
40
41
 
41
42
  const openSwitchHandler = (enabled: boolean) => {
@@ -120,26 +121,28 @@ export const CategoryContent = (props: categoryContent) => {
120
121
 
121
122
  {!categorySidebarData?.data?.children?.length &&
122
123
  <>
123
- {switchOpenAnswStatus &&
124
+ {!switchYesOrNoAnswStatus &&
124
125
  <div className={styles.openAnswer}>
125
126
  <Label isUppercase>
126
127
  {t('components.categoryContent.openAnswer')}
127
128
  </Label>
128
129
  <Form.Item
129
130
  name={['openAnswer']}
131
+ initialValue={switchOpenAnswStatus}
130
132
  >
131
133
  <Switch onChange={(enabled: boolean) => { openSwitchHandler(enabled) }} checked={switchOpenAnswStatus} />
132
134
  </Form.Item>
133
135
  </div>
134
136
  }
135
137
 
136
- {switchYesOrNoAnswStatus &&
138
+ {!switchOpenAnswStatus &&
137
139
  <div className={styles.yesNoAnswer}>
138
140
  <Label isUppercase>
139
141
  {t('components.categoryContent.yesNoAnswer')}
140
142
  </Label>
141
143
  <Form.Item
142
144
  name={['isYesOrNo']}
145
+ initialValue={switchYesOrNoAnswStatus}
143
146
  >
144
147
  <Switch onChange={(enabled: boolean) => { yesNoSwitchHandler(enabled) }} checked={switchYesOrNoAnswStatus} />
145
148
  </Form.Item>
@@ -8,43 +8,6 @@ interface Category {
8
8
  serverReadyData: any;
9
9
  }
10
10
 
11
- const fakeData: any = {
12
- data: [
13
- {
14
- "title": "opgg (Q: 1) ",
15
- "key": "0",
16
- "data": {
17
- "categoryName": "opgg",
18
- "openAnswer": true,
19
- "questions": [
20
- {
21
- "question": "1",
22
- "info": "2"
23
- }
24
- ]
25
- }
26
- },
27
- {
28
- "title": "abcd (Q: 1) (G: 2)",
29
- "key": "1",
30
- "data": {
31
- "categoryName": "abcd",
32
- "openAnswer": false,
33
- "questions": [
34
- {
35
- "question": "ax1",
36
- "info": "se2",
37
- "grade": "1s"
38
- }
39
- ],
40
- "generalEvaluationLevel": "2",
41
- "grade": "2"
42
- }
43
- }
44
- ],
45
- noData: []
46
- }
47
-
48
11
  export const Category = (props: Category) => {
49
12
  const {
50
13
  data