MDL-67917 user: Add skeleton for new participants filter
[moodle.git] / user / amd / src / local / participantsfilter / selectors.js
CommitLineData
77ba77f1
AN
1// This file is part of Moodle - http://moodle.org/
2//
3// Moodle is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// Moodle is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
15
16/**
17 * Module containing the selectors for user filters.
18 *
19 * @module core_user/local/user_filter/selectors
20 * @package core_user
21 * @copyright 2020 Michael Hawkins <michaelh@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25const getFilterRegion = region => `[data-filterregion="${region}"]`;
26const getFilterAction = action => `[data-filteraction="${action}"]`;
27const getFilterField = field => `[data-filterfield="${field}"]`;
28
29export default {
30 filter: {
31 region: getFilterRegion('filter'),
32 actions: {
33 remove: getFilterAction('remove'),
34 },
35 fields: {
36 join: getFilterField('join'),
37 type: getFilterField('type'),
38 },
39 regions: {
40 values: getFilterRegion('value'),
41 },
42 byName: name => `${getFilterRegion('filter')}[data-filter-type="${name}"]`,
43 },
44 filterset: {
45 region: getFilterRegion('actions'),
46 actions: {
47 addRow: getFilterAction('add'),
48 applyFilters: getFilterAction('apply'),
49 resetFilters: getFilterAction('reset'),
50 },
51 regions: {
52 filterlist: getFilterRegion('filters'),
53 datasource: getFilterRegion('filtertypedata'),
54 },
55 },
56 data: {
57 fields: {
58 byName: name => `[data-field-name="${name}"]`,
59 },
60 typeList: getFilterRegion('filtertypelist'),
61 },
62};