lightning-base-components 1.16.3-alpha → 1.16.5-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/README.md +7 -0
- package/metadata/raptor.json +110 -0
- package/package.json +59 -2
- package/scopedImports/@salesforce-label-LightningForm.cancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.closeError.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.edit.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.editErrorHelp.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.error.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.errorPopoverHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.preview.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.previewHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.reload.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.save.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.saveFieldErrorSummary.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.undo.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.messageWhenMissingInformation.js +1 -0
- package/src/lightning/button/__docs__/button.md +13 -0
- package/src/lightning/button/button.slds.css +155 -11
- package/src/lightning/buttonGroup/button-group.slds.css +35 -59
- package/src/lightning/buttonIcon/button-icon.slds.css +287 -122
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +224 -39
- package/src/lightning/buttonStateful/button-stateful.slds.css +3269 -0
- package/src/lightning/card/card.slds.css +50 -0
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +180 -364
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +46 -413
- package/src/lightning/datatable/datatable.js +2 -2
- package/src/lightning/datatable/rowSelection.js +21 -4
- package/src/lightning/datetimepicker/datetimepicker.html +1 -3
- package/src/lightning/datetimepicker/datetimepicker.js +5 -0
- package/src/lightning/fileDownload/__docs__/fileDownload.md +41 -0
- package/src/lightning/helptext/help-text.slds.css +184 -39
- package/src/lightning/icon/icon.slds.css +823 -3
- package/src/lightning/input/input-checkbox.slds.css +291 -32
- package/src/lightning/input/input-text.slds.css +70 -7
- package/src/lightning/inputAddress/__docs__/inputAddress.md +1 -1
- package/src/lightning/inputAddress/inputAddress.js +2 -1
- package/src/lightning/internationalizationLibrary/datetime/intlFormat.js +20 -2
- package/src/lightning/iso8601Utils/iso8601Utils.js +2 -3
- package/src/lightning/mediaUtils/__docs__/mediaUtils.md +87 -0
- package/src/lightning/mediaUtils/mediaUtils.js +321 -0
- package/src/lightning/mediaUtils/mediaUtils.js-meta.xml +6 -0
- package/src/lightning/modal/__docs__/migration.md +158 -0
- package/src/lightning/modal/__docs__/modal.md +414 -0
- package/src/lightning/modal/__examples__disabled/all/all.css +7 -0
- package/src/lightning/modal/__examples__disabled/all/all.html +9 -0
- package/src/lightning/modal/__examples__disabled/all/all.js +25 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.css +7 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.html +9 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.js +49 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.html +24 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.js +12 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.html +9 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.js +27 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.html +15 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.html +26 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.css +3 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.html +146 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.js +240 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.html +17 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.js +11 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.html +20 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.js +12 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.css +7 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.html +9 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.js +19 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.css +7 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.html +9 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.js +27 -0
- package/src/lightning/modal/modal.html +3 -0
- package/src/lightning/modal/modal.js +93 -0
- package/src/lightning/modal/modal.js-meta.xml +6 -0
- package/src/lightning/modalBody/__docs__/modalBody.md +61 -0
- package/src/lightning/modalBody/modalBody.html +13 -0
- package/src/lightning/modalBody/modalBody.js +203 -0
- package/src/lightning/modalBody/modalBody.js-meta.xml +6 -0
- package/src/lightning/modalFooter/__docs__/modalFooter.md +72 -0
- package/src/lightning/modalFooter/modalFooter.html +8 -0
- package/src/lightning/modalFooter/modalFooter.js +161 -0
- package/src/lightning/modalFooter/modalFooter.js-meta.xml +6 -0
- package/src/lightning/modalHeader/__docs__/modalHeader.md +64 -0
- package/src/lightning/modalHeader/modalHeader.html +16 -0
- package/src/lightning/modalHeader/modalHeader.js +204 -0
- package/src/lightning/modalHeader/modalHeader.js-meta.xml +6 -0
- package/src/lightning/primitiveBubble/tooltip.slds.css +45 -1
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -12
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +2994 -319
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +14 -11
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +1 -0
- package/src/lightning/primitiveIcon/icon.slds.css +823 -3
- package/src/lightning/progressStep/base.html +1 -0
- package/src/lightning/progressStep/path.html +1 -1
- package/src/lightning/radioGroup/input-radio-group.slds.css +168 -379
- package/src/lightning/spinner/spinner.slds.css +8 -2
- package/src/lightning/timepicker/timepicker.html +1 -4
- package/src/lightning/timepicker/timepicker.js +9 -5
- package/src/lightning/treeGrid/treeGrid.js +66 -1
- package/src/lightning/utilsPrivate/linkUtils.js +1 -1
- package/src/lightning/formattedAddress/__component__/formattedAddress.spec.js +0 -61
- package/src/lightning/formattedAddress/__component__/formattedAddressDisabled.spec.js +0 -20
- package/src/lightning/formattedAddress/__component__/x/basic/basic.html +0 -10
- package/src/lightning/formattedAddress/__component__/x/basic/basic.js +0 -17
- package/src/lightning/input/__component__/inputCheckbox.spec.js +0 -60
- package/src/lightning/input/__component__/inputDateTimePicker.spec.js +0 -60
- package/src/lightning/input/__component__/inputNumber.spec.js +0 -75
- package/src/lightning/input/__component__/inputSelection.spec.js +0 -83
- package/src/lightning/input/__component__/x/tall/tall.css +0 -5
- package/src/lightning/input/__component__/x/tall/tall.html +0 -5
- package/src/lightning/input/__component__/x/tall/tall.js +0 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningModal from 'lightning/modal';
|
|
3
|
+
|
|
4
|
+
export default class ModalDemoAll extends LightningModal {
|
|
5
|
+
@api header = 'Select an Option';
|
|
6
|
+
@api body = 'Select an option:';
|
|
7
|
+
@api options = [];
|
|
8
|
+
|
|
9
|
+
handleOptionClick(e) {
|
|
10
|
+
const { target } = e;
|
|
11
|
+
this.close(parseInt(target.dataset.id, 10));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lightning-modal-header label={heading}>
|
|
3
|
+
<p>Update your contact information by completing the form below.</p>
|
|
4
|
+
</lightning-modal-header>
|
|
5
|
+
<lightning-modal-body><div id="all-body">
|
|
6
|
+
<div class="slds-form slds-form_stacked" role="list">
|
|
7
|
+
<div class="slds-form__row">
|
|
8
|
+
<div class="slds-form__item" role="listitem">
|
|
9
|
+
<lightning-input onchange={handleTextInput} type="text" name="assignedTo" label="Assigned To" required></lightning-input>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="slds-form__item" role="listitem">
|
|
12
|
+
<lightning-input onchange={handleTextInput} type="text" name="teamName" label="Team Name" required></lightning-input>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="slds-form__row">
|
|
16
|
+
<div class="slds-form__item" role="listitem">
|
|
17
|
+
<lightning-input type="toggle" label="Security Assessment Required?" name="input3" checked disabled></lightning-input>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="slds-form__item" role="listitem">
|
|
20
|
+
<lightning-combobox
|
|
21
|
+
name="progress"
|
|
22
|
+
label="Status"
|
|
23
|
+
value={statusValue}
|
|
24
|
+
placeholder="Select Progress"
|
|
25
|
+
options={statusOptions}
|
|
26
|
+
onchange={handleChangeStatus}
|
|
27
|
+
></lightning-combobox>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="slds-form__row">
|
|
31
|
+
<div class="slds-form__item" role="listitem">
|
|
32
|
+
<lightning-input onchange={handleTextInput} type="text" name="personalSettings" label="Personalization Settings"></lightning-input>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="slds-form__item" role="listitem">
|
|
35
|
+
<lightning-input onchange={handleTextInput} type="number" name="slaSerialNum" label="SLA Serial Number"></lightning-input>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="slds-form__row">
|
|
39
|
+
<div class="slds-form__item" role="listitem">
|
|
40
|
+
<lightning-input onchange={handleDateInput} type="date" name="slaExpireDate" label="SLA Expiration Date" ></lightning-input>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="slds-form__item" role="listitem">
|
|
43
|
+
<lightning-input onchange={handleTimeInput} type="time" name="slaExpireTime" label="SLA Expiration Time" ></lightning-input>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="slds-form__row">
|
|
47
|
+
<div class="slds-form__item" role="listitem">
|
|
48
|
+
<lightning-input onchange={handleTextInput} type="text" name="location" label="Location"></lightning-input>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="slds-form__item" role="listitem">
|
|
51
|
+
<lightning-input onchange={handleTextInput} type="text" name="selectedLangs" label="Selected Languages"></lightning-input>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="slds-form__row">
|
|
55
|
+
<div class="slds-form__item" role="listitem">
|
|
56
|
+
<lightning-input-address
|
|
57
|
+
address-label="Billing Address"
|
|
58
|
+
street-label="Street"
|
|
59
|
+
city-label="City"
|
|
60
|
+
country-label="Country"
|
|
61
|
+
province-label="Province"
|
|
62
|
+
postal-code-label="PostalCode"
|
|
63
|
+
street={addressBilling.street}
|
|
64
|
+
city={addressBilling.city}
|
|
65
|
+
country={addressBilling.country}
|
|
66
|
+
province={addressBilling.province}
|
|
67
|
+
postal-code={addressBilling.postalCode}
|
|
68
|
+
country-options={getCountryOptsBilling}
|
|
69
|
+
province-options={getProvinceOptsBilling}
|
|
70
|
+
onchange={handleChangeBilling}
|
|
71
|
+
field-level-help="Enter your billing address. Where your credit card statements are sent."
|
|
72
|
+
></lightning-input-address>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="slds-form__item" role="listitem">
|
|
75
|
+
<lightning-input-address
|
|
76
|
+
address-label="Shipping Address"
|
|
77
|
+
street-label="Street"
|
|
78
|
+
city-label="City"
|
|
79
|
+
country-label="Country"
|
|
80
|
+
province-label="Province"
|
|
81
|
+
postal-code-label="PostalCode"
|
|
82
|
+
street={addressShipping.street}
|
|
83
|
+
city={addressShipping.city}
|
|
84
|
+
country={addressShipping.country}
|
|
85
|
+
province={addressShipping.province}
|
|
86
|
+
postal-code={addressShipping.postalCode}
|
|
87
|
+
field-level-help="Enter your shipping address. Where you receive packages."
|
|
88
|
+
country-options={getCountryOptsShipping}
|
|
89
|
+
province-options={getProvinceOptsShipping}
|
|
90
|
+
onchange={handleChangeShipping}
|
|
91
|
+
></lightning-input-address>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div></lightning-modal-body>
|
|
96
|
+
<lightning-modal-footer><div id="all-footer">
|
|
97
|
+
<template for:each={options} for:item="option">
|
|
98
|
+
<template if:true={option.triggerCancel}>
|
|
99
|
+
<lightning-button
|
|
100
|
+
key={option.id}
|
|
101
|
+
label={option.label}
|
|
102
|
+
class="slds-button"
|
|
103
|
+
data-focus={option.focusName}
|
|
104
|
+
variant={option.variant}
|
|
105
|
+
onclick={handleButtonCancel}
|
|
106
|
+
data-id={option.id}
|
|
107
|
+
disabled={disableClose}
|
|
108
|
+
></lightning-button>
|
|
109
|
+
</template>
|
|
110
|
+
<template if:true={option.triggerSecondModal}>
|
|
111
|
+
<lightning-button
|
|
112
|
+
key={option.id}
|
|
113
|
+
label={option.label}
|
|
114
|
+
class="slds-button"
|
|
115
|
+
data-focus={option.focusName}
|
|
116
|
+
variant={option.variant}
|
|
117
|
+
onclick={handleButtonOpenSecondModal}
|
|
118
|
+
data-id={option.id}
|
|
119
|
+
></lightning-button>
|
|
120
|
+
</template>
|
|
121
|
+
<template if:true={option.toggleDisableClose}>
|
|
122
|
+
<lightning-button
|
|
123
|
+
key={option.id}
|
|
124
|
+
label={computedDisableCloseLabel}
|
|
125
|
+
class="slds-button"
|
|
126
|
+
data-focus={option.focusName}
|
|
127
|
+
variant={option.variant}
|
|
128
|
+
onclick={handleButtonToggleDisableButton}
|
|
129
|
+
data-id={option.id}
|
|
130
|
+
></lightning-button>
|
|
131
|
+
</template>
|
|
132
|
+
<template if:true={option.triggerSubmit}>
|
|
133
|
+
<lightning-button
|
|
134
|
+
key={option.id}
|
|
135
|
+
label={option.label}
|
|
136
|
+
class="slds-button"
|
|
137
|
+
data-focus={option.focusName}
|
|
138
|
+
variant={option.variant}
|
|
139
|
+
onclick={handleButtonSubmit}
|
|
140
|
+
data-id={option.id}
|
|
141
|
+
disabled={disableClose}
|
|
142
|
+
></lightning-button>
|
|
143
|
+
</template>
|
|
144
|
+
</template>
|
|
145
|
+
</div></lightning-modal-footer>
|
|
146
|
+
</template>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningModal from 'lightning/modal';
|
|
3
|
+
import ModalAllMulti from 'modal/allmulti';
|
|
4
|
+
|
|
5
|
+
// this form is loosely based on SLDS form blueprint, Stacked Alignment
|
|
6
|
+
// https://www.lightningdesignsystem.com/components/form-element/#Stacked-Alignment
|
|
7
|
+
|
|
8
|
+
export default class ModalForm extends LightningModal {
|
|
9
|
+
@api heading = '';
|
|
10
|
+
@api options = [];
|
|
11
|
+
|
|
12
|
+
buttonOptions = [
|
|
13
|
+
{
|
|
14
|
+
id: 1,
|
|
15
|
+
variant: 'neutral',
|
|
16
|
+
label: 'Close This Modal',
|
|
17
|
+
focusName: 'focus-footer-button-01',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// toggle disable close button state
|
|
22
|
+
toggleCloseButtonLabel = {
|
|
23
|
+
label: 'Disable Close Button',
|
|
24
|
+
labelToggle: 'Enable Close Button',
|
|
25
|
+
};
|
|
26
|
+
computedDisableCloseLabel = this.toggleCloseButtonLabel.label;
|
|
27
|
+
|
|
28
|
+
// form fields
|
|
29
|
+
assignedTo = null;
|
|
30
|
+
teamName = null;
|
|
31
|
+
securityAssessReq = true;
|
|
32
|
+
statusValue = 'inProgress';
|
|
33
|
+
personalSettings = null;
|
|
34
|
+
slaSerialNum = null;
|
|
35
|
+
slaExpireDate = null;
|
|
36
|
+
slaExpireTime = null;
|
|
37
|
+
location = null;
|
|
38
|
+
selectedLangs = null;
|
|
39
|
+
|
|
40
|
+
addressBilling = {
|
|
41
|
+
street: '',
|
|
42
|
+
city: '',
|
|
43
|
+
province: '',
|
|
44
|
+
postalCode: '',
|
|
45
|
+
country: 'US',
|
|
46
|
+
};
|
|
47
|
+
addressShipping = {
|
|
48
|
+
street: '',
|
|
49
|
+
city: '',
|
|
50
|
+
province: '',
|
|
51
|
+
postalCode: '',
|
|
52
|
+
country: 'US',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
openSecondModal() {
|
|
56
|
+
ModalAllMulti.open({
|
|
57
|
+
size: 'small',
|
|
58
|
+
heading: 'Second Modal w/ higher z-index',
|
|
59
|
+
description: 'A description of the second modal',
|
|
60
|
+
// ModalDemo
|
|
61
|
+
options: this.buttonOptions,
|
|
62
|
+
}).then((result) => {
|
|
63
|
+
if (result === null) {
|
|
64
|
+
this.demoResult = { action: 'dismissed' };
|
|
65
|
+
} else {
|
|
66
|
+
this.demoResult = result;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
handleButtonOpenSecondModal() {
|
|
72
|
+
this.openSecondModal();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
handleButtonToggleDisableButton() {
|
|
76
|
+
const newDisableCloseValue = !this.disableClose;
|
|
77
|
+
this.disableClose = newDisableCloseValue;
|
|
78
|
+
this.computedDisableCloseLabel = newDisableCloseValue
|
|
79
|
+
? this.toggleCloseButtonLabel.labelToggle
|
|
80
|
+
: this.toggleCloseButtonLabel.label;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// handle events in the form
|
|
84
|
+
handleButtonSubmit() {
|
|
85
|
+
const data = this.compileData();
|
|
86
|
+
const dataAsString = JSON.stringify(data);
|
|
87
|
+
this.close(dataAsString);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handleButtonCancel() {
|
|
91
|
+
this.close({ action: 'cancel' });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
handleTextInput(event) {
|
|
95
|
+
const { detail, target } = event;
|
|
96
|
+
const inputElem = target.shadowRoot.querySelector('input');
|
|
97
|
+
const inputName = inputElem.getAttribute('name');
|
|
98
|
+
if (inputName) {
|
|
99
|
+
this[inputName] = detail.value || '';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
handleDateInput(event) {
|
|
104
|
+
const { detail, target } = event;
|
|
105
|
+
const pickerElem = target.shadowRoot.querySelector(
|
|
106
|
+
'lightning-datepicker'
|
|
107
|
+
);
|
|
108
|
+
const inputElem = pickerElem.shadowRoot.querySelector('input');
|
|
109
|
+
const inputName = inputElem.getAttribute('name');
|
|
110
|
+
if (inputName) {
|
|
111
|
+
this[inputName] = detail.value || '';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
handleTimeInput(event) {
|
|
116
|
+
const { detail, target } = event;
|
|
117
|
+
const pickerElem = target.shadowRoot.querySelector(
|
|
118
|
+
'lightning-timepicker'
|
|
119
|
+
);
|
|
120
|
+
const comboBoxElem = pickerElem.shadowRoot.querySelector(
|
|
121
|
+
'lightning-base-combobox'
|
|
122
|
+
);
|
|
123
|
+
const inputElem = comboBoxElem.shadowRoot.querySelector('input');
|
|
124
|
+
const inputName = inputElem.getAttribute('name');
|
|
125
|
+
if (inputName) {
|
|
126
|
+
this[inputName] = detail.value || '';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
handleChangeStatus(event) {
|
|
131
|
+
this.statusValue = event.detail.value;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
handleChangeBilling(event) {
|
|
135
|
+
const { street, city, province, country, postalCode } = event.detail;
|
|
136
|
+
this.addressBilling = { street, city, province, country, postalCode };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
handleChangeShipping(event) {
|
|
140
|
+
const { street, city, province, country, postalCode } = event.detail;
|
|
141
|
+
this.addressShipping = { street, city, province, country, postalCode };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get statusOptions() {
|
|
145
|
+
return [
|
|
146
|
+
{ label: 'New', value: 'new' },
|
|
147
|
+
{ label: 'In Progress', value: 'inProgress' },
|
|
148
|
+
{ label: 'Finished', value: 'finished' },
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// these are by no means intended to be complete country or province lists
|
|
153
|
+
// only enough values to provide some examples to choose from
|
|
154
|
+
countryProvinceMap = {
|
|
155
|
+
US: [
|
|
156
|
+
{ label: 'California', value: 'CA' },
|
|
157
|
+
{ label: 'Texas', value: 'TX' },
|
|
158
|
+
{ label: 'Washington', value: 'WA' },
|
|
159
|
+
],
|
|
160
|
+
CN: [
|
|
161
|
+
{ label: 'GuangDong', value: 'GD' },
|
|
162
|
+
{ label: 'GuangXi', value: 'GX' },
|
|
163
|
+
{ label: 'Sichuan', value: 'SC' },
|
|
164
|
+
],
|
|
165
|
+
CA: [
|
|
166
|
+
{ label: 'Alberta', value: 'AB' },
|
|
167
|
+
{ label: 'British Columbia', value: 'BC' },
|
|
168
|
+
{ label: 'Manitoba', value: 'MB' },
|
|
169
|
+
{ label: 'New Brunswick', value: 'NB' },
|
|
170
|
+
{ label: 'Newfoundland and Labrador', value: 'NL' },
|
|
171
|
+
{ label: 'Nova Scotia', value: 'NS' },
|
|
172
|
+
{ label: 'Ontario', value: 'ON' },
|
|
173
|
+
{ label: 'Prince Edward Island', value: 'PE' },
|
|
174
|
+
{ label: 'Quebec', value: 'QC' },
|
|
175
|
+
{ label: 'Saskatchewan', value: 'SK' },
|
|
176
|
+
],
|
|
177
|
+
SP: [
|
|
178
|
+
{ label: 'Ávila', value: 'AV' },
|
|
179
|
+
{ label: 'Burgos', value: 'BU' },
|
|
180
|
+
{ label: 'Cantabria', value: 'S' },
|
|
181
|
+
{ label: 'Goiás', value: 'GO' },
|
|
182
|
+
{ label: 'Paraíba', value: 'PB' },
|
|
183
|
+
{ label: 'Tyrol', value: 'TIR' },
|
|
184
|
+
],
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
countryOptions = [
|
|
188
|
+
{ label: 'United States', value: 'US' },
|
|
189
|
+
{ label: 'China', value: 'CN' },
|
|
190
|
+
{ label: 'Canada', value: 'CA' },
|
|
191
|
+
{ label: 'Spain', value: 'SP' },
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
get getProvinceOptsBilling() {
|
|
195
|
+
return this.countryProvinceMap[this.addressBilling.country];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
get getProvinceOptsShipping() {
|
|
199
|
+
return this.countryProvinceMap[this.addressShipping.country];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
get getCountryOptsBilling() {
|
|
203
|
+
return this.countryOptions;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
get getCountryOptsShipping() {
|
|
207
|
+
return this.countryOptions;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
compileData() {
|
|
211
|
+
const {
|
|
212
|
+
addressShipping,
|
|
213
|
+
addressBilling,
|
|
214
|
+
statusValue,
|
|
215
|
+
assignedTo,
|
|
216
|
+
teamName,
|
|
217
|
+
securityAssessReq,
|
|
218
|
+
personalSettings,
|
|
219
|
+
slaSerialNum,
|
|
220
|
+
slaExpireDate,
|
|
221
|
+
slaExpireTime,
|
|
222
|
+
location,
|
|
223
|
+
selectedLangs,
|
|
224
|
+
} = this;
|
|
225
|
+
return {
|
|
226
|
+
addressShipping,
|
|
227
|
+
addressBilling,
|
|
228
|
+
statusValue,
|
|
229
|
+
assignedTo,
|
|
230
|
+
teamName,
|
|
231
|
+
securityAssessReq,
|
|
232
|
+
personalSettings,
|
|
233
|
+
slaSerialNum,
|
|
234
|
+
slaExpireDate,
|
|
235
|
+
slaExpireTime,
|
|
236
|
+
location,
|
|
237
|
+
selectedLangs,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lightning-modal-header label={header}>
|
|
3
|
+
Here’s a tagline if you need it. It is allowed to extend across
|
|
4
|
+
mulitple lines, so I’m making up content to show that to you.
|
|
5
|
+
It is allowed to have links but this one doesn't have any links.
|
|
6
|
+
</lightning-modal-header>
|
|
7
|
+
<lightning-modal-body>
|
|
8
|
+
<p>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis
|
|
9
|
+
aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing.</p>
|
|
10
|
+
<p>Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Link to <a href="https://salesforce.com" target="_blank">Salesforce.com</a>. Eiusmod et adipisicing culpa deserunt nostrud
|
|
11
|
+
ad veniam nulla aute est. Link to <a href="https://salesforce.com" target="_blank">Salesforce.com</a> Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
|
|
12
|
+
<p>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis
|
|
13
|
+
aute consequat ipsum magna exercitation reprehenderit magna. Link to <a href="https://salesforce.com" target="_blank">Salesforce.com</a>. Tempor cupidatat consequat elit dolor adipisicing.</p>
|
|
14
|
+
<p>Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt nostrud
|
|
15
|
+
ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
|
|
16
|
+
</lightning-modal-body>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningModal from 'lightning/modal';
|
|
3
|
+
|
|
4
|
+
export default class ModalDemoFootless extends LightningModal {
|
|
5
|
+
@api header = 'Modal Demo Without Footer';
|
|
6
|
+
|
|
7
|
+
handleOptionClick(e) {
|
|
8
|
+
const { target } = e;
|
|
9
|
+
this.close(parseInt(target.dataset.id, 10));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lightning-modal-body>
|
|
3
|
+
<p>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis
|
|
4
|
+
aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing.</p>
|
|
5
|
+
<p>Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt nostrud
|
|
6
|
+
ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
|
|
7
|
+
</lightning-modal-body>
|
|
8
|
+
<lightning-modal-footer>
|
|
9
|
+
<template for:each={options} for:item="option">
|
|
10
|
+
<lightning-button
|
|
11
|
+
key={option.id}
|
|
12
|
+
label={option.label}
|
|
13
|
+
class="slds-button"
|
|
14
|
+
variant={option.variant}
|
|
15
|
+
onclick={handleOptionClick}
|
|
16
|
+
data-id={option.id}
|
|
17
|
+
></lightning-button>
|
|
18
|
+
</template>
|
|
19
|
+
</lightning-modal-footer>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningModal from 'lightning/modal';
|
|
3
|
+
|
|
4
|
+
export default class ModalDemoHeadless extends LightningModal {
|
|
5
|
+
@api body = 'Select an option:';
|
|
6
|
+
@api options = [];
|
|
7
|
+
|
|
8
|
+
handleOptionClick(e) {
|
|
9
|
+
const { target } = e;
|
|
10
|
+
this.close(parseInt(target.dataset.id, 10));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LightningElement } from 'lwc';
|
|
2
|
+
import ModalDemoFootless from 'modal/demofootless';
|
|
3
|
+
|
|
4
|
+
export default class ModalFootless extends LightningElement {
|
|
5
|
+
demoResult = 'unset';
|
|
6
|
+
|
|
7
|
+
handleDemoModal() {
|
|
8
|
+
ModalDemoFootless.open({
|
|
9
|
+
// LightningModal
|
|
10
|
+
size: 'small',
|
|
11
|
+
}).then((result) => {
|
|
12
|
+
if (result === null) {
|
|
13
|
+
this.demoResult = 'dismiss';
|
|
14
|
+
} else {
|
|
15
|
+
this.demoResult = result;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LightningElement } from 'lwc';
|
|
2
|
+
import ModalDemoHeadless from 'modal/demoheadless';
|
|
3
|
+
|
|
4
|
+
export default class ModalAllChildren extends LightningElement {
|
|
5
|
+
demoResult = 'unset';
|
|
6
|
+
|
|
7
|
+
handleDemoModal() {
|
|
8
|
+
ModalDemoHeadless.open({
|
|
9
|
+
// LightningModal
|
|
10
|
+
size: 'small',
|
|
11
|
+
label: 'Modal Header',
|
|
12
|
+
// ModalDemo
|
|
13
|
+
body: 'Select an option:',
|
|
14
|
+
options: [
|
|
15
|
+
{ id: 1, variant: 'neutral', label: 'Option 1' },
|
|
16
|
+
{ id: 2, variant: 'neutral', label: 'Option 2' },
|
|
17
|
+
{ id: 3, variant: 'brand', label: 'Main Option' },
|
|
18
|
+
],
|
|
19
|
+
}).then((result) => {
|
|
20
|
+
if (result === null) {
|
|
21
|
+
this.demoResult = 'dismiss';
|
|
22
|
+
} else {
|
|
23
|
+
this.demoResult = result;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { api } from 'lwc';
|
|
2
|
+
import LightningOverlay from 'lightning/overlay';
|
|
3
|
+
import { parent, instanceName, secure } from 'lightning/overlayUtils';
|
|
4
|
+
import LightningModalBase from 'lightning/modalBase';
|
|
5
|
+
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Extend this component to create a message modal overlayed on the current app window.
|
|
9
|
+
*/
|
|
10
|
+
export default class LightningModal extends LightningOverlay {
|
|
11
|
+
static [parent] = LightningModalBase;
|
|
12
|
+
static [instanceName] = 'lightning-modal';
|
|
13
|
+
|
|
14
|
+
// private tracked state
|
|
15
|
+
_disableClose = false;
|
|
16
|
+
|
|
17
|
+
// public api
|
|
18
|
+
/**
|
|
19
|
+
* How much of the viewport width the modal uses. Supported values are small, medium, or large.
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @default medium
|
|
22
|
+
*/
|
|
23
|
+
@api size = 'medium';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sets the modal's title and assistive device label.
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @required true
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
@api label = '';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sets the modal's accessible description.
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
@api description = '';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Prevents closing the modal by normal means like the ESC key, the close button, or `.close()`.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
@api
|
|
46
|
+
get disableClose() {
|
|
47
|
+
return this._disableClose;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set disableClose(value) {
|
|
51
|
+
const currentDisableClose = this._disableClose;
|
|
52
|
+
this._disableClose = normalizeBoolean(value);
|
|
53
|
+
// if there is a change, dispatch private event for modalBase
|
|
54
|
+
if (currentDisableClose !== this._disableClose) {
|
|
55
|
+
this.dispatchEvent(
|
|
56
|
+
new CustomEvent('privatedisableclosebutton', {
|
|
57
|
+
detail: {
|
|
58
|
+
disableClose: this._disableClose,
|
|
59
|
+
[secure]: true,
|
|
60
|
+
},
|
|
61
|
+
bubbles: true,
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@api
|
|
68
|
+
close(result) {
|
|
69
|
+
// Prevent close() private event until disableClose removed
|
|
70
|
+
if (!this.disableClose) {
|
|
71
|
+
const promise = new Promise((resolve) => {
|
|
72
|
+
this.dispatchEvent(
|
|
73
|
+
new CustomEvent('privateclose', {
|
|
74
|
+
detail: {
|
|
75
|
+
resolve,
|
|
76
|
+
[secure]: true,
|
|
77
|
+
},
|
|
78
|
+
bubbles: true,
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
super.close(result, promise);
|
|
83
|
+
} else {
|
|
84
|
+
// Intentionally console error when devs have not disabled elements
|
|
85
|
+
// when disableClose has been set true
|
|
86
|
+
let errorMsg =
|
|
87
|
+
'LightningModal - Any interactions (buttons, processes, etc) that call modal.close() should be ';
|
|
88
|
+
errorMsg += '(a) disabled, while disableClose api set true, and ';
|
|
89
|
+
errorMsg += '(b) re-enabled, when disableClose set false';
|
|
90
|
+
console.error(errorMsg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|