@controleonline/ui-default 1.0.265 → 1.0.267
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 +1 -1
- package/src/react/components/inputs/DefaultInput.js +71 -33
- package/src/react/components/inputs/DefaultInput.styles.js +36 -4
- package/src/react/components/inputs/DefaultSelect.js +83 -35
- package/src/react/components/inputs/defaultInputUtils.js +173 -26
- package/src/react/components/table/DefaultDebug.js +234 -233
- package/src/react/components/table/DefaultTable.js +431 -396
- package/src/react/components/table/DefaultTable.styles.js +69 -54
- package/src/react/components/table/DefaultTableCards.js +18 -9
- package/src/react/components/table/DefaultTableControls.js +205 -208
- package/src/react/components/table/DefaultTableFooter.js +10 -1
- package/src/react/components/table/DefaultTableRows.js +360 -333
- package/src/react/components/table/DefaultTableToolbar.js +8 -2
- package/src/react/components/table/useDefaultTableTheme.js +90 -47
- package/src/tests/react/components/table/DefaultTable.test.js +376 -241
- package/src/tests/react/inputs/defaultInputUtils.test.js +80 -9
|
@@ -16,15 +16,14 @@ const styles = StyleSheet.create({
|
|
|
16
16
|
flex: 1,
|
|
17
17
|
width: '100%',
|
|
18
18
|
minHeight: 0,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
overflow: 'visible',
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
overflow: 'hidden',
|
|
22
21
|
position: 'relative',
|
|
23
22
|
},
|
|
24
23
|
toolbar: {
|
|
25
|
-
minHeight:
|
|
26
|
-
paddingHorizontal:
|
|
27
|
-
paddingVertical:
|
|
24
|
+
minHeight: 52,
|
|
25
|
+
paddingHorizontal: 16,
|
|
26
|
+
paddingVertical: 10,
|
|
28
27
|
borderBottomWidth: 1,
|
|
29
28
|
flexDirection: 'row',
|
|
30
29
|
flexWrap: 'nowrap',
|
|
@@ -51,7 +50,7 @@ const styles = StyleSheet.create({
|
|
|
51
50
|
flexDirection: 'row',
|
|
52
51
|
flexWrap: 'nowrap',
|
|
53
52
|
alignItems: 'center',
|
|
54
|
-
gap:
|
|
53
|
+
gap: 8,
|
|
55
54
|
flexShrink: 0,
|
|
56
55
|
marginLeft: 'auto',
|
|
57
56
|
},
|
|
@@ -76,8 +75,8 @@ const styles = StyleSheet.create({
|
|
|
76
75
|
marginLeft: 0,
|
|
77
76
|
},
|
|
78
77
|
toolbarSearch: {
|
|
79
|
-
width:
|
|
80
|
-
maxWidth:
|
|
78
|
+
width: 260,
|
|
79
|
+
maxWidth: 360,
|
|
81
80
|
flexShrink: 1,
|
|
82
81
|
},
|
|
83
82
|
toolbarSearchButton: {
|
|
@@ -111,10 +110,10 @@ const styles = StyleSheet.create({
|
|
|
111
110
|
fontWeight: '900',
|
|
112
111
|
},
|
|
113
112
|
toolbarButton: {
|
|
114
|
-
minWidth:
|
|
115
|
-
height:
|
|
116
|
-
borderRadius:
|
|
117
|
-
paddingHorizontal:
|
|
113
|
+
minWidth: 36,
|
|
114
|
+
height: 36,
|
|
115
|
+
borderRadius: 8,
|
|
116
|
+
paddingHorizontal: 10,
|
|
118
117
|
borderWidth: 1,
|
|
119
118
|
flexDirection: 'row',
|
|
120
119
|
alignItems: 'center',
|
|
@@ -123,11 +122,23 @@ const styles = StyleSheet.create({
|
|
|
123
122
|
},
|
|
124
123
|
toolbarButtonActive: {
|
|
125
124
|
},
|
|
126
|
-
toolbarAddButton: {
|
|
127
|
-
minWidth:
|
|
128
|
-
width:
|
|
129
|
-
paddingHorizontal: 0,
|
|
130
|
-
},
|
|
125
|
+
toolbarAddButton: {
|
|
126
|
+
minWidth: 36,
|
|
127
|
+
width: 36,
|
|
128
|
+
paddingHorizontal: 0,
|
|
129
|
+
},
|
|
130
|
+
floatingAddButton: {
|
|
131
|
+
position: 'absolute',
|
|
132
|
+
right: 16,
|
|
133
|
+
bottom: 16,
|
|
134
|
+
width: 52,
|
|
135
|
+
height: 52,
|
|
136
|
+
borderRadius: 26,
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
justifyContent: 'center',
|
|
139
|
+
zIndex: 30,
|
|
140
|
+
...shadow,
|
|
141
|
+
},
|
|
131
142
|
toolbarBadgeText: {
|
|
132
143
|
fontSize: 10,
|
|
133
144
|
fontWeight: '900',
|
|
@@ -271,8 +282,8 @@ const styles = StyleSheet.create({
|
|
|
271
282
|
minWidth: '100%',
|
|
272
283
|
minHeight: 0,
|
|
273
284
|
},
|
|
274
|
-
headerRow: {
|
|
275
|
-
minHeight:
|
|
285
|
+
headerRow: {
|
|
286
|
+
minHeight: 40,
|
|
276
287
|
width: '100%',
|
|
277
288
|
flexDirection: 'row',
|
|
278
289
|
alignItems: 'center',
|
|
@@ -280,8 +291,8 @@ const styles = StyleSheet.create({
|
|
|
280
291
|
borderBottomWidth: 1,
|
|
281
292
|
borderBottomColor: '#E2E8F0',
|
|
282
293
|
},
|
|
283
|
-
filterRow: {
|
|
284
|
-
minHeight:
|
|
294
|
+
filterRow: {
|
|
295
|
+
minHeight: 46,
|
|
285
296
|
width: '100%',
|
|
286
297
|
flexDirection: 'row',
|
|
287
298
|
alignItems: 'stretch',
|
|
@@ -289,25 +300,24 @@ const styles = StyleSheet.create({
|
|
|
289
300
|
borderBottomWidth: 1,
|
|
290
301
|
borderBottomColor: '#E2E8F0',
|
|
291
302
|
},
|
|
292
|
-
row: {
|
|
293
|
-
minHeight:
|
|
303
|
+
row: {
|
|
304
|
+
minHeight: 48,
|
|
294
305
|
width: '100%',
|
|
295
306
|
flexDirection: 'row',
|
|
296
307
|
alignItems: 'stretch',
|
|
297
308
|
borderBottomWidth: 1,
|
|
298
309
|
borderBottomColor: '#EEF2F7',
|
|
299
310
|
},
|
|
300
|
-
cell: {
|
|
301
|
-
minWidth: 118,
|
|
302
|
-
flexBasis: 118,
|
|
311
|
+
cell: {
|
|
312
|
+
minWidth: 118,
|
|
313
|
+
flexBasis: 118,
|
|
303
314
|
flexGrow: 1,
|
|
304
315
|
flexShrink: 0,
|
|
305
|
-
paddingHorizontal:
|
|
306
|
-
paddingVertical:
|
|
307
|
-
justifyContent: 'center',
|
|
308
|
-
borderRightWidth:
|
|
309
|
-
|
|
310
|
-
},
|
|
316
|
+
paddingHorizontal: 14,
|
|
317
|
+
paddingVertical: 10,
|
|
318
|
+
justifyContent: 'center',
|
|
319
|
+
borderRightWidth: 0,
|
|
320
|
+
},
|
|
311
321
|
identityCell: {
|
|
312
322
|
minWidth: 76,
|
|
313
323
|
flexBasis: 76,
|
|
@@ -365,13 +375,12 @@ const styles = StyleSheet.create({
|
|
|
365
375
|
flexBasis: 132,
|
|
366
376
|
flexGrow: 0.9,
|
|
367
377
|
},
|
|
368
|
-
headerText: {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
},
|
|
378
|
+
headerText: {
|
|
379
|
+
fontSize: 11,
|
|
380
|
+
fontWeight: '800',
|
|
381
|
+
letterSpacing: 0,
|
|
382
|
+
textTransform: 'uppercase',
|
|
383
|
+
},
|
|
375
384
|
sortableHeader: {
|
|
376
385
|
flexDirection: 'row',
|
|
377
386
|
alignItems: 'center',
|
|
@@ -392,11 +401,10 @@ const styles = StyleSheet.create({
|
|
|
392
401
|
fontSize: 11,
|
|
393
402
|
fontWeight: '700',
|
|
394
403
|
},
|
|
395
|
-
cellText: {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
},
|
|
404
|
+
cellText: {
|
|
405
|
+
fontSize: 13,
|
|
406
|
+
fontWeight: '600',
|
|
407
|
+
},
|
|
400
408
|
mutedCellText: {
|
|
401
409
|
color: '#94A3B8',
|
|
402
410
|
},
|
|
@@ -479,23 +487,30 @@ const styles = StyleSheet.create({
|
|
|
479
487
|
flexGrow: 1,
|
|
480
488
|
width: '100%',
|
|
481
489
|
},
|
|
482
|
-
cardItem: {
|
|
483
|
-
position: 'relative',
|
|
484
|
-
},
|
|
490
|
+
cardItem: {
|
|
491
|
+
position: 'relative',
|
|
492
|
+
},
|
|
493
|
+
cardItemWithActions: {
|
|
494
|
+
flexDirection: 'row',
|
|
495
|
+
alignItems: 'center',
|
|
496
|
+
gap: 8,
|
|
497
|
+
},
|
|
498
|
+
cardContent: {
|
|
499
|
+
flex: 1,
|
|
500
|
+
minWidth: 0,
|
|
501
|
+
},
|
|
485
502
|
cardActions: {
|
|
486
|
-
position: 'absolute',
|
|
487
|
-
right: 10,
|
|
488
|
-
bottom: 10,
|
|
489
503
|
flexDirection: 'row',
|
|
490
504
|
alignItems: 'center',
|
|
505
|
+
justifyContent: 'flex-end',
|
|
491
506
|
gap: 6,
|
|
507
|
+
flexShrink: 0,
|
|
492
508
|
},
|
|
493
509
|
cardActionGroup: {
|
|
494
|
-
position: 'absolute',
|
|
495
|
-
right: 8,
|
|
496
|
-
top: 8,
|
|
497
510
|
flexDirection: 'row',
|
|
498
511
|
alignItems: 'center',
|
|
512
|
+
justifyContent: 'flex-end',
|
|
513
|
+
alignSelf: 'flex-end',
|
|
499
514
|
gap: 6,
|
|
500
515
|
},
|
|
501
516
|
defaultCard: {
|
|
@@ -81,15 +81,24 @@ const DefaultTableCards = ({ storeName }) => {
|
|
|
81
81
|
|
|
82
82
|
if (typeof configs.renderCard === 'function') {
|
|
83
83
|
return (
|
|
84
|
-
<View
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
84
|
+
<View
|
|
85
|
+
key={row?.['@id'] || row?.id}
|
|
86
|
+
style={[
|
|
87
|
+
styles.cardItem,
|
|
88
|
+
hasRowActions ? styles.cardItemWithActions : null,
|
|
89
|
+
rowStyleValue,
|
|
90
|
+
]}
|
|
91
|
+
>
|
|
92
|
+
<View style={styles.cardContent}>
|
|
93
|
+
{configs.renderCard({
|
|
94
|
+
item: row,
|
|
95
|
+
openEdit: () => configs.onEditRow?.(row),
|
|
96
|
+
openRow: hasRowPress ? () => configs.onRowPress(row) : null,
|
|
97
|
+
renderField,
|
|
98
|
+
renderValue,
|
|
99
|
+
row,
|
|
100
|
+
})}
|
|
101
|
+
</View>
|
|
93
102
|
{hasRowActions ? (
|
|
94
103
|
<View style={styles.cardActions}>
|
|
95
104
|
{customRowActions}
|
|
@@ -1,208 +1,205 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, TouchableOpacity } from 'react-native';
|
|
3
|
-
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
-
import { useStore } from '@store';
|
|
5
|
-
import DefaultColumnMenu from './DefaultColumnMenu';
|
|
6
|
-
import DefaultDebug from './DefaultDebug';
|
|
7
|
-
import DefaultFiltersModal from './DefaultFiltersModal';
|
|
8
|
-
import DefaultModalButton from './DefaultModalButton';
|
|
9
|
-
import styles from './DefaultTable.styles';
|
|
10
|
-
import { normalizeText } from '../inputs/defaultInputUtils';
|
|
11
|
-
import {
|
|
12
|
-
persistTableViewModePreference,
|
|
13
|
-
resolveDefaultTablePreferenceScope,
|
|
14
|
-
} from '../../utils/tableVisibleColumnsPreferences';
|
|
15
|
-
import { shouldIncludeColumn } from './DefaultTable.utils';
|
|
16
|
-
import useDefaultTableTheme from './useDefaultTableTheme';
|
|
17
|
-
|
|
18
|
-
const DefaultTableControls = ({ storeName }) => {
|
|
19
|
-
const store = useStore(storeName);
|
|
20
|
-
const configs = store?.getters?.configs || {};
|
|
21
|
-
const effectiveViewMode =
|
|
22
|
-
configs.effectiveViewMode ||
|
|
23
|
-
configs.viewMode ||
|
|
24
|
-
configs.initialViewMode ||
|
|
25
|
-
'table';
|
|
26
|
-
const tablePreferenceScope =
|
|
27
|
-
configs.tablePreferenceScope ||
|
|
28
|
-
resolveDefaultTablePreferenceScope({ storeName });
|
|
29
|
-
const columns = Array.isArray(store?.getters?.columns) ? store.getters.columns : [];
|
|
30
|
-
const filters = store?.getters?.filters || {};
|
|
31
|
-
const hasFilterableColumns = columns.some(
|
|
32
|
-
column =>
|
|
33
|
-
configs.showColumnFiltersButton !== false &&
|
|
34
|
-
shouldIncludeColumn(column) &&
|
|
35
|
-
column?.filter !== false &&
|
|
36
|
-
column?.filters !== false,
|
|
37
|
-
);
|
|
38
|
-
const tableFiltersVisible = Boolean(configs.tableFiltersVisible);
|
|
39
|
-
const activeFilterCount = Object.values(filters).filter(value => normalizeText(value) !== '').length;
|
|
40
|
-
const addConfig = store?.getters?.add;
|
|
41
|
-
const shouldRenderAddButton =
|
|
42
|
-
(addConfig === true || configs.add === true) &&
|
|
43
|
-
(typeof configs.onAdd === 'function' || typeof store?.actions?.save === 'function');
|
|
44
|
-
const { tableButtonColors } = useDefaultTableTheme();
|
|
45
|
-
const {
|
|
46
|
-
backgroundColor,
|
|
47
|
-
borderColor,
|
|
48
|
-
iconColor,
|
|
49
|
-
pressedBackgroundColor,
|
|
50
|
-
pressedBorderColor,
|
|
51
|
-
pressedIconColor,
|
|
52
|
-
textColor,
|
|
53
|
-
} = tableButtonColors;
|
|
54
|
-
|
|
55
|
-
const buttonStyle = [
|
|
56
|
-
styles.toolbarButton,
|
|
57
|
-
{ borderColor, backgroundColor },
|
|
58
|
-
];
|
|
59
|
-
const pressedStyle = {
|
|
60
|
-
backgroundColor: pressedBackgroundColor,
|
|
61
|
-
borderColor: pressedBorderColor,
|
|
62
|
-
};
|
|
63
|
-
const updateConfigs = nextConfigs => {
|
|
64
|
-
if (typeof store?.actions?.setConfigs === 'function') {
|
|
65
|
-
store.actions.setConfigs(nextConfigs);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (store?.getters) {
|
|
70
|
-
store.getters.configs = nextConfigs;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export default DefaultTableControls;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, TouchableOpacity } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/Feather';
|
|
4
|
+
import { useStore } from '@store';
|
|
5
|
+
import DefaultColumnMenu from './DefaultColumnMenu';
|
|
6
|
+
import DefaultDebug from './DefaultDebug';
|
|
7
|
+
import DefaultFiltersModal from './DefaultFiltersModal';
|
|
8
|
+
import DefaultModalButton from './DefaultModalButton';
|
|
9
|
+
import styles from './DefaultTable.styles';
|
|
10
|
+
import { normalizeText } from '../inputs/defaultInputUtils';
|
|
11
|
+
import {
|
|
12
|
+
persistTableViewModePreference,
|
|
13
|
+
resolveDefaultTablePreferenceScope,
|
|
14
|
+
} from '../../utils/tableVisibleColumnsPreferences';
|
|
15
|
+
import { shouldIncludeColumn } from './DefaultTable.utils';
|
|
16
|
+
import useDefaultTableTheme from './useDefaultTableTheme';
|
|
17
|
+
|
|
18
|
+
const DefaultTableControls = ({ storeName }) => {
|
|
19
|
+
const store = useStore(storeName);
|
|
20
|
+
const configs = store?.getters?.configs || {};
|
|
21
|
+
const effectiveViewMode =
|
|
22
|
+
configs.effectiveViewMode ||
|
|
23
|
+
configs.viewMode ||
|
|
24
|
+
configs.initialViewMode ||
|
|
25
|
+
'table';
|
|
26
|
+
const tablePreferenceScope =
|
|
27
|
+
configs.tablePreferenceScope ||
|
|
28
|
+
resolveDefaultTablePreferenceScope({ storeName });
|
|
29
|
+
const columns = Array.isArray(store?.getters?.columns) ? store.getters.columns : [];
|
|
30
|
+
const filters = store?.getters?.filters || {};
|
|
31
|
+
const hasFilterableColumns = columns.some(
|
|
32
|
+
column =>
|
|
33
|
+
configs.showColumnFiltersButton !== false &&
|
|
34
|
+
shouldIncludeColumn(column) &&
|
|
35
|
+
column?.filter !== false &&
|
|
36
|
+
column?.filters !== false,
|
|
37
|
+
);
|
|
38
|
+
const tableFiltersVisible = Boolean(configs.tableFiltersVisible);
|
|
39
|
+
const activeFilterCount = Object.values(filters).filter(value => normalizeText(value) !== '').length;
|
|
40
|
+
const addConfig = store?.getters?.add;
|
|
41
|
+
const shouldRenderAddButton =
|
|
42
|
+
(addConfig === true || configs.add === true) &&
|
|
43
|
+
(typeof configs.onAdd === 'function' || typeof store?.actions?.save === 'function');
|
|
44
|
+
const { tableButtonColors } = useDefaultTableTheme();
|
|
45
|
+
const {
|
|
46
|
+
backgroundColor,
|
|
47
|
+
borderColor,
|
|
48
|
+
iconColor,
|
|
49
|
+
pressedBackgroundColor,
|
|
50
|
+
pressedBorderColor,
|
|
51
|
+
pressedIconColor,
|
|
52
|
+
textColor,
|
|
53
|
+
} = tableButtonColors;
|
|
54
|
+
|
|
55
|
+
const buttonStyle = [
|
|
56
|
+
styles.toolbarButton,
|
|
57
|
+
{ borderColor, backgroundColor },
|
|
58
|
+
];
|
|
59
|
+
const pressedStyle = {
|
|
60
|
+
backgroundColor: pressedBackgroundColor,
|
|
61
|
+
borderColor: pressedBorderColor,
|
|
62
|
+
};
|
|
63
|
+
const updateConfigs = nextConfigs => {
|
|
64
|
+
if (typeof store?.actions?.setConfigs === 'function') {
|
|
65
|
+
store.actions.setConfigs(nextConfigs);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (store?.getters) {
|
|
70
|
+
store.getters.configs = nextConfigs;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const nextViewMode = effectiveViewMode === 'table' ? 'cards' : 'table';
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<DefaultDebug storeName={storeName} />
|
|
78
|
+
{hasFilterableColumns && effectiveViewMode === 'table' ? (
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
style={[
|
|
81
|
+
...buttonStyle,
|
|
82
|
+
tableFiltersVisible ? pressedStyle : null,
|
|
83
|
+
]}
|
|
84
|
+
activeOpacity={0.82}
|
|
85
|
+
onPress={() =>
|
|
86
|
+
updateConfigs({
|
|
87
|
+
...configs,
|
|
88
|
+
tableFiltersVisible: !tableFiltersVisible,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
>
|
|
92
|
+
<Icon
|
|
93
|
+
name="filter"
|
|
94
|
+
size={14}
|
|
95
|
+
color={tableFiltersVisible ? pressedIconColor : textColor}
|
|
96
|
+
/>
|
|
97
|
+
{activeFilterCount > 0 ? (
|
|
98
|
+
<Text
|
|
99
|
+
style={[
|
|
100
|
+
styles.toolbarBadgeText,
|
|
101
|
+
{ color: tableFiltersVisible ? pressedIconColor : textColor },
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
104
|
+
{activeFilterCount}
|
|
105
|
+
</Text>
|
|
106
|
+
) : null}
|
|
107
|
+
</TouchableOpacity>
|
|
108
|
+
) : null}
|
|
109
|
+
{hasFilterableColumns && effectiveViewMode === 'cards' ? (
|
|
110
|
+
<DefaultModalButton
|
|
111
|
+
renderButton={({ isOpen, open }) => (
|
|
112
|
+
<TouchableOpacity
|
|
113
|
+
style={[
|
|
114
|
+
...buttonStyle,
|
|
115
|
+
isOpen ? pressedStyle : null,
|
|
116
|
+
]}
|
|
117
|
+
activeOpacity={0.82}
|
|
118
|
+
onPress={open}
|
|
119
|
+
>
|
|
120
|
+
<Icon
|
|
121
|
+
name="filter"
|
|
122
|
+
size={14}
|
|
123
|
+
color={isOpen ? pressedIconColor : textColor}
|
|
124
|
+
/>
|
|
125
|
+
{activeFilterCount > 0 ? (
|
|
126
|
+
<Text
|
|
127
|
+
style={[
|
|
128
|
+
styles.toolbarBadgeText,
|
|
129
|
+
{ color: isOpen ? pressedIconColor : textColor },
|
|
130
|
+
]}>
|
|
131
|
+
{activeFilterCount}
|
|
132
|
+
</Text>
|
|
133
|
+
) : null}
|
|
134
|
+
</TouchableOpacity>
|
|
135
|
+
)}
|
|
136
|
+
>
|
|
137
|
+
{({ close, isOpen }) => (
|
|
138
|
+
<DefaultFiltersModal
|
|
139
|
+
storeName={storeName}
|
|
140
|
+
visible={isOpen}
|
|
141
|
+
onClose={close}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</DefaultModalButton>
|
|
145
|
+
) : null}
|
|
146
|
+
<TouchableOpacity
|
|
147
|
+
style={buttonStyle}
|
|
148
|
+
activeOpacity={0.82}
|
|
149
|
+
onPress={() => {
|
|
150
|
+
const nextConfigs = {
|
|
151
|
+
...configs,
|
|
152
|
+
effectiveViewMode: nextViewMode,
|
|
153
|
+
viewMode: nextViewMode,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
persistTableViewModePreference(tablePreferenceScope, nextConfigs.viewMode);
|
|
157
|
+
updateConfigs(nextConfigs);
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<Icon
|
|
161
|
+
name={nextViewMode === 'cards' ? 'grid' : 'list'}
|
|
162
|
+
size={14}
|
|
163
|
+
color={textColor}
|
|
164
|
+
/>
|
|
165
|
+
</TouchableOpacity>
|
|
166
|
+
<DefaultModalButton
|
|
167
|
+
renderButton={({ isOpen, toggle }) => (
|
|
168
|
+
<TouchableOpacity
|
|
169
|
+
style={[
|
|
170
|
+
...buttonStyle,
|
|
171
|
+
isOpen ? pressedStyle : null,
|
|
172
|
+
]}
|
|
173
|
+
activeOpacity={0.82}
|
|
174
|
+
onPress={toggle}
|
|
175
|
+
>
|
|
176
|
+
<Icon name="columns" size={14} color={isOpen ? pressedIconColor : textColor} />
|
|
177
|
+
</TouchableOpacity>
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
{({ close, isOpen }) => (
|
|
181
|
+
<DefaultColumnMenu
|
|
182
|
+
storeName={storeName}
|
|
183
|
+
visible={isOpen}
|
|
184
|
+
onClose={close}
|
|
185
|
+
/>
|
|
186
|
+
)}
|
|
187
|
+
</DefaultModalButton>
|
|
188
|
+
{shouldRenderAddButton ? (
|
|
189
|
+
<TouchableOpacity
|
|
190
|
+
style={[
|
|
191
|
+
styles.toolbarButton,
|
|
192
|
+
styles.toolbarAddButton,
|
|
193
|
+
{ backgroundColor: backgroundColor, borderColor: backgroundColor },
|
|
194
|
+
]}
|
|
195
|
+
activeOpacity={0.85}
|
|
196
|
+
onPress={() => configs.onAdd?.()}
|
|
197
|
+
>
|
|
198
|
+
<Icon name="plus" size={16} color={textColor} />
|
|
199
|
+
</TouchableOpacity>
|
|
200
|
+
) : null}
|
|
201
|
+
</>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default DefaultTableControls;
|