@omniumretail/component-library 1.0.74 → 1.0.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/.storybook/main.js +16 -16
- package/.storybook/preview-head.html +20 -20
- package/.storybook/preview.js +27 -27
- package/NPMPUBLISH.md +29 -29
- package/README.md +54 -54
- package/bitbucket-pipelines.yml +94 -94
- package/dist/bundle.js +247 -291
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -5
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -2
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -12
- package/dist/types/components/Button/Button.stories.d.ts +6 -6
- package/dist/types/components/Button/index.d.ts +7 -7
- package/dist/types/components/Category/Category.stories.d.ts +4 -4
- package/dist/types/components/Category/CategoryContent/index.d.ts +7 -7
- package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -26
- package/dist/types/components/Category/index.d.ts +7 -7
- package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -4
- package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryReadOnly/index.d.ts +9 -9
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -4
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryResponse/index.d.ts +9 -9
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -5
- package/dist/types/components/DatePicker/index.d.ts +8 -8
- package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -5
- package/dist/types/components/DatePickerTag/index.d.ts +6 -6
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -5
- package/dist/types/components/Footer/index.d.ts +4 -4
- package/dist/types/components/Input/Input.stories.d.ts +5 -5
- package/dist/types/components/Input/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -5
- package/dist/types/components/Label/Label.stories.d.ts +6 -6
- package/dist/types/components/Label/index.d.ts +7 -7
- package/dist/types/components/Link/Link.stories.d.ts +7 -7
- package/dist/types/components/Link/index.d.ts +7 -7
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -5
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/Menu/index.d.ts +3 -2
- package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/index.d.ts +9 -9
- package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -5
- package/dist/types/components/ModalWithTable/index.d.ts +13 -13
- package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -5
- package/dist/types/components/Navigation/index.d.ts +10 -10
- package/dist/types/components/Notification/Notification.stories.d.ts +5 -5
- package/dist/types/components/Notification/index.d.ts +9 -9
- package/dist/types/components/Questions/Questions.stories.d.ts +4 -4
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +5 -5
- package/dist/types/components/Radio/Radio.stories.d.ts +5 -5
- package/dist/types/components/Radio/index.d.ts +10 -10
- package/dist/types/components/Select/Select.stories.d.ts +6 -6
- package/dist/types/components/Select/index.d.ts +5 -5
- package/dist/types/components/Separator/Separator.stories.d.ts +6 -6
- package/dist/types/components/Separator/index.d.ts +11 -11
- package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -6
- package/dist/types/components/Sidebar/index.d.ts +15 -15
- package/dist/types/components/Switch/Switch.stories.d.ts +5 -5
- package/dist/types/components/Switch/index.d.ts +2 -2
- package/dist/types/components/Table/Table.stories.d.ts +9 -9
- package/dist/types/components/Table/index.d.ts +37 -37
- package/dist/types/components/Tag/Tag.stories.d.ts +5 -5
- package/dist/types/components/Tag/index.d.ts +8 -8
- package/dist/types/components/Upload/Upload.stories.d.ts +4 -4
- package/dist/types/components/Upload/index.d.ts +8 -8
- package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -4
- package/dist/types/components/UserInfo/index.d.ts +8 -8
- package/dist/types/components/index.d.ts +25 -25
- package/dist/types/constants/i18n.d.ts +1 -1
- package/dist/types/constants/translationHelper.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +198 -198
- package/src/assets/scss/_global.scss +89 -89
- package/src/assets/scss/index.scss +2 -2
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +236 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -19
- package/src/components/AnalyticsBar/index.tsx +76 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -13
- package/src/components/AnalyticsBar/styles.module.scss +108 -108
- package/src/components/Button/Button.stories.tsx +26 -26
- package/src/components/Button/index.tsx +24 -24
- package/src/components/Button/styles.module.scss +65 -65
- package/src/components/Category/Category.stories.tsx +88 -88
- package/src/components/Category/CategoryContent/index.tsx +188 -188
- package/src/components/Category/CategoryContent/styles.module.scss +51 -51
- package/src/components/Category/CategorySidebar/index.tsx +268 -268
- package/src/components/Category/CategorySidebar/styles.module.scss +28 -28
- package/src/components/Category/index.tsx +76 -76
- package/src/components/Category/styles.module.scss +13 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +270 -270
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +81 -81
- package/src/components/CategoryReadOnly/index.tsx +254 -254
- package/src/components/CategoryReadOnly/styles.module.scss +184 -184
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +251 -251
- package/src/components/CategoryResponse/evaluationOptions.tsx +81 -81
- package/src/components/CategoryResponse/index.tsx +277 -277
- package/src/components/CategoryResponse/styles.module.scss +180 -180
- package/src/components/DatePicker/DatePicker.stories.tsx +16 -16
- package/src/components/DatePicker/index.tsx +38 -38
- package/src/components/DatePicker/styles.module.scss +3 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +19 -19
- package/src/components/DatePickerTag/index.tsx +89 -89
- package/src/components/DatePickerTag/styles.module.scss +31 -31
- package/src/components/Footer/Footer.stories.tsx +14 -14
- package/src/components/Footer/index.tsx +38 -38
- package/src/components/Footer/styles.module.scss +38 -38
- package/src/components/Input/Input.stories.tsx +13 -13
- package/src/components/Input/index.tsx +31 -31
- package/src/components/Input/styles.module.scss +8 -8
- package/src/components/InputCountryCode/index.tsx +75 -75
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +55 -55
- package/src/components/InputCountryCode/styles.module.scss +3 -3
- package/src/components/Label/Label.stories.tsx +21 -21
- package/src/components/Label/index.tsx +19 -19
- package/src/components/Label/styles.module.scss +16 -16
- package/src/components/Link/Link.stories.tsx +30 -30
- package/src/components/Link/index.tsx +21 -21
- package/src/components/Link/styles.module.scss +24 -24
- package/src/components/Menu/Menu.stories.tsx +178 -178
- package/src/components/Menu/helpers/codeMutation.tsx +19 -19
- package/src/components/Menu/index.tsx +23 -23
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +40 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +5 -5
- package/src/components/ModalConfirmation/index.tsx +70 -70
- package/src/components/ModalConfirmation/styles.module.scss +62 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +96 -96
- package/src/components/ModalWithTable/index.tsx +232 -232
- package/src/components/ModalWithTable/styles.module.scss +77 -77
- package/src/components/Navigation/Navigation.stories.tsx +17 -17
- package/src/components/Navigation/index.tsx +33 -33
- package/src/components/Navigation/styles.module.scss +59 -59
- package/src/components/Notification/Notification.stories.tsx +29 -29
- package/src/components/Notification/index.tsx +21 -21
- package/src/components/Questions/Questions.stories.tsx +37 -37
- package/src/components/Questions/SingleQuestion/index.tsx +84 -84
- package/src/components/Questions/SingleQuestion/styles.module.scss +81 -81
- package/src/components/Questions/index.tsx +78 -78
- package/src/components/Radio/Radio.stories.tsx +43 -43
- package/src/components/Radio/index.tsx +26 -26
- package/src/components/Radio/styles.module.scss +23 -23
- package/src/components/Select/Select.stories.tsx +39 -39
- package/src/components/Select/index.tsx +27 -27
- package/src/components/Select/styles.module.scss +13 -13
- package/src/components/Separator/Separator.stories.tsx +22 -22
- package/src/components/Separator/index.tsx +27 -27
- package/src/components/Separator/styles.module.scss +25 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +85 -85
- package/src/components/Sidebar/index.tsx +103 -103
- package/src/components/Sidebar/styles.module.scss +85 -85
- package/src/components/Switch/Switch.stories.tsx +14 -14
- package/src/components/Switch/index.tsx +8 -8
- package/src/components/Switch/styles.module.scss +7 -7
- package/src/components/Table/Table.stories.tsx +222 -222
- package/src/components/Table/index.tsx +279 -275
- package/src/components/Table/styles.module.scss +75 -75
- package/src/components/Tag/Tag.stories.tsx +22 -22
- package/src/components/Tag/index.tsx +189 -189
- package/src/components/Tag/styles.module.scss +60 -60
- package/src/components/Upload/Upload.stories.tsx +45 -45
- package/src/components/Upload/index.tsx +91 -91
- package/src/components/UserInfo/UserInfo.stories.tsx +38 -37
- package/src/components/UserInfo/index.tsx +77 -62
- package/src/components/UserInfo/styles.module.scss +30 -29
- package/src/components/index.tsx +25 -25
- package/src/constants/i18n.ts +25 -25
- package/src/constants/translationHelper.ts +7 -7
- package/src/index.ts +2 -2
- package/src/locales/en.json +86 -86
- package/src/locales/es.json +86 -86
- package/src/locales/pt.json +86 -86
- package/src/types/Global.d.ts +4 -4
- package/tsconfig.json +29 -29
- package/webpack.config.js +51 -51
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { AnalyticsBar } from '.';
|
|
3
|
-
import { AnalyticsBarProps } from './interfaces/analyticsBar';
|
|
4
|
-
import { getItem } from './helpers/codeMutation';
|
|
5
|
-
import { useMemo, useState } from "react";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'AnalyticsBar',
|
|
9
|
-
component: AnalyticsBar,
|
|
10
|
-
} as Meta;
|
|
11
|
-
|
|
12
|
-
const Template: Story<AnalyticsBarProps> = (args) => {
|
|
13
|
-
const [sortedBy, setSortedBy] = useState<any>('');
|
|
14
|
-
const [optionInUse, setOptionInUse] = useState<any>();
|
|
15
|
-
const [activeListItem, setActiveListItem] = useState<any>();
|
|
16
|
-
|
|
17
|
-
const data = [
|
|
18
|
-
{
|
|
19
|
-
"Label": "PeriodOfExperimentation",
|
|
20
|
-
"Items": [
|
|
21
|
-
{
|
|
22
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
23
|
-
"Name": "Teste1",
|
|
24
|
-
"Categories": {
|
|
25
|
-
"Category": {
|
|
26
|
-
"Name": "Category Name Here",
|
|
27
|
-
"Questions": [
|
|
28
|
-
{
|
|
29
|
-
"Name": "question1",
|
|
30
|
-
"Id": "abc133"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"Name": "question2",
|
|
34
|
-
"Id": "abc122"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"Label": "PeriodOfExperimentation",
|
|
44
|
-
"Items": [
|
|
45
|
-
{
|
|
46
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
47
|
-
"Name": "Name"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"Label": "PeriodOfExperimentation",
|
|
53
|
-
"Items": [
|
|
54
|
-
{
|
|
55
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
56
|
-
"Name": "Name"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"Label": "PeriodOfExperimentation",
|
|
62
|
-
"Items": [
|
|
63
|
-
{
|
|
64
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
65
|
-
"Name": "Name"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"Label": "PeriodOfExperimentation",
|
|
71
|
-
"Items": [
|
|
72
|
-
{
|
|
73
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
74
|
-
"Name": "Name"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"Label": "PeriodOfExperimentation",
|
|
80
|
-
"Items": [
|
|
81
|
-
{
|
|
82
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
83
|
-
"Name": "Name"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"Label": "PeriodOfExperimentation",
|
|
89
|
-
"Items": [
|
|
90
|
-
{
|
|
91
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
92
|
-
"Name": "Name"
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"Label": "PeriodOfExperimentation",
|
|
98
|
-
"Items": [
|
|
99
|
-
{
|
|
100
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
101
|
-
"Name": "Name"
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"Label": "PeriodOfExperimentation",
|
|
107
|
-
"Items": [
|
|
108
|
-
{
|
|
109
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
110
|
-
"Name": "Name"
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"Label": "PeriodOfExperimentation",
|
|
116
|
-
"Items": [
|
|
117
|
-
{
|
|
118
|
-
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
119
|
-
"Name": "Name"
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"Label": "Permanent",
|
|
125
|
-
"Items": [
|
|
126
|
-
{
|
|
127
|
-
"Id": "A3FE0C73-E771-40BB-B87D-1E40597841A6",
|
|
128
|
-
"Name": "Evaluation Cycle"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"Id": "05A411CC-4350-4779-93C4-B8A511CBBCCD",
|
|
132
|
-
"Name": "Evaluation Cycle 2"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"Id": "D5A77A3B-1163-4590-9C98-2E6D62442F62",
|
|
136
|
-
"Name": "EV2"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"Id": "42A6EFDD-6D74-4905-94AE-5B5588967BE6",
|
|
140
|
-
"Name": "EV2"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"Id": "E39FE86D-6CE1-400A-8BA2-AE31A8E9D9BE",
|
|
144
|
-
"Name": "Suuuup"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"Id": "7FC59CF0-9478-4705-B1E0-C1B709FFB81B",
|
|
148
|
-
"Name": "CicloParaRespostas1"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"Id": "767DF403-C33D-4074-B7CA-FE3F4E4B41DD",
|
|
152
|
-
"Name": "XPTO"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"Id": "DB821A00-D516-467C-8F22-710EA18BFD23",
|
|
156
|
-
"Name": "EvaluationCycle for Notifications"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
];
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// const items = useMemo(() => data.map((el: any, index: any) => {
|
|
164
|
-
// return (
|
|
165
|
-
// getItem(
|
|
166
|
-
// el.Label,
|
|
167
|
-
// index,
|
|
168
|
-
// null,
|
|
169
|
-
// el.Items?.map((item: any, subIndex: any) => {
|
|
170
|
-
// return getItem(item.Name, item.Id);
|
|
171
|
-
// })
|
|
172
|
-
// )
|
|
173
|
-
// )
|
|
174
|
-
// }), [data]);
|
|
175
|
-
|
|
176
|
-
const items = useMemo(() => {
|
|
177
|
-
const createQuestionItems = (questionsData: any[]): any[] => {
|
|
178
|
-
return questionsData.map((question: any) => {
|
|
179
|
-
return getItem(question.Name, question.Id);
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
const createCategoryItems = (categoryData: any): any[] => {
|
|
184
|
-
if (categoryData) {
|
|
185
|
-
return [
|
|
186
|
-
getItem(
|
|
187
|
-
categoryData.Name,
|
|
188
|
-
categoryData.Name,
|
|
189
|
-
null,
|
|
190
|
-
createQuestionItems(categoryData.Questions)
|
|
191
|
-
),
|
|
192
|
-
];
|
|
193
|
-
}
|
|
194
|
-
return [];
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
return data.map((el: any, index: any) => {
|
|
198
|
-
return getItem(
|
|
199
|
-
el.Label,
|
|
200
|
-
index,
|
|
201
|
-
null,
|
|
202
|
-
el.Items?.map((item: any) => {
|
|
203
|
-
const categoryItems = createCategoryItems(item.Categories?.Category);
|
|
204
|
-
return getItem(
|
|
205
|
-
item.Name,
|
|
206
|
-
item.Id,
|
|
207
|
-
null,
|
|
208
|
-
categoryItems.length ? categoryItems : undefined
|
|
209
|
-
);
|
|
210
|
-
})
|
|
211
|
-
);
|
|
212
|
-
});
|
|
213
|
-
}, [data]);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const selectOptions = [
|
|
217
|
-
{
|
|
218
|
-
value: 'ano',
|
|
219
|
-
label: 'ANO',
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
value: 'tipo_de_ciclo',
|
|
223
|
-
label: 'TIPO DE CICLO',
|
|
224
|
-
},
|
|
225
|
-
];
|
|
226
|
-
|
|
227
|
-
// console.log('stories:', sortedBy, optionInUse, activeListItem);
|
|
228
|
-
|
|
229
|
-
return <div style={{height: '500px'}}>
|
|
230
|
-
<AnalyticsBar {...args} data={items} selectOptions={selectOptions} selectDefault={selectOptions[0]} sortedBy={setSortedBy} selectUserOption={setOptionInUse} activeListItem={setActiveListItem}></AnalyticsBar>
|
|
231
|
-
</div>;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export const Primary = Template.bind({});
|
|
235
|
-
Primary.args = {
|
|
236
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { AnalyticsBar } from '.';
|
|
3
|
+
import { AnalyticsBarProps } from './interfaces/analyticsBar';
|
|
4
|
+
import { getItem } from './helpers/codeMutation';
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'AnalyticsBar',
|
|
9
|
+
component: AnalyticsBar,
|
|
10
|
+
} as Meta;
|
|
11
|
+
|
|
12
|
+
const Template: Story<AnalyticsBarProps> = (args) => {
|
|
13
|
+
const [sortedBy, setSortedBy] = useState<any>('');
|
|
14
|
+
const [optionInUse, setOptionInUse] = useState<any>();
|
|
15
|
+
const [activeListItem, setActiveListItem] = useState<any>();
|
|
16
|
+
|
|
17
|
+
const data = [
|
|
18
|
+
{
|
|
19
|
+
"Label": "PeriodOfExperimentation",
|
|
20
|
+
"Items": [
|
|
21
|
+
{
|
|
22
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
23
|
+
"Name": "Teste1",
|
|
24
|
+
"Categories": {
|
|
25
|
+
"Category": {
|
|
26
|
+
"Name": "Category Name Here",
|
|
27
|
+
"Questions": [
|
|
28
|
+
{
|
|
29
|
+
"Name": "question1",
|
|
30
|
+
"Id": "abc133"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"Name": "question2",
|
|
34
|
+
"Id": "abc122"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"Label": "PeriodOfExperimentation",
|
|
44
|
+
"Items": [
|
|
45
|
+
{
|
|
46
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
47
|
+
"Name": "Name"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"Label": "PeriodOfExperimentation",
|
|
53
|
+
"Items": [
|
|
54
|
+
{
|
|
55
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
56
|
+
"Name": "Name"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"Label": "PeriodOfExperimentation",
|
|
62
|
+
"Items": [
|
|
63
|
+
{
|
|
64
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
65
|
+
"Name": "Name"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"Label": "PeriodOfExperimentation",
|
|
71
|
+
"Items": [
|
|
72
|
+
{
|
|
73
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
74
|
+
"Name": "Name"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"Label": "PeriodOfExperimentation",
|
|
80
|
+
"Items": [
|
|
81
|
+
{
|
|
82
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
83
|
+
"Name": "Name"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"Label": "PeriodOfExperimentation",
|
|
89
|
+
"Items": [
|
|
90
|
+
{
|
|
91
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
92
|
+
"Name": "Name"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"Label": "PeriodOfExperimentation",
|
|
98
|
+
"Items": [
|
|
99
|
+
{
|
|
100
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
101
|
+
"Name": "Name"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"Label": "PeriodOfExperimentation",
|
|
107
|
+
"Items": [
|
|
108
|
+
{
|
|
109
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
110
|
+
"Name": "Name"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"Label": "PeriodOfExperimentation",
|
|
116
|
+
"Items": [
|
|
117
|
+
{
|
|
118
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
119
|
+
"Name": "Name"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"Label": "Permanent",
|
|
125
|
+
"Items": [
|
|
126
|
+
{
|
|
127
|
+
"Id": "A3FE0C73-E771-40BB-B87D-1E40597841A6",
|
|
128
|
+
"Name": "Evaluation Cycle"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"Id": "05A411CC-4350-4779-93C4-B8A511CBBCCD",
|
|
132
|
+
"Name": "Evaluation Cycle 2"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"Id": "D5A77A3B-1163-4590-9C98-2E6D62442F62",
|
|
136
|
+
"Name": "EV2"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"Id": "42A6EFDD-6D74-4905-94AE-5B5588967BE6",
|
|
140
|
+
"Name": "EV2"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"Id": "E39FE86D-6CE1-400A-8BA2-AE31A8E9D9BE",
|
|
144
|
+
"Name": "Suuuup"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"Id": "7FC59CF0-9478-4705-B1E0-C1B709FFB81B",
|
|
148
|
+
"Name": "CicloParaRespostas1"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"Id": "767DF403-C33D-4074-B7CA-FE3F4E4B41DD",
|
|
152
|
+
"Name": "XPTO"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"Id": "DB821A00-D516-467C-8F22-710EA18BFD23",
|
|
156
|
+
"Name": "EvaluationCycle for Notifications"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
// const items = useMemo(() => data.map((el: any, index: any) => {
|
|
164
|
+
// return (
|
|
165
|
+
// getItem(
|
|
166
|
+
// el.Label,
|
|
167
|
+
// index,
|
|
168
|
+
// null,
|
|
169
|
+
// el.Items?.map((item: any, subIndex: any) => {
|
|
170
|
+
// return getItem(item.Name, item.Id);
|
|
171
|
+
// })
|
|
172
|
+
// )
|
|
173
|
+
// )
|
|
174
|
+
// }), [data]);
|
|
175
|
+
|
|
176
|
+
const items = useMemo(() => {
|
|
177
|
+
const createQuestionItems = (questionsData: any[]): any[] => {
|
|
178
|
+
return questionsData.map((question: any) => {
|
|
179
|
+
return getItem(question.Name, question.Id);
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const createCategoryItems = (categoryData: any): any[] => {
|
|
184
|
+
if (categoryData) {
|
|
185
|
+
return [
|
|
186
|
+
getItem(
|
|
187
|
+
categoryData.Name,
|
|
188
|
+
categoryData.Name,
|
|
189
|
+
null,
|
|
190
|
+
createQuestionItems(categoryData.Questions)
|
|
191
|
+
),
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
return [];
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return data.map((el: any, index: any) => {
|
|
198
|
+
return getItem(
|
|
199
|
+
el.Label,
|
|
200
|
+
index,
|
|
201
|
+
null,
|
|
202
|
+
el.Items?.map((item: any) => {
|
|
203
|
+
const categoryItems = createCategoryItems(item.Categories?.Category);
|
|
204
|
+
return getItem(
|
|
205
|
+
item.Name,
|
|
206
|
+
item.Id,
|
|
207
|
+
null,
|
|
208
|
+
categoryItems.length ? categoryItems : undefined
|
|
209
|
+
);
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
}, [data]);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
const selectOptions = [
|
|
217
|
+
{
|
|
218
|
+
value: 'ano',
|
|
219
|
+
label: 'ANO',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
value: 'tipo_de_ciclo',
|
|
223
|
+
label: 'TIPO DE CICLO',
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
// console.log('stories:', sortedBy, optionInUse, activeListItem);
|
|
228
|
+
|
|
229
|
+
return <div style={{height: '500px'}}>
|
|
230
|
+
<AnalyticsBar {...args} data={items} selectOptions={selectOptions} selectDefault={selectOptions[0]} sortedBy={setSortedBy} selectUserOption={setOptionInUse} activeListItem={setActiveListItem}></AnalyticsBar>
|
|
231
|
+
</div>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const Primary = Template.bind({});
|
|
235
|
+
Primary.args = {
|
|
236
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { MenuProps } from 'antd';
|
|
2
|
-
|
|
3
|
-
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
-
|
|
5
|
-
export function getItem(
|
|
6
|
-
label: React.ReactNode,
|
|
7
|
-
key: React.Key,
|
|
8
|
-
icon?: React.ReactNode,
|
|
9
|
-
children?: MenuItem[],
|
|
10
|
-
type?: 'group',
|
|
11
|
-
): MenuItem {
|
|
12
|
-
return {
|
|
13
|
-
key,
|
|
14
|
-
icon,
|
|
15
|
-
children,
|
|
16
|
-
label,
|
|
17
|
-
type,
|
|
18
|
-
} as MenuItem;
|
|
19
|
-
}
|
|
1
|
+
import type { MenuProps } from 'antd';
|
|
2
|
+
|
|
3
|
+
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
+
|
|
5
|
+
export function getItem(
|
|
6
|
+
label: React.ReactNode,
|
|
7
|
+
key: React.Key,
|
|
8
|
+
icon?: React.ReactNode,
|
|
9
|
+
children?: MenuItem[],
|
|
10
|
+
type?: 'group',
|
|
11
|
+
): MenuItem {
|
|
12
|
+
return {
|
|
13
|
+
key,
|
|
14
|
+
icon,
|
|
15
|
+
children,
|
|
16
|
+
label,
|
|
17
|
+
type,
|
|
18
|
+
} as MenuItem;
|
|
19
|
+
}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import { MinusOutlined, PlusOutlined, SortAscendingOutlined, SortDescendingOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Select } from '../Select';
|
|
4
|
-
import type { MenuProps } from 'antd';
|
|
5
|
-
import { Menu } from 'antd';
|
|
6
|
-
import { AnalyticsBarProps, sortBy } from './interfaces/analyticsBar';
|
|
7
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
-
import { t } from 'i18next';
|
|
9
|
-
|
|
10
|
-
export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
11
|
-
const {
|
|
12
|
-
data: items = [],
|
|
13
|
-
selectOptions,
|
|
14
|
-
selectDefault,
|
|
15
|
-
selectUserOption,
|
|
16
|
-
sortedBy,
|
|
17
|
-
activeListItem
|
|
18
|
-
} = props;
|
|
19
|
-
|
|
20
|
-
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
|
|
21
|
-
const [sortInfo, setSortInfo] = useState<any>(sortBy.desc);
|
|
22
|
-
|
|
23
|
-
const selectOnChange = useCallback((value: any) => {
|
|
24
|
-
selectUserOption(value);
|
|
25
|
-
}, [selectUserOption]);
|
|
26
|
-
|
|
27
|
-
const setSorter = useCallback(() => {
|
|
28
|
-
sortInfo === sortBy.desc
|
|
29
|
-
? setSortInfo(sortBy.asc)
|
|
30
|
-
: setSortInfo(sortBy.desc);
|
|
31
|
-
|
|
32
|
-
sortedBy(sortInfo);
|
|
33
|
-
}, [sortInfo]);
|
|
34
|
-
|
|
35
|
-
const onClick: MenuProps['onClick'] = (e: any) => {
|
|
36
|
-
const { key } = e;
|
|
37
|
-
if (selectedKeys.includes(key)) {
|
|
38
|
-
setSelectedKeys([]);
|
|
39
|
-
} else {
|
|
40
|
-
setSelectedKeys([key]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
activeListItem(key);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className={styles.analyticsbar}>
|
|
48
|
-
<div className={styles.header}>
|
|
49
|
-
<Select
|
|
50
|
-
options={selectOptions}
|
|
51
|
-
customClass={styles.select}
|
|
52
|
-
onChange={selectOnChange}
|
|
53
|
-
defaultActiveFirstOption
|
|
54
|
-
defaultValue={selectDefault}
|
|
55
|
-
/>
|
|
56
|
-
|
|
57
|
-
<div className={styles.sorterWrapper} onClick={() => setSorter()}>
|
|
58
|
-
{sortInfo === sortBy.desc
|
|
59
|
-
? <>{ t('components.analyticsBar.desc') }<SortDescendingOutlined /></>
|
|
60
|
-
: <>{ t('components.analyticsBar.asc') }<SortAscendingOutlined /></>
|
|
61
|
-
}
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div className={styles.content}>
|
|
66
|
-
<Menu
|
|
67
|
-
selectedKeys={selectedKeys}
|
|
68
|
-
onClick={onClick}
|
|
69
|
-
mode="inline"
|
|
70
|
-
items={items}
|
|
71
|
-
expandIcon={({ isOpen }) => (isOpen ? <MinusOutlined /> : <PlusOutlined />)}
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { MinusOutlined, PlusOutlined, SortAscendingOutlined, SortDescendingOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Select } from '../Select';
|
|
4
|
+
import type { MenuProps } from 'antd';
|
|
5
|
+
import { Menu } from 'antd';
|
|
6
|
+
import { AnalyticsBarProps, sortBy } from './interfaces/analyticsBar';
|
|
7
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
import { t } from 'i18next';
|
|
9
|
+
|
|
10
|
+
export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
11
|
+
const {
|
|
12
|
+
data: items = [],
|
|
13
|
+
selectOptions,
|
|
14
|
+
selectDefault,
|
|
15
|
+
selectUserOption,
|
|
16
|
+
sortedBy,
|
|
17
|
+
activeListItem
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
|
|
21
|
+
const [sortInfo, setSortInfo] = useState<any>(sortBy.desc);
|
|
22
|
+
|
|
23
|
+
const selectOnChange = useCallback((value: any) => {
|
|
24
|
+
selectUserOption(value);
|
|
25
|
+
}, [selectUserOption]);
|
|
26
|
+
|
|
27
|
+
const setSorter = useCallback(() => {
|
|
28
|
+
sortInfo === sortBy.desc
|
|
29
|
+
? setSortInfo(sortBy.asc)
|
|
30
|
+
: setSortInfo(sortBy.desc);
|
|
31
|
+
|
|
32
|
+
sortedBy(sortInfo);
|
|
33
|
+
}, [sortInfo]);
|
|
34
|
+
|
|
35
|
+
const onClick: MenuProps['onClick'] = (e: any) => {
|
|
36
|
+
const { key } = e;
|
|
37
|
+
if (selectedKeys.includes(key)) {
|
|
38
|
+
setSelectedKeys([]);
|
|
39
|
+
} else {
|
|
40
|
+
setSelectedKeys([key]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
activeListItem(key);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={styles.analyticsbar}>
|
|
48
|
+
<div className={styles.header}>
|
|
49
|
+
<Select
|
|
50
|
+
options={selectOptions}
|
|
51
|
+
customClass={styles.select}
|
|
52
|
+
onChange={selectOnChange}
|
|
53
|
+
defaultActiveFirstOption
|
|
54
|
+
defaultValue={selectDefault}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<div className={styles.sorterWrapper} onClick={() => setSorter()}>
|
|
58
|
+
{sortInfo === sortBy.desc
|
|
59
|
+
? <>{ t('components.analyticsBar.desc') }<SortDescendingOutlined /></>
|
|
60
|
+
: <>{ t('components.analyticsBar.asc') }<SortAscendingOutlined /></>
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div className={styles.content}>
|
|
66
|
+
<Menu
|
|
67
|
+
selectedKeys={selectedKeys}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
mode="inline"
|
|
70
|
+
items={items}
|
|
71
|
+
expandIcon={({ isOpen }) => (isOpen ? <MinusOutlined /> : <PlusOutlined />)}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|