@@ -7,7 +7,7 @@ import { arrowDown, arrowUp } from '@wordpress/icons';
77/**
88 * Internal dependencies
99 */
10- import type { Operator , DayNumber } from './types' ;
10+ import type { DayNumber } from './types' ;
1111
1212// Filter operators.
1313export const OPERATOR_IS_ANY = 'isAny' ;
@@ -33,179 +33,6 @@ export const OPERATOR_STARTS_WITH = 'startsWith';
3333export const OPERATOR_ON = 'on' ;
3434export const OPERATOR_NOT_ON = 'notOn' ;
3535
36- export const OPERATORS : {
37- name : Operator ;
38- label : string ;
39- display ?: string ;
40- selection : 'single' | 'multi' | 'custom' ;
41- } [ ] = [
42- {
43- name : OPERATOR_IS_ANY ,
44- /* translators: DataViews operator name */
45- label : __ ( 'Includes' ) ,
46- selection : 'multi' ,
47- } ,
48- {
49- name : OPERATOR_IS_NONE ,
50- /* translators: DataViews operator name */
51- label : __ ( 'Is none of' ) ,
52- selection : 'multi' ,
53- } ,
54- {
55- name : OPERATOR_IS_ALL ,
56- /* translators: DataViews operator name */
57- label : __ ( 'Includes all' ) ,
58- selection : 'multi' ,
59- } ,
60- {
61- name : OPERATOR_IS_NOT_ALL ,
62- /* translators: DataViews operator name */
63- label : __ ( 'Is none of' ) ,
64- selection : 'multi' ,
65- } ,
66- {
67- name : OPERATOR_BETWEEN ,
68- /* translators: DataViews operator name */
69- label : __ ( 'Between (inc)' ) ,
70- selection : 'custom' ,
71- } ,
72- {
73- name : OPERATOR_IN_THE_PAST ,
74- /* translators: DataViews operator name */
75- label : __ ( 'In the past' ) ,
76- /* translators: DataViews operator string, e.g.: "Date is in the past: 2 days" */
77- display : __ ( 'is in the past' ) ,
78- selection : 'custom' ,
79- } ,
80- {
81- name : OPERATOR_OVER ,
82- /* translators: DataViews operator name */
83- label : __ ( 'Over' ) ,
84- /* translators: DataViews operator string, e.g.: "Date is over: 2 days" */
85- display : __ ( 'is over' ) ,
86- selection : 'custom' ,
87- } ,
88- {
89- name : OPERATOR_IS ,
90- /* translators: DataViews operator name */
91- label : __ ( 'Is' ) ,
92- selection : 'single' ,
93- } ,
94- {
95- name : OPERATOR_IS_NOT ,
96- /* translators: DataViews operator name */
97- label : __ ( 'Is not' ) ,
98- selection : 'single' ,
99- } ,
100- {
101- name : OPERATOR_LESS_THAN ,
102- /* translators: DataViews operator name */
103- label : __ ( 'Less than' ) ,
104- selection : 'single' ,
105- } ,
106- {
107- name : OPERATOR_GREATER_THAN ,
108- /* translators: DataViews operator name */
109- label : __ ( 'Greater than' ) ,
110- /* translators: DataViews operator string, e.g.: "Count is greater than: 2" */
111- display : __ ( 'is greater than' ) ,
112- selection : 'single' ,
113- } ,
114- {
115- name : OPERATOR_LESS_THAN_OR_EQUAL ,
116- /* translators: DataViews operator name */
117- label : __ ( 'Less than or equal' ) ,
118- /* translators: DataViews operator string, e.g.: "Count is less than or equal to: 2" */
119- display : __ ( 'is less than or equal to' ) ,
120- selection : 'single' ,
121- } ,
122- {
123- name : OPERATOR_GREATER_THAN_OR_EQUAL ,
124- /* translators: DataViews operator name */
125- label : __ ( 'Greater than or equal' ) ,
126- /* translators: DataViews operator string, e.g.: "Count is greater than or equal to: 2" */
127- display : __ ( 'is greater than or equal to' ) ,
128- selection : 'single' ,
129- } ,
130- {
131- name : OPERATOR_BEFORE ,
132- /* translators: DataViews operator name */
133- label : __ ( 'Before' ) ,
134- /* translators: DataViews operator string, e.g.: "Date is after: 2025-02-01" */
135- display : __ ( 'is before' ) ,
136- selection : 'single' ,
137- } ,
138- {
139- name : OPERATOR_AFTER ,
140- /* translators: DataViews operator name */
141- label : __ ( 'After' ) ,
142- /* translators: DataViews operator string, e.g.: "Date is after: 2025-02-01" */
143- display : __ ( 'is after' ) ,
144- selection : 'single' ,
145- } ,
146- {
147- name : OPERATOR_BEFORE_INC ,
148- /* translators: DataViews operator name */
149- label : __ ( 'Before (inc)' ) ,
150- /* translators: DataViews operator string, e.g.: "Date is on or before: 2025-02-01" */
151- display : __ ( 'is on or before' ) ,
152- selection : 'single' ,
153- } ,
154- {
155- name : OPERATOR_AFTER_INC ,
156- /* translators: DataViews operator name */
157- label : __ ( 'After (inc)' ) ,
158- /* translators: DataViews operator string, e.g.: "Date is on or after: 2025-02-01" */
159- display : __ ( 'is on or after' ) ,
160- selection : 'single' ,
161- } ,
162- {
163- name : OPERATOR_CONTAINS ,
164- /* translators: DataViews operator name */
165- label : __ ( 'Contains' ) ,
166- selection : 'single' ,
167- } ,
168- {
169- name : OPERATOR_NOT_CONTAINS ,
170- /* translators: DataViews operator name */
171- label : __ ( "Doesn't contain" ) ,
172- selection : 'single' ,
173- } ,
174- {
175- name : OPERATOR_STARTS_WITH ,
176- /* translators: DataViews operator name */
177- label : __ ( 'Starts with' ) ,
178- selection : 'single' ,
179- } ,
180- {
181- name : OPERATOR_ON ,
182- /* translators: DataViews operator name */
183- label : __ ( 'On' ) ,
184- /* translators: DataViews operator string, e.g.: "Author is: Admin" */
185- display : __ ( 'is' ) ,
186- selection : 'single' ,
187- } ,
188- {
189- name : OPERATOR_NOT_ON ,
190- /* translators: DataViews operator name */
191- label : __ ( 'Not on' ) ,
192- /* translators: DataViews operator string, e.g.: "Author is not: Admin" */
193- display : __ ( 'is not' ) ,
194- selection : 'single' ,
195- } ,
196- ] ;
197-
198- export const ALL_OPERATOR_NAMES = OPERATORS . map ( ( op ) => op . name ) ;
199- export const SINGLE_SELECTION_OPERATOR_NAMES = OPERATORS . filter (
200- ( op ) => op . selection === 'single'
201- ) . map ( ( op ) => op . name ) ;
202- export const MULTI_SELECTION_OPERATOR_NAMES = OPERATORS . filter (
203- ( op ) => op . selection === 'multi'
204- ) . map ( ( op ) => op . name ) ;
205- export const CUSTOM_SELECTION_OPERATOR_NAMES = OPERATORS . filter (
206- ( op ) => op . selection === 'custom'
207- ) . map ( ( op ) => op . name ) ;
208-
20936export const SORTING_DIRECTIONS = [ 'asc' , 'desc' ] as const ;
21037export const sortArrows = { asc : '↑' , desc : '↓' } ;
21138export const sortValues = { asc : 'ascending' , desc : 'descending' } as const ;
0 commit comments