Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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/datafilter/selectors
20
 * @copyright  2020 Michael Hawkins <michaelh@moodle.com>
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
23
 
24
const getFilterRegion = region => `[data-filterregion="${region}"]`;
25
const getFilterAction = action => `[data-filteraction="${action}"]`;
26
const getFilterField = field => `[data-filterfield="${field}"]`;
27
 
28
export default {
29
    filter: {
30
        region: getFilterRegion('filter'),
31
        actions: {
32
            remove: getFilterAction('remove'),
33
        },
34
        fields: {
35
            join: getFilterField('join'),
36
            type: getFilterField('type'),
37
        },
38
        regions: {
39
            values: getFilterRegion('value'),
40
        },
41
        byName: name => `${getFilterRegion('filter')}[data-filter-type="${name}"]`,
42
    },
43
    filterset: {
44
        region: getFilterRegion('actions'),
45
        actions: {
46
            addRow: getFilterAction('add'),
47
            applyFilters: getFilterAction('apply'),
48
            resetFilters: getFilterAction('reset'),
49
        },
50
        regions: {
51
            filtermatch: getFilterRegion('filtermatch'),
52
            filterlist: getFilterRegion('filters'),
53
            datasource: getFilterRegion('filtertypedata'),
54
            emptyFilterRow: `${getFilterRegion('filter')}[data-filter-type=""]`,
55
        },
56
        fields: {
57
            join: `${getFilterRegion('filtermatch')} ${getFilterField('join')}`,
58
        },
59
    },
60
    data: {
61
        fields: {
62
            byName: name => `[data-field-name="${name}"]`,
63
            all: `${getFilterRegion('filtertypedata')} [data-field-name]`,
64
        },
65
        typeList: getFilterRegion('filtertypelist'),
66
        typeListSelect: `select${getFilterRegion('filtertypelist')}`,
67
        required: `${getFilterRegion('value')} > [data-required="1"]`,
68
    },
69
};