lightning-base-components 1.20.1-alpha → 1.20.2-alpha
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
CHANGED
|
@@ -59,7 +59,7 @@ supports the following input types:
|
|
|
59
59
|
- `checkbox`
|
|
60
60
|
- `checkbox-button`
|
|
61
61
|
- `date`
|
|
62
|
-
- `datetime`
|
|
62
|
+
- `datetime`/`datetime-local`
|
|
63
63
|
- `time`
|
|
64
64
|
- `email`
|
|
65
65
|
- `file`
|
|
@@ -71,7 +71,9 @@ supports the following input types:
|
|
|
71
71
|
- `text` (default)
|
|
72
72
|
- `toggle`
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
There is no behavioral difference between the `datetime` and `datetime-local` types.
|
|
75
|
+
|
|
76
|
+
The following HTML input types aren't supported.
|
|
75
77
|
|
|
76
78
|
- `button`
|
|
77
79
|
- `hidden`
|
|
@@ -79,6 +81,8 @@ The following HTML input types are not supported.
|
|
|
79
81
|
- `radio`
|
|
80
82
|
- `reset`
|
|
81
83
|
- `submit`
|
|
84
|
+
- `week`
|
|
85
|
+
- `month`
|
|
82
86
|
|
|
83
87
|
Use [`lightning-button`](bundle/lightning-button/documentation)
|
|
84
88
|
instead for input types `button`, `reset`, and
|
|
@@ -87,6 +91,8 @@ instead for input types `button`, `reset`, and
|
|
|
87
91
|
Use [`lightning-radio-group`](bundle/lightning-radio-group/documentation)
|
|
88
92
|
instead of input type `radio` for radio buttons.
|
|
89
93
|
|
|
94
|
+
Use [`lightning-combobox`](bundle/lightning-combobox/documentation) or input type `number` instead of input types `week` and `month`. The `week` and `month` types are browser-dependent and may cause issues with styling, accessibility, and general functionality in specific browsers.
|
|
95
|
+
|
|
90
96
|
When working with forms that interact with Salesforce records, consider using the record form components. The `lightning-record-form`, `lightning-record-view-form`, and `lightning-record-edit-form` components provide a form-based UI that's metadata-driven. The components are automatically wired up to your record data, labels, and field-level help text. For more information, see [Work with Records Using Base Components](https://developer.salesforce.com/docs/platform/lwc/guide/data-get-user-input-intro).
|
|
91
97
|
|
|
92
98
|
Alternatively, to create your own custom UI to work with Salesforce records, use `lightning-input` with the `lightning/ui*Api` wire adapters and functions, such as `getRecord` and `updateRecord`. For more information, see [Use the Wire Service with Base Components](https://developer.salesforce.com/docs/platform/lwc/guide/data-wire-base-components).
|
|
@@ -1815,16 +1815,21 @@ export default class LightningInput extends LightningElement {
|
|
|
1815
1815
|
* @returns {boolean} - wether the value is valid or not
|
|
1816
1816
|
*/
|
|
1817
1817
|
_validateType(type) {
|
|
1818
|
+
if (VALID_INPUT_TYPES.includes(type)) {
|
|
1819
|
+
return true;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
const invalidMsg = `<lightning-input> The type attribute value "${type}" is invalid.`;
|
|
1818
1823
|
assert(
|
|
1819
1824
|
type !== 'hidden',
|
|
1820
|
-
|
|
1825
|
+
`${invalidMsg} Use a regular <input type="hidden"> instead.`
|
|
1821
1826
|
);
|
|
1822
1827
|
assert(
|
|
1823
1828
|
type !== 'submit' &&
|
|
1824
1829
|
type !== 'reset' &&
|
|
1825
1830
|
type !== 'image' &&
|
|
1826
1831
|
type !== 'button',
|
|
1827
|
-
|
|
1832
|
+
`${invalidMsg} Use <lightning:button> instead.`
|
|
1828
1833
|
);
|
|
1829
1834
|
if (this.isTypeRadio) {
|
|
1830
1835
|
assert(
|
|
@@ -1832,12 +1837,19 @@ export default class LightningInput extends LightningElement {
|
|
|
1832
1837
|
`<lightning-input> The required attribute is not supported on radio inputs directly. It should be implemented at the radio group level.`
|
|
1833
1838
|
);
|
|
1834
1839
|
}
|
|
1840
|
+
|
|
1835
1841
|
if (type === 'phone') {
|
|
1836
1842
|
console.warn(
|
|
1837
|
-
|
|
1843
|
+
`${invalidMsg} Please use <lightning-input type="tel"> instead. Defaulting to text type.`
|
|
1838
1844
|
);
|
|
1845
|
+
} else if (type === 'week' || type === 'month') {
|
|
1846
|
+
console.warn(
|
|
1847
|
+
`${invalidMsg} Please use <lightning-combobox> and/or <lightning-input type="number"> instead to avoid inconsistencies and breakages across browsers.`
|
|
1848
|
+
);
|
|
1849
|
+
} else {
|
|
1850
|
+
console.warn(`${invalidMsg} Defaulting to text type.`);
|
|
1839
1851
|
}
|
|
1840
|
-
return
|
|
1852
|
+
return false;
|
|
1841
1853
|
}
|
|
1842
1854
|
|
|
1843
1855
|
/**
|