-
Notifications
You must be signed in to change notification settings - Fork 4k
/
constants.js
92 lines (86 loc) · 1.8 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* WordPress dependencies
*/
import { __, isRTL } from '@wordpress/i18n';
import {
blockTable,
category,
formatListBullets,
formatListBulletsRTL,
} from '@wordpress/icons';
/**
* Internal dependencies
*/
import ViewTable from './view-table';
import ViewGrid from './view-grid';
import ViewList from './view-list';
// Filter operators.
export const OPERATOR_IS = 'is';
export const OPERATOR_IS_NOT = 'isNot';
export const OPERATOR_IS_ANY = 'isAny';
export const OPERATOR_IS_NONE = 'isNone';
export const OPERATOR_IS_ALL = 'isAll';
export const OPERATOR_IS_NOT_ALL = 'isNotAll';
export const ALL_OPERATORS = [
OPERATOR_IS,
OPERATOR_IS_NOT,
OPERATOR_IS_ANY,
OPERATOR_IS_NONE,
OPERATOR_IS_ALL,
OPERATOR_IS_NOT_ALL,
];
export const OPERATORS = {
[ OPERATOR_IS ]: {
key: 'is-filter',
label: __( 'Is' ),
},
[ OPERATOR_IS_NOT ]: {
key: 'is-not-filter',
label: __( 'Is not' ),
},
[ OPERATOR_IS_ANY ]: {
key: 'is-any-filter',
label: __( 'Is any' ),
},
[ OPERATOR_IS_NONE ]: {
key: 'is-none-filter',
label: __( 'Is none' ),
},
[ OPERATOR_IS_ALL ]: {
key: 'is-all-filter',
label: __( 'Is all' ),
},
[ OPERATOR_IS_NOT_ALL ]: {
key: 'is-not-all-filter',
label: __( 'Is not all' ),
},
};
// Sorting
export const SORTING_DIRECTIONS = {
asc: { label: __( 'Sort ascending' ) },
desc: { label: __( 'Sort descending' ) },
};
// View layouts.
export const LAYOUT_TABLE = 'table';
export const LAYOUT_GRID = 'grid';
export const LAYOUT_LIST = 'list';
export const VIEW_LAYOUTS = [
{
type: LAYOUT_TABLE,
label: __( 'Table' ),
component: ViewTable,
icon: blockTable,
},
{
type: LAYOUT_GRID,
label: __( 'Grid' ),
component: ViewGrid,
icon: category,
},
{
type: LAYOUT_LIST,
label: __( 'List' ),
component: ViewList,
icon: isRTL() ? formatListBulletsRTL : formatListBullets,
},
];