Skip to content

Commit 7063e94

Browse files
committed
fix space
1 parent 36d88ea commit 7063e94

File tree

5 files changed

+122
-65
lines changed

5 files changed

+122
-65
lines changed

force-app/main/default/lwc/datatableImageColumn/datatableImageColumn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LightningElement, track, api } from 'lwc';
1+
import { LightningElement, api } from 'lwc';
22

33
export default class DatatableImage extends LightningElement {
44
@api value;
Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,55 @@
11
<!-- sldsValidatorIgnore -->
22
<template>
3-
<div class="lookupBlock" id="lookup">
4-
<div if:true={showLookup} class="lookup-container" onmouseleave={onMouseLeaveLookup}>
5-
<lightning-record-edit-form object-api-name={object}>
6-
<lightning-input-field
7-
class="slds-popover slds-popover_edit slds-popover__body"
8-
field-name={fieldName}
9-
value={value}
10-
variant={variant}
11-
onchange={handleChange}>
12-
</lightning-input-field>
13-
</lightning-record-edit-form>
14-
</div>
15-
<div if:false={showLookup} class="slds-table_edit_container slds-is-relative">
16-
<span class="slds-grid slds-grid_align-spread slds-cell-edit slds-align_absolute-center">
17-
<span class="slds-truncate" title={lookupName}>
18-
<lightning-formatted-url value={lookupValue} label={lookupName} target={target}>
19-
</lightning-formatted-url>
20-
</span>
21-
<button data-id={context} class="slds-button slds-button_icon slds-cell-edit__button slds-m-left_x-small" tabindex="-1"
22-
title="Edit" onclick={handleClick}>
23-
<svg class="slds-button__icon slds-button__icon_hint slds-button__icon_lock slds-button__icon_small slds-button__icon_edit slds-icon slds-icon-text-default slds-icon_xx-small"
24-
aria-hidden="true">
25-
<use xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.37.1#edit"></use>
26-
</svg>
27-
<span class="slds-assistive-text">Edit</span>
28-
</button>
29-
</span>
30-
</div>
31-
</div>
32-
</template>
3+
<div class="lookupBlock" id="lookup">
4+
<div
5+
if:true={showLookup}
6+
class="lookup-container"
7+
onmouseleave={onMouseLeaveLookup}
8+
>
9+
<lightning-record-edit-form object-api-name={object}>
10+
<lightning-input-field
11+
class="slds-popover slds-popover_edit slds-popover__body"
12+
field-name={fieldName}
13+
value={value}
14+
variant={variant}
15+
onchange={handleChange}
16+
>
17+
</lightning-input-field>
18+
</lightning-record-edit-form>
19+
</div>
20+
<div
21+
if:false={showLookup}
22+
class="slds-table_edit_container slds-is-relative"
23+
>
24+
<span
25+
class="slds-grid slds-grid_align-spread slds-cell-edit slds-align_absolute-center"
26+
>
27+
<span class="slds-truncate" title={lookupName}>
28+
<lightning-formatted-url
29+
value={lookupValue}
30+
label={lookupName}
31+
target={target}
32+
>
33+
</lightning-formatted-url>
34+
</span>
35+
<button
36+
data-id={context}
37+
class="slds-button slds-button_icon slds-cell-edit__button slds-m-left_x-small"
38+
tabindex="-1"
39+
title="Edit"
40+
onclick={handleClick}
41+
>
42+
<svg
43+
class="slds-button__icon slds-button__icon_hint slds-button__icon_lock slds-button__icon_small slds-button__icon_edit slds-icon slds-icon-text-default slds-icon_xx-small"
44+
aria-hidden="true"
45+
>
46+
<use
47+
xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.37.1#edit"
48+
></use>
49+
</svg>
50+
<span class="slds-assistive-text">Edit</span>
51+
</button>
52+
</span>
53+
</div>
54+
</div>
55+
</template>

force-app/main/default/lwc/datatableLookup/datatableLookup.js

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @lwc/lwc/no-api-reassignments */
22
import { LightningElement, api, wire } from 'lwc';
3-
import { getRecord } from "lightning/uiRecordApi";
3+
import { getRecord } from 'lightning/uiRecordApi';
44

55
export default class DatatableLookup extends LightningElement {
66
@api label;
@@ -25,25 +25,27 @@ export default class DatatableLookup extends LightningElement {
2525
this.value = event.detail.value[0];
2626
this.showLookup = this.value != null ? false : true;
2727
this.dispatchEvent(
28-
new CustomEvent('lookupchanged', {
29-
composed: true,
30-
bubbles: true,
31-
cancelable: true,
32-
detail: {
33-
data: {
34-
context: this.context,
35-
fieldName: this.fieldName,
36-
value: this.value
37-
}
38-
}
39-
})
28+
new CustomEvent('lookupchanged', {
29+
composed: true,
30+
bubbles: true,
31+
cancelable: true,
32+
detail: {
33+
data: {
34+
context: this.context,
35+
fieldName: this.fieldName,
36+
value: this.value
37+
}
38+
}
39+
})
4040
);
4141
}
4242

4343
//loads the custom CSS for lookup custom type on lightning datatable
4444
renderedCallback() {
4545
if (!this.guid) {
46-
this.guid = this.template.querySelector('.lookupBlock').getAttribute('id');
46+
this.guid = this.template
47+
.querySelector('.lookupBlock')
48+
.getAttribute('id');
4749
/* Register the event with this component as event payload.
4850
Used to identify the window click event and if click is outside the current context of lookup,
4951
set the dom to show the text and not the combobox */
@@ -69,25 +71,38 @@ export default class DatatableLookup extends LightningElement {
6971
if (this.context !== context) {
7072
this.showLookup = false;
7173
}
72-
}
74+
};
7375

7476
//Fire edit event on to allow to modify the lookup selection.
7577
handleClick(event) {
7678
event.preventDefault();
7779
event.stopPropagation();
7880
this.showLookup = true;
79-
this.dispatchCustomEvent('edit', this.context, this.value, this.label, this.name);
81+
this.dispatchCustomEvent(
82+
'edit',
83+
this.context,
84+
this.value,
85+
this.label,
86+
this.name
87+
);
8088
}
8189

8290
dispatchCustomEvent(eventName, context, value, label, name) {
83-
this.dispatchEvent(new CustomEvent(eventName, {
84-
composed: true,
85-
bubbles: true,
86-
cancelable: true,
87-
detail: {
88-
data: { context: context, value: value, label: label, name: name }
89-
}
90-
}));
91+
this.dispatchEvent(
92+
new CustomEvent(eventName, {
93+
composed: true,
94+
bubbles: true,
95+
cancelable: true,
96+
detail: {
97+
data: {
98+
context: context,
99+
value: value,
100+
label: label,
101+
name: name
102+
}
103+
}
104+
})
105+
);
91106
}
92107

93108
onMouseLeaveLookup() {
@@ -99,19 +114,27 @@ export default class DatatableLookup extends LightningElement {
99114
autonumber, pass the informative field reference eg. CustomObject__c.CustomField__c*/
100115
getFieldName() {
101116
let fieldName = this.fields[0];
102-
fieldName = fieldName.substring(fieldName.lastIndexOf('.') + 1, fieldName.length);
117+
fieldName = fieldName.substring(
118+
fieldName.lastIndexOf('.') + 1,
119+
fieldName.length
120+
);
103121
return fieldName;
104122
}
105123

106124
//label of formatted url
107125
get lookupName() {
108-
return (this.record.data != null) ? this.record.data.fields[this.getFieldName()].value : '';
126+
return this.record.data != null
127+
? this.record.data.fields[this.getFieldName()].value
128+
: '';
109129
}
110130

111131
//value of formatted url
112132
get lookupValue() {
113-
if(!this.value) return '';
133+
if (!this.value) return '';
114134

115-
return (this.record.data != null && this.record.data.fields[this.getFieldName()].value) ? '/' + this.value : '';
135+
return this.record.data != null &&
136+
this.record.data.fields[this.getFieldName()].value
137+
? '/' + this.value
138+
: '';
116139
}
117-
}
140+
}

force-app/main/default/lwc/extendedDatatable/extendedDatatable.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ export default class ExtendedDatatable extends LightningDatatable {
1313
},
1414
//example JSON {"Account.Name":{"label":"Account Name","type":"lookup","typeAttributes":{"placeholder": "Choose Account","objectApiName": "Contact","fieldName": "AccountId","label": "Account","value": { "fieldName": "AccountId" },"context": { "fieldName": "Id" },"variant": "label-hidden","name": "Account","fields": ["Account.Name"],"target": "_self"} }}
1515
lookup: {
16-
template: customLookup,
17-
standardCellLayout: true,
18-
typeAttributes: ['label', 'value', 'placeholder', 'fieldName', 'objectApiName', 'context', 'variant', 'name', 'fields', 'target']
16+
template: customLookup,
17+
standardCellLayout: true,
18+
typeAttributes: [
19+
'label',
20+
'value',
21+
'placeholder',
22+
'fieldName',
23+
'objectApiName',
24+
'context',
25+
'variant',
26+
'name',
27+
'fields',
28+
'target'
29+
]
1930
},
2031
textarea: {
2132
template: textAreaTemplate,
@@ -27,4 +38,4 @@ export default class ExtendedDatatable extends LightningDatatable {
2738
standardCellLayout: false
2839
}
2940
};
30-
}
41+
}

force-app/main/default/lwc/lwcRelatedList/lwcRelatedList.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@
126126
</lightning-button>
127127
</footer>
128128
</lightning-card>
129-
</template>
129+
</template>

0 commit comments

Comments
 (0)