lwc#api JavaScript Examples
The following examples show how to use
lwc#api.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: outputTable.js From lwc-soql-builder with MIT License | 6 votes |
@api
async generateCsv() {
const convertToCsvValue = value => {
if (/[\n",]/.test(value)) {
return `"${value.replace(/"/g, '""')}"`;
}
return value;
};
await this._fetchSubsequentRecords(this._nextRecordsUrl);
const header = this.columns.map(convertToCsvValue).join(',');
const data = this._allRows
.map(row => {
return row.values
.map(cell => {
return convertToCsvValue(cell.data);
})
.join(',');
})
.join('\n');
return `${header}\n${data}`;
}
Example #2
Source File: drawAnnotationCanvas.js From DrawAnnotations with BSD 3-Clause "New" or "Revised" License | 6 votes |
@api addStampOption(label, svgString) {
let coreId = label.toLowerCase().replace(/ /g,"-");
this.stamps.push({
id: "stamp" + coreId,
label: label,
class: "toolbar-stamp toolbar-stamp-" + coreId,
checked: false,
toolbar: TOOLBAR.STAMPS,
menuitem: coreId,
svgString: svgString,
});
if (this.isStampingMode) {
this.menuitem = coreId;
this.toolbar = TOOLBAR.STAMPS;
this.resolveMenuItemClick(label, this.stamps);
}
}
Example #3
Source File: drawAnnotationCanvas.js From DrawAnnotations with BSD 3-Clause "New" or "Revised" License | 6 votes |
@api interactionMode(value) {
if (value === INTERACTION_MODE.STAMPING) {
this._interactionMode = INTERACTION_MODE.STAMPING;
} else if (value === INTERACTION_MODE.DRAWING) {
this._interactionMode = INTERACTION_MODE.DRAWING;
} else {
this._interactionMode = INTERACTION_MODE.FULL;
}
}
Example #4
Source File: clusterPredictResult.js From ClusterAnalysis with BSD 3-Clause "New" or "Revised" License | 6 votes |
@api
predict() {
if (this.recordId && this.jobOrModel) {
this.spinnerVisible = true;
return predict({
recordId: this.recordId,
jobOrModel: this.jobOrModel,
isPolling: this.pollingCount > 0
})
.then(result => {
this.predictCallback(result);
})
.catch((error) => {
this.handleError(error);
});
}
else {
return null;
}
}
Example #5
Source File: objectDetails.js From AppRecordDetails with BSD 3-Clause "New" or "Revised" License | 6 votes |
/*
* Info: This Method is called on click of edit pencil icon
* Params: event
* Result: Toggles form view to recor edit mode
*/
toggleEditForm(event){
this.isEditVisible = true;
this.isViewVisible = false;
this.focusFieldApi = event.target.dataset.api;
this.isStencilVisible = true;
}
Example #6
Source File: relatedListDeletePopup.js From relatedList with MIT License | 5 votes |
@api hide() {
this.showModal = false;
}
Example #7
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
getElementAtEventChart(e) {
let res = null;
if (this._chart) {
res = this._chart.getElementAtEvent(e);
}
return res;
}
Example #8
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
getElementsAtEventChart(e) {
let res = null;
if (this._chart) {
res = this._chart.getElementsAtEvent(e);
}
return res;
}
Example #9
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
getDatasetAtEventChart(e) {
let res = null;
if (this._chart) {
res = this._chart.getDatasetAtEvent(e);
}
return res;
}
Example #10
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
getDatasetMetaChart(index) {
let res = null;
if (this._chart) {
res = this._chart.getDatasetMeta(index);
}
return res;
}
Example #11
Source File: accountPage.js From relatedList with MIT License | 5 votes |
@api
customHandler() {
alert("It's a custom action!")
}
Example #12
Source File: modal.js From relatedList with MIT License | 5 votes |
@api show() {
this.showModal = true;
}
Example #13
Source File: modal.js From relatedList with MIT License | 5 votes |
@api hide() {
this.showModal = false;
}
Example #14
Source File: relatedListDeletePopup.js From relatedList with MIT License | 5 votes |
@api show() {
this.showModal = true;
}
Example #15
Source File: auraPubsub.js From pubsub with Creative Commons Zero v1.0 Universal | 5 votes |
@api
unregisterAllListeners() {
unregisterAllListeners(this);
}
Example #16
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
clearChart() {
if (this._chart) {
this._chart.clear();
}
return this;
}
Example #17
Source File: spinner.js From lwc-soql-builder with MIT License | 5 votes |
@api
close() {
this.template.host.remove();
}
Example #18
Source File: relatedListNewEditPopup.js From relatedList with MIT License | 5 votes |
@api show() {
this.showModal = true;
}
Example #19
Source File: relatedListNewEditPopup.js From relatedList with MIT License | 5 votes |
@api hide() {
this.showModal = false;
}
Example #20
Source File: auraPubsub.js From pubsub with Creative Commons Zero v1.0 Universal | 5 votes |
@api
registerListener(eventName, callback) {
registerListener(eventName, callback, this);
}
Example #21
Source File: auraPubsub.js From pubsub with Creative Commons Zero v1.0 Universal | 5 votes |
@api
fireEvent(eventName, data) {
fireEvent(this.pageRef, eventName, data);
}
Example #22
Source File: auraPubsub.js From pubsub with Creative Commons Zero v1.0 Universal | 5 votes |
@api
unregisterListener(eventName, callback) {
unregisterListener(eventName, callback, this);
}
Example #23
Source File: chart.js From LightningWebChartJS with MIT License | 5 votes |
@api
destroyChart() {
if (this._chart) {
this._chart.destroy();
this._chart = null;
}
}
Example #24
Source File: dataPassingExample.js From LWC-Webinar with Apache License 2.0 | 5 votes |
@api restoreValue() {
this._value = this._savedValue;
}
Example #25
Source File: importExampleUtils.js From LWC-Webinar with Apache License 2.0 | 5 votes |
@api getDateTime() {
return getDateTime();
}
Example #26
Source File: multiTemplateExample.js From LWC-Webinar with Apache License 2.0 | 5 votes |
@api saveValue() {
this._savedValue = this._value;
}
Example #27
Source File: multiTemplateExample.js From LWC-Webinar with Apache License 2.0 | 5 votes |
@api restoreValue() {
this._value = this._savedValue;
}
Example #28
Source File: clusterPredictResult.js From ClusterAnalysis with BSD 3-Clause "New" or "Revised" License | 5 votes |
@api
getPrediction() {
return this.predictCluster;
}
Example #29
Source File: lookup.js From ClusterAnalysis with BSD 3-Clause "New" or "Revised" License | 5 votes |
@api
setSearchResults(results) {
// Reset the spinner
this.loading = false;
// Clone results before modifying them to avoid Locker restriction
const resultsLocal = JSON.parse(JSON.stringify(results));
// Format results
const regex = new RegExp(`(${this._searchTerm})`, 'gi');
this._searchResults = resultsLocal.map((result) => {
// Format title and subtitle
if (this._searchTerm.length > 0) {
result.titleFormatted = result.title
? result.title.replace(regex, '<strong>$1</strong>')
: result.title;
result.subtitleFormatted = result.subtitle
? result.subtitle.replace(regex, '<strong>$1</strong>')
: result.subtitle;
} else {
result.titleFormatted = result.title;
result.subtitleFormatted = result.subtitle;
}
// Add icon if missing
if (typeof result.icon === 'undefined') {
result.icon = 'standard:default';
}
return result;
});
// Add local state and dynamic class to search results
this._focusedResultIndex = null;
const self = this;
this.searchResultsLocalState = this._searchResults.map((result, i) => {
return {
result,
state: {},
get classes() {
let cls =
'slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta';
if (self._focusedResultIndex === i) {
cls += ' slds-has-focus';
}
return cls;
}
};
});
}