@brightspace-ui/labs 2.33.2 → 2.34.1
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/package.json +1 -1
- package/src/components/grade-result/README.md +1 -1
- package/src/components/grade-result/grade-result-letter-score.js +3 -3
- package/src/components/grade-result/grade-result-numeric-score.js +6 -6
- package/src/components/grade-result/grade-result-presentational.js +11 -15
- package/src/utilities/router/README.md +2 -27
- package/src/utilities/router/router.js +3 -4
package/package.json
CHANGED
|
@@ -57,7 +57,7 @@ Components used for rendering grades in Brightspace.
|
|
|
57
57
|
| `includeReportsButton` | All | `boolean` | `false` | Determines whether the reports icon button is rendered. |
|
|
58
58
|
| `gradeButtonTooltip` | All | `string` | `''` | The text that is inside of the tooltip when hovering over the grades button. |
|
|
59
59
|
| `reportsButtonTooltip` | All | `string` | `''` | The text that is inside of the tooltip when hovering over the reports button. |
|
|
60
|
-
| `
|
|
60
|
+
| `readonly` | All | `boolean` | `false` | Set to `true` if the user does not have permissions to edit the grade. |
|
|
61
61
|
| `isManualOverrideActive` | All | `boolean` | `false` | Set to `true` if the user is currently manually overriding the grade. This will display the button to 'Clear Manual Override'. |
|
|
62
62
|
| `hideTitle` | All | `boolean` | `false` | This property will hide the "Overall Grade" title above the component. |
|
|
63
63
|
| `customManualOverrideClearText` | All | `string` | `undefined` | This property will substitute the stock text on the "Clear Manual Override" button. |
|
|
@@ -12,8 +12,8 @@ export class D2LGradeResultLetterScore extends LocalizeLabsElement(LitElement) {
|
|
|
12
12
|
return {
|
|
13
13
|
availableOptions: { type: Object },
|
|
14
14
|
label: { type: String },
|
|
15
|
-
selectedOption: { type: String },
|
|
16
|
-
|
|
15
|
+
selectedOption: { attribute: 'selected-option', type: String },
|
|
16
|
+
readonly: { type: Boolean }
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -39,7 +39,7 @@ export class D2LGradeResultLetterScore extends LocalizeLabsElement(LitElement) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
render() {
|
|
42
|
-
if (!this.
|
|
42
|
+
if (!this.readonly) {
|
|
43
43
|
return html`
|
|
44
44
|
<div class="d2l-grade-result-letter-score-container">
|
|
45
45
|
<select
|
|
@@ -21,12 +21,12 @@ export class D2LGradeResultNumericScore extends LocalizeLabsElement(LitElement)
|
|
|
21
21
|
static get properties() {
|
|
22
22
|
return {
|
|
23
23
|
label: { type: String },
|
|
24
|
-
scoreNumerator: { type: Number, converter: numberConverter },
|
|
25
|
-
scoreDenominator: { type: Number },
|
|
26
|
-
|
|
24
|
+
scoreNumerator: { attribute: 'score-numerator', type: Number, converter: numberConverter },
|
|
25
|
+
scoreDenominator: { attribute: 'score-denominator', type: Number },
|
|
26
|
+
readonly: { type: Boolean },
|
|
27
27
|
required: { type: Boolean },
|
|
28
|
-
allowNegativeScore: { type: Boolean },
|
|
29
|
-
showFlooredScoreWarning: { type: Boolean },
|
|
28
|
+
allowNegativeScore: { attribute: 'allow-negative-score', type: Boolean },
|
|
29
|
+
showFlooredScoreWarning: { attribute: 'show-floored-score-warning', type: Boolean },
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -57,7 +57,7 @@ export class D2LGradeResultNumericScore extends LocalizeLabsElement(LitElement)
|
|
|
57
57
|
|
|
58
58
|
return html`
|
|
59
59
|
<div class="d2l-grade-result-numeric-score-container">
|
|
60
|
-
${!this.
|
|
60
|
+
${!this.readonly ? html`
|
|
61
61
|
<div class="d2l-grade-result-numeric-score-score">
|
|
62
62
|
<d2l-form>
|
|
63
63
|
<d2l-input-number
|
|
@@ -89,7 +89,7 @@ export class D2LGradeResultPresentational extends LocalizeLabsElement(LitElement
|
|
|
89
89
|
* Set to true if the user does not have permissions to edit the grade
|
|
90
90
|
* @type {boolean}
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
readonly: { type: Boolean },
|
|
93
93
|
/**
|
|
94
94
|
* The text that is inside of the tooltip when hovering over the reports button
|
|
95
95
|
* @type {string}
|
|
@@ -167,7 +167,7 @@ export class D2LGradeResultPresentational extends LocalizeLabsElement(LitElement
|
|
|
167
167
|
this.includeReportsButton = false;
|
|
168
168
|
this.isManualOverrideActive = false;
|
|
169
169
|
this.labelHeadingLevel = undefined;
|
|
170
|
-
this.
|
|
170
|
+
this.readonly = false;
|
|
171
171
|
this.selectedLetterGrade = '';
|
|
172
172
|
this.showFlooredScoreWarning = false;
|
|
173
173
|
this.subtitleText = undefined;
|
|
@@ -191,10 +191,6 @@ export class D2LGradeResultPresentational extends LocalizeLabsElement(LitElement
|
|
|
191
191
|
`;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
_isReadOnly() {
|
|
195
|
-
return Boolean(this.readOnly);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
194
|
_onGradeButtonClick() {
|
|
199
195
|
this.dispatchEvent(new CustomEvent('d2l-grade-result-grade-button-click', {
|
|
200
196
|
bubbles: true,
|
|
@@ -248,9 +244,9 @@ export class D2LGradeResultPresentational extends LocalizeLabsElement(LitElement
|
|
|
248
244
|
return html`
|
|
249
245
|
<d2l-labs-grade-result-letter-score
|
|
250
246
|
.availableOptions=${this.letterGradeOptions}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
label=${this.inputLabelText}
|
|
248
|
+
?readonly=${this.readonly}
|
|
249
|
+
selected-option=${ifDefined(this.selectedLetterGrade)}
|
|
254
250
|
></d2l-labs-grade-result-letter-score>
|
|
255
251
|
`;
|
|
256
252
|
}
|
|
@@ -275,13 +271,13 @@ export class D2LGradeResultPresentational extends LocalizeLabsElement(LitElement
|
|
|
275
271
|
_renderNumericScoreComponent() {
|
|
276
272
|
return html`
|
|
277
273
|
<d2l-labs-grade-result-numeric-score
|
|
278
|
-
?
|
|
279
|
-
|
|
280
|
-
|
|
274
|
+
?allow-negative-score=${this.allowNegativeScore}
|
|
275
|
+
label=${this.inputLabelText}
|
|
276
|
+
?readonly=${this.readonly}
|
|
281
277
|
?required=${this.required}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
?
|
|
278
|
+
score-denominator=${ifDefined(this.scoreDenominator)}
|
|
279
|
+
score-numerator=${ifDefined(this.scoreNumerator)}
|
|
280
|
+
?show-floored-score-warning=${this.showFlooredScoreWarning}
|
|
285
281
|
></d2l-labs-grade-result-numeric-score>
|
|
286
282
|
`;
|
|
287
283
|
}
|
|
@@ -222,31 +222,6 @@ describe('Page Routing', () => {
|
|
|
222
222
|
|
|
223
223
|
### Route order inversion issue
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
This issue is resolved by default but the fix can be bypassed (for backwards compatibility) by setting the `disableRouteOrderFix` option to `true`.
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
#### Issue Fix
|
|
230
|
-
|
|
231
|
-
There is currently a fix available for this ordering issue, but it requires setting the `enableRouteOrderFix` option to `true`. Ex:
|
|
232
|
-
|
|
233
|
-
```js
|
|
234
|
-
registerRoutes([
|
|
235
|
-
{
|
|
236
|
-
pattern: '/home',
|
|
237
|
-
view: () => html`...`
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
pattern: '/404',
|
|
241
|
-
view: () => html`...`
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
pattern: '*',
|
|
245
|
-
to: '/404'
|
|
246
|
-
}
|
|
247
|
-
], {
|
|
248
|
-
enableRouteOrderFix: true
|
|
249
|
-
});
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Note: The reason this is an opt-in fix is that a lot of existing implementations of lit-router have worked around this issue by putting the wildcard routes at the start, which would break if the issue were fixed for everyone automatically.
|
|
227
|
+
Bypassing the fix causes a warning to appear in the dev console. To resolve the warning, remove the `disaableRouteOrderFix` option and thoroughly test your routing. If your routes contain wildcards (`*`, typically for 404s), you may need to register them last.
|
|
@@ -39,10 +39,9 @@ const _handleRouteView = (context, next, r) => {
|
|
|
39
39
|
|
|
40
40
|
const _handleRouteLoader = r => (context, next) => {
|
|
41
41
|
const disableRouteOrderFix = _lastOptions?.disableRouteOrderFix ?? false;
|
|
42
|
-
const enableRouteOrderFix = _lastOptions?.enableRouteOrderFix ?? false;
|
|
43
42
|
|
|
44
43
|
// Skip further pattern matches if the route has already been handled
|
|
45
|
-
if (!disableRouteOrderFix &&
|
|
44
|
+
if (!disableRouteOrderFix && context.handled) {
|
|
46
45
|
next();
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
@@ -52,7 +51,7 @@ const _handleRouteLoader = r => (context, next) => {
|
|
|
52
51
|
_handleRouteView(context, next, r);
|
|
53
52
|
});
|
|
54
53
|
} else if (r.pattern && r.to) {
|
|
55
|
-
if (!disableRouteOrderFix
|
|
54
|
+
if (!disableRouteOrderFix) {
|
|
56
55
|
activePage.redirect(r.to);
|
|
57
56
|
} else {
|
|
58
57
|
activePage.redirect(r.pattern, r.to);
|
|
@@ -94,7 +93,7 @@ export const registerRoutes = (routes, options) => {
|
|
|
94
93
|
if (hasRegistered) throw new Error('May not construct multiple routers.');
|
|
95
94
|
hasRegistered = true;
|
|
96
95
|
|
|
97
|
-
if (
|
|
96
|
+
if (options?.disableRouteOrderFix) console.warn('lit-router: The disableRouteOrderFix option is enabled, which may cause issues with route handling. See here for details: https://github.com/BrightspaceUI/labs/tree/main/src/utilities/router#route-order-inversion-issue');
|
|
98
97
|
|
|
99
98
|
configure(options);
|
|
100
99
|
|