lightning-base-components 1.21.3-alpha → 1.21.4-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/metadata/raptor.json +49 -0
- package/package.json +88 -21
- package/scopedImports/@salesforce-label-LightningDatatable.showActions.js +1 -1
- package/scopedImports/@salesforce-label-LightningForm.controllerFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.generalDependentFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.learnMore.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.okButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalCancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalSelect.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.currentStage.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.errorStage.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageComplete.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageNotStarted.js +1 -1
- package/src/lightning/avatar/avatar.html +1 -0
- package/src/lightning/badge/badge.html +3 -3
- package/src/lightning/baseCombobox/baseCombobox.html +4 -1
- package/src/lightning/baseCombobox/baseCombobox.js +3 -16
- package/src/lightning/button/__docs__/button.md +2 -1
- package/src/lightning/button/button.js +3 -4
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +1 -0
- package/src/lightning/buttonIcon/buttonIcon.html +1 -1
- package/src/lightning/buttonIcon/buttonIcon.js +18 -17
- package/src/lightning/buttonMenu/buttonMenu.css +5 -0
- package/src/lightning/buttonMenu/buttonMenu.js +2 -0
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +12 -0
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +11 -1
- package/src/lightning/combobox/combobox.html +1 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.html +11 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.js +25 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/generateData.js +15 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/customInput.html +4 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/myCustomTypeDatatable.js +17 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/nestedSimpleComponentParent.html +7 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.html +9 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.js +6 -0
- package/src/lightning/datatable/autoWidthStrategy.js +8 -36
- package/src/lightning/datatable/columnResizer.js +51 -161
- package/src/lightning/datatable/columnWidthManager.js +25 -81
- package/src/lightning/datatable/columns.js +180 -302
- package/src/lightning/datatable/datatable.js +455 -441
- package/src/lightning/datatable/errors.js +17 -29
- package/src/lightning/datatable/fixedWidthStrategy.js +7 -22
- package/src/lightning/datatable/headerActions.js +8 -38
- package/src/lightning/datatable/indexes.js +42 -0
- package/src/lightning/datatable/infiniteLoading.js +16 -35
- package/src/lightning/datatable/inlineEdit.js +125 -156
- package/src/lightning/datatable/keyboard.js +226 -282
- package/src/lightning/datatable/renderManager.js +0 -4
- package/src/lightning/datatable/resizeObserver.js +4 -13
- package/src/lightning/datatable/rowLevelActions.js +2 -2
- package/src/lightning/datatable/rowNumber.js +21 -59
- package/src/lightning/datatable/rowSelection.js +95 -178
- package/src/lightning/datatable/rowSelectionShared.js +13 -27
- package/src/lightning/datatable/rows.js +171 -418
- package/src/lightning/datatable/sort.js +16 -75
- package/src/lightning/datatable/templates/div/div.html +12 -4
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +10 -16
- package/src/lightning/datatable/templates/table/table.html +15 -5
- package/src/lightning/datatable/tree.js +17 -35
- package/src/lightning/datatable/types.js +10 -31
- package/src/lightning/datatable/utils.js +49 -24
- package/src/lightning/datatable/virtualization.js +2 -5
- package/src/lightning/datatable/widthManagerShared.js +0 -20
- package/src/lightning/datatable/wrapText.js +29 -60
- package/src/lightning/dualListbox/dualListbox.js +7 -8
- package/src/lightning/formattedName/formattedName.js +3 -2
- package/src/lightning/formattedName/formattedName.js-meta.xml +3 -0
- package/src/lightning/formattedNumber/formattedNumber.js +3 -2
- package/src/lightning/formattedNumber/formattedNumber.js-meta.xml +3 -0
- package/src/lightning/formattedRichText/richTextConfig.js +1 -0
- package/src/lightning/helptext/helptext.css +7 -0
- package/src/lightning/helptext/helptext.js +3 -4
- package/src/lightning/icon/icon.html +1 -1
- package/src/lightning/input/input.html +5 -0
- package/src/lightning/inputAddress/addressFormat.js +31 -4
- package/src/lightning/inputAddress/fieldsLayout.js +6 -0
- package/src/lightning/inputAddress/inputAddress.html +19 -1
- package/src/lightning/inputAddress/inputAddress.js +74 -3
- package/src/lightning/internationalizationLibrary/address/AddressFormat.js +553 -610
- package/src/lightning/lookupAddress/lookupAddress.html +6 -1
- package/src/lightning/lookupAddress/lookupAddress.js +25 -0
- package/src/lightning/modal/__docs__/modal.md +10 -1
- package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +3 -7
- package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +39 -133
- package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
- package/src/lightning/modal/modal.js +1 -1
- package/src/lightning/modalBase/modalBase.html +15 -10
- package/src/lightning/modalBase/modalBase.js +131 -146
- package/src/lightning/modalBody/modalBody.css +6 -0
- package/src/lightning/modalHeader/modalHeader.html +16 -4
- package/src/lightning/modalHeader/modalHeader.js +61 -14
- package/src/lightning/pill/link.html +1 -0
- package/src/lightning/pill/plain.html +1 -0
- package/src/lightning/pill/plainLink.html +1 -0
- package/src/lightning/primitiveBubble/primitiveBubble.js +42 -0
- package/src/lightning/primitiveDatatableCell/primitiveDatatableCell.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +13 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +19 -6
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +3 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.css +11 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +2 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +1 -0
- package/src/lightning/progressStep/base.html +5 -6
- package/src/lightning/progressStep/progressStep.js +14 -9
- package/src/lightning/prompt/__docs__/prompt.md +1 -1
- package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +0 -2
- package/src/lightning/sldsCommon/sldsCommon.css +134 -98
- package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +1 -1
- package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +14 -13
- package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +95 -92
- package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +1 -1
- package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +77 -75
- package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +73 -73
- package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +552 -558
- package/src/lightning/sldsUtilsVisibility/sldsUtilsVisibility.css +2 -2
- package/src/lightning/staticMap/staticMap.js +3 -2
- package/src/lightning/tab/tab.js +6 -3
- package/src/lightning/tab/tab.js-meta.xml +3 -0
- package/src/lightning/tabBar/tabBar.js +10 -5
- package/src/lightning/tabset/tabset.html +2 -0
- package/src/lightning/tabset/tabset.js-meta.xml +3 -0
- package/src/lightning/textarea/textarea.js +6 -1
- package/src/lightning/toastContainer/__docs__/toastContainer.md +3 -2
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +24 -15
- package/src/lightning/verticalNavigation/vertical-navigation.slds.css +14 -0
- package/src/lightning/verticalNavigation/verticalNavigation.css +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.js +66 -28
- package/src/lightning/verticalNavigation/verticalNavigation.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.css +2 -3
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js +29 -15
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.native.css +2 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemBadge/badge.slds.css +76 -0
- package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.css +2 -3
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.html +1 -1
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js +28 -15
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.css +2 -3
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js +29 -15
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.native.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationOverflow/button.slds.css +503 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-section.slds.css +17 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.css +2 -1
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.html +2 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js +18 -13
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +14 -14
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.js-meta.xml +3 -0
- package/src/lightning/datatable/inlineEditShared.js +0 -26
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customDatatypeTable.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customLink.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customName.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumber.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumberEdit.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/deleteRow.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/iconPill.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/orderingButtons.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.js +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import labelClipText from '@salesforce/label/LightningDatatable.clipText';
|
|
2
2
|
import labelWrapText from '@salesforce/label/LightningDatatable.wrapText';
|
|
3
3
|
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
4
|
-
import { getStateColumnIndex
|
|
4
|
+
import { getStateColumnIndex } from './columns';
|
|
5
5
|
import { normalizeNumberAttribute } from './utils';
|
|
6
6
|
import { getDefaultState } from './state';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const NON_WRAPPABLE_TYPES = [
|
|
8
|
+
const NON_WRAPPABLE_TYPES = new Set([
|
|
10
9
|
'action',
|
|
11
10
|
'boolean',
|
|
12
11
|
'button',
|
|
13
12
|
'button-icon',
|
|
14
13
|
'date-local',
|
|
15
14
|
'rowNumber',
|
|
16
|
-
];
|
|
15
|
+
]);
|
|
17
16
|
|
|
18
17
|
const i18n = {
|
|
19
18
|
clipText: labelClipText,
|
|
@@ -22,39 +21,23 @@ const i18n = {
|
|
|
22
21
|
|
|
23
22
|
/************************** WRAP TEXT STATE **************************/
|
|
24
23
|
|
|
25
|
-
/**
|
|
26
|
-
* Returns a boolean representing whether or not the column should be text wrapped
|
|
27
|
-
*
|
|
28
|
-
* NOTE: Wrap text is not supported in IE, so default parameters are fine here.
|
|
29
|
-
*
|
|
30
|
-
* @param {Object} state Datatable's state object
|
|
31
|
-
* @param {String} colKeyValue The column key value to look up wrap text configuration
|
|
32
|
-
* @returns {Boolean} Whether the text is currently wrapped
|
|
33
|
-
*/
|
|
34
|
-
export function getWrapTextState(state = getDefaultState(), colKeyValue) {
|
|
35
|
-
return state.wrapText[colKeyValue] || WRAP_TEXT_DEFAULT;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
24
|
/**
|
|
39
25
|
* Sets a boolean value in state's wrapText object against the column key value
|
|
40
26
|
* representing whether or not the column is text wrapped.
|
|
41
27
|
*
|
|
42
|
-
* NOTE: Wrap text is not supported in IE, so default parameters are fine here.
|
|
43
|
-
*
|
|
44
28
|
* @param {Object} state The datatable state
|
|
45
|
-
* @param {Object} col The datatable column
|
|
29
|
+
* @param {Object} col The datatable column definition
|
|
46
30
|
*/
|
|
47
31
|
export function setWrapTextState(state = getDefaultState(), col) {
|
|
48
|
-
if (
|
|
49
|
-
state.wrapText[col.colKeyValue] =
|
|
50
|
-
normalizeBoolean(col.wrapText) || WRAP_TEXT_DEFAULT;
|
|
32
|
+
if (!NON_WRAPPABLE_TYPES.has(col.type)) {
|
|
33
|
+
state.wrapText[col.colKeyValue] = normalizeBoolean(col.wrapText);
|
|
51
34
|
}
|
|
52
35
|
}
|
|
53
36
|
|
|
54
37
|
/************************** WRAP TEXT MAX LINES **************************/
|
|
55
38
|
|
|
56
39
|
/**
|
|
57
|
-
* Normalizes and sets wrapTextMaxLines in datatable
|
|
40
|
+
* Normalizes and sets wrapTextMaxLines in datatable state object.
|
|
58
41
|
* The normalized value should be a positive integer or it'll fall back to undefined.
|
|
59
42
|
*
|
|
60
43
|
* @param {Object} state The datatable state
|
|
@@ -100,33 +83,30 @@ function updateWrapTextAndMaxLinesValuesInCells(state, colIndex, colKeyValue) {
|
|
|
100
83
|
* @param {Object} col The datatable column definition
|
|
101
84
|
* @returns {Array} An array of wrap text actions
|
|
102
85
|
*/
|
|
103
|
-
export function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// Must be done first, so getWrapTextState correctly resolves.
|
|
86
|
+
export function getInternalActions(state, col) {
|
|
87
|
+
// Untracked state change.
|
|
88
|
+
// Must be done first, so isTextWrapped correctly resolves.
|
|
108
89
|
setWrapTextState(state, col);
|
|
109
|
-
|
|
110
90
|
// If not hidden and isWrapable, sets the internal actions.
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
91
|
+
if (col.hideDefaultActions || NON_WRAPPABLE_TYPES.has(col.type)) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
const isTextWrapped = state.wrapText[col.colKeyValue] || false;
|
|
95
|
+
const { clipText, wrapText } = i18n;
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
label: wrapText,
|
|
99
|
+
title: wrapText,
|
|
117
100
|
checked: isTextWrapped,
|
|
118
101
|
name: 'wrapText',
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
title: `${i18n.clipText}`,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: clipText,
|
|
105
|
+
title: clipText,
|
|
124
106
|
checked: !isTextWrapped,
|
|
125
107
|
name: 'clipText',
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return wrapTextActions;
|
|
108
|
+
},
|
|
109
|
+
];
|
|
130
110
|
}
|
|
131
111
|
|
|
132
112
|
/**
|
|
@@ -134,14 +114,15 @@ export function getActions(state, col) {
|
|
|
134
114
|
* needs to be changed in the state, change it to the new value and update
|
|
135
115
|
* the check mark to represent the currently selected action
|
|
136
116
|
*
|
|
137
|
-
* @param {Object}
|
|
117
|
+
* @param {Object} dt The datatable
|
|
138
118
|
* @param {String} action Action that was selected/triggered
|
|
139
119
|
* @param {String} colKeyValue Column key value
|
|
140
120
|
*/
|
|
141
|
-
export function handleTriggeredAction(
|
|
121
|
+
export function handleTriggeredAction(dt, action, colKeyValue) {
|
|
142
122
|
const { name } = action;
|
|
143
123
|
const isWrapText = name === 'wrapText';
|
|
144
124
|
if (isWrapText || name === 'clipText') {
|
|
125
|
+
const { state } = dt;
|
|
145
126
|
// If state should be changed
|
|
146
127
|
if (state.wrapText[colKeyValue] !== isWrapText) {
|
|
147
128
|
state.shouldResetHeights = true;
|
|
@@ -164,7 +145,7 @@ function updateSelectedOptionInHeaderActions(state, colKeyValue) {
|
|
|
164
145
|
if (colIndex === -1) {
|
|
165
146
|
return;
|
|
166
147
|
}
|
|
167
|
-
const columns =
|
|
148
|
+
const { columns } = state;
|
|
168
149
|
const col = columns[colIndex];
|
|
169
150
|
const { internalActions } = col.actions;
|
|
170
151
|
|
|
@@ -183,15 +164,3 @@ function updateSelectedOptionInHeaderActions(state, colKeyValue) {
|
|
|
183
164
|
// Force a refresh on this column, because the wrapText checked value changed.
|
|
184
165
|
col.actions = Object.assign({}, col.actions);
|
|
185
166
|
}
|
|
186
|
-
|
|
187
|
-
/************************** HELPER FUNCTIONS **************************/
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Determines if a given column type is wrappable.
|
|
191
|
-
*
|
|
192
|
-
* @param {String} type The type to check.
|
|
193
|
-
* @returns {Boolean} Whether the given type is wrappable.
|
|
194
|
-
*/
|
|
195
|
-
function isWrappableType(type) {
|
|
196
|
-
return NON_WRAPPABLE_TYPES.indexOf(type) < 0;
|
|
197
|
-
}
|
|
@@ -249,10 +249,6 @@ export default class LightningDualListbox extends LightningShadowBaseClass {
|
|
|
249
249
|
reflectAttribute(this, 'variant', this._variant);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
set size(value) {
|
|
253
|
-
this._size = value;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
252
|
/**
|
|
257
253
|
* Number of items that display in the listboxes before vertical scrollbars are displayed. Determines the vertical size of the listbox.
|
|
258
254
|
* @type {number}
|
|
@@ -262,6 +258,9 @@ export default class LightningDualListbox extends LightningShadowBaseClass {
|
|
|
262
258
|
get size() {
|
|
263
259
|
return this._size;
|
|
264
260
|
}
|
|
261
|
+
set size(value) {
|
|
262
|
+
this._size = value;
|
|
263
|
+
}
|
|
265
264
|
|
|
266
265
|
/**
|
|
267
266
|
* Help text detailing the purpose and function of the dual listbox.
|
|
@@ -269,10 +268,6 @@ export default class LightningDualListbox extends LightningShadowBaseClass {
|
|
|
269
268
|
*/
|
|
270
269
|
@api fieldLevelHelp;
|
|
271
270
|
|
|
272
|
-
set disableReordering(value) {
|
|
273
|
-
this._disableReordering = normalizeBoolean(value);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
271
|
/**
|
|
277
272
|
* If present, the Up and Down buttons used for reordering the selected list items are hidden.
|
|
278
273
|
* @type {boolean}
|
|
@@ -283,6 +278,10 @@ export default class LightningDualListbox extends LightningShadowBaseClass {
|
|
|
283
278
|
return this._disableReordering;
|
|
284
279
|
}
|
|
285
280
|
|
|
281
|
+
set disableReordering(value) {
|
|
282
|
+
this._disableReordering = normalizeBoolean(value);
|
|
283
|
+
}
|
|
284
|
+
|
|
286
285
|
/**
|
|
287
286
|
* If present, a spinner is displayed in the first listbox to indicate loading activity.
|
|
288
287
|
* @type {boolean}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import locale from '@salesforce/i18n/locale';
|
|
2
|
-
import {
|
|
2
|
+
import { api, track } from 'lwc';
|
|
3
3
|
import { normalizeString as normalize } from 'lightning/utilsPrivate';
|
|
4
4
|
import { nameFormat } from 'lightning/internationalizationLibrary';
|
|
5
|
+
import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
|
|
5
6
|
|
|
6
7
|
const DEFAULT_FORMAT = 'long';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Displays a formatted name that can include a salutation and suffix.
|
|
10
11
|
*/
|
|
11
|
-
export default class LightningFormattedName extends
|
|
12
|
+
export default class LightningFormattedName extends LightningShadowBaseClass {
|
|
12
13
|
/**
|
|
13
14
|
* The format to use to display the name. Valid values include short, medium, and long. This value defaults to long.
|
|
14
15
|
* @type {string}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
|
|
2
3
|
import { numberFormat } from 'lightning/internationalizationLibrary';
|
|
3
4
|
import { toFormattedNumber } from 'lightning/utilsPrivate';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Displays formatted numbers for decimals, currency, and percentages.
|
|
7
8
|
*/
|
|
8
|
-
export default class LightningFormattedNumber extends
|
|
9
|
+
export default class LightningFormattedNumber extends LightningShadowBaseClass {
|
|
9
10
|
/**
|
|
10
11
|
* The value to be formatted.
|
|
11
12
|
* @type {number}
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
@import './helptext.lbc.native.css';
|
|
2
|
+
|
|
3
|
+
/* TODO: check if this style can be removed once W-14915319 is closed */
|
|
4
|
+
/* Styles required for Multi-Column Sorting Modal in datatable */
|
|
5
|
+
:host(.modal_header) .slds-form-element__icon {
|
|
6
|
+
padding-top: unset;
|
|
7
|
+
padding-left: var(--slds-g-sizing-2);
|
|
8
|
+
}
|
|
@@ -30,10 +30,9 @@ export default class LightningHelptext extends LightningShadowBaseClass {
|
|
|
30
30
|
content;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Reserved for internal use only.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* be set to 0 if button should be focused.
|
|
33
|
+
* Reserved for internal use only. Use the global tabindex attribute instead.
|
|
34
|
+
* Set tab index to -1 to prevent focus on the button during tab navigation.
|
|
35
|
+
* The default value is 0, which makes the button focusable during tab navigation.
|
|
37
36
|
* @type {number}
|
|
38
37
|
*/
|
|
39
38
|
@api tabIndex;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
autocomplete={autocomplete}
|
|
16
16
|
computed-label-class={computedLabelClass}
|
|
17
17
|
disabled={disabled}
|
|
18
|
+
exportparts="input-text, input-container, input"
|
|
18
19
|
field-level-help={fieldLevelHelp}
|
|
19
20
|
formatter={formatter}
|
|
20
21
|
format-fraction-digits={formatFractionDigits}
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
aria-invalid={computedAriaInvalid}
|
|
57
58
|
checked={checked}
|
|
58
59
|
disabled={disabled}
|
|
60
|
+
exportparts="indicator"
|
|
59
61
|
help-message={_helpMessage}
|
|
60
62
|
label={label}
|
|
61
63
|
message-toggle-active={messageToggleActive}
|
|
@@ -81,6 +83,7 @@
|
|
|
81
83
|
aria-invalid={computedAriaInvalid}
|
|
82
84
|
checked={checked}
|
|
83
85
|
disabled={disabled}
|
|
86
|
+
exportparts="indicator"
|
|
84
87
|
field-level-help={fieldLevelHelp}
|
|
85
88
|
help-message={_helpMessage}
|
|
86
89
|
helptext-alternative-text={helptextAlternativeText}
|
|
@@ -126,6 +129,7 @@
|
|
|
126
129
|
aria-roledescription={ariaRoleDescription}
|
|
127
130
|
aria-label={ariaLabel}
|
|
128
131
|
disabled={disabled}
|
|
132
|
+
exportparts="indicator"
|
|
129
133
|
help-message={_helpMessage}
|
|
130
134
|
label={label}
|
|
131
135
|
name={name}
|
|
@@ -148,6 +152,7 @@
|
|
|
148
152
|
aria-roledescription={ariaRoleDescription}
|
|
149
153
|
aria-label={computedAriaLabel}
|
|
150
154
|
disabled={disabled}
|
|
155
|
+
exportparts="button"
|
|
151
156
|
help-message={_helpMessage}
|
|
152
157
|
label={label}
|
|
153
158
|
label-class={computedLabelClass}
|
|
@@ -18,7 +18,12 @@ export const parseLocaleFormat = function (format) {
|
|
|
18
18
|
return [];
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export function getInputOrder(
|
|
21
|
+
export function getInputOrder(
|
|
22
|
+
langCode,
|
|
23
|
+
countryCode,
|
|
24
|
+
hasCountryPicklist,
|
|
25
|
+
renderSubpremise
|
|
26
|
+
) {
|
|
22
27
|
let inputOrder = addressFormat.getAddressInputOrderAllField(
|
|
23
28
|
langCode,
|
|
24
29
|
countryCode
|
|
@@ -28,15 +33,37 @@ export function getInputOrder(langCode, countryCode, hasCountryPicklist) {
|
|
|
28
33
|
if (hasCountryPicklist) {
|
|
29
34
|
inputOrder = 'K' + inputOrder.replace('K', '');
|
|
30
35
|
}
|
|
31
|
-
|
|
36
|
+
|
|
37
|
+
const parsed = parseLocaleFormat(inputOrder);
|
|
38
|
+
|
|
39
|
+
// TD-0120510 Render single textarea as two separate inputs
|
|
40
|
+
if (renderSubpremise) {
|
|
41
|
+
const index = parsed.indexOf('street');
|
|
42
|
+
if (index !== -1) {
|
|
43
|
+
parsed.splice(index, 1, 'addressLine1', 'addressLine2');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return parsed;
|
|
32
48
|
}
|
|
33
49
|
|
|
34
|
-
export function getRequiredFields(langCode, countryCode) {
|
|
50
|
+
export function getRequiredFields(langCode, countryCode, renderSubpremise) {
|
|
35
51
|
const requireFields = addressFormat.getAddressRequireFields(
|
|
36
52
|
langCode,
|
|
37
53
|
countryCode
|
|
38
54
|
);
|
|
39
|
-
|
|
55
|
+
|
|
56
|
+
const parsed = parseLocaleFormat(requireFields);
|
|
57
|
+
|
|
58
|
+
// TD-0120510 Subpremise is never required
|
|
59
|
+
if (renderSubpremise) {
|
|
60
|
+
const index = parsed.indexOf('street');
|
|
61
|
+
if (index !== -1) {
|
|
62
|
+
parsed.splice(index, 1, 'addressLine1');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return parsed;
|
|
40
67
|
}
|
|
41
68
|
|
|
42
69
|
function isValidFieldFormat(value) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
part="input-address"
|
|
5
5
|
>
|
|
6
6
|
<legend class={computedLegendClass}>
|
|
7
|
-
<template if:true={
|
|
7
|
+
<template if:true={addressLabelRequired}>
|
|
8
8
|
<abbr class="slds-required" title={i18n.required}>*</abbr>
|
|
9
9
|
</template>
|
|
10
10
|
{addressLabel}
|
|
@@ -36,6 +36,24 @@
|
|
|
36
36
|
<template for:each={domFieldsMeta} for:item="row" for:index="index">
|
|
37
37
|
<div class="slds-form-element__row" key={row.name}>
|
|
38
38
|
<template for:each={row} for:item="field">
|
|
39
|
+
<template if:true={field.isLookupAddress}>
|
|
40
|
+
<lightning-lookup-address
|
|
41
|
+
always-render
|
|
42
|
+
key={field.name}
|
|
43
|
+
data-field={field.name}
|
|
44
|
+
class={field.classnames}
|
|
45
|
+
label={field.label}
|
|
46
|
+
name={field.name}
|
|
47
|
+
autocomplete={field.autocomplete}
|
|
48
|
+
input-text={field.value}
|
|
49
|
+
placeholder={field.placeholder}
|
|
50
|
+
required={field.required}
|
|
51
|
+
disabled={field.disabled}
|
|
52
|
+
onfocus={handleFocus}
|
|
53
|
+
onblur={handleBlur}
|
|
54
|
+
onchange={handleAddress}
|
|
55
|
+
></lightning-lookup-address>
|
|
56
|
+
</template>
|
|
39
57
|
<template if:true={field.isInput}>
|
|
40
58
|
<lightning-input
|
|
41
59
|
key={field.name}
|
|
@@ -31,6 +31,7 @@ const FIELD_TYPE = {
|
|
|
31
31
|
TEXTAREA: 'textarea',
|
|
32
32
|
INPUT: 'input',
|
|
33
33
|
PICKLIST: 'combobox',
|
|
34
|
+
LOOKUP_ADDRESS: 'address',
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
const i18n = {
|
|
@@ -57,6 +58,13 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
57
58
|
*/
|
|
58
59
|
@api streetLabel;
|
|
59
60
|
|
|
61
|
+
/**
|
|
62
|
+
* The label for the subpremise field.
|
|
63
|
+
* Visible only when using show-compact-address-lookup.
|
|
64
|
+
* @type {string}
|
|
65
|
+
*/
|
|
66
|
+
@api subpremiseLabel;
|
|
67
|
+
|
|
60
68
|
/**
|
|
61
69
|
* The label for the city field.
|
|
62
70
|
* @type {string}
|
|
@@ -87,6 +95,13 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
87
95
|
*/
|
|
88
96
|
@api streetPlaceholder;
|
|
89
97
|
|
|
98
|
+
/**
|
|
99
|
+
* The placeholder for the subpremise field.
|
|
100
|
+
* Visible only when using show-compact-address-lookup.
|
|
101
|
+
* @type {string}
|
|
102
|
+
*/
|
|
103
|
+
@api subpremisePlaceholder;
|
|
104
|
+
|
|
90
105
|
/**
|
|
91
106
|
* The placeholder for the city field.
|
|
92
107
|
* @type {string}
|
|
@@ -155,6 +170,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
155
170
|
@track _fieldLevelHelp;
|
|
156
171
|
@track _variant;
|
|
157
172
|
@track _street = '';
|
|
173
|
+
@track _subpremise = '';
|
|
158
174
|
@track _city = '';
|
|
159
175
|
@track _province = '';
|
|
160
176
|
@track _country = '';
|
|
@@ -186,7 +202,8 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
186
202
|
|
|
187
203
|
/**
|
|
188
204
|
* The value for the street field.
|
|
189
|
-
* Maximum length is 255 characters.
|
|
205
|
+
* Maximum length is 255 characters when rendered as a textarea.
|
|
206
|
+
* Maximum length is 80 characters when rendered as an input (when using show-compact-address-lookup).
|
|
190
207
|
* @type {string}
|
|
191
208
|
*
|
|
192
209
|
*/
|
|
@@ -198,6 +215,19 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
198
215
|
this._street = value;
|
|
199
216
|
}
|
|
200
217
|
|
|
218
|
+
/**
|
|
219
|
+
* The value for the subpremise field.
|
|
220
|
+
* Maximum length is 80 characters.
|
|
221
|
+
* @type {string}
|
|
222
|
+
*/
|
|
223
|
+
@api
|
|
224
|
+
get subpremise() {
|
|
225
|
+
return this._subpremise;
|
|
226
|
+
}
|
|
227
|
+
set subpremise(value) {
|
|
228
|
+
this._subpremise = value;
|
|
229
|
+
}
|
|
230
|
+
|
|
201
231
|
/**
|
|
202
232
|
* The value for the city field.
|
|
203
233
|
* Maximum length is 40 characters.
|
|
@@ -280,6 +310,19 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
280
310
|
this._showAddressLookup = normalizeBoolean(value);
|
|
281
311
|
}
|
|
282
312
|
|
|
313
|
+
/**
|
|
314
|
+
* If present, a compact address lookup using Google Maps is enabled.
|
|
315
|
+
* @type {boolean}
|
|
316
|
+
* @default false
|
|
317
|
+
*/
|
|
318
|
+
@api
|
|
319
|
+
get showCompactAddressLookup() {
|
|
320
|
+
return this._showAddressLookup;
|
|
321
|
+
}
|
|
322
|
+
set showCompactAddressLookup(value) {
|
|
323
|
+
this._showCompactAddressLookup = normalizeBoolean(value);
|
|
324
|
+
}
|
|
325
|
+
|
|
283
326
|
/**
|
|
284
327
|
* If present, the address fields are read-only and cannot be edited.
|
|
285
328
|
* @type {boolean}
|
|
@@ -424,6 +467,10 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
424
467
|
return this.disabled || this.readOnly;
|
|
425
468
|
}
|
|
426
469
|
|
|
470
|
+
get addressLabelRequired() {
|
|
471
|
+
return this.addressLabel && this.required;
|
|
472
|
+
}
|
|
473
|
+
|
|
427
474
|
get i18n() {
|
|
428
475
|
return i18n;
|
|
429
476
|
}
|
|
@@ -473,6 +520,18 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
473
520
|
maxlength: 255,
|
|
474
521
|
type: FIELD_TYPE.TEXTAREA,
|
|
475
522
|
},
|
|
523
|
+
addressLine1: {
|
|
524
|
+
autocomplete: 'address-line1',
|
|
525
|
+
name: 'street',
|
|
526
|
+
maxlength: 80,
|
|
527
|
+
type: FIELD_TYPE.LOOKUP_ADDRESS,
|
|
528
|
+
},
|
|
529
|
+
addressLine2: {
|
|
530
|
+
autocomplete: 'address-line2',
|
|
531
|
+
name: 'subpremise',
|
|
532
|
+
maxlength: 80,
|
|
533
|
+
type: FIELD_TYPE.INPUT,
|
|
534
|
+
},
|
|
476
535
|
city: {
|
|
477
536
|
autocomplete: 'address-level2',
|
|
478
537
|
name: 'city',
|
|
@@ -508,12 +567,21 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
508
567
|
const hasCountryPicklist =
|
|
509
568
|
this.fieldsTypeMeta.country.type === FIELD_TYPE.PICKLIST;
|
|
510
569
|
const [langCode, countryCode] = this.locale.split('-');
|
|
511
|
-
return getInputOrder(
|
|
570
|
+
return getInputOrder(
|
|
571
|
+
langCode,
|
|
572
|
+
countryCode,
|
|
573
|
+
hasCountryPicklist,
|
|
574
|
+
this._showCompactAddressLookup
|
|
575
|
+
);
|
|
512
576
|
}
|
|
513
577
|
|
|
514
578
|
get requiredFields() {
|
|
515
579
|
const [langCode, countryCode] = this.locale.split('-');
|
|
516
|
-
return getRequiredFields(
|
|
580
|
+
return getRequiredFields(
|
|
581
|
+
langCode,
|
|
582
|
+
countryCode,
|
|
583
|
+
this._showCompactAddressLookup
|
|
584
|
+
);
|
|
517
585
|
}
|
|
518
586
|
|
|
519
587
|
get fieldsMeta() {
|
|
@@ -554,6 +622,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
554
622
|
isInput: type === FIELD_TYPE.INPUT,
|
|
555
623
|
isPicklist: type === FIELD_TYPE.PICKLIST,
|
|
556
624
|
isTextArea: type === FIELD_TYPE.TEXTAREA,
|
|
625
|
+
isLookupAddress: type === FIELD_TYPE.LOOKUP_ADDRESS,
|
|
557
626
|
value: value,
|
|
558
627
|
options: this.getFieldOptions(name),
|
|
559
628
|
required: this.required && !!required,
|
|
@@ -586,6 +655,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
586
655
|
const address = evt.detail.address || {};
|
|
587
656
|
|
|
588
657
|
this.street = address.street || '';
|
|
658
|
+
this.subpremise = address.subpremise || '';
|
|
589
659
|
this.city = address.city || '';
|
|
590
660
|
this.province = address.state || '';
|
|
591
661
|
|
|
@@ -636,6 +706,7 @@ export default class LightningInputAddress extends LightningShadowBaseClass {
|
|
|
636
706
|
bubbles: true,
|
|
637
707
|
detail: {
|
|
638
708
|
street: this.street,
|
|
709
|
+
subpremise: this.subpremise,
|
|
639
710
|
city: this.city,
|
|
640
711
|
province: this.province,
|
|
641
712
|
country: this.country,
|