@brightspace-ui/core 2.59.2 → 2.59.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.
|
@@ -155,7 +155,7 @@ export const FormElementMixin = superclass => class extends LocalizeCoreElement(
|
|
|
155
155
|
return this.localize('components.form-element.defaultError', { label });
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
/** @ignore */
|
|
158
|
+
/** @ignore Note: this may be our custom FormElementValidityState or native ValidityState depending on the source. */
|
|
159
159
|
get validity() {
|
|
160
160
|
return this._validity;
|
|
161
161
|
}
|
|
@@ -306,6 +306,15 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
306
306
|
return super.validationMessage;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
/** @ignore */
|
|
310
|
+
get validity() {
|
|
311
|
+
const elem = this.shadowRoot && this.shadowRoot.querySelector('d2l-input-text');
|
|
312
|
+
if (elem && !elem.validity.valid) {
|
|
313
|
+
return elem.validity;
|
|
314
|
+
}
|
|
315
|
+
return super.validity;
|
|
316
|
+
}
|
|
317
|
+
|
|
309
318
|
firstUpdated(changedProperties) {
|
|
310
319
|
super.firstUpdated(changedProperties);
|
|
311
320
|
this.addEventListener('d2l-localize-resources-change', () => {
|
|
@@ -331,6 +340,7 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
331
340
|
?hide-invalid-icon="${this.hideInvalidIcon}"
|
|
332
341
|
id="${this._inputId}"
|
|
333
342
|
input-width="${this.inputWidth}"
|
|
343
|
+
@invalid-change="${this._handleInvalidChange}"
|
|
334
344
|
label="${ifDefined(this.label)}"
|
|
335
345
|
?label-hidden="${this.labelHidden || this.labelledBy}"
|
|
336
346
|
.labelRequired="${false}"
|
|
@@ -352,27 +362,35 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
352
362
|
updated(changedProperties) {
|
|
353
363
|
super.updated(changedProperties);
|
|
354
364
|
|
|
365
|
+
let checkValidity = false;
|
|
355
366
|
changedProperties.forEach((oldVal, prop) => {
|
|
356
367
|
if (prop === 'value') {
|
|
357
368
|
this.setFormValue(this.value);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
let rangeOverflowCondition = false;
|
|
365
|
-
if (typeof(this.max) === 'number') {
|
|
366
|
-
rangeOverflowCondition = this.maxExclusive ? this.value >= this.max : this.value > this.max;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
this.setValidity({
|
|
370
|
-
rangeUnderflow: rangeUnderflowCondition,
|
|
371
|
-
rangeOverflow: rangeOverflowCondition
|
|
372
|
-
});
|
|
373
|
-
this.requestValidate(true);
|
|
369
|
+
checkValidity = true;
|
|
370
|
+
} else if ((prop === 'min' && oldVal !== undefined)
|
|
371
|
+
|| (prop === 'max' && oldVal !== undefined)
|
|
372
|
+
|| (prop === 'minExclusive' && oldVal !== undefined)
|
|
373
|
+
|| (prop === 'maxExclusive' && oldVal !== undefined)) {
|
|
374
|
+
checkValidity = true;
|
|
374
375
|
}
|
|
375
376
|
});
|
|
377
|
+
|
|
378
|
+
if (checkValidity) {
|
|
379
|
+
let rangeUnderflowCondition = false;
|
|
380
|
+
if (typeof(this.min) === 'number') {
|
|
381
|
+
rangeUnderflowCondition = this.minExclusive ? this.value <= this.min : this.value < this.min;
|
|
382
|
+
}
|
|
383
|
+
let rangeOverflowCondition = false;
|
|
384
|
+
if (typeof(this.max) === 'number') {
|
|
385
|
+
rangeOverflowCondition = this.maxExclusive ? this.value >= this.max : this.value > this.max;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
this.setValidity({
|
|
389
|
+
rangeUnderflow: rangeUnderflowCondition,
|
|
390
|
+
rangeOverflow: rangeOverflowCondition
|
|
391
|
+
});
|
|
392
|
+
this.requestValidate(true);
|
|
393
|
+
}
|
|
376
394
|
}
|
|
377
395
|
|
|
378
396
|
async validate() {
|
|
@@ -456,6 +474,10 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
|
|
|
456
474
|
}
|
|
457
475
|
}
|
|
458
476
|
|
|
477
|
+
_handleInvalidChange() {
|
|
478
|
+
this.requestValidate(true);
|
|
479
|
+
}
|
|
480
|
+
|
|
459
481
|
_handleKeyPress(e) {
|
|
460
482
|
// NOTE: keypress event is deprecated, but keydown fires for ALL keys (including Shift/Tab/etc.)
|
|
461
483
|
// which makes it hard to selectively supress "not numbers". The "beforeinput" event is
|
|
@@ -307,7 +307,7 @@ class InputText extends FocusMixin(LabelledMixin(FormElementMixin(SkeletonMixin(
|
|
|
307
307
|
/** @ignore */
|
|
308
308
|
get validity() {
|
|
309
309
|
const elem = this.shadowRoot && this.shadowRoot.querySelector('.d2l-input');
|
|
310
|
-
if (!elem.validity.valid) {
|
|
310
|
+
if (elem && !elem.validity.valid) {
|
|
311
311
|
return elem.validity;
|
|
312
312
|
}
|
|
313
313
|
return super.validity;
|
|
@@ -18,6 +18,7 @@ Tables are used to display tabular data in rows and columns. They can allow user
|
|
|
18
18
|
* There are more than just a few dimensions
|
|
19
19
|
* The dimensions need to be sortable
|
|
20
20
|
* The dimensions need to be easily compared across rows (ie- scannable)
|
|
21
|
+
* Specify [column and row headings](https://www.w3.org/WAI/tutorials/tables/) so data is meaningful to screen reader users
|
|
21
22
|
<!-- docs: end dos -->
|
|
22
23
|
|
|
23
24
|
<!-- docs: start donts -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.59.
|
|
3
|
+
"version": "2.59.4",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|