lightning-base-components 1.20.2-alpha → 1.21.1-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 +1 -0
- package/package.json +10 -1
- package/scopedImports/@salesforce-label-LightningCombobox.currentSelection.js +1 -1
- package/scopedImports/@salesforce-label-LightningDualListbox.moveToAssistiveText.js +1 -0
- package/scopedImports/@salesforce-label-LightningDualListbox.verticallyMovedOptions.js +1 -0
- package/src/lightning/ariaObserver/ariaObserver.js-meta.xml +4 -0
- package/src/lightning/baseCombobox/baseCombobox.js +3 -2
- package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.html +11 -0
- package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.js +158 -0
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +6 -0
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +28 -0
- package/src/lightning/datatable/__examples__/customDatatypeLink/customDatatypeLink.html +9 -0
- package/src/lightning/datatable/__examples__/customDatatypeLink/customDatatypeLink.js +15 -0
- package/src/lightning/datatable/__examples__/customDatatypeNumber/customDatatypeNumber.html +10 -0
- package/src/lightning/datatable/__examples__/customDatatypeNumber/customDatatypeNumber.js +21 -0
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +10 -0
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +40 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/customDatatypeTable.js +38 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/customLink.html +9 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/customName.html +4 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumber.html +3 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumberEdit.html +10 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/deleteRow.html +8 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/iconPill.html +17 -0
- package/src/lightning/datatable/__examples__/customDatatypeTable/orderingButtons.html +10 -0
- package/src/lightning/datatable/__examples__/withAllColumnTypes/generateData.js +23 -0
- package/src/lightning/datatable/__examples__/withAllColumnTypes/withAllColumnTypes.html +11 -0
- package/src/lightning/datatable/__examples__/withAllColumnTypes/withAllColumnTypes.js +71 -0
- package/src/lightning/datatable/__examples__/withColResizing/generateData.js +14 -0
- package/src/lightning/datatable/__examples__/withColResizing/withColResizing.html +47 -0
- package/src/lightning/datatable/__examples__/withColResizing/withColResizing.js +42 -0
- package/src/lightning/datatable/__examples__/withErrors/generateData.js +14 -0
- package/src/lightning/datatable/__examples__/withErrors/withErrors.html +13 -0
- package/src/lightning/datatable/__examples__/withErrors/withErrors.js +44 -0
- package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.html +2 -1
- package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.js +1 -0
- package/src/lightning/datatable/__examples__/withInlineEdit/withInlineEdit.html +1 -0
- package/src/lightning/datatable/__examples__/withInlineEdit/withInlineEdit.js +1 -0
- package/src/lightning/datatable/__examples__/withRowSelection/generateData.js +14 -0
- package/src/lightning/datatable/__examples__/withRowSelection/withRowSelection.html +21 -0
- package/src/lightning/datatable/__examples__/withRowSelection/withRowSelection.js +34 -0
- package/src/lightning/datatable/__examples__/withTextWrapping/generateData.js +16 -0
- package/src/lightning/datatable/__examples__/withTextWrapping/withTextWrapping.html +14 -0
- package/src/lightning/datatable/__examples__/withTextWrapping/withTextWrapping.js +31 -0
- package/src/lightning/datatable/__examples__/withVirtualization/generateData.js +14 -0
- package/src/lightning/datatable/__examples__/withVirtualization/withVirtualization.html +12 -0
- package/src/lightning/datatable/__examples__/withVirtualization/withVirtualization.js +27 -0
- package/src/lightning/datatable/__examples__/withoutTableHeader/generateData.js +14 -0
- package/src/lightning/datatable/__examples__/withoutTableHeader/withoutTableHeader.html +10 -0
- package/src/lightning/datatable/__examples__/withoutTableHeader/withoutTableHeader.js +22 -0
- package/src/lightning/dualListbox/dualListbox.html +2 -2
- package/src/lightning/dualListbox/dualListbox.js +56 -2
- package/src/lightning/menuDivider/menuDivider.js +1 -0
- package/src/lightning/pill/__docs__/pill.md +6 -2
- package/src/lightning/pillContainer/__docs__/pillContainer.md +16 -8
package/metadata/raptor.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightning-base-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1-alpha",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"external",
|
|
@@ -454,6 +454,14 @@
|
|
|
454
454
|
"name": "@salesforce/label/LightningDualListbox.movedOptionsPlural",
|
|
455
455
|
"path": "scopedImports/@salesforce-label-LightningDualListbox.movedOptionsPlural.js"
|
|
456
456
|
},
|
|
457
|
+
{
|
|
458
|
+
"name": "@salesforce/label/LightningDualListbox.verticallyMovedOptions",
|
|
459
|
+
"path": "scopedImports/@salesforce-label-LightningDualListbox.verticallyMovedOptions.js"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"name": "@salesforce/label/LightningDualListbox.moveToAssistiveText",
|
|
463
|
+
"path": "scopedImports/@salesforce-label-LightningDualListbox.moveToAssistiveText.js"
|
|
464
|
+
},
|
|
457
465
|
{
|
|
458
466
|
"name": "@salesforce/label/LightningProgressIndicator.stageComplete",
|
|
459
467
|
"path": "scopedImports/@salesforce-label-LightningProgressIndicator.stageComplete.js"
|
|
@@ -1372,6 +1380,7 @@
|
|
|
1372
1380
|
"lightning/accordion",
|
|
1373
1381
|
"lightning/accordionSection",
|
|
1374
1382
|
"lightning/alert",
|
|
1383
|
+
"lightning/ariaObserver",
|
|
1375
1384
|
"lightning/avatar",
|
|
1376
1385
|
"lightning/badge",
|
|
1377
1386
|
"lightning/barcodeScanner",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default 'Current
|
|
1
|
+
export default '{0} - Current selection: {1}';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'Move to {0}';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default '{0} moved to position {1}';
|
|
@@ -3,10 +3,11 @@ import labelDeselectOptionKeyboard from '@salesforce/label/LightningCombobox.des
|
|
|
3
3
|
import labelLoadingText from '@salesforce/label/LightningCombobox.loadingText';
|
|
4
4
|
import labelPillCloseButtonAlternativeText from '@salesforce/label/LightningCombobox.pillCloseButtonAlternativeText';
|
|
5
5
|
import labelPlaceholder from '@salesforce/label/LightningCombobox.placeholder';
|
|
6
|
+
import labelCurrentSelection from '@salesforce/label/LightningCombobox.currentSelection';
|
|
6
7
|
import { api, track, LightningElement } from 'lwc';
|
|
7
8
|
import { handleKeyDownOnInput } from './keyboard';
|
|
8
9
|
import { BaseComboboxEvents } from './baseComboboxEvents';
|
|
9
|
-
import { classSet } from 'lightning/utils';
|
|
10
|
+
import { classSet, formatLabel } from 'lightning/utils';
|
|
10
11
|
import {
|
|
11
12
|
assert,
|
|
12
13
|
computeAriaInvalid,
|
|
@@ -580,7 +581,7 @@ export default class LightningBaseCombobox extends LightningElement {
|
|
|
580
581
|
return value;
|
|
581
582
|
}
|
|
582
583
|
|
|
583
|
-
return
|
|
584
|
+
return formatLabel(labelCurrentSelection, label, value);
|
|
584
585
|
}
|
|
585
586
|
|
|
586
587
|
handleListboxScroll(event) {
|
package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<datatable-custom-datatype-table
|
|
3
|
+
key-field="id"
|
|
4
|
+
data={data}
|
|
5
|
+
columns={columns}
|
|
6
|
+
onprivatemoverowup={moveRowUp}
|
|
7
|
+
onprivatemoverowdown={moveRowDown}
|
|
8
|
+
onprivatedeleterow={deleteRow}
|
|
9
|
+
hide-checkbox-column>
|
|
10
|
+
</datatable-custom-datatype-table>
|
|
11
|
+
</template>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { LightningElement, track } from 'lwc';
|
|
2
|
+
|
|
3
|
+
// Add <datatable-custom-datatable-wrapper></datatable-custom-datatable-wrapper> to the lwr-playground to see the table
|
|
4
|
+
|
|
5
|
+
const columns = [
|
|
6
|
+
{
|
|
7
|
+
label: 'Reorder',
|
|
8
|
+
type: 'orderingButtons',
|
|
9
|
+
fixedWidth: 90,
|
|
10
|
+
fieldName: 'id',
|
|
11
|
+
typeAttributes: {
|
|
12
|
+
isFirstRow: { fieldName: 'isFirstRow' },
|
|
13
|
+
isLastRow: { fieldName: 'isLastRow' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Account Name',
|
|
18
|
+
type: 'customName',
|
|
19
|
+
typeAttributes: {
|
|
20
|
+
accountName: { fieldName: 'name' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Website',
|
|
25
|
+
fieldName: 'website',
|
|
26
|
+
type: 'customLink',
|
|
27
|
+
typeAttributes: {
|
|
28
|
+
label: { fieldName: 'name' },
|
|
29
|
+
tooltip: { fieldName: 'name' },
|
|
30
|
+
},
|
|
31
|
+
hideDefaultActions: true,
|
|
32
|
+
actions: [
|
|
33
|
+
{ label: 'Action 1', name: 'action1' },
|
|
34
|
+
{ label: 'Action 2', name: 'action2' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Amount',
|
|
39
|
+
type: 'customNumber',
|
|
40
|
+
fieldName: 'amount',
|
|
41
|
+
editable: true,
|
|
42
|
+
typeAttributes: {
|
|
43
|
+
min: 0,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{ label: 'Icon', type: 'iconPill' },
|
|
47
|
+
{
|
|
48
|
+
label: '',
|
|
49
|
+
type: 'deleteRowButton',
|
|
50
|
+
fieldName: 'id',
|
|
51
|
+
fixedWidth: 70,
|
|
52
|
+
typeAttributes: {
|
|
53
|
+
attrA: { fieldName: 'attrA' },
|
|
54
|
+
attrB: { fieldName: 'attrB' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const exampleData = [
|
|
60
|
+
{
|
|
61
|
+
id: 1,
|
|
62
|
+
name: 'Name 1',
|
|
63
|
+
website: 'https://www.google.com',
|
|
64
|
+
amount: 200.0,
|
|
65
|
+
isFirstRow: true,
|
|
66
|
+
isLastRow: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 2,
|
|
70
|
+
name: 'Name 2',
|
|
71
|
+
website: 'https://www.salesforce.com',
|
|
72
|
+
amount: 500000.0,
|
|
73
|
+
isFirstRow: false,
|
|
74
|
+
isLastRow: false,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 3,
|
|
78
|
+
name: 'Name 3',
|
|
79
|
+
website: 'https://www.quora.com',
|
|
80
|
+
amount: 600.0,
|
|
81
|
+
isFirstRow: false,
|
|
82
|
+
isLastRow: true,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
export default class CustomDatatableWrapper extends LightningElement {
|
|
87
|
+
@track data = exampleData;
|
|
88
|
+
@track columns = columns;
|
|
89
|
+
|
|
90
|
+
moveRowUp(event) {
|
|
91
|
+
const { rowId } = event.detail;
|
|
92
|
+
const index = findRowIndex(this.data, rowId);
|
|
93
|
+
if (index > 0) {
|
|
94
|
+
const row = this.data[index];
|
|
95
|
+
const previous = this.data[index - 1];
|
|
96
|
+
this.data = this.data
|
|
97
|
+
.slice(0, index - 1)
|
|
98
|
+
.concat([row, previous])
|
|
99
|
+
.concat(this.data.slice(index + 1));
|
|
100
|
+
if (index - 1 === 0) {
|
|
101
|
+
this.data[0].isFirstRow = true;
|
|
102
|
+
this.data[1].isFirstRow = false;
|
|
103
|
+
} else if (index === this.data.length - 1) {
|
|
104
|
+
this.data[index].isLastRow = true;
|
|
105
|
+
this.data[index - 1].isLastRow = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
moveRowDown(event) {
|
|
111
|
+
const { rowId } = event.detail;
|
|
112
|
+
const index = findRowIndex(this.data, rowId);
|
|
113
|
+
const length = this.data.length;
|
|
114
|
+
if (index < length - 1) {
|
|
115
|
+
const row = this.data[index];
|
|
116
|
+
const next = this.data[index + 1];
|
|
117
|
+
this.data = this.data
|
|
118
|
+
.slice(0, index)
|
|
119
|
+
.concat([next, row])
|
|
120
|
+
.concat(this.data.slice(index + 2));
|
|
121
|
+
if (index === 0) {
|
|
122
|
+
this.data[0].isFirstRow = true;
|
|
123
|
+
this.data[1].isFirstRow = false;
|
|
124
|
+
} else if (index === this.data.length - 2) {
|
|
125
|
+
this.data[index].isLastRow = false;
|
|
126
|
+
this.data[index + 1].isLastRow = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
deleteRow(event) {
|
|
132
|
+
const { rowId } = event.detail;
|
|
133
|
+
const index = findRowIndex(this.data, rowId);
|
|
134
|
+
const length = this.data.length;
|
|
135
|
+
if (index >= 0) {
|
|
136
|
+
this.data = this.data
|
|
137
|
+
.slice(0, index)
|
|
138
|
+
.concat(this.data.slice(index + 1));
|
|
139
|
+
if (index === 0) {
|
|
140
|
+
this.data[0].isFirstRow = true;
|
|
141
|
+
} else if (index === length - 1) {
|
|
142
|
+
this.data[length - 2].isLastRow = true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function findRowIndex(data, rowId) {
|
|
149
|
+
let index = -1;
|
|
150
|
+
data.some((row, i) => {
|
|
151
|
+
if (row.id === rowId) {
|
|
152
|
+
index = i;
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
});
|
|
157
|
+
return index;
|
|
158
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LightningElement, api } from 'lwc';
|
|
2
|
+
import { baseNavigation } from 'lightning/datatableKeyboardMixins';
|
|
3
|
+
import template from './customDatatypeDeleteRowBtn.html';
|
|
4
|
+
|
|
5
|
+
export default class CustomDatatypeDeleteRowBtn extends baseNavigation(
|
|
6
|
+
LightningElement
|
|
7
|
+
) {
|
|
8
|
+
@api rowId;
|
|
9
|
+
@api attrA;
|
|
10
|
+
@api attrB;
|
|
11
|
+
|
|
12
|
+
// Required for mixins
|
|
13
|
+
render() {
|
|
14
|
+
return template;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fireDeleteRow() {
|
|
18
|
+
const event = CustomEvent('privatedeleterow', {
|
|
19
|
+
composed: true,
|
|
20
|
+
bubbles: true,
|
|
21
|
+
cancelable: true,
|
|
22
|
+
detail: {
|
|
23
|
+
rowId: this.rowId,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
this.dispatchEvent(event);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<p><lightning-formatted-url value={url} tooltip="Omit leading slash" label={label} target="_blank"></lightning-formatted-url></p>
|
|
4
|
+
<p><lightning-formatted-url value={url} tooltip="Use full domain name" label={label}
|
|
5
|
+
target="_blank"></lightning-formatted-url></p>
|
|
6
|
+
<p><lightning-formatted-url value={url} tooltip="Use https://domain-name"
|
|
7
|
+
label={label} target="_blank"></lightning-formatted-url></p>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LightningElement, api } from 'lwc';
|
|
2
|
+
import mix from 'lightning/mixinBuilder';
|
|
3
|
+
import { baseNavigation } from 'lightning/datatableKeyboardMixins';
|
|
4
|
+
import template from './customDatatypeLink.html';
|
|
5
|
+
|
|
6
|
+
export default class CustomDatatypeLink extends mix(LightningElement).with(
|
|
7
|
+
baseNavigation
|
|
8
|
+
) {
|
|
9
|
+
@api url;
|
|
10
|
+
@api label;
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
return template;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={computedClass}>
|
|
3
|
+
<lightning-formatted-number format-style="currency" value={value}>
|
|
4
|
+
</lightning-formatted-number>
|
|
5
|
+
<lightning-icon class="slds-p-horizontal_xx-small" icon-name={computedIcon} size="xx-small"
|
|
6
|
+
variant={iconVariant}>
|
|
7
|
+
</lightning-icon>
|
|
8
|
+
({range})
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LightningElement, api } from 'lwc';
|
|
2
|
+
|
|
3
|
+
export default class CustomDatatypeNumber extends LightningElement {
|
|
4
|
+
@api value;
|
|
5
|
+
get range() {
|
|
6
|
+
return this.value > 50000 ? 'High' : 'Low';
|
|
7
|
+
}
|
|
8
|
+
get computedClass() {
|
|
9
|
+
return this.value > 50000
|
|
10
|
+
? 'slds-text-color_success'
|
|
11
|
+
: 'slds-text-color_error';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get computedIcon() {
|
|
15
|
+
return this.value > 50000 ? 'utility:arrowup' : 'utility:arrowdown';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get iconVariant() {
|
|
19
|
+
return this.value > 50000 ? 'success' : 'error';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="text-align: center; padding: 4px;">
|
|
3
|
+
<div class="slds-button-group" role="group">
|
|
4
|
+
<lightning-button-icon icon-name="utility:up" alternative-text="up" title="up" size="x-small"
|
|
5
|
+
onclick={fireMoveRowUp} disabled={isFirstRow}></lightning-button-icon>
|
|
6
|
+
<lightning-button-icon icon-name="utility:down" alternative-text="down" title="down" size="x-small"
|
|
7
|
+
onclick={fireMoveRowDown} disabled={isLastRow}></lightning-button-icon>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LightningElement, api } from 'lwc';
|
|
2
|
+
import mix from 'lightning/mixinBuilder';
|
|
3
|
+
import { baseNavigation } from 'lightning/datatableKeyboardMixins';
|
|
4
|
+
import template from './customDatatypeRowOrderingBtn.html';
|
|
5
|
+
|
|
6
|
+
export default class CustomDatatypeRowOrderingBtn extends mix(
|
|
7
|
+
LightningElement
|
|
8
|
+
).with(baseNavigation) {
|
|
9
|
+
@api rowId;
|
|
10
|
+
@api isFirstRow;
|
|
11
|
+
@api isLastRow;
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
return template;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fireMoveRowUp() {
|
|
18
|
+
const event = new CustomEvent('privatemoverowup', {
|
|
19
|
+
composed: true,
|
|
20
|
+
bubbles: true,
|
|
21
|
+
cancelable: true,
|
|
22
|
+
detail: {
|
|
23
|
+
rowId: this.rowId,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
this.dispatchEvent(event);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fireMoveRowDown() {
|
|
30
|
+
const event = new CustomEvent('privatemoverowdown', {
|
|
31
|
+
composed: true,
|
|
32
|
+
bubbles: true,
|
|
33
|
+
cancelable: true,
|
|
34
|
+
detail: {
|
|
35
|
+
rowId: this.rowId,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
this.dispatchEvent(event);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import LightningDatatable from 'lightning/datatable';
|
|
2
|
+
import deleteRow from './deleteRow.html';
|
|
3
|
+
import orderingButtons from './orderingButtons.html';
|
|
4
|
+
import iconPill from './iconPill.html';
|
|
5
|
+
import customName from './customName.html';
|
|
6
|
+
import customNumber from './customNumber.html';
|
|
7
|
+
import customLink from './customLink.html';
|
|
8
|
+
import customNumberEdit from './customNumberEdit.html';
|
|
9
|
+
|
|
10
|
+
export default class CustomDatatypeTable extends LightningDatatable {
|
|
11
|
+
static customTypes = {
|
|
12
|
+
deleteRowButton: {
|
|
13
|
+
template: deleteRow,
|
|
14
|
+
typeAttributes: ['attrA', 'attrB'],
|
|
15
|
+
},
|
|
16
|
+
orderingButtons: {
|
|
17
|
+
template: orderingButtons,
|
|
18
|
+
typeAttributes: ['isFirstRow', 'isLastRow'],
|
|
19
|
+
},
|
|
20
|
+
customLink: {
|
|
21
|
+
template: customLink,
|
|
22
|
+
typeAttributes: ['label', 'tooltip'],
|
|
23
|
+
},
|
|
24
|
+
iconPill: {
|
|
25
|
+
template: iconPill,
|
|
26
|
+
},
|
|
27
|
+
customName: {
|
|
28
|
+
template: customName,
|
|
29
|
+
typeAttributes: ['accountName'],
|
|
30
|
+
},
|
|
31
|
+
customNumber: {
|
|
32
|
+
template: customNumber,
|
|
33
|
+
editTemplate: customNumberEdit,
|
|
34
|
+
standardCellLayout: true,
|
|
35
|
+
typeAttributes: ['min'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="padding: 0 10px;">
|
|
3
|
+
<span class="slds-pill slds-pill_link">
|
|
4
|
+
<span class="slds-pill__icon_container">
|
|
5
|
+
<span class="slds-icon_container slds-icon-standard-account" title="Account">
|
|
6
|
+
<lightning-icon class="slds-icon" icon-name="standard:account" alternative-text="Account" title="Account"></lightning-icon>
|
|
7
|
+
</span>
|
|
8
|
+
</span>
|
|
9
|
+
<a href="javascript:void(0);" class="slds-pill__action" title="Full pill label verbiage mirrored here"
|
|
10
|
+
tabindex={internalTabIndex}>
|
|
11
|
+
<span class="slds-pill__label">Pill Label</span>
|
|
12
|
+
</a>
|
|
13
|
+
<lightning-button-icon class="slds-button slds-button_icon slds-button_icon slds-pill__remove" icon-name="utility:close" size="x-small" alternative-text="close"
|
|
14
|
+
title="close" variant="bare"></lightning-button-icon>
|
|
15
|
+
</span>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<datatable-custom-datatype-row-ordering-btn
|
|
3
|
+
row-id={value}
|
|
4
|
+
is-first-row={typeAttributes.isFirstRow}
|
|
5
|
+
is-last-row={typeAttributes.isLastRow}
|
|
6
|
+
data-navigation="enable"
|
|
7
|
+
tabindex={internalTabIndex}
|
|
8
|
+
keyboard-mode={keyboardMode}>
|
|
9
|
+
</datatable-custom-datatype-row-ordering-btn>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default function generateData({ amountOfRecords }) {
|
|
2
|
+
return [...Array(amountOfRecords)].map((_, index) => {
|
|
3
|
+
return {
|
|
4
|
+
name: `Name (${index})`,
|
|
5
|
+
boolean: Math.random() < 0.5,
|
|
6
|
+
website: 'www.salesforce.com',
|
|
7
|
+
phone: `${Math.floor(Math.random() * 9000000000) + 1000000000}`,
|
|
8
|
+
currency: Math.floor(Math.random() * 100),
|
|
9
|
+
date: new Date(
|
|
10
|
+
Date.now() + 86400000 * Math.ceil(Math.random() * 20)
|
|
11
|
+
),
|
|
12
|
+
dateLocal: new Date(Date.now()),
|
|
13
|
+
email: 'test@salesforce.com',
|
|
14
|
+
location: {
|
|
15
|
+
latitude: (Math.random() * 90).toFixed(2),
|
|
16
|
+
longitude: (Math.random() * 180).toFixed(2),
|
|
17
|
+
},
|
|
18
|
+
number: Math.floor(Math.random() * 100),
|
|
19
|
+
percent: Math.random(),
|
|
20
|
+
iconName: 'action:approval',
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LightningElement } from 'lwc';
|
|
2
|
+
import generateData from './generateData';
|
|
3
|
+
|
|
4
|
+
// Add <datatable-with-all-column-types></datatable-with-all-column-types> to the lwr-playground to see the table
|
|
5
|
+
|
|
6
|
+
const columns = [
|
|
7
|
+
{ label: 'Name', fieldName: 'name' },
|
|
8
|
+
{ label: 'Boolean', fieldName: 'boolean', type: 'boolean' },
|
|
9
|
+
{ label: 'Url', fieldName: 'url', type: 'url' },
|
|
10
|
+
{ label: 'Phone', fieldName: 'phone', type: 'phone' },
|
|
11
|
+
{
|
|
12
|
+
label: 'Currency',
|
|
13
|
+
fieldName: 'currency',
|
|
14
|
+
type: 'currency',
|
|
15
|
+
typeAttributes: {
|
|
16
|
+
currencyCode: 'EUR',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{ label: 'Date', fieldName: 'date', type: 'date' },
|
|
20
|
+
{
|
|
21
|
+
label: 'Date-local',
|
|
22
|
+
fieldName: 'dateLocal',
|
|
23
|
+
type: 'date-local',
|
|
24
|
+
typeAttributes: {
|
|
25
|
+
month: '2-digit',
|
|
26
|
+
day: '2-digit',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{ label: 'Email', fieldName: 'email', type: 'email' },
|
|
30
|
+
{ label: 'Location', fieldName: 'location', type: 'location' },
|
|
31
|
+
{ label: 'Number', fieldName: 'number', type: 'number' },
|
|
32
|
+
{ label: 'Percent', fieldName: 'percent', type: 'percent' },
|
|
33
|
+
{
|
|
34
|
+
label: 'Action',
|
|
35
|
+
type: 'action',
|
|
36
|
+
typeAttributes: {
|
|
37
|
+
rowActions: [
|
|
38
|
+
{ label: 'action 1', name: 'action1' },
|
|
39
|
+
{ label: 'action 2', name: 'action2' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Button',
|
|
45
|
+
type: 'button',
|
|
46
|
+
typeAttributes: {
|
|
47
|
+
label: 'Submit',
|
|
48
|
+
name: 'submitAction',
|
|
49
|
+
iconName: { fieldName: 'iconName' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: 'Button-icon',
|
|
54
|
+
type: 'button-icon',
|
|
55
|
+
typeAttributes: {
|
|
56
|
+
label: 'Submit',
|
|
57
|
+
name: 'submitAction',
|
|
58
|
+
iconName: { fieldName: 'iconName' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default class DatatableWithAllColumnTypes extends LightningElement {
|
|
64
|
+
data = [];
|
|
65
|
+
columns = columns;
|
|
66
|
+
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
const data = generateData({ amountOfRecords: 100 });
|
|
69
|
+
this.data = data;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default function generateData({ amountOfRecords }) {
|
|
2
|
+
return [...Array(amountOfRecords)].map((_, index) => {
|
|
3
|
+
return {
|
|
4
|
+
id: index + 1,
|
|
5
|
+
name: `Name (${index})`,
|
|
6
|
+
website: 'www.salesforce.com',
|
|
7
|
+
amount: Math.floor(Math.random() * 100),
|
|
8
|
+
phone: `${Math.floor(Math.random() * 9000000000) + 1000000000}`,
|
|
9
|
+
closeAt: new Date(
|
|
10
|
+
Date.now() + 86400000 * Math.ceil(Math.random() * 20)
|
|
11
|
+
),
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
}
|