@gooddata/sdk-ui-filters 11.54.0-alpha.3 → 11.54.0-alpha.4

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.
@@ -0,0 +1,15 @@
1
+ export declare class AbsoluteForm {
2
+ setStartDate: (value: string) => void;
3
+ submitStartDateWithEnter: (value: string) => void;
4
+ setEndDate: (value: string) => void;
5
+ submitEndDateWithEnter: (value: string) => void;
6
+ setStartTime: (value: string) => void;
7
+ setEndTime: (value: string) => void;
8
+ getStartDate: () => string;
9
+ getEndDate: () => string;
10
+ getStartTime: () => string;
11
+ getEndTime: () => string;
12
+ isVisible: () => boolean;
13
+ isErrorVisible: () => boolean;
14
+ }
15
+ //# sourceMappingURL=AbsoluteForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbsoluteForm.d.ts","sourceRoot":"","sources":["../../src/DateFilter/AbsoluteForm.tsx"],"names":[],"mappings":"AAWA,qBAAa,YAAY;IACd,YAAY,0BAIjB;IAEK,wBAAwB,0BAI7B;IAEK,UAAU,0BAIf;IAEK,sBAAsB,0BAI3B;IAEK,YAAY,0BAIjB;IAEK,UAAU,0BAIf;IAEK,YAAY,eAGjB;IAEK,UAAU,eAGf;IAEK,YAAY,eAGjB;IAEK,UAAU,eAGf;IAEK,SAAS,gBAA+C;IAExD,cAAc,gBAAyC;CACjE"}
@@ -0,0 +1,58 @@
1
+ // (C) 2022-2026 GoodData Corporation
2
+ import { fireEvent } from "@testing-library/react";
3
+ const rangePicker = ".s-date-range-picker";
4
+ const error = ".s-absolute-range-error";
5
+ const startDateInput = ".s-date-range-picker-from .s-date-range-picker-input-field";
6
+ const endDateInput = ".s-date-range-picker-to .s-date-range-picker-input-field";
7
+ const startTimeInput = ".s-date-range-picker-from .s-date-range-picker-input-time .input-text";
8
+ const endTimeInput = ".s-date-range-picker-to .s-date-range-picker-input-time .input-text";
9
+ export class AbsoluteForm {
10
+ setStartDate = (value) => {
11
+ const input = document.querySelector(startDateInput);
12
+ fireEvent.change(input, { target: { value } });
13
+ fireEvent.blur(input);
14
+ };
15
+ submitStartDateWithEnter = (value) => {
16
+ const input = document.querySelector(startDateInput);
17
+ fireEvent.change(input, { target: { value } });
18
+ fireEvent.keyDown(input, { key: "Enter" });
19
+ };
20
+ setEndDate = (value) => {
21
+ const input = document.querySelector(endDateInput);
22
+ fireEvent.change(input, { target: { value } });
23
+ fireEvent.blur(input);
24
+ };
25
+ submitEndDateWithEnter = (value) => {
26
+ const input = document.querySelector(endDateInput);
27
+ fireEvent.change(input, { target: { value } });
28
+ fireEvent.keyDown(input, { key: "Enter" });
29
+ };
30
+ setStartTime = (value) => {
31
+ const input = document.querySelector(startTimeInput);
32
+ fireEvent.change(input, { target: { value } });
33
+ fireEvent.blur(input);
34
+ };
35
+ setEndTime = (value) => {
36
+ const input = document.querySelector(endTimeInput);
37
+ fireEvent.change(input, { target: { value } });
38
+ fireEvent.blur(input);
39
+ };
40
+ getStartDate = () => {
41
+ const input = document.querySelector(startDateInput);
42
+ return input.value;
43
+ };
44
+ getEndDate = () => {
45
+ const input = document.querySelector(endDateInput);
46
+ return input.value;
47
+ };
48
+ getStartTime = () => {
49
+ const input = document.querySelector(startTimeInput);
50
+ return input.value;
51
+ };
52
+ getEndTime = () => {
53
+ const input = document.querySelector(endTimeInput);
54
+ return input.value;
55
+ };
56
+ isVisible = () => !!document.querySelector(rangePicker);
57
+ isErrorVisible = () => !!document.querySelector(error);
58
+ }
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from "react";
2
+ export declare function IntlDecorator(components: ReactElement, locale?: string): ReactElement;
3
+ //# sourceMappingURL=IntlDecorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlDecorators.d.ts","sourceRoot":"","sources":["../../../src/DateFilter/DateRangePicker/IntlDecorators.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,MAAM,GAAE,MAAgB,GAAG,YAAY,CAE9F"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IntlWrapper } from "@gooddata/sdk-ui";
3
+ export function IntlDecorator(components, locale = "en-US") {
4
+ return _jsx(IntlWrapper, { locale: locale, children: components });
5
+ }
@@ -0,0 +1,45 @@
1
+ import { type RenderResult } from "@testing-library/react";
2
+ import { type IDateFilterProps } from "./DateFilter.js";
3
+ import { type DateFilterOption, type IDateFilterOptionsByType } from "./interfaces/index.js";
4
+ export declare const defaultDateFilterOptions: IDateFilterOptionsByType;
5
+ export declare const createDateFilter: (customProps?: Partial<IDateFilterProps>) => RenderResult;
6
+ /**
7
+ * Use this component renderer if you need to check some state changes regarding apply handler
8
+ */
9
+ export declare const createDateFilterWithState: (customProps?: Partial<IDateFilterProps>) => RenderResult;
10
+ export declare function DateFilterWithState(customProps?: Partial<IDateFilterProps>): import("react/jsx-runtime").JSX.Element;
11
+ export declare const clickDateFilterButton: () => boolean;
12
+ export declare const clickApplyButton: () => boolean;
13
+ export declare const isApplyButtonDisabled: () => boolean;
14
+ export declare const clickCancelButton: () => boolean;
15
+ export declare const getDateFilterButtonText: () => string;
16
+ export declare const clickConfigurationButton: () => boolean;
17
+ export declare const getFilterTitle: () => string;
18
+ export declare const isDateFilterBodyVisible: () => boolean;
19
+ export declare const isDateFilterVisible: () => boolean;
20
+ export declare const getSelectedItemText: () => string;
21
+ export declare const isConfigurationButtonVisible: () => boolean;
22
+ export declare const getPresetByItem: (item: string, relativePreset: DateFilterOption[]) => DateFilterOption | undefined;
23
+ export declare const clickAllTime: () => boolean;
24
+ export declare const clickStaticFilter: (filter: string) => void;
25
+ export declare const getAllStaticItemsLabels: () => string[];
26
+ export declare const clickAbsoluteFilter: (filter: string) => void;
27
+ export declare const clickAbsoluteFormFilter: () => boolean;
28
+ export declare const openAbsoluteFormFilter: () => void;
29
+ export declare const dateToAbsoluteInputFormat: (dateString: string, dateFormat?: string) => string;
30
+ export declare const getTodayDate: (dateFormat?: string) => string;
31
+ export declare const getMonthAgo: (dateFormat?: string) => string;
32
+ export declare const clickRelativeFormFilter: () => void;
33
+ export declare const openRelativeFormFilter: () => void;
34
+ export declare const getRelativeFormInputFromValue: () => string;
35
+ export declare const getRelativeFormInputToValue: () => string;
36
+ export declare const setRelativeFormInputs: (from: string, to: string) => void;
37
+ export declare const clickRelativeFormGranularity: (granularity: string) => void;
38
+ export declare const isRelativeFormGranularitySelected: (granularity: string) => boolean;
39
+ export declare const isRelativeFormVisible: () => boolean;
40
+ export declare const isRelativeFormSelectMenuVisible: () => boolean;
41
+ export declare const queryExcludeCurrentPeriodCheckbox: () => HTMLInputElement | null;
42
+ export declare const getExcludeCurrentPeriodCheckbox: () => HTMLInputElement;
43
+ export declare const clickExcludeCurrentPeriodCheckBox: () => void;
44
+ export declare const isExcludeCurrentPeriodChecked: () => boolean;
45
+ //# sourceMappingURL=extendedDateFilters.test.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extendedDateFilters.test.helpers.d.ts","sourceRoot":"","sources":["../../src/DateFilter/extendedDateFilters.test.helpers.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAA6B,MAAM,wBAAwB,CAAC;AAOtF,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE7F,eAAO,MAAM,wBAAwB,EAAE,wBAuJtC,CAAC;AAgDF,eAAO,MAAM,gBAAgB,2DAI5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,2DAIrC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,WAAW,GAAE,OAAO,CAAC,gBAAgB,CAAM,2CAsB9E;AAID,eAAO,MAAM,qBAAqB,eAAmE,CAAC;AAItG,eAAO,MAAM,gBAAgB,eAA0C,CAAC;AAExE,eAAO,MAAM,qBAAqB,eAAuE,CAAC;AAE1G,eAAO,MAAM,iBAAiB,eAAoD,CAAC;AAEnF,eAAO,MAAM,uBAAuB,cAAkE,CAAC;AAEvG,eAAO,MAAM,wBAAwB,eAAsE,CAAC;AAI5G,eAAO,MAAM,cAAc,cAAmE,CAAC;AAE/F,eAAO,MAAM,uBAAuB,eAAiD,CAAC;AAEtF,eAAO,MAAM,mBAAmB,eAAmD,CAAC;AAEpF,eAAO,MAAM,mBAAmB,cAAoE,CAAC;AAErG,eAAO,MAAM,4BAA4B,eAAsD,CAAC;AAQhG,eAAO,MAAM,eAAe,oFAK3B,CAAC;AAUF,eAAO,MAAM,YAAY,eAAgE,CAAC;AAE1F,eAAO,MAAM,iBAAiB,0BAG7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,gBAMnC,CAAC;AAGF,eAAO,MAAM,mBAAmB,0BAG/B,CAAC;AAGF,eAAO,MAAM,uBAAuB,eAAqE,CAAC;AAE1G,eAAO,MAAM,sBAAsB,YAGlC,CAAC;AAEF,eAAO,MAAM,yBAAyB,qDAErC,CAAC;AAEF,eAAO,MAAM,YAAY,iCAExB,CAAC;AAEF,eAAO,MAAM,WAAW,iCAOvB,CAAC;AAGF,eAAO,MAAM,uBAAuB,YAEnC,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAGlC,CAAC;AAEF,eAAO,MAAM,6BAA6B,cACmC,CAAC;AAE9E,eAAO,MAAM,2BAA2B,cACmC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,oCAKjC,CAAC;AAkBF,eAAO,MAAM,4BAA4B,+BAGxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,kCAG7C,CAAC;AAEF,eAAO,MAAM,qBAAqB,eAAqD,CAAC;AAExF,eAAO,MAAM,+BAA+B,eAAyD,CAAC;AAItG,eAAO,MAAM,iCAAiC,+BACU,CAAC;AAEzD,eAAO,MAAM,+BAA+B,wBAA+D,CAAC;AAE5G,eAAO,MAAM,iCAAiC,YAE7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,eAAkD,CAAC"}
@@ -0,0 +1,327 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2007-2026 GoodData Corporation
3
+ import { useState } from "react";
4
+ import { fireEvent, render, screen } from "@testing-library/react";
5
+ import { add, formatDate } from "date-fns";
6
+ import moment from "moment";
7
+ import { platformDateFormat } from "./constants/Platform.js";
8
+ import { DateFilter } from "./DateFilter.js";
9
+ export const defaultDateFilterOptions = {
10
+ allTime: {
11
+ localIdentifier: "ALL_TIME",
12
+ type: "allTime",
13
+ name: "",
14
+ visible: true,
15
+ },
16
+ absoluteForm: {
17
+ localIdentifier: "ABSOLUTE_FORM",
18
+ type: "absoluteForm",
19
+ from: moment().subtract(1, "month").startOf("day").format(platformDateFormat),
20
+ to: moment().startOf("day").format(platformDateFormat),
21
+ name: "",
22
+ visible: true,
23
+ },
24
+ absolutePreset: [
25
+ {
26
+ from: "2019-12-24",
27
+ to: "2019-12-26",
28
+ name: "Christmas 2019",
29
+ localIdentifier: "CHRISTMAS_2019",
30
+ visible: true,
31
+ type: "absolutePreset",
32
+ },
33
+ {
34
+ from: "2018-01-01",
35
+ to: "2018-12-31",
36
+ name: "Year 2018",
37
+ localIdentifier: "YEAR_2018",
38
+ visible: true,
39
+ type: "absolutePreset",
40
+ },
41
+ ],
42
+ relativeForm: {
43
+ localIdentifier: "RELATIVE_FORM",
44
+ type: "relativeForm",
45
+ granularity: "GDC.time.month",
46
+ from: undefined,
47
+ to: undefined,
48
+ name: "",
49
+ visible: true,
50
+ },
51
+ relativePreset: {
52
+ "GDC.time.date": [
53
+ {
54
+ from: -6,
55
+ to: 0,
56
+ granularity: "GDC.time.date",
57
+ localIdentifier: "LAST_7_DAYS",
58
+ type: "relativePreset",
59
+ visible: true,
60
+ name: "",
61
+ },
62
+ {
63
+ from: -29,
64
+ to: 0,
65
+ granularity: "GDC.time.date",
66
+ localIdentifier: "LAST_30_DAYS",
67
+ type: "relativePreset",
68
+ visible: true,
69
+ name: "",
70
+ },
71
+ {
72
+ from: -89,
73
+ to: 0,
74
+ granularity: "GDC.time.date",
75
+ localIdentifier: "LAST_90_DAYS",
76
+ type: "relativePreset",
77
+ visible: true,
78
+ name: "",
79
+ },
80
+ ],
81
+ "GDC.time.month": [
82
+ {
83
+ from: 0,
84
+ to: 0,
85
+ granularity: "GDC.time.month",
86
+ localIdentifier: "THIS_MONTH",
87
+ type: "relativePreset",
88
+ visible: true,
89
+ name: "",
90
+ },
91
+ {
92
+ from: -1,
93
+ to: -1,
94
+ granularity: "GDC.time.month",
95
+ localIdentifier: "LAST_MONTH",
96
+ type: "relativePreset",
97
+ visible: true,
98
+ name: "",
99
+ },
100
+ {
101
+ from: -11,
102
+ to: 0,
103
+ granularity: "GDC.time.month",
104
+ localIdentifier: "LAST_12_MONTHS",
105
+ type: "relativePreset",
106
+ visible: true,
107
+ name: "",
108
+ },
109
+ ],
110
+ "GDC.time.quarter": [
111
+ {
112
+ from: 0,
113
+ to: 0,
114
+ granularity: "GDC.time.quarter",
115
+ localIdentifier: "THIS_QUARTER",
116
+ type: "relativePreset",
117
+ visible: true,
118
+ name: "",
119
+ },
120
+ {
121
+ from: -1,
122
+ to: -1,
123
+ granularity: "GDC.time.quarter",
124
+ localIdentifier: "LAST_QUARTER",
125
+ type: "relativePreset",
126
+ visible: true,
127
+ name: "",
128
+ },
129
+ {
130
+ from: -3,
131
+ to: 0,
132
+ granularity: "GDC.time.quarter",
133
+ localIdentifier: "LAST_4_QUARTERS",
134
+ type: "relativePreset",
135
+ visible: true,
136
+ name: "",
137
+ },
138
+ ],
139
+ "GDC.time.year": [
140
+ {
141
+ from: 0,
142
+ to: 0,
143
+ granularity: "GDC.time.year",
144
+ localIdentifier: "THIS_YEAR",
145
+ type: "relativePreset",
146
+ visible: true,
147
+ name: "",
148
+ },
149
+ {
150
+ from: -1,
151
+ to: -1,
152
+ granularity: "GDC.time.year",
153
+ localIdentifier: "LAST_YEAR",
154
+ type: "relativePreset",
155
+ visible: true,
156
+ name: "",
157
+ },
158
+ ],
159
+ },
160
+ };
161
+ const availableGranularities = [
162
+ "GDC.time.month",
163
+ "GDC.time.year",
164
+ "GDC.time.quarter",
165
+ "GDC.time.date",
166
+ "GDC.time.hour",
167
+ "GDC.time.minute",
168
+ ];
169
+ const defaultProps = {
170
+ excludeCurrentPeriod: false,
171
+ selectedFilterOption: defaultDateFilterOptions.allTime,
172
+ filterOptions: defaultDateFilterOptions,
173
+ availableGranularities,
174
+ isEditMode: false,
175
+ customFilterName: "Filter name",
176
+ dateFilterMode: "active",
177
+ onApply: () => { },
178
+ onCancel: () => { },
179
+ onOpen: () => { },
180
+ onClose: () => { },
181
+ };
182
+ const configurationButton = ".s-configuration-button";
183
+ const dateFilterButton = ".s-date-filter-button";
184
+ const dateButtonFilterTitle = ".s-date-filter-title";
185
+ const dateFilterButtonText = ".s-button-text";
186
+ const dateFilterSelectedItem = ".gd-list-item.is-selected";
187
+ const dateFilterBody = ".s-extended-date-filters-body";
188
+ const excludeCurrentPeriodCheckbox = ".s-exclude-current-period input";
189
+ const allTimeButton = "button.s-all-time";
190
+ const absoluteFormButton = "button.s-absolute-form-button";
191
+ const relativeFormButton = "button.s-relative-form-button";
192
+ const relativeFormPicker = ".s-relative-range-picker";
193
+ const relativeFormSelectMenu = ".s-select-menu";
194
+ const relativeFormInputFrom = ".s-relative-range-picker-from input";
195
+ const relativeFormInputTo = ".s-relative-range-picker-to input";
196
+ const relativeFormGranularityTab = (intlGranularity) => `.gd-tab.s-granularity-${intlGranularity}`;
197
+ const defaultDateFormat = "MM/dd/yyyy";
198
+ export const createDateFilter = (customProps = {}) => {
199
+ const props = { ...defaultProps, ...customProps };
200
+ return render(_jsx(DateFilter, { ...props }));
201
+ };
202
+ /**
203
+ * Use this component renderer if you need to check some state changes regarding apply handler
204
+ */
205
+ export const createDateFilterWithState = (customProps = {}) => {
206
+ const props = { ...defaultProps, ...customProps };
207
+ return render(_jsx(DateFilterWithState, { ...props }));
208
+ };
209
+ export function DateFilterWithState(customProps = {}) {
210
+ const [selectedFilterOption, setSelectedFilterOption] = useState(customProps.selectedFilterOption ?? defaultProps.selectedFilterOption);
211
+ const [excludeCurrentPeriod, setExcludeCurrentPeriod] = useState(customProps.excludeCurrentPeriod ?? defaultProps.excludeCurrentPeriod);
212
+ const handleApply = (selectedFilterOption, excludeCurrentPeriod) => {
213
+ setSelectedFilterOption(selectedFilterOption);
214
+ setExcludeCurrentPeriod(excludeCurrentPeriod);
215
+ customProps.onApply?.(selectedFilterOption, excludeCurrentPeriod);
216
+ };
217
+ return (_jsx(DateFilter, { ...defaultProps, ...customProps, selectedFilterOption: selectedFilterOption, excludeCurrentPeriod: excludeCurrentPeriod, onApply: handleApply }));
218
+ }
219
+ // common methods
220
+ export const clickDateFilterButton = () => fireEvent.click(document.querySelector(dateFilterButton));
221
+ const getApplyButton = () => screen.getByText("Apply");
222
+ export const clickApplyButton = () => fireEvent.click(getApplyButton());
223
+ export const isApplyButtonDisabled = () => getApplyButton().parentElement.classList.contains("disabled");
224
+ export const clickCancelButton = () => fireEvent.click(screen.getByText("Cancel"));
225
+ export const getDateFilterButtonText = () => document.querySelector(dateFilterButtonText).textContent;
226
+ export const clickConfigurationButton = () => fireEvent.click(document.querySelector(configurationButton));
227
+ // config
228
+ export const getFilterTitle = () => document.querySelector(dateButtonFilterTitle).textContent;
229
+ export const isDateFilterBodyVisible = () => !!document.querySelector(dateFilterBody);
230
+ export const isDateFilterVisible = () => !!document.querySelector(dateFilterButton);
231
+ export const getSelectedItemText = () => document.querySelector(dateFilterSelectedItem).textContent;
232
+ export const isConfigurationButtonVisible = () => !!document.querySelector(configurationButton);
233
+ // relative presets
234
+ const getLocalIdentifierFromItem = (item) => {
235
+ return item.toUpperCase().replace(/-/g, "_");
236
+ };
237
+ export const getPresetByItem = (item, relativePreset) => {
238
+ const localIdentifier = getLocalIdentifierFromItem(item);
239
+ return relativePreset.find((x) => {
240
+ return x.localIdentifier === localIdentifier.toUpperCase();
241
+ });
242
+ };
243
+ const getStaticFilterSelectorClass = (filter) => {
244
+ return `button.s-relative-preset-${filter}`;
245
+ };
246
+ const getAbsoluteFilterSelectorClass = (filter) => {
247
+ return `button.s-absolute-preset-${filter}`;
248
+ };
249
+ export const clickAllTime = () => fireEvent.click(document.querySelector(allTimeButton));
250
+ export const clickStaticFilter = (filter) => {
251
+ const filterSelector = getStaticFilterSelectorClass(filter);
252
+ fireEvent.click(document.querySelector(filterSelector));
253
+ };
254
+ export const getAllStaticItemsLabels = () => {
255
+ const labels = [];
256
+ document
257
+ .querySelectorAll("[class*='s-relative-preset-']")
258
+ .forEach((item) => labels.push(item.textContent));
259
+ return labels;
260
+ };
261
+ // absolute presets
262
+ export const clickAbsoluteFilter = (filter) => {
263
+ const filterSelector = getAbsoluteFilterSelectorClass(filter);
264
+ fireEvent.click(document.querySelector(filterSelector));
265
+ };
266
+ // Absolute filter form
267
+ export const clickAbsoluteFormFilter = () => fireEvent.click(document.querySelector(absoluteFormButton));
268
+ export const openAbsoluteFormFilter = () => {
269
+ clickDateFilterButton();
270
+ clickAbsoluteFormFilter();
271
+ };
272
+ export const dateToAbsoluteInputFormat = (dateString, dateFormat = defaultDateFormat) => {
273
+ return formatDate(new Date(dateString), dateFormat);
274
+ };
275
+ export const getTodayDate = (dateFormat = defaultDateFormat) => {
276
+ return formatDate(new Date(), dateFormat);
277
+ };
278
+ export const getMonthAgo = (dateFormat = defaultDateFormat) => {
279
+ return formatDate(add(new Date(), {
280
+ months: -1,
281
+ }), dateFormat);
282
+ };
283
+ // Relative filter form
284
+ export const clickRelativeFormFilter = () => {
285
+ fireEvent.click(document.querySelector(relativeFormButton));
286
+ };
287
+ export const openRelativeFormFilter = () => {
288
+ clickDateFilterButton();
289
+ clickRelativeFormFilter();
290
+ };
291
+ export const getRelativeFormInputFromValue = () => document.querySelector(relativeFormInputFrom).value;
292
+ export const getRelativeFormInputToValue = () => document.querySelector(relativeFormInputTo).value;
293
+ export const setRelativeFormInputs = (from, to) => {
294
+ // it is necessary set value TO first and than FROM because strange menu opening in RelativeDateFilter copoment
295
+ // if FROM is set first than in TO is problem to select menu item (is not visible)
296
+ writeToRelativeFormInputTo(to);
297
+ writeToRelativeFormInputFrom(from);
298
+ };
299
+ const writeToRelativeFormInputTo = (value) => {
300
+ const input = document.querySelector(relativeFormInputTo);
301
+ fireEvent.change(input, { target: { value } });
302
+ const menuItem = document.querySelector(".s-select-item-focused");
303
+ fireEvent.click(menuItem);
304
+ };
305
+ const writeToRelativeFormInputFrom = (value) => {
306
+ const input = document.querySelector(relativeFormInputFrom);
307
+ fireEvent.change(input, { target: { value } });
308
+ const menuItem = document.querySelector(".s-select-item-focused");
309
+ fireEvent.click(menuItem);
310
+ };
311
+ export const clickRelativeFormGranularity = (granularity) => {
312
+ const tab = document.querySelector(relativeFormGranularityTab(granularity));
313
+ fireEvent.click(tab);
314
+ };
315
+ export const isRelativeFormGranularitySelected = (granularity) => {
316
+ const tab = document.querySelector(relativeFormGranularityTab(granularity));
317
+ return tab.classList.contains("is-active");
318
+ };
319
+ export const isRelativeFormVisible = () => !!document.querySelector(relativeFormPicker);
320
+ export const isRelativeFormSelectMenuVisible = () => !!document.querySelector(relativeFormSelectMenu);
321
+ // exclude
322
+ export const queryExcludeCurrentPeriodCheckbox = () => document.querySelector(excludeCurrentPeriodCheckbox);
323
+ export const getExcludeCurrentPeriodCheckbox = () => queryExcludeCurrentPeriodCheckbox();
324
+ export const clickExcludeCurrentPeriodCheckBox = () => {
325
+ fireEvent.click(getExcludeCurrentPeriodCheckbox());
326
+ };
327
+ export const isExcludeCurrentPeriodChecked = () => getExcludeCurrentPeriodCheckbox().checked;
@@ -0,0 +1,15 @@
1
+ import { type IAbsoluteDateFilterPreset, type IAllTimeDateFilterOption, type IRelativeDateFilterPreset } from "@gooddata/sdk-model";
2
+ import { type IUiAbsoluteDateFilterForm } from "../../interfaces/index.js";
3
+ export declare const allTimeFilter: IAllTimeDateFilterOption;
4
+ export declare const absoluteFormFilter: IUiAbsoluteDateFilterForm;
5
+ export declare const absoluteFormFilterOneDay: IUiAbsoluteDateFilterForm;
6
+ export declare const absoluteFormFilterWithTime: IUiAbsoluteDateFilterForm;
7
+ export declare const absoluteFormFilterWithTimeInOneDay: IUiAbsoluteDateFilterForm;
8
+ export declare const absoluteFormFilterWithSecondsInOneDay: IUiAbsoluteDateFilterForm;
9
+ export declare const absoluteFormFilterWithSecondsOnlyChangeInOneDay: IUiAbsoluteDateFilterForm;
10
+ export declare const absoluteFormFilterWithWholeDaySeconds: IUiAbsoluteDateFilterForm;
11
+ export declare const absoluteFormFilterWithSecondsWithinMoreDays: IUiAbsoluteDateFilterForm;
12
+ export declare const absoluteFormFilterWithTimeWithinMoreDays: IUiAbsoluteDateFilterForm;
13
+ export declare const absolutePresetFilter: IAbsoluteDateFilterPreset;
14
+ export declare const relativePresetFilter: IRelativeDateFilterPreset;
15
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/DateFilter/utils/Translations/fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EACjC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3E,eAAO,MAAM,aAAa,EAAE,wBAK3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,yBAOhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,yBAOtC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,yBAOxC,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,yBAOhD,CAAC;AAEF,eAAO,MAAM,qCAAqC,EAAE,yBAOnD,CAAC;AAEF,eAAO,MAAM,+CAA+C,EAAE,yBAO7D,CAAC;AAEF,eAAO,MAAM,qCAAqC,EAAE,yBAOnD,CAAC;AAEF,eAAO,MAAM,2CAA2C,EAAE,yBAOzD,CAAC;AAEF,eAAO,MAAM,wCAAwC,EAAE,yBAOtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,yBAOlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,yBAQlC,CAAC"}
@@ -0,0 +1,96 @@
1
+ // (C) 2019-2026 GoodData Corporation
2
+ export const allTimeFilter = {
3
+ localIdentifier: "ALL_TIME",
4
+ type: "allTime",
5
+ name: "",
6
+ visible: true,
7
+ };
8
+ export const absoluteFormFilter = {
9
+ localIdentifier: "ABSOLUTE_FORM",
10
+ type: "absoluteForm",
11
+ from: "2019-01-01",
12
+ to: "2019-02-01",
13
+ name: "Static range",
14
+ visible: true,
15
+ };
16
+ export const absoluteFormFilterOneDay = {
17
+ localIdentifier: "ABSOLUTE_FORM",
18
+ type: "absoluteForm",
19
+ from: "2019-01-01",
20
+ to: "2019-01-01",
21
+ name: "Static range",
22
+ visible: true,
23
+ };
24
+ export const absoluteFormFilterWithTime = {
25
+ localIdentifier: "ABSOLUTE_FORM",
26
+ type: "absoluteForm",
27
+ from: "2019-01-01 1:00",
28
+ to: "2019-02-01 16:55",
29
+ name: "Static range",
30
+ visible: true,
31
+ };
32
+ export const absoluteFormFilterWithTimeInOneDay = {
33
+ localIdentifier: "ABSOLUTE_FORM",
34
+ type: "absoluteForm",
35
+ from: "2019-01-01 00:00",
36
+ to: "2019-01-01 23:59",
37
+ name: "Static range",
38
+ visible: true,
39
+ };
40
+ export const absoluteFormFilterWithSecondsInOneDay = {
41
+ localIdentifier: "ABSOLUTE_FORM",
42
+ type: "absoluteForm",
43
+ from: "2019-01-01 22:11:00",
44
+ to: "2019-01-01 22:31:05",
45
+ name: "Static range",
46
+ visible: true,
47
+ };
48
+ export const absoluteFormFilterWithSecondsOnlyChangeInOneDay = {
49
+ localIdentifier: "ABSOLUTE_FORM",
50
+ type: "absoluteForm",
51
+ from: "2019-01-01 00:00:30",
52
+ to: "2019-01-01 23:59:40",
53
+ name: "Static range",
54
+ visible: true,
55
+ };
56
+ export const absoluteFormFilterWithWholeDaySeconds = {
57
+ localIdentifier: "ABSOLUTE_FORM",
58
+ type: "absoluteForm",
59
+ from: "2019-01-01 00:00:00",
60
+ to: "2019-01-01 23:59:59",
61
+ name: "Static range",
62
+ visible: true,
63
+ };
64
+ export const absoluteFormFilterWithSecondsWithinMoreDays = {
65
+ localIdentifier: "ABSOLUTE_FORM",
66
+ type: "absoluteForm",
67
+ from: "2019-01-01 22:11:00",
68
+ to: "2019-01-04 22:31:05",
69
+ name: "Static range",
70
+ visible: true,
71
+ };
72
+ export const absoluteFormFilterWithTimeWithinMoreDays = {
73
+ localIdentifier: "ABSOLUTE_FORM",
74
+ type: "absoluteForm",
75
+ from: "2019-01-01 00:00",
76
+ to: "2019-01-04 23:59",
77
+ name: "Static range",
78
+ visible: true,
79
+ };
80
+ export const absolutePresetFilter = {
81
+ localIdentifier: "ABSOLUTE_PRESET_FOO",
82
+ type: "absolutePreset",
83
+ from: "2019-01-01",
84
+ to: "2019-02-01",
85
+ name: "foo",
86
+ visible: true,
87
+ };
88
+ export const relativePresetFilter = {
89
+ localIdentifier: "RELATIVE_PRESET_FOO",
90
+ type: "relativePreset",
91
+ from: -5,
92
+ to: 5,
93
+ granularity: "GDC.time.date",
94
+ name: "foo",
95
+ visible: true,
96
+ };
@@ -0,0 +1,29 @@
1
+ export declare class MeasureValueFilterFragment {
2
+ getOperatorDropdown: () => HTMLElement | null;
3
+ getOperatorDropdownButtons: () => NodeListOf<Element>;
4
+ getOperatorDropdownButton: (index?: number) => Element;
5
+ isOperatorDropdownOpen: () => boolean;
6
+ getApplyButton: () => HTMLElement | null;
7
+ clickApply: () => this;
8
+ clickCancel: () => this;
9
+ openOperatorDropdown: (index?: number) => this;
10
+ getOperator: (operator: string) => Element | null;
11
+ getOperatorBubbles: (operator: string) => NodeListOf<Element>;
12
+ selectOperator: (operator: string) => this;
13
+ getComparisonValueInput: () => HTMLInputElement;
14
+ setComparisonValue: (value: string) => this;
15
+ getRangeFromInput: () => HTMLInputElement;
16
+ setRangeFrom: (value: string) => this;
17
+ getRangeToInput: () => HTMLInputElement;
18
+ setRangeTo: (value: string) => this;
19
+ isApplyButtonDisabled: () => boolean;
20
+ pressEnterInComparisonInput: () => boolean;
21
+ getSelectedOperatorTitle: (index?: number) => string;
22
+ getInputSuffixes: () => NodeListOf<Element>;
23
+ getWarningMessage: () => Element | null;
24
+ getWarningMessageBySeverity: (severity: string) => Element | null;
25
+ getPreview: () => HTMLElement | null;
26
+ clickTreatNullAsCheckbox: () => this;
27
+ getTreatNullAsCheckbox: () => HTMLInputElement | null;
28
+ }
29
+ //# sourceMappingURL=MeasureValueFilterDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MeasureValueFilterDropdown.d.ts","sourceRoot":"","sources":["../../../src/MeasureValueFilter/fragments/MeasureValueFilterDropdown.tsx"],"names":[],"mappings":"AASA,qBAAa,0BAA0B;IAC5B,mBAAmB,2BAC+B;IAElD,0BAA0B,4BAAmE;IAE7F,yBAAyB,8BAAgE;IAEzF,sBAAsB,gBAAsC;IAE5D,cAAc,2BAAiD;IAE/D,UAAU,aAGf;IAEK,WAAW,aAGhB;IAEK,oBAAoB,2BAKzB;IAEK,WAAW,uCACsD;IAEjE,kBAAkB,4CACoE;IAEtF,cAAc,6BAGnB;IAEK,uBAAuB,yBACqC;IAE5D,kBAAkB,0BAGvB;IAEK,iBAAiB,yBACqC;IAEtD,YAAY,0BAGjB;IAEK,eAAe,yBAAkF;IAEjG,UAAU,0BAGf;IAEK,qBAAqB,gBAA+D;IAEpF,2BAA2B,gBACqC;IAEhE,wBAAwB,6BAAoE;IAE5F,gBAAgB,4BAAuD;IAEvE,iBAAiB,uBAA0D;IAE3E,2BAA2B,uCAC+B;IAE1D,UAAU,2BAAwF;IAElG,wBAAwB,aAM7B;IAEK,sBAAsB,gCACsE;CACtG"}
@@ -0,0 +1,62 @@
1
+ // (C) 2019-2026 GoodData Corporation
2
+ import { fireEvent, screen } from "@testing-library/react";
3
+ import { simplifyText } from "@gooddata/util";
4
+ const CLASS_OPERATOR_DROPDOWN_BUTTON = ".s-mvf-operator-dropdown-button";
5
+ const CLASS_OPERATOR_DROPDOWN_BODY = ".s-mvf-operator-dropdown-body";
6
+ export class MeasureValueFilterFragment {
7
+ getOperatorDropdown = () => document.querySelector(CLASS_OPERATOR_DROPDOWN_BODY);
8
+ getOperatorDropdownButtons = () => document.querySelectorAll(CLASS_OPERATOR_DROPDOWN_BUTTON);
9
+ getOperatorDropdownButton = (index = 0) => this.getOperatorDropdownButtons().item(index);
10
+ isOperatorDropdownOpen = () => !!this.getOperatorDropdown();
11
+ getApplyButton = () => screen.getByText("Apply").parentElement;
12
+ clickApply = () => {
13
+ fireEvent.click(this.getApplyButton());
14
+ return this;
15
+ };
16
+ clickCancel = () => {
17
+ fireEvent.click(screen.getByText("Cancel"));
18
+ return this;
19
+ };
20
+ openOperatorDropdown = (index = 0) => {
21
+ if (!this.isOperatorDropdownOpen()) {
22
+ fireEvent.click(this.getOperatorDropdownButton(index));
23
+ }
24
+ return this;
25
+ };
26
+ getOperator = (operator) => document.querySelector(`.s-mvf-operator-${simplifyText(operator)}`);
27
+ getOperatorBubbles = (operator) => document.querySelectorAll(`.s-mvf-operator-${simplifyText(operator)} .s-list-item-info`);
28
+ selectOperator = (operator) => {
29
+ fireEvent.click(this.getOperator(operator));
30
+ return this;
31
+ };
32
+ getComparisonValueInput = () => document.querySelector(".s-mvf-comparison-value-input input");
33
+ setComparisonValue = (value) => {
34
+ fireEvent.change(this.getComparisonValueInput(), { target: { value } });
35
+ return this;
36
+ };
37
+ getRangeFromInput = () => document.querySelector(".s-mvf-range-from-input input");
38
+ setRangeFrom = (value) => {
39
+ fireEvent.change(this.getRangeFromInput(), { target: { value } });
40
+ return this;
41
+ };
42
+ getRangeToInput = () => document.querySelector(".s-mvf-range-to-input input");
43
+ setRangeTo = (value) => {
44
+ fireEvent.change(this.getRangeToInput(), { target: { value } });
45
+ return this;
46
+ };
47
+ isApplyButtonDisabled = () => this.getApplyButton().classList.contains("disabled");
48
+ pressEnterInComparisonInput = () => fireEvent.keyDown(this.getComparisonValueInput(), { keyCode: 13 });
49
+ getSelectedOperatorTitle = (index = 0) => this.getOperatorDropdownButton(index).textContent;
50
+ getInputSuffixes = () => document.querySelectorAll(".gd-input-suffix");
51
+ getWarningMessage = () => document.querySelector(".s-mvf-warning-message");
52
+ getWarningMessageBySeverity = (severity) => document.querySelector(`.s-mvf-warning-message-${severity}`);
53
+ getPreview = () => document.querySelector("[data-testid='mvf-preview-text']");
54
+ clickTreatNullAsCheckbox = () => {
55
+ const checkbox = this.getTreatNullAsCheckbox();
56
+ const nextChecked = !checkbox.checked;
57
+ fireEvent.click(checkbox);
58
+ fireEvent.change(checkbox, { target: { checked: nextChecked } });
59
+ return this;
60
+ };
61
+ getTreatNullAsCheckbox = () => document.querySelector("[data-testid='mvf-treat-null-values-as-zero'] input[type='checkbox']");
62
+ }
@@ -0,0 +1,35 @@
1
+ export declare class RankingFilterDropdownFragment {
2
+ clickCancel: () => RankingFilterDropdownFragment;
3
+ clickApply: () => RankingFilterDropdownFragment;
4
+ getApplyButton: () => HTMLElement | null;
5
+ isApplyButtonDisabled: () => boolean;
6
+ isOperatorDropdownOpen: () => boolean;
7
+ getOperatorDropdownButton: () => Element | null;
8
+ openOperatorDropdown: () => RankingFilterDropdownFragment;
9
+ setOperator: (value: string) => RankingFilterDropdownFragment;
10
+ getOperator: () => string;
11
+ getValueDropdown: () => Element | null;
12
+ getValueDropdownItems: () => NodeListOf<Element>;
13
+ isValueDropdownVisible: () => boolean;
14
+ changeInputValue: (value: string) => RankingFilterDropdownFragment;
15
+ setValue: (value: string) => RankingFilterDropdownFragment;
16
+ setValueByBlur: (value: string) => RankingFilterDropdownFragment;
17
+ getValue: () => string;
18
+ isMeasureDropdownOpen: () => boolean;
19
+ getMeasureDropdownButton: () => Element | null;
20
+ openMeasureDropdown: () => RankingFilterDropdownFragment;
21
+ getMeasureItem: (value: string) => Element | null;
22
+ setMeasureItem: (value: string) => RankingFilterDropdownFragment;
23
+ getMeasure: () => string;
24
+ isAttributeButtonDisabled: () => boolean;
25
+ isAttributeDropdownOpen: () => boolean;
26
+ openAttributeDropdown: () => RankingFilterDropdownFragment;
27
+ getAttributeDropdownDisabledButtons: () => NodeListOf<Element>;
28
+ getAttributeItem: (value: string) => Element | null;
29
+ setAttributeItem: (value: string) => RankingFilterDropdownFragment;
30
+ setAttributeToAllRecords: () => RankingFilterDropdownFragment;
31
+ getAttributeDropdownButton: () => Element | null;
32
+ getAttribute: () => string;
33
+ getPreview: () => string;
34
+ }
35
+ //# sourceMappingURL=RankingFilterDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RankingFilterDropdown.d.ts","sourceRoot":"","sources":["../../../src/RankingFilter/fragments/RankingFilterDropdown.tsx"],"names":[],"mappings":"AAiBA,qBAAa,6BAA6B;IAC/B,WAAW,sCAGhB;IAEK,UAAU,sCAGf;IAEK,cAAc,2BAAiD;IAE/D,qBAAqB,gBAA+D;IAEpF,sBAAsB,gBAAmE;IAEzF,yBAAyB,uBAA0D;IAEnF,oBAAoB,sCAKzB;IAEK,WAAW,mDAGhB;IAEK,WAAW,eAA+E;IAE1F,gBAAgB,uBAA2D;IAE3E,qBAAqB,4BAC+C;IAEpE,sBAAsB,gBAAmC;IAEzD,gBAAgB,mDAIrB;IAEK,QAAQ,mDAIb;IAEK,cAAc,mDAInB;IAEK,QAAQ,eAAkF;IAE1F,qBAAqB,gBAAkE;IAEvF,wBAAwB,uBAAyD;IAEjF,mBAAmB,sCAKxB;IAEK,cAAc,oCAEnB;IAEK,cAAc,mDAGnB;IAEK,UAAU,eAA8E;IAExF,yBAAyB,gBACsC;IAE/D,uBAAuB,gBAAoE;IAE3F,qBAAqB,sCAK1B;IAEK,mCAAmC,4BAExC;IAEK,gBAAgB,oCAErB;IAEK,gBAAgB,mDAGrB;IAEK,wBAAwB,sCAG7B;IAEK,0BAA0B,uBAA2D;IAErF,YAAY,eAAgE;IAE5E,UAAU,eAAmE;CACvF"}
@@ -0,0 +1,98 @@
1
+ // (C) 2020-2026 GoodData Corporation
2
+ import { fireEvent, screen } from "@testing-library/react";
3
+ import { simplifyText } from "@gooddata/util";
4
+ const OPERATOR_DROPDOWN_BUTTON = ".s-rf-operator-dropdown-button";
5
+ const OPERATOR_DROPDOWN_BODY = ".s-rf-operator-dropdown-body";
6
+ const VALUE_DROPDOWN_INPUT = ".s-rf-value-dropdown-button input";
7
+ const VALUE_DROPDOWN_ITEM = ".s-rf-value-dropdown-item";
8
+ const MEASURE_DROPDOWN_BUTTON = ".s-rf-measure-dropdown-button";
9
+ const MEASURE_DROPDOWN_BODY = ".s-rf-measure-dropdown-body";
10
+ const ATTRIBUTE_DROPDOWN_BUTTON = ".s-rf-attribute-dropdown-button";
11
+ const ATTRIBUTE_DROPDOWN_BODY = ".s-rf-attribute-dropdown-body";
12
+ const ATTRIBUTE_ALL_RECORDS = ".s-rf-attribute-all-records";
13
+ const PREVIEW_TEXT = ".s-rf-preview";
14
+ export class RankingFilterDropdownFragment {
15
+ clickCancel = () => {
16
+ fireEvent.click(screen.getByText("Cancel"));
17
+ return this;
18
+ };
19
+ clickApply = () => {
20
+ fireEvent.click(this.getApplyButton());
21
+ return this;
22
+ };
23
+ getApplyButton = () => screen.getByText("Apply").parentElement;
24
+ isApplyButtonDisabled = () => this.getApplyButton().classList.contains("disabled");
25
+ isOperatorDropdownOpen = () => !!document.querySelector(OPERATOR_DROPDOWN_BODY);
26
+ getOperatorDropdownButton = () => document.querySelector(OPERATOR_DROPDOWN_BUTTON);
27
+ openOperatorDropdown = () => {
28
+ if (!this.isOperatorDropdownOpen()) {
29
+ fireEvent.click(this.getOperatorDropdownButton());
30
+ }
31
+ return this;
32
+ };
33
+ setOperator = (value) => {
34
+ fireEvent.click(document.querySelector(`.s-rf-operator-${simplifyText(value)}`));
35
+ return this;
36
+ };
37
+ getOperator = () => document.querySelector(OPERATOR_DROPDOWN_BUTTON).textContent;
38
+ getValueDropdown = () => document.querySelector(".gd-dynamic-select-menu");
39
+ getValueDropdownItems = () => this.getValueDropdown().querySelectorAll(".s-rf-value-dropdown-item");
40
+ isValueDropdownVisible = () => !!this.getValueDropdown();
41
+ changeInputValue = (value) => {
42
+ const input = document.querySelector(VALUE_DROPDOWN_INPUT);
43
+ fireEvent.change(input, { target: { value } });
44
+ return this;
45
+ };
46
+ setValue = (value) => {
47
+ this.changeInputValue(value);
48
+ fireEvent.click(document.querySelector(VALUE_DROPDOWN_ITEM));
49
+ return this;
50
+ };
51
+ setValueByBlur = (value) => {
52
+ this.changeInputValue(value);
53
+ fireEvent.blur(document.querySelector(VALUE_DROPDOWN_INPUT));
54
+ return this;
55
+ };
56
+ getValue = () => document.querySelector(VALUE_DROPDOWN_INPUT).value;
57
+ isMeasureDropdownOpen = () => !!document.querySelector(MEASURE_DROPDOWN_BODY);
58
+ getMeasureDropdownButton = () => document.querySelector(MEASURE_DROPDOWN_BUTTON);
59
+ openMeasureDropdown = () => {
60
+ if (!this.isMeasureDropdownOpen()) {
61
+ fireEvent.click(document.querySelector(MEASURE_DROPDOWN_BUTTON));
62
+ }
63
+ return this;
64
+ };
65
+ getMeasureItem = (value) => {
66
+ return document.querySelector(`.s-rf-measure-${simplifyText(value)}`);
67
+ };
68
+ setMeasureItem = (value) => {
69
+ fireEvent.click(this.getMeasureItem(value));
70
+ return this;
71
+ };
72
+ getMeasure = () => document.querySelector(MEASURE_DROPDOWN_BUTTON).textContent;
73
+ isAttributeButtonDisabled = () => this.getAttributeDropdownButton().classList.contains("disabled");
74
+ isAttributeDropdownOpen = () => !!document.querySelector(ATTRIBUTE_DROPDOWN_BODY);
75
+ openAttributeDropdown = () => {
76
+ if (!this.isAttributeDropdownOpen()) {
77
+ fireEvent.click(this.getAttributeDropdownButton());
78
+ }
79
+ return this;
80
+ };
81
+ getAttributeDropdownDisabledButtons = () => {
82
+ return document.querySelectorAll(`${ATTRIBUTE_DROPDOWN_BODY} button.disabled`);
83
+ };
84
+ getAttributeItem = (value) => {
85
+ return document.querySelector(`.s-rf-attribute-${simplifyText(value)}`);
86
+ };
87
+ setAttributeItem = (value) => {
88
+ fireEvent.click(this.getAttributeItem(value));
89
+ return this;
90
+ };
91
+ setAttributeToAllRecords = () => {
92
+ fireEvent.click(document.querySelector(ATTRIBUTE_ALL_RECORDS));
93
+ return this;
94
+ };
95
+ getAttributeDropdownButton = () => document.querySelector(ATTRIBUTE_DROPDOWN_BUTTON);
96
+ getAttribute = () => this.getAttributeDropdownButton().textContent;
97
+ getPreview = () => document.querySelector(PREVIEW_TEXT).textContent;
98
+ }
@@ -0,0 +1,17 @@
1
+ import { type IRankingFilter } from "@gooddata/sdk-model";
2
+ import { type IAttributeDropdownItem, type IMeasureDropdownItem } from "./types.js";
3
+ export declare const attribute1Ref: import("@gooddata/sdk-model").UriRef;
4
+ export declare const attribute2Ref: import("@gooddata/sdk-model").IdentifierRef;
5
+ export declare const attribute3Ref: import("@gooddata/sdk-model").LocalIdRef;
6
+ export declare const attribute4Ref: import("@gooddata/sdk-model").LocalIdRef;
7
+ export declare const measure1Ref: import("@gooddata/sdk-model").LocalIdRef;
8
+ export declare const measure2Ref: import("@gooddata/sdk-model").LocalIdRef;
9
+ export declare const measure3Ref: import("@gooddata/sdk-model").LocalIdRef;
10
+ export declare const measure4Ref: import("@gooddata/sdk-model").LocalIdRef;
11
+ export declare const measure5Ref: import("@gooddata/sdk-model").LocalIdRef;
12
+ export declare const date1Ref: import("@gooddata/sdk-model").LocalIdRef;
13
+ export declare const defaultFilter: IRankingFilter;
14
+ export declare const filterWithRichSetting: IRankingFilter;
15
+ export declare const measureItems: IMeasureDropdownItem[];
16
+ export declare const attributeItems: IAttributeDropdownItem[];
17
+ //# sourceMappingURL=mocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/RankingFilter/mocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEpF,eAAO,MAAM,aAAa,sCAAuB,CAAC;AAClD,eAAO,MAAM,aAAa,6CAAsB,CAAC;AACjD,eAAO,MAAM,aAAa,0CAA2B,CAAC;AACtD,eAAO,MAAM,aAAa,0CAA2B,CAAC;AAEtD,eAAO,MAAM,WAAW,0CAAyB,CAAC;AAClD,eAAO,MAAM,WAAW,0CAAyB,CAAC;AAClD,eAAO,MAAM,WAAW,0CAAyB,CAAC;AAClD,eAAO,MAAM,WAAW,0CAAyB,CAAC;AAClD,eAAO,MAAM,WAAW,0CAAyB,CAAC;AAElD,eAAO,MAAM,QAAQ,0CAAsB,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,cAM3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,cAOnC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,oBAAoB,EAM9C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,sBAAsB,EAMlD,CAAC"}
@@ -0,0 +1,41 @@
1
+ // (C) 2020-2026 GoodData Corporation
2
+ import { idRef, localIdRef, uriRef } from "@gooddata/sdk-model";
3
+ export const attribute1Ref = uriRef("attribute1");
4
+ export const attribute2Ref = idRef("attribute2");
5
+ export const attribute3Ref = localIdRef("attribute3");
6
+ export const attribute4Ref = localIdRef("attribute4");
7
+ export const measure1Ref = localIdRef("measure1");
8
+ export const measure2Ref = localIdRef("measure2");
9
+ export const measure3Ref = localIdRef("measure3");
10
+ export const measure4Ref = localIdRef("measure4");
11
+ export const measure5Ref = localIdRef("measure5");
12
+ export const date1Ref = localIdRef("date1");
13
+ export const defaultFilter = {
14
+ rankingFilter: {
15
+ measure: measure1Ref,
16
+ operator: "TOP",
17
+ value: 10,
18
+ },
19
+ };
20
+ export const filterWithRichSetting = {
21
+ rankingFilter: {
22
+ measure: measure3Ref,
23
+ attributes: [attribute1Ref, attribute2Ref, attribute3Ref, attribute4Ref],
24
+ operator: "BOTTOM",
25
+ value: 100,
26
+ },
27
+ };
28
+ export const measureItems = [
29
+ { title: "Measure 1", ref: measure1Ref },
30
+ { title: "Measure 2", ref: measure2Ref },
31
+ { title: "Measure 3", ref: measure3Ref },
32
+ { title: "Measure 4", ref: measure4Ref },
33
+ { title: "Measure 5", ref: measure5Ref },
34
+ ];
35
+ export const attributeItems = [
36
+ { title: "Attribute 1", ref: attribute1Ref, type: "ATTRIBUTE" },
37
+ { title: "Attribute 2", ref: attribute2Ref, type: "ATTRIBUTE" },
38
+ { title: "Attribute 3", ref: attribute3Ref, type: "ATTRIBUTE" },
39
+ { title: "Date", ref: date1Ref, type: "DATE" },
40
+ { title: "Attribute 4", ref: attribute4Ref, type: "ATTRIBUTE" },
41
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-filters",
3
- "version": "11.54.0-alpha.3",
3
+ "version": "11.54.0-alpha.4",
4
4
  "description": "GoodData.UI SDK - Filter Components",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -46,11 +46,11 @@
46
46
  "ts-invariant": "0.10.3",
47
47
  "tslib": "2.8.1",
48
48
  "uuid": "11.1.1",
49
- "@gooddata/sdk-backend-spi": "11.54.0-alpha.3",
50
- "@gooddata/sdk-model": "11.54.0-alpha.3",
51
- "@gooddata/sdk-ui": "11.54.0-alpha.3",
52
- "@gooddata/sdk-ui-kit": "11.54.0-alpha.3",
53
- "@gooddata/util": "11.54.0-alpha.3"
49
+ "@gooddata/sdk-model": "11.54.0-alpha.4",
50
+ "@gooddata/sdk-backend-spi": "11.54.0-alpha.4",
51
+ "@gooddata/sdk-ui-kit": "11.54.0-alpha.4",
52
+ "@gooddata/sdk-ui": "11.54.0-alpha.4",
53
+ "@gooddata/util": "11.54.0-alpha.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@microsoft/api-documenter": "^7.17.0",
@@ -92,12 +92,12 @@
92
92
  "typescript": "5.9.3",
93
93
  "vitest": "4.1.8",
94
94
  "vitest-dom": "0.1.1",
95
- "@gooddata/eslint-config": "11.54.0-alpha.3",
96
- "@gooddata/oxlint-config": "11.54.0-alpha.3",
97
- "@gooddata/reference-workspace": "11.54.0-alpha.3",
98
- "@gooddata/sdk-ui-theme-provider": "11.54.0-alpha.3",
99
- "@gooddata/sdk-backend-mockingbird": "11.54.0-alpha.3",
100
- "@gooddata/stylelint-config": "11.54.0-alpha.3"
95
+ "@gooddata/eslint-config": "11.54.0-alpha.4",
96
+ "@gooddata/oxlint-config": "11.54.0-alpha.4",
97
+ "@gooddata/reference-workspace": "11.54.0-alpha.4",
98
+ "@gooddata/sdk-backend-mockingbird": "11.54.0-alpha.4",
99
+ "@gooddata/stylelint-config": "11.54.0-alpha.4",
100
+ "@gooddata/sdk-ui-theme-provider": "11.54.0-alpha.4"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": "^18.0.0 || ^19.0.0",