@omniumretail/component-library 1.0.58 → 1.0.60
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 +103 -59
- package/dist/main.css +13 -0
- package/dist/types/components/Menu/index.d.ts +0 -1
- package/dist/types/components/Table/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/components/Table/index.tsx +55 -3
- package/src/components/Table/styles.module.scss +18 -4
- package/src/locales/en.json +56 -34
- package/src/locales/es.json +51 -10
- package/src/locales/pt.json +5 -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
|
\************************************************************************************************************************************************************/
|
|
@@ -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
|
@@ -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
|
+
onSelectAllButtonClick &&
|
|
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
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -1,58 +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"
|
|
29
47
|
},
|
|
30
48
|
"categorySidBar": {
|
|
31
|
-
"addCategory": "
|
|
32
|
-
"removeCategory": "
|
|
49
|
+
"addCategory": "Adicionar Categoria",
|
|
50
|
+
"removeCategory": "Remover Categoria"
|
|
33
51
|
},
|
|
34
52
|
"categoryContent": {
|
|
35
|
-
"message": "Por favor selecione uma categoria na barra lateral
|
|
36
|
-
"categoryName": "Nome Categoria
|
|
37
|
-
"weighting": "Ponderação
|
|
38
|
-
"openAnswer": "Resposta Aberta
|
|
39
|
-
"answerOption": "Opção De Resposta
|
|
40
|
-
"answers": "Questões
|
|
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"
|
|
41
59
|
},
|
|
42
60
|
"categoryResponse": {
|
|
43
|
-
"notApplicable": "Não Aplicável
|
|
44
|
-
"answer": "Resposta
|
|
61
|
+
"notApplicable": "Não Aplicável",
|
|
62
|
+
"answer": "Resposta"
|
|
45
63
|
},
|
|
46
64
|
"categoryReadOnly": {
|
|
47
|
-
"categories": "Categories",
|
|
48
|
-
"categoryAverage": "
|
|
65
|
+
"categories": "Categories ENG",
|
|
66
|
+
"categoryAverage": "Categoy Score ENG"
|
|
49
67
|
},
|
|
50
68
|
"analyticsBar": {
|
|
51
|
-
"desc": "Decrescente
|
|
52
|
-
"asc": "Crescente
|
|
69
|
+
"desc": "Decrescente",
|
|
70
|
+
"asc": "Crescente"
|
|
53
71
|
},
|
|
54
72
|
"tag": {
|
|
55
|
-
"search": "Procurar
|
|
73
|
+
"search": "Procurar"
|
|
74
|
+
},
|
|
75
|
+
"table": {
|
|
76
|
+
"selectAll": "Select All",
|
|
77
|
+
"deselectAll": "Deselect All"
|
|
56
78
|
}
|
|
57
79
|
}
|
|
58
80
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"tableHeadings": {
|
|
3
|
-
"key": "
|
|
4
|
-
"name": "
|
|
5
|
-
"mecanographicNumber": "
|
|
6
|
-
"store": "
|
|
7
|
-
"role": "
|
|
8
|
-
"type": "
|
|
9
|
-
"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
30
|
"back": "Go Back ES",
|
|
@@ -27,13 +45,36 @@
|
|
|
27
45
|
"placeholderGrade": "Grade ES",
|
|
28
46
|
"errorGrade": "Missing Grade ES"
|
|
29
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"
|
|
59
|
+
},
|
|
30
60
|
"categoryResponse": {
|
|
31
|
-
"notApplicable": "
|
|
32
|
-
"answer": "
|
|
61
|
+
"notApplicable": "Não Aplicável",
|
|
62
|
+
"answer": "Resposta"
|
|
33
63
|
},
|
|
34
64
|
"categoryReadOnly": {
|
|
35
65
|
"categories": "Categories ES",
|
|
36
|
-
"categoryAverage": "
|
|
66
|
+
"categoryAverage": "Categoy Score ES"
|
|
67
|
+
},
|
|
68
|
+
"analyticsBar": {
|
|
69
|
+
"desc": "Decrescente",
|
|
70
|
+
"asc": "Crescente"
|
|
71
|
+
},
|
|
72
|
+
"tag": {
|
|
73
|
+
"search": "Procurar"
|
|
74
|
+
},
|
|
75
|
+
"table": {
|
|
76
|
+
"selectAll": "Select All ES",
|
|
77
|
+
"deselectAll": "Deselect All ES"
|
|
37
78
|
}
|
|
38
79
|
}
|
|
39
80
|
}
|
package/src/locales/pt.json
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"categoryReadOnly": {
|
|
65
65
|
"categories": "Categories PT",
|
|
66
|
-
"categoryAverage": "
|
|
66
|
+
"categoryAverage": "Categoy Score PT"
|
|
67
67
|
},
|
|
68
68
|
"analyticsBar": {
|
|
69
69
|
"desc": "Decrescente",
|
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
},
|
|
72
72
|
"tag": {
|
|
73
73
|
"search": "Procurar"
|
|
74
|
+
},
|
|
75
|
+
"table": {
|
|
76
|
+
"selectAll": "Select All PT",
|
|
77
|
+
"deselectAll": "Deselect All PT"
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
}
|