@brightspace-ui-labs/facet-filter-sort 5.2.1 → 5.4.0
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.
- package/README.md +1 -22
- package/components/localize-behavior.js +1 -1
- package/components/search-facets/search-facets-grouping.js +1 -1
- package/components/search-facets/search-facets-option.js +1 -1
- package/custom-elements.json +318 -35
- package/package.json +3 -3
- package/components/applied-filters/applied-core-filters.js +0 -154
package/README.md
CHANGED
|
@@ -31,7 +31,6 @@ npm install @brightspace-ui-labs/facet-filter-sort
|
|
|
31
31
|
- [d2l-labs-search-facets](#d2l-labs-search-facets)
|
|
32
32
|
- [d2l-labs-search-results-count](#d2l-labs-search-results-count)
|
|
33
33
|
- [d2l-labs-sort-by-dropdown](#d2l-labs-sort-by-dropdown)
|
|
34
|
-
- [d2l-labs-applied-core-filters](#d2l-labs-applied-core-filters)
|
|
35
34
|
|
|
36
35
|
### d2l-labs-search-facets
|
|
37
36
|
|
|
@@ -57,26 +56,6 @@ To Do
|
|
|
57
56
|
|
|
58
57
|
To Do
|
|
59
58
|
|
|
60
|
-
### d2l-labs-applied-core-filters
|
|
61
|
-
|
|
62
|
-
The same design as the deprecated `d2l-labs-applied-filters` below, but this version works with the `d2l-filter` component in `core`. It supports hooking up to multiple filters and will be migrated to `core` once designs are finalized.
|
|
63
|
-
|
|
64
|
-
#### Attributes
|
|
65
|
-
|
|
66
|
-
- `filter-ids`: Ids (space-delimited) of the filter components to subscribe to
|
|
67
|
-
- `label-text` (optional): The text displayed in this component's label. Defaults to "Applied Filters:".
|
|
68
|
-
|
|
69
|
-
#### Usage
|
|
70
|
-
|
|
71
|
-
Set the `filter-ids` param to the ids of the `d2l-filter`s that you want to track.
|
|
72
|
-
The `d2l-filter`s must be in the same DOM scope.
|
|
73
|
-
|
|
74
|
-
```html
|
|
75
|
-
<d2l-filter id="course"> ... </d2l-filter>
|
|
76
|
-
<d2l-filter id="role"> ... </d2l-filter>
|
|
77
|
-
<d2l-labs-applied-core-filters filter-ids="course role"></d2l-labs-applied-core-filters>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
59
|
## Deprecated Components
|
|
81
60
|
|
|
82
61
|
- [d2l-labs-filter-dropdown](#d2l-labs-filter-dropdown)
|
|
@@ -176,7 +155,7 @@ Note that for the header and opener text overrides, if the terms are to reflect
|
|
|
176
155
|
|
|
177
156
|
### d2l-labs-applied-filters
|
|
178
157
|
|
|
179
|
-
A multi-select-list allowing the user to see (and remove) the currently applied filters. Works with the `d2l-labs-filter-dropdown` above.
|
|
158
|
+
A multi-select-list allowing the user to see (and remove) the currently applied filters. Works with the `d2l-labs-filter-dropdown` above.
|
|
180
159
|
|
|
181
160
|
NOTE: This component uses the `slotchange` event and so will not work if you require IE support
|
|
182
161
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@brightspace-ui/core/components/colors/colors.js';
|
|
2
2
|
import '@brightspace-ui/core/components/inputs/input-checkbox-spacer.js';
|
|
3
|
-
import '
|
|
3
|
+
import '@brightspace-ui/typography/d2l-typography-shared-styles.js';
|
|
4
4
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
5
5
|
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
6
6
|
import { LocalizeBehavior } from '../localize-behavior.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@brightspace-ui/core/components/inputs/input-checkbox.js';
|
|
2
|
-
import '
|
|
2
|
+
import '@brightspace-ui/localize-behavior/d2l-localize-behavior.js';
|
|
3
3
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
4
4
|
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
5
5
|
|
package/custom-elements.json
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "experimental",
|
|
3
3
|
"tags": [
|
|
4
|
-
{
|
|
5
|
-
"name": "d2l-labs-applied-core-filters",
|
|
6
|
-
"path": "./components/applied-filters/applied-core-filters.js",
|
|
7
|
-
"description": "A multi-select-list allowing the user to see (and remove) the currently applied filters, adjusted to work with the new core d2l-filter.",
|
|
8
|
-
"attributes": [
|
|
9
|
-
{
|
|
10
|
-
"name": "filter-ids",
|
|
11
|
-
"description": "Ids (space-delimited) of the filter components to subscribe to",
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "label-text",
|
|
16
|
-
"description": "Optional: The text displayed in this component's label. Default: \"Applied Filters:\"",
|
|
17
|
-
"type": "string",
|
|
18
|
-
"default": "\"\""
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"properties": [
|
|
22
|
-
{
|
|
23
|
-
"name": "filterIds",
|
|
24
|
-
"attribute": "filter-ids",
|
|
25
|
-
"description": "Ids (space-delimited) of the filter components to subscribe to",
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "labelText",
|
|
30
|
-
"attribute": "label-text",
|
|
31
|
-
"description": "Optional: The text displayed in this component's label. Default: \"Applied Filters:\"",
|
|
32
|
-
"type": "string",
|
|
33
|
-
"default": "\"\""
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
4
|
{
|
|
38
5
|
"name": "d2l-labs-applied-filters",
|
|
39
6
|
"path": "./components/applied-filters/applied-filters.js",
|
|
@@ -64,6 +31,10 @@
|
|
|
64
31
|
"description": "Optional: The text displayed in this component's label. Default: \"Applied Filters:\"",
|
|
65
32
|
"type": "string",
|
|
66
33
|
"default": "\"\""
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "documentLocaleSettings",
|
|
37
|
+
"default": "\"getDocumentLocaleSettings()\""
|
|
67
38
|
}
|
|
68
39
|
]
|
|
69
40
|
},
|
|
@@ -100,6 +71,23 @@
|
|
|
100
71
|
"description": "The number of selected filter options for that filter category. When options are selected and de-selected, the consumer is responsible for updating this number after updating its own data store.",
|
|
101
72
|
"type": "number",
|
|
102
73
|
"default": "0"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "text",
|
|
77
|
+
"description": "REQUIRED: The text used for the tab, as well as labelling the panel",
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "no-padding",
|
|
82
|
+
"description": "Opt out of default padding/whitespace around the panel",
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"default": "false"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "selected",
|
|
88
|
+
"description": "Use to select the tab",
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"default": "false"
|
|
103
91
|
}
|
|
104
92
|
],
|
|
105
93
|
"properties": [
|
|
@@ -136,6 +124,30 @@
|
|
|
136
124
|
"description": "The number of selected filter options for that filter category. When options are selected and de-selected, the consumer is responsible for updating this number after updating its own data store.",
|
|
137
125
|
"type": "number",
|
|
138
126
|
"default": "0"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "documentLocaleSettings",
|
|
130
|
+
"default": "\"getDocumentLocaleSettings()\""
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "text",
|
|
134
|
+
"attribute": "text",
|
|
135
|
+
"description": "REQUIRED: The text used for the tab, as well as labelling the panel",
|
|
136
|
+
"type": "string"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "noPadding",
|
|
140
|
+
"attribute": "no-padding",
|
|
141
|
+
"description": "Opt out of default padding/whitespace around the panel",
|
|
142
|
+
"type": "boolean",
|
|
143
|
+
"default": "false"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "selected",
|
|
147
|
+
"attribute": "selected",
|
|
148
|
+
"description": "Use to select the tab",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"default": "false"
|
|
139
151
|
}
|
|
140
152
|
],
|
|
141
153
|
"events": [
|
|
@@ -154,6 +166,14 @@
|
|
|
154
166
|
{
|
|
155
167
|
"name": "d2l-labs-filter-dropdown-option-change",
|
|
156
168
|
"description": "Dispatched when a filter option is selected"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "d2l-tab-panel-selected",
|
|
172
|
+
"description": "Dispatched when a tab is selected"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "d2l-tab-panel-text-changed",
|
|
176
|
+
"description": "Dispatched when the text attribute is changed"
|
|
157
177
|
}
|
|
158
178
|
],
|
|
159
179
|
"slots": [
|
|
@@ -167,16 +187,86 @@
|
|
|
167
187
|
"name": "d2l-labs-filter-dropdown-option",
|
|
168
188
|
"path": "./components/filter-dropdown/filter-dropdown-option.js",
|
|
169
189
|
"description": "A filter menu item component.",
|
|
190
|
+
"attributes": [
|
|
191
|
+
{
|
|
192
|
+
"name": "value",
|
|
193
|
+
"description": "REQUIRED: The selectable item's value",
|
|
194
|
+
"type": "string"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "selected",
|
|
198
|
+
"description": "This will set the item to be selected by default",
|
|
199
|
+
"type": "boolean",
|
|
200
|
+
"default": "false"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "text",
|
|
204
|
+
"description": "REQUIRED: Text displayed by the menu item",
|
|
205
|
+
"type": "string"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "description",
|
|
209
|
+
"description": "Provide a description for the menu item that will be used by screen readers",
|
|
210
|
+
"type": "string"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "disabled",
|
|
214
|
+
"description": "Disables the menu item",
|
|
215
|
+
"type": "boolean",
|
|
216
|
+
"default": "false"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
170
219
|
"properties": [
|
|
171
220
|
{
|
|
172
221
|
"name": "role",
|
|
173
222
|
"type": "string",
|
|
174
223
|
"default": "\"menuitemcheckbox\""
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "value",
|
|
227
|
+
"attribute": "value",
|
|
228
|
+
"description": "REQUIRED: The selectable item's value",
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "selected",
|
|
233
|
+
"attribute": "selected",
|
|
234
|
+
"description": "This will set the item to be selected by default",
|
|
235
|
+
"type": "boolean",
|
|
236
|
+
"default": "false"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "text",
|
|
240
|
+
"attribute": "text",
|
|
241
|
+
"description": "REQUIRED: Text displayed by the menu item",
|
|
242
|
+
"type": "string"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "description",
|
|
246
|
+
"attribute": "description",
|
|
247
|
+
"description": "Provide a description for the menu item that will be used by screen readers",
|
|
248
|
+
"type": "string"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "disabled",
|
|
252
|
+
"attribute": "disabled",
|
|
253
|
+
"description": "Disables the menu item",
|
|
254
|
+
"type": "boolean",
|
|
255
|
+
"default": "false"
|
|
175
256
|
}
|
|
176
257
|
],
|
|
177
258
|
"events": [
|
|
178
259
|
{
|
|
179
|
-
"name": "d2l-menu-item-select"
|
|
260
|
+
"name": "d2l-menu-item-select",
|
|
261
|
+
"description": "Dispatched when the menu item is selected"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "d2l-menu-item-change",
|
|
265
|
+
"description": "Dispatched when the selected menu item changes"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "d2l-menu-item-visibility-change",
|
|
269
|
+
"description": "Dispatched when the visibility of the menu item changes"
|
|
180
270
|
}
|
|
181
271
|
]
|
|
182
272
|
},
|
|
@@ -314,6 +404,25 @@
|
|
|
314
404
|
"attribute": "no-padding-footer",
|
|
315
405
|
"type": "boolean",
|
|
316
406
|
"default": "false"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "rootPath",
|
|
410
|
+
"type": "string"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "importPath",
|
|
414
|
+
"type": "string"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"name": "root",
|
|
418
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "$",
|
|
422
|
+
"type": "{ [key: string]: Element; }"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
317
426
|
}
|
|
318
427
|
],
|
|
319
428
|
"events": [
|
|
@@ -382,6 +491,25 @@
|
|
|
382
491
|
"description": "The value of the grouping name",
|
|
383
492
|
"type": "string",
|
|
384
493
|
"default": "\"\""
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"name": "rootPath",
|
|
497
|
+
"type": "string"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "importPath",
|
|
501
|
+
"type": "string"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"name": "root",
|
|
505
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "$",
|
|
509
|
+
"type": "{ [key: string]: Element; }"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
385
513
|
}
|
|
386
514
|
],
|
|
387
515
|
"events": [
|
|
@@ -468,6 +596,25 @@
|
|
|
468
596
|
"description": "The value of this option",
|
|
469
597
|
"type": "string",
|
|
470
598
|
"default": "\"\""
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"name": "rootPath",
|
|
602
|
+
"type": "string"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"name": "importPath",
|
|
606
|
+
"type": "string"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"name": "root",
|
|
610
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"name": "$",
|
|
614
|
+
"type": "{ [key: string]: Element; }"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
471
618
|
}
|
|
472
619
|
],
|
|
473
620
|
"events": [
|
|
@@ -481,6 +628,27 @@
|
|
|
481
628
|
"name": "d2l-labs-search-facets",
|
|
482
629
|
"path": "./components/search-facets/search-facets.js",
|
|
483
630
|
"description": "Polymer-based web component for D2L search facets.",
|
|
631
|
+
"properties": [
|
|
632
|
+
{
|
|
633
|
+
"name": "rootPath",
|
|
634
|
+
"type": "string"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
"name": "importPath",
|
|
638
|
+
"type": "string"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"name": "root",
|
|
642
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"name": "$",
|
|
646
|
+
"type": "{ [key: string]: Element; }"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
650
|
+
}
|
|
651
|
+
],
|
|
484
652
|
"events": [
|
|
485
653
|
{
|
|
486
654
|
"name": "d2l-labs-search-facets-change",
|
|
@@ -542,13 +710,109 @@
|
|
|
542
710
|
"description": "Search query",
|
|
543
711
|
"type": "string",
|
|
544
712
|
"default": "\"\""
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "rootPath",
|
|
716
|
+
"type": "string"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"name": "importPath",
|
|
720
|
+
"type": "string"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
"name": "root",
|
|
724
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"name": "$",
|
|
728
|
+
"type": "{ [key: string]: Element; }"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
545
732
|
}
|
|
546
733
|
]
|
|
547
734
|
},
|
|
548
735
|
{
|
|
549
736
|
"name": "d2l-labs-sort-by-dropdown-option",
|
|
550
737
|
"path": "./components/sort-by-dropdown/sort-by-dropdown-option.js",
|
|
551
|
-
"description": "A dropdown option menu item component."
|
|
738
|
+
"description": "A dropdown option menu item component.",
|
|
739
|
+
"attributes": [
|
|
740
|
+
{
|
|
741
|
+
"name": "value",
|
|
742
|
+
"description": "REQUIRED: The selectable item's value",
|
|
743
|
+
"type": "string"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "selected",
|
|
747
|
+
"description": "This will set the item to be selected by default",
|
|
748
|
+
"type": "boolean",
|
|
749
|
+
"default": "false"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "text",
|
|
753
|
+
"description": "REQUIRED: Text displayed by the menu item",
|
|
754
|
+
"type": "string"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"name": "description",
|
|
758
|
+
"description": "Provide a description for the menu item that will be used by screen readers",
|
|
759
|
+
"type": "string"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
"name": "disabled",
|
|
763
|
+
"description": "Disables the menu item",
|
|
764
|
+
"type": "boolean",
|
|
765
|
+
"default": "false"
|
|
766
|
+
}
|
|
767
|
+
],
|
|
768
|
+
"properties": [
|
|
769
|
+
{
|
|
770
|
+
"name": "value",
|
|
771
|
+
"attribute": "value",
|
|
772
|
+
"description": "REQUIRED: The selectable item's value",
|
|
773
|
+
"type": "string"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"name": "selected",
|
|
777
|
+
"attribute": "selected",
|
|
778
|
+
"description": "This will set the item to be selected by default",
|
|
779
|
+
"type": "boolean",
|
|
780
|
+
"default": "false"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "text",
|
|
784
|
+
"attribute": "text",
|
|
785
|
+
"description": "REQUIRED: Text displayed by the menu item",
|
|
786
|
+
"type": "string"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"name": "description",
|
|
790
|
+
"attribute": "description",
|
|
791
|
+
"description": "Provide a description for the menu item that will be used by screen readers",
|
|
792
|
+
"type": "string"
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"name": "disabled",
|
|
796
|
+
"attribute": "disabled",
|
|
797
|
+
"description": "Disables the menu item",
|
|
798
|
+
"type": "boolean",
|
|
799
|
+
"default": "false"
|
|
800
|
+
}
|
|
801
|
+
],
|
|
802
|
+
"events": [
|
|
803
|
+
{
|
|
804
|
+
"name": "d2l-menu-item-change",
|
|
805
|
+
"description": "Dispatched when the selected menu item changes"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "d2l-menu-item-select",
|
|
809
|
+
"description": "Dispatched when the menu item is selected"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"name": "d2l-menu-item-visibility-change",
|
|
813
|
+
"description": "Dispatched when the visibility of the menu item changes"
|
|
814
|
+
}
|
|
815
|
+
]
|
|
552
816
|
},
|
|
553
817
|
{
|
|
554
818
|
"name": "d2l-labs-sort-by-dropdown",
|
|
@@ -619,6 +883,25 @@
|
|
|
619
883
|
"attribute": "value",
|
|
620
884
|
"description": "The value of the currently selected option",
|
|
621
885
|
"type": "string"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"name": "rootPath",
|
|
889
|
+
"type": "string"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"name": "importPath",
|
|
893
|
+
"type": "string"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"name": "root",
|
|
897
|
+
"type": "HTMLElement | StampedTemplate | ShadowRoot | null"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"name": "$",
|
|
901
|
+
"type": "{ [key: string]: Element; }"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
"name": "PROPERTY_EFFECT_TYPES"
|
|
622
905
|
}
|
|
623
906
|
],
|
|
624
907
|
"events": [
|
package/package.json
CHANGED
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"sinon": "^13",
|
|
45
45
|
"stylelint": "^14"
|
|
46
46
|
},
|
|
47
|
-
"version": "5.
|
|
47
|
+
"version": "5.4.0",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@brightspace-ui/core": "^2",
|
|
50
|
-
"
|
|
50
|
+
"@brightspace-ui/localize-behavior": "^2",
|
|
51
|
+
"@brightspace-ui/typography": "^8",
|
|
51
52
|
"@brightspace-ui-labs/multi-select": "^6",
|
|
52
|
-
"d2l-typography": "BrightspaceUI/typography#semver:^8",
|
|
53
53
|
"lit-element": "^3",
|
|
54
54
|
"lit-html": "^2",
|
|
55
55
|
"@polymer/polymer": "^3"
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import '@brightspace-ui/core/components/button/button-subtle.js';
|
|
2
|
-
import '@brightspace-ui-labs/multi-select/multi-select-list.js';
|
|
3
|
-
import '@brightspace-ui-labs/multi-select/multi-select-list-item.js';
|
|
4
|
-
import { css, html, LitElement } from 'lit-element';
|
|
5
|
-
import { announce } from '@brightspace-ui/core/helpers/announce.js';
|
|
6
|
-
import { bodyCompactStyles } from '@brightspace-ui/core/components/typography/styles.js';
|
|
7
|
-
import { FilterLocalizeMixin } from '../localize-mixin.js';
|
|
8
|
-
import { IdSubscriberController } from '@brightspace-ui/core/controllers/subscriber/subscriberControllers.js';
|
|
9
|
-
import { RtlMixin } from '@brightspace-ui/core/mixins/rtl-mixin.js';
|
|
10
|
-
|
|
11
|
-
const CLEAR_FILTERS_THRESHOLD = 4;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A multi-select-list allowing the user to see (and remove) the currently applied filters, adjusted to work with the new core d2l-filter.
|
|
15
|
-
*/
|
|
16
|
-
class D2lLabsAppliedCoreFilters extends RtlMixin(FilterLocalizeMixin(LitElement)) {
|
|
17
|
-
static get properties() {
|
|
18
|
-
return {
|
|
19
|
-
/**
|
|
20
|
-
* Ids (space-delimited) of the filter components to subscribe to
|
|
21
|
-
* @type {string}
|
|
22
|
-
*/
|
|
23
|
-
filterIds: { type: String, attribute: 'filter-ids' },
|
|
24
|
-
/**
|
|
25
|
-
* Optional: The text displayed in this component's label. Default: "Applied Filters:"
|
|
26
|
-
*/
|
|
27
|
-
labelText: { type: String, attribute: 'label-text' }
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static get styles() {
|
|
32
|
-
return [bodyCompactStyles, css`
|
|
33
|
-
:host {
|
|
34
|
-
display: block;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
d2l-labs-multi-select-list {
|
|
38
|
-
flex: 1;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.d2l-labs-applied-filters-wrapper {
|
|
42
|
-
display: flex;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.d2l-labs-applied-filters-label {
|
|
46
|
-
display: inline-block;
|
|
47
|
-
font-weight: bold;
|
|
48
|
-
margin-right: 0.25rem;
|
|
49
|
-
padding-top: 0.3rem;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([dir="rtl"]) .d2l-labs-applied-filters-label {
|
|
53
|
-
margin-left: 0.25rem;
|
|
54
|
-
margin-right: 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.d2l-labs-applied-filters-none-label {
|
|
58
|
-
color: var(--d2l-color-corundum);
|
|
59
|
-
display: inline-block;
|
|
60
|
-
font-style: italic;
|
|
61
|
-
padding-top: 0.3rem;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#d2l-clear-filters-button {
|
|
65
|
-
margin-left: 3px;
|
|
66
|
-
margin-right: 3px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
#d2l-list-holder {
|
|
70
|
-
flex: 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:host([hidden]) {
|
|
74
|
-
display: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
[hidden] {
|
|
78
|
-
display: none;
|
|
79
|
-
}
|
|
80
|
-
`];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
constructor() {
|
|
84
|
-
super();
|
|
85
|
-
this.labelText = '';
|
|
86
|
-
|
|
87
|
-
this._allActiveFilters = new Map();
|
|
88
|
-
this._filters = new IdSubscriberController(this,
|
|
89
|
-
{ onUnsubscribe: this._removeLostFilter.bind(this) },
|
|
90
|
-
{ idPropertyName: 'filterIds' }
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
render() {
|
|
95
|
-
let numActiveFilters = 0;
|
|
96
|
-
const allActiveFilters = Array.from(this._allActiveFilters);
|
|
97
|
-
let filters = html`
|
|
98
|
-
<d2l-labs-multi-select-list
|
|
99
|
-
collapsable
|
|
100
|
-
aria-labelledby="d2l-labs-applied-filters-label">
|
|
101
|
-
${allActiveFilters.map(filter => filter[1].map((value, index) => { numActiveFilters++; return html`
|
|
102
|
-
<d2l-labs-multi-select-list-item
|
|
103
|
-
text="${value.text}"
|
|
104
|
-
deletable
|
|
105
|
-
data-filter-id="${filter[0]}"
|
|
106
|
-
data-index="${index}"
|
|
107
|
-
@d2l-labs-multi-select-list-item-deleted="${this._multiSelectItemDeleted}">
|
|
108
|
-
</d2l-labs-multi-select-list-item>
|
|
109
|
-
`;}))}
|
|
110
|
-
</d2l-labs-multi-select-list>
|
|
111
|
-
`;
|
|
112
|
-
if (numActiveFilters === 0) filters = html`<span class="d2l-labs-applied-filters-none-label d2l-body-compact">${this.localize('noActiveFilters')}</span>`;
|
|
113
|
-
|
|
114
|
-
return html`
|
|
115
|
-
<div class="d2l-labs-applied-filters-wrapper">
|
|
116
|
-
<span id="d2l-labs-applied-filters-label" class="d2l-labs-applied-filters-label d2l-body-compact">${this.labelText || this.localize('appliedFilters')}</span>
|
|
117
|
-
<div id="d2l-list-holder">
|
|
118
|
-
${filters}
|
|
119
|
-
<d2l-button-subtle id="d2l-clear-filters-button" text="${this.localize('clearFilters')}" ?hidden="${numActiveFilters < CLEAR_FILTERS_THRESHOLD}" @click="${this._clearFiltersClicked}"></d2l-button-subtle>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
`;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
updateActiveFilters(filterId, activeFilters) {
|
|
126
|
-
this._allActiveFilters.set(filterId, activeFilters);
|
|
127
|
-
this.requestUpdate();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
_clearFiltersClicked() {
|
|
131
|
-
this._filters.registries.forEach((filter, index) => {
|
|
132
|
-
if (index === 0) filter.focus();
|
|
133
|
-
filter.requestFilterClearAll();
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
_multiSelectItemDeleted(e) {
|
|
138
|
-
const filterId = e.target.getAttribute('data-filter-id');
|
|
139
|
-
const filterValueIndex = e.target.getAttribute('data-index');
|
|
140
|
-
const filterValue = this._allActiveFilters.get(filterId)[filterValueIndex];
|
|
141
|
-
const filter = this._filters.registries.find(filter => filter.id === filterId);
|
|
142
|
-
filter.requestFilterValueClear(filterValue.keyObject);
|
|
143
|
-
|
|
144
|
-
announce(this.localize('filterRemoved', 'filterText', e.target.text));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
_removeLostFilter(filterId) {
|
|
148
|
-
this._allActiveFilters.delete(filterId);
|
|
149
|
-
this.requestUpdate();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
customElements.define('d2l-labs-applied-core-filters', D2lLabsAppliedCoreFilters);
|