@omniumretail/component-library 1.0.57 → 1.0.59
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/bundle.js +110 -66
- package/dist/main.css +13 -0
- package/dist/types/components/Menu/index.d.ts +0 -1
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +1 -0
- package/dist/types/components/Table/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/AnalyticsBar/index.tsx +3 -3
- package/src/components/Category/Category.stories.tsx +3 -3
- package/src/components/Category/CategoryContent/index.tsx +30 -20
- package/src/components/Category/CategorySidebar/index.tsx +3 -2
- package/src/components/CategoryResponse/index.tsx +1 -6
- package/src/components/Questions/SingleQuestion/index.tsx +5 -8
- package/src/components/Questions/index.tsx +3 -0
- package/src/components/Table/index.tsx +55 -3
- package/src/components/Table/styles.module.scss +18 -4
- package/src/components/Tag/index.tsx +2 -1
- package/src/locales/en.json +64 -23
- package/src/locales/es.json +51 -10
- package/src/locales/pt.json +24 -1
package/dist/main.css
CHANGED
|
@@ -206,6 +206,9 @@
|
|
|
206
206
|
.pwZdBKCECvzAH92fQDTI .ant-table-thead > tr > th:before {
|
|
207
207
|
display: none;
|
|
208
208
|
}
|
|
209
|
+
.pwZdBKCECvzAH92fQDTI .ant-table-tbody > tr {
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
}
|
|
209
212
|
.pwZdBKCECvzAH92fQDTI .ant-table-tbody > tr:last-child > td {
|
|
210
213
|
border-bottom: 1px solid var(--color-grey-light) !important;
|
|
211
214
|
}
|
|
@@ -233,6 +236,16 @@
|
|
|
233
236
|
border: none !important;
|
|
234
237
|
box-shadow: none !important;
|
|
235
238
|
}
|
|
239
|
+
.pwZdBKCECvzAH92fQDTI .ant-pagination {
|
|
240
|
+
max-width: calc(100% - 200px);
|
|
241
|
+
margin-left: auto !important;
|
|
242
|
+
}
|
|
243
|
+
.pwZdBKCECvzAH92fQDTI button[type=button].ant-pagination-item-link {
|
|
244
|
+
margin-top: 0 !important;
|
|
245
|
+
}
|
|
246
|
+
.pwZdBKCECvzAH92fQDTI button[type=button] {
|
|
247
|
+
margin-top: -50px;
|
|
248
|
+
}
|
|
236
249
|
/*!************************************************************************************************************************************************************!*\
|
|
237
250
|
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/Tag/styles.module.scss ***!
|
|
238
251
|
\************************************************************************************************************************************************************/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SingleQuestion: ({ key, provided, snapshot, remove, name, showGrade, ...restField }: any) => JSX.Element;
|
|
1
|
+
export declare const SingleQuestion: ({ key, provided, snapshot, remove, name, showGrade, handleChanges, ...restField }: any) => JSX.Element;
|
|
@@ -24,5 +24,11 @@ export interface TableCustomProps extends TableProps<any> {
|
|
|
24
24
|
rowKeyValue?: string;
|
|
25
25
|
hiddenColumns?: string[];
|
|
26
26
|
rowSelection?: any;
|
|
27
|
+
onSelectAllButtonClick?: () => void;
|
|
28
|
+
AllItemsShowing?: boolean;
|
|
29
|
+
selectAllStatus?: any;
|
|
30
|
+
isTableDataRefreshed?: any;
|
|
31
|
+
tableLoading?: any;
|
|
32
|
+
tableMaxHeight?: any;
|
|
27
33
|
}
|
|
28
34
|
export declare const Table: (props: TableCustomProps) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import type { MenuProps } from 'antd';
|
|
|
5
5
|
import { Menu } from 'antd';
|
|
6
6
|
import { AnalyticsBarProps, sortBy } from './interfaces/analyticsBar';
|
|
7
7
|
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
import { t } from 'i18next';
|
|
8
9
|
|
|
9
10
|
export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
10
11
|
const {
|
|
@@ -42,7 +43,6 @@ export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
|
42
43
|
activeListItem(key);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
console.log(sortInfo);
|
|
46
46
|
return (
|
|
47
47
|
<div className={styles.analyticsbar}>
|
|
48
48
|
<div className={styles.header}>
|
|
@@ -56,8 +56,8 @@ export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
|
56
56
|
|
|
57
57
|
<div className={styles.sorterWrapper} onClick={() => setSorter()}>
|
|
58
58
|
{sortInfo === sortBy.desc
|
|
59
|
-
? <>
|
|
60
|
-
: <>
|
|
59
|
+
? <>{ t('components.analyticsBar.desc') }<SortDescendingOutlined /></>
|
|
60
|
+
: <>{ t('components.analyticsBar.asc') }<SortAscendingOutlined /></>
|
|
61
61
|
}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
@@ -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
|
-
|
|
15
|
-
}, [serverData])
|
|
13
|
+
// useEffect(() => {
|
|
14
|
+
// console.log(serverData);
|
|
15
|
+
// }, [serverData])
|
|
16
16
|
|
|
17
17
|
return <Category {...args} serverReadyData={setServerData} data={[
|
|
18
18
|
{
|
|
@@ -5,8 +5,9 @@ import { InputField } from '../../Input';
|
|
|
5
5
|
import { Label } from '../../Label';
|
|
6
6
|
import { Questions } from '../../Questions';
|
|
7
7
|
import { Switch } from '../../Switch';
|
|
8
|
-
import { useEffect, useState } from 'react';
|
|
8
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
9
9
|
import styles from './styles.module.scss';
|
|
10
|
+
import { t } from 'i18next';
|
|
10
11
|
|
|
11
12
|
interface categoryContent {
|
|
12
13
|
categoryContentShow: boolean;
|
|
@@ -26,6 +27,7 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
26
27
|
categorySidebarData
|
|
27
28
|
} = props;
|
|
28
29
|
|
|
30
|
+
const [submitForm, setSubmitForm] = useState<boolean>(false);
|
|
29
31
|
const [contentInfo, setContentInfo] = useState<any>(defaultInitialValues);
|
|
30
32
|
const [switchStatus, setSwitchStatus] = useState<boolean>(false);
|
|
31
33
|
const [initialValues, setInitialValues] = useState<any>(categorySidebarData?.data || defaultInitialValues)
|
|
@@ -37,8 +39,21 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
37
39
|
|
|
38
40
|
const switchHandler = (enabled: boolean) => {
|
|
39
41
|
setSwitchStatus(enabled);
|
|
42
|
+
handleInputChange();
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
const handleInputChange = useCallback(() => {
|
|
46
|
+
// Check if all required fields are filled
|
|
47
|
+
const allRequiredFieldsFilled = form.getFieldsError().every(fieldError => !fieldError.errors.length);
|
|
48
|
+
|
|
49
|
+
if (allRequiredFieldsFilled) {
|
|
50
|
+
// Add a small delay before submitting the form
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
form.submit();
|
|
53
|
+
}, 100);
|
|
54
|
+
}
|
|
55
|
+
}, [form]);
|
|
56
|
+
|
|
42
57
|
useEffect(() => {
|
|
43
58
|
props.categoryContentInfo(contentInfo);
|
|
44
59
|
}, [contentInfo]);
|
|
@@ -60,7 +75,7 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
60
75
|
{
|
|
61
76
|
!categoryContentShow
|
|
62
77
|
? <div className={styles.uncheckedCategory}>
|
|
63
|
-
|
|
78
|
+
{ t('components.categoryContent.message') }
|
|
64
79
|
</div>
|
|
65
80
|
|
|
66
81
|
: <>
|
|
@@ -74,26 +89,26 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
74
89
|
<div className={styles.formHeader}>
|
|
75
90
|
<div className={styles.category}>
|
|
76
91
|
<Label isUppercase>
|
|
77
|
-
|
|
92
|
+
{ t('components.categoryContent.categoryName') }
|
|
78
93
|
</Label>
|
|
79
94
|
<Form.Item
|
|
80
95
|
name={['categoryName']}
|
|
81
96
|
rules={[{ required: true, message: 'Category Name is Missing' }]}
|
|
97
|
+
validateTrigger="onBlur"
|
|
82
98
|
>
|
|
83
|
-
<InputField placeholder={'Category Name'} />
|
|
99
|
+
<InputField placeholder={'Category Name'} onBlur={handleInputChange} />
|
|
84
100
|
</Form.Item>
|
|
85
101
|
</div>
|
|
86
102
|
|
|
87
103
|
{categorySidebarData?.data?.children?.length > 0 &&
|
|
88
104
|
<div className={styles.grade}>
|
|
89
105
|
<Label isUppercase>
|
|
90
|
-
|
|
106
|
+
{ t('components.categoryContent.weighting') }
|
|
91
107
|
</Label>
|
|
92
108
|
<Form.Item
|
|
93
109
|
name={['grade']}
|
|
94
|
-
rules={[{ required: true, message: 'Grade is Missing' }]}
|
|
95
110
|
>
|
|
96
|
-
<InputField placeholder={'EX: 15%'} />
|
|
111
|
+
<InputField placeholder={'EX: 15%'} onBlur={handleInputChange}/>
|
|
97
112
|
</Form.Item>
|
|
98
113
|
</div>
|
|
99
114
|
}
|
|
@@ -102,14 +117,12 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
102
117
|
<>
|
|
103
118
|
<div className={styles.openAnswer}>
|
|
104
119
|
<Label isUppercase>
|
|
105
|
-
|
|
120
|
+
{ t('components.categoryContent.openAnswer') }
|
|
106
121
|
</Label>
|
|
107
122
|
<Form.Item
|
|
108
123
|
name={['openAnswer']}
|
|
109
124
|
>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<Switch onChange={(enabled: boolean) => switchHandler(enabled)} checked={switchStatus} />
|
|
125
|
+
<Switch onChange={(enabled: boolean) => {switchHandler(enabled)}} checked={switchStatus} />
|
|
113
126
|
</Form.Item>
|
|
114
127
|
</div>
|
|
115
128
|
|
|
@@ -118,7 +131,7 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
118
131
|
<>
|
|
119
132
|
<div className={styles.generalEvaluationLevel}>
|
|
120
133
|
<Label isUppercase>
|
|
121
|
-
|
|
134
|
+
{ t('components.categoryContent.answerOption') }
|
|
122
135
|
</Label>
|
|
123
136
|
<Form.Item
|
|
124
137
|
name={['generalEvaluationLevel']}
|
|
@@ -136,20 +149,19 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
136
149
|
value: '2',
|
|
137
150
|
label: '1 a 5 ou “Não Aplicável”',
|
|
138
151
|
},
|
|
139
|
-
]}
|
|
152
|
+
]} onBlur={handleInputChange}
|
|
140
153
|
/>
|
|
141
154
|
</Form.Item>
|
|
142
155
|
</div>
|
|
143
156
|
|
|
144
157
|
<div className={styles.grade}>
|
|
145
158
|
<Label isUppercase>
|
|
146
|
-
|
|
159
|
+
{ t('components.categoryContent.weighting') }
|
|
147
160
|
</Label>
|
|
148
161
|
<Form.Item
|
|
149
162
|
name={['grade']}
|
|
150
|
-
rules={[{ required: true, message: 'Grade is Missing' }]}
|
|
151
163
|
>
|
|
152
|
-
<InputField placeholder={'EX: 15%'} />
|
|
164
|
+
<InputField placeholder={'EX: 15%'} onBlur={handleInputChange}/>
|
|
153
165
|
</Form.Item>
|
|
154
166
|
</div>
|
|
155
167
|
</>
|
|
@@ -161,16 +173,14 @@ export const CategoryContent = (props: categoryContent) => {
|
|
|
161
173
|
{!categorySidebarData?.data?.children?.length &&
|
|
162
174
|
<div className={styles.questionsWrapper}>
|
|
163
175
|
<Label isUppercase>
|
|
164
|
-
|
|
176
|
+
{ t('components.categoryContent.answers') }
|
|
165
177
|
</Label>
|
|
166
178
|
<Form.Item>
|
|
167
|
-
<Questions showGrade={!switchStatus}></Questions>
|
|
179
|
+
<Questions showGrade={!switchStatus} handleChanges={handleInputChange}></Questions>
|
|
168
180
|
</Form.Item>
|
|
169
181
|
</div>
|
|
170
182
|
}
|
|
171
183
|
</Form>
|
|
172
|
-
|
|
173
|
-
<Button onClick={() => form.submit()}>Submit</Button>
|
|
174
184
|
</>
|
|
175
185
|
}
|
|
176
186
|
</div>
|
|
@@ -4,6 +4,7 @@ import type { TreeProps } from 'antd/es/tree';
|
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
5
|
import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
|
|
6
6
|
import { Button } from '../../Button';
|
|
7
|
+
import { t } from 'i18next';
|
|
7
8
|
|
|
8
9
|
export interface Questions {
|
|
9
10
|
grade: string;
|
|
@@ -239,13 +240,13 @@ export const CategorySidebar = (props: SidebarProps) => {
|
|
|
239
240
|
<div className={styles.categorySidebar}>
|
|
240
241
|
<div className={styles.title}>Categorias</div>
|
|
241
242
|
<Button icon={<PlusOutlined />} onClick={addCategory}>
|
|
242
|
-
|
|
243
|
+
{ t('components.categorySidBar.addCategory') }
|
|
243
244
|
</Button>
|
|
244
245
|
|
|
245
246
|
{
|
|
246
247
|
sidebarInfo &&
|
|
247
248
|
<Button icon={<MinusOutlined />} onClick={removeCategory}>
|
|
248
|
-
|
|
249
|
+
{ t('components.categorySidBar.removeCategory') }
|
|
249
250
|
</Button>
|
|
250
251
|
}
|
|
251
252
|
|
|
@@ -232,6 +232,7 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
232
232
|
onFinish={onFinish}
|
|
233
233
|
autoComplete="off"
|
|
234
234
|
form={form}
|
|
235
|
+
onValuesChange={(_, allValues) => onFinish(allValues)}
|
|
235
236
|
>
|
|
236
237
|
<div className={styles.details}>
|
|
237
238
|
<div className={styles.categoryName}>
|
|
@@ -269,12 +270,6 @@ export const CategoryResponse = React.forwardRef((props: CategoryResponse, ref)
|
|
|
269
270
|
</div>
|
|
270
271
|
</div>
|
|
271
272
|
))}
|
|
272
|
-
|
|
273
|
-
{selectedCategory?.Data?.Questions.length > 0 && (
|
|
274
|
-
<Button onClick={() => form.submit()}>{
|
|
275
|
-
t('components.categoryResponse.answer')
|
|
276
|
-
}</Button>
|
|
277
|
-
)}
|
|
278
273
|
</Form>
|
|
279
274
|
</div>
|
|
280
275
|
</div>
|
|
@@ -3,7 +3,7 @@ import { Form, Input, Space } from 'antd';
|
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
5
|
|
|
6
|
-
export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, ...restField }: any) => {
|
|
6
|
+
export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, handleChanges, ...restField }: any) => {
|
|
7
7
|
return (
|
|
8
8
|
<div
|
|
9
9
|
key={key}
|
|
@@ -25,13 +25,12 @@ export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrad
|
|
|
25
25
|
<Form.Item
|
|
26
26
|
{...restField}
|
|
27
27
|
name={[name, 'question']}
|
|
28
|
-
rules={[{ required: true, message: t('components.category.errorQuestion') }]}
|
|
29
28
|
>
|
|
30
|
-
<Input placeholder={`${t('components.category.placeholderQuestion')}`} />
|
|
29
|
+
<Input placeholder={`${t('components.category.placeholderQuestion')}`} onBlur={handleChanges} />
|
|
31
30
|
</Form.Item>
|
|
32
31
|
</div>
|
|
33
32
|
<div className={styles.actions}>
|
|
34
|
-
|
|
33
|
+
{/* <div className={styles.edit}>
|
|
35
34
|
<div className={styles.notEditing}
|
|
36
35
|
// onClick={() => handleStartEdit(index)}
|
|
37
36
|
>
|
|
@@ -63,9 +62,8 @@ export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrad
|
|
|
63
62
|
<Form.Item
|
|
64
63
|
{...restField}
|
|
65
64
|
name={[name, 'info']}
|
|
66
|
-
rules={[{ required: true, message: t('components.category.errorInfo') }]}
|
|
67
65
|
>
|
|
68
|
-
<Input placeholder={`${t('components.category.placeholderInfo')}`} />
|
|
66
|
+
<Input placeholder={`${t('components.category.placeholderInfo')}`} onBlur={handleChanges}/>
|
|
69
67
|
</Form.Item>
|
|
70
68
|
</div>
|
|
71
69
|
{showGrade &&
|
|
@@ -73,9 +71,8 @@ export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrad
|
|
|
73
71
|
<Form.Item
|
|
74
72
|
{...restField}
|
|
75
73
|
name={[name, 'grade']}
|
|
76
|
-
rules={[{ required: true, message: t('components.category.errorGrade') }]}
|
|
77
74
|
>
|
|
78
|
-
<Input placeholder={`${t('components.category.placeholderGrade')}`} />
|
|
75
|
+
<Input placeholder={`${t('components.category.placeholderGrade')}`} onBlur={handleChanges} />
|
|
79
76
|
</Form.Item>
|
|
80
77
|
</div>
|
|
81
78
|
}
|
|
@@ -9,11 +9,13 @@ import { t } from 'i18next';
|
|
|
9
9
|
|
|
10
10
|
export interface QuestionsProps {
|
|
11
11
|
showGrade?: boolean;
|
|
12
|
+
handleChanges: any;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const Questions = (props: QuestionsProps) => {
|
|
15
16
|
const {
|
|
16
17
|
showGrade = true,
|
|
18
|
+
handleChanges,
|
|
17
19
|
} = props;
|
|
18
20
|
|
|
19
21
|
const formContext = useContext(FieldContext);
|
|
@@ -52,6 +54,7 @@ export const Questions = (props: QuestionsProps) => {
|
|
|
52
54
|
remove={remove}
|
|
53
55
|
name={name}
|
|
54
56
|
showGrade={showGrade}
|
|
57
|
+
handleChanges={handleChanges}
|
|
55
58
|
/>
|
|
56
59
|
</>
|
|
57
60
|
)}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
-
import { Space, TableProps, Select, Dropdown } from 'antd';
|
|
2
|
+
import { Space, TableProps, Select, Dropdown, MenuProps } from 'antd';
|
|
3
3
|
import { Table as AntdTable } from 'antd';
|
|
4
4
|
import type { ColumnsType } from 'antd/es/table/interface';
|
|
5
5
|
import styles from './styles.module.scss';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { MoreOutlined } from '@ant-design/icons';
|
|
8
8
|
import classnames from 'classnames';
|
|
9
|
+
import { Button } from '../Button';
|
|
9
10
|
|
|
10
11
|
export interface FilterOptions {
|
|
11
12
|
value: string;
|
|
@@ -35,6 +36,12 @@ export interface TableCustomProps extends TableProps<any> {
|
|
|
35
36
|
rowKeyValue?: string;
|
|
36
37
|
hiddenColumns?: string[];
|
|
37
38
|
rowSelection?: any;
|
|
39
|
+
onSelectAllButtonClick?: () => void;
|
|
40
|
+
AllItemsShowing?: boolean;
|
|
41
|
+
selectAllStatus?: any;
|
|
42
|
+
isTableDataRefreshed?: any;
|
|
43
|
+
tableLoading?: any;
|
|
44
|
+
tableMaxHeight?: any;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export const Table = (props: TableCustomProps) => {
|
|
@@ -50,12 +57,21 @@ export const Table = (props: TableCustomProps) => {
|
|
|
50
57
|
rowKeyValue,
|
|
51
58
|
hiddenColumns,
|
|
52
59
|
rowSelection,
|
|
60
|
+
onSelectAllButtonClick,
|
|
61
|
+
AllItemsShowing,
|
|
62
|
+
selectAllStatus,
|
|
63
|
+
isTableDataRefreshed,
|
|
64
|
+
tableLoading,
|
|
65
|
+
tableMaxHeight
|
|
53
66
|
} = props;
|
|
54
67
|
|
|
55
68
|
const [customFilters, setCustomFilters] = useState<any>([]);
|
|
56
69
|
const [customColumns, setCustomColumns] = useState<ColumnsType<any>>([]);
|
|
57
70
|
const [sortInfo, setSortInfo] = useState<any>([]);
|
|
58
71
|
const [selectedRowKeys, setselectedRowKeys] = useState<any>(rowSelection?.selectedRowKeys || []);
|
|
72
|
+
const [selectedAllRowKeys, setSelectedAllRowKeys] = useState(false);
|
|
73
|
+
const [deselectAll, setDeselectAll] = useState(false);
|
|
74
|
+
|
|
59
75
|
|
|
60
76
|
const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
|
|
61
77
|
if (rowSelection.type === 'radio') {
|
|
@@ -72,6 +88,9 @@ export const Table = (props: TableCustomProps) => {
|
|
|
72
88
|
|
|
73
89
|
return [...oldKeys, ...newSelectedRowKeys];
|
|
74
90
|
});
|
|
91
|
+
|
|
92
|
+
setSelectedAllRowKeys(false);
|
|
93
|
+
setDeselectAll(false);
|
|
75
94
|
};
|
|
76
95
|
|
|
77
96
|
const handleChange: TableProps<any>['onChange'] = (pagination) => {
|
|
@@ -93,6 +112,32 @@ export const Table = (props: TableCustomProps) => {
|
|
|
93
112
|
setSortInfo(sortData)
|
|
94
113
|
};
|
|
95
114
|
|
|
115
|
+
const selectAllRows = () => {
|
|
116
|
+
if (selectedAllRowKeys) {
|
|
117
|
+
setDeselectAll(true);
|
|
118
|
+
} else {
|
|
119
|
+
onSelectAllButtonClick?.(); // Call the onSelectAllButtonClick callback
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (isTableDataRefreshed && !tableLoading || AllItemsShowing) {
|
|
125
|
+
if (selectAllStatus && AllItemsShowing) {
|
|
126
|
+
const allRowKeys = dataSource?.map((record) => record[rowKeyValue as any]);
|
|
127
|
+
setselectedRowKeys(allRowKeys);
|
|
128
|
+
setSelectedAllRowKeys(true);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, [isTableDataRefreshed, tableLoading, selectAllStatus, AllItemsShowing]);
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (deselectAll) {
|
|
135
|
+
setselectedRowKeys([]);
|
|
136
|
+
setDeselectAll(false);
|
|
137
|
+
setSelectedAllRowKeys(false);
|
|
138
|
+
}
|
|
139
|
+
}, [deselectAll]);
|
|
140
|
+
|
|
96
141
|
useEffect(() => {
|
|
97
142
|
props.rowSelectionInfo(selectedRowKeys);
|
|
98
143
|
}, [selectedRowKeys]);
|
|
@@ -178,6 +223,7 @@ export const Table = (props: TableCustomProps) => {
|
|
|
178
223
|
/>
|
|
179
224
|
</Space>
|
|
180
225
|
}
|
|
226
|
+
|
|
181
227
|
<AntdTable
|
|
182
228
|
dataSource={dataSource}
|
|
183
229
|
onChange={handleChange}
|
|
@@ -188,13 +234,19 @@ export const Table = (props: TableCustomProps) => {
|
|
|
188
234
|
rowSelection: {
|
|
189
235
|
selectedRowKeys: selectedRowKeys,
|
|
190
236
|
onChange: onSelectChange,
|
|
191
|
-
type: props.rowSelection?.type
|
|
192
|
-
// ...rowSelection
|
|
237
|
+
type: props.rowSelection?.type,
|
|
193
238
|
}
|
|
194
239
|
}
|
|
195
240
|
) : null}
|
|
196
241
|
rowKey={rowKeyValue}
|
|
242
|
+
{...(tableMaxHeight ? { scroll: { y: tableMaxHeight } } : {})}
|
|
197
243
|
/>
|
|
244
|
+
{
|
|
245
|
+
selectAllStatus &&
|
|
246
|
+
<Button onClick={selectAllRows} className={styles.selectAllRows}>
|
|
247
|
+
{selectedAllRowKeys ? t('components.table.deselectAll') : t('components.table.selectAll')}
|
|
248
|
+
</Button>
|
|
249
|
+
}
|
|
198
250
|
</div>
|
|
199
251
|
);
|
|
200
252
|
};
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
.ant-table-tbody {
|
|
18
18
|
> tr {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
|
|
19
21
|
&:last-child {
|
|
20
22
|
> td {
|
|
21
23
|
border-bottom: 1px solid var(--color-grey-light) !important;
|
|
@@ -40,14 +42,13 @@
|
|
|
40
42
|
.ant-space {
|
|
41
43
|
align-self: flex-end;
|
|
42
44
|
}
|
|
43
|
-
|
|
45
|
+
|
|
44
46
|
.ant-select-selection-placeholder {
|
|
45
47
|
color: var(--color-black);
|
|
46
48
|
}
|
|
47
|
-
|
|
49
|
+
|
|
48
50
|
.ant-select-selector,
|
|
49
|
-
.ant-select-focused
|
|
50
|
-
.ant-select-selection-search {
|
|
51
|
+
.ant-select-focused .ant-select-selection-search {
|
|
51
52
|
border: none !important;
|
|
52
53
|
box-shadow: none !important;
|
|
53
54
|
|
|
@@ -57,5 +58,18 @@
|
|
|
57
58
|
box-shadow: none !important;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
.ant-pagination {
|
|
63
|
+
max-width: calc(100% - 200px);
|
|
64
|
+
margin-left: auto !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
button[type="button"].ant-pagination-item-link {
|
|
68
|
+
margin-top: 0 !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
button[type="button"] {
|
|
73
|
+
margin-top: -50px;
|
|
60
74
|
}
|
|
61
75
|
}
|
|
@@ -5,6 +5,7 @@ import { Input, Tag, TagProps } from 'antd';
|
|
|
5
5
|
import { TweenOneGroup } from 'rc-tween-one';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
+
import { t } from 'i18next';
|
|
8
9
|
|
|
9
10
|
export interface customTagProps extends TagProps {
|
|
10
11
|
customTags?: any,
|
|
@@ -86,7 +87,7 @@ export const TagField = (props: customTagProps) => {
|
|
|
86
87
|
)}
|
|
87
88
|
{!inputVisible && (
|
|
88
89
|
<Tag onClick={showInput} className={classNames(styles['tagfield__creator'], 'site-tag-plus')}>
|
|
89
|
-
<SearchOutlined />
|
|
90
|
+
<SearchOutlined /> { t('components.tag.search') }
|
|
90
91
|
</Tag>
|
|
91
92
|
)}
|
|
92
93
|
<div style={{ marginTop: 16 }}>
|
package/src/locales/en.json
CHANGED
|
@@ -1,39 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"tableHeadings": {
|
|
3
|
-
"key": "
|
|
4
|
-
"name": "
|
|
5
|
-
"mecanographicNumber": "
|
|
6
|
-
"store": "
|
|
7
|
-
"role": "
|
|
8
|
-
"type": "
|
|
9
|
-
"id": "Id"
|
|
3
|
+
"key": "Chave",
|
|
4
|
+
"name": "Nome",
|
|
5
|
+
"mecanographicNumber": "Número Mecanográfico",
|
|
6
|
+
"store": "Loja",
|
|
7
|
+
"role": "Posição",
|
|
8
|
+
"type": "Tipo",
|
|
9
|
+
"id": "Id",
|
|
10
|
+
"action": "Ação"
|
|
11
|
+
},
|
|
12
|
+
"userInfoColumn": {
|
|
13
|
+
"Date": "Data",
|
|
14
|
+
"Store": "Loja",
|
|
15
|
+
"Team": "Equipa em Gestão",
|
|
16
|
+
"Supervisor": "Supervisor",
|
|
17
|
+
"TypeOfContract": "Tipo de contrato",
|
|
18
|
+
"Nationality": "Nacionalidade",
|
|
19
|
+
"CivilStatus": "Estado Civil",
|
|
20
|
+
"IdentificationDocument": "Doc.Identificação",
|
|
21
|
+
"NTaxpayer": "Nº Contribuinte",
|
|
22
|
+
"NIB": "NIB",
|
|
23
|
+
"SocialSecurity": "Nr Segurança Social",
|
|
24
|
+
"NChildren": "Nº Filhos",
|
|
25
|
+
"Workload": "Carga horária",
|
|
26
|
+
"Description": "Descrição",
|
|
27
|
+
"Comments": "Comentários"
|
|
10
28
|
},
|
|
11
29
|
"navigation": {
|
|
12
|
-
"back": "Go Back",
|
|
13
|
-
"logout": "Log Out",
|
|
14
|
-
"home": "Home"
|
|
30
|
+
"back": "Go Back ENG",
|
|
31
|
+
"logout": "Log Out ENG",
|
|
32
|
+
"home": "Home ENG"
|
|
15
33
|
},
|
|
16
34
|
"actions": {
|
|
17
|
-
"one": "one",
|
|
18
|
-
"two": "two"
|
|
35
|
+
"one": "one ENG",
|
|
36
|
+
"two": "two ENG"
|
|
19
37
|
},
|
|
20
38
|
"components": {
|
|
21
39
|
"category": {
|
|
22
|
-
"addQuestion": "Add Question",
|
|
23
|
-
"placeholderInfo": "Question Information",
|
|
24
|
-
"errorInfo": "Missing Question Information",
|
|
25
|
-
"placeholderQuestion": "Question",
|
|
26
|
-
"errorQuestion": "Missing Question",
|
|
27
|
-
"placeholderGrade": "Grade",
|
|
28
|
-
"errorGrade": "Missing Grade"
|
|
40
|
+
"addQuestion": "Add Question ENG",
|
|
41
|
+
"placeholderInfo": "Question Information ENG",
|
|
42
|
+
"errorInfo": "Missing Question Information ENG",
|
|
43
|
+
"placeholderQuestion": "Question ENG",
|
|
44
|
+
"errorQuestion": "Missing Question ENG",
|
|
45
|
+
"placeholderGrade": "Grade ENG",
|
|
46
|
+
"errorGrade": "Missing Grade ENG"
|
|
47
|
+
},
|
|
48
|
+
"categorySidBar": {
|
|
49
|
+
"addCategory": "Adicionar Categoria",
|
|
50
|
+
"removeCategory": "Remover Categoria"
|
|
51
|
+
},
|
|
52
|
+
"categoryContent": {
|
|
53
|
+
"message": "Por favor selecione uma categoria na barra lateral",
|
|
54
|
+
"categoryName": "Nome Categoria",
|
|
55
|
+
"weighting": "Ponderação",
|
|
56
|
+
"openAnswer": "Resposta Aberta",
|
|
57
|
+
"answerOption": "Opção De Resposta",
|
|
58
|
+
"answers": "Questões"
|
|
29
59
|
},
|
|
30
60
|
"categoryResponse": {
|
|
31
|
-
"notApplicable": "
|
|
32
|
-
"answer": "
|
|
61
|
+
"notApplicable": "Não Aplicável",
|
|
62
|
+
"answer": "Resposta"
|
|
33
63
|
},
|
|
34
64
|
"categoryReadOnly": {
|
|
35
|
-
"categories": "Categories",
|
|
36
|
-
"categoryAverage": "
|
|
65
|
+
"categories": "Categories ENG",
|
|
66
|
+
"categoryAverage": "Categoy Score ENG"
|
|
67
|
+
},
|
|
68
|
+
"analyticsBar": {
|
|
69
|
+
"desc": "Decrescente",
|
|
70
|
+
"asc": "Crescente"
|
|
71
|
+
},
|
|
72
|
+
"tag": {
|
|
73
|
+
"search": "Procurar"
|
|
74
|
+
},
|
|
75
|
+
"table": {
|
|
76
|
+
"selectAll": "Select All",
|
|
77
|
+
"deselectAll": "Deselect All"
|
|
37
78
|
}
|
|
38
79
|
}
|
|
39
80
|
}
|