diff --git a/resources/templates/createRecord/createRecord.css b/resources/templates/createRecord/createRecord.css new file mode 100644 index 00000000..4c70033b --- /dev/null +++ b/resources/templates/createRecord/createRecord.css @@ -0,0 +1 @@ +@import 'c/commonStyles'; diff --git a/resources/templates/createRecord/createRecord.html b/resources/templates/createRecord/createRecord.html new file mode 100644 index 00000000..f37f41e0 --- /dev/null +++ b/resources/templates/createRecord/createRecord.html @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/resources/templates/createRecord/createRecord.js b/resources/templates/createRecord/createRecord.js new file mode 100644 index 00000000..6b83b9a8 --- /dev/null +++ b/resources/templates/createRecord/createRecord.js @@ -0,0 +1,26 @@ +import { LightningElement, api } from "lwc"; + +///TEMPLATE_IMPORTS/// + +export default class Create///TEMPLATE_OBJECT_API_NAME///Record +extends LightningElement { + @api recordId; + @api objectApiName; + + ///TEMPLATE_VARIABLES/// + + ///TEMPLATE_VARIABLE_ASSIGNMENTS/// + + onSuccess(event) { + console.log("Created record", event.detail); + // Dismiss modal on success + this.dismiss(event); + } + + dismiss(event) { + console.log("Dismissing modal", event.detail); + // TODO: Can we use window.history.back() here? + // eslint-disable-next-line no-restricted-globals + history.back(); + } +} diff --git a/resources/templates/createRecord/createRecord.js-meta.xml b/resources/templates/createRecord/createRecord.js-meta.xml new file mode 100644 index 00000000..b34a40c5 --- /dev/null +++ b/resources/templates/createRecord/createRecord.js-meta.xml @@ -0,0 +1,17 @@ + + + 59.0 + true + ///TEMPLATE_CREATE_LWC_LABEL/// + Creates a new ///TEMPLATE_OBJECT_API_NAME/// record. + + lightning__GlobalAction + lightning__RecordPage + lightning__RecordAction + + + + ScreenAction + + + \ No newline at end of file diff --git a/resources/templates/editRecord/editRecord.css b/resources/templates/editRecord/editRecord.css new file mode 100644 index 00000000..8a4236dc --- /dev/null +++ b/resources/templates/editRecord/editRecord.css @@ -0,0 +1,2 @@ +@import 'c/commonStyles'; + diff --git a/resources/templates/editRecord/editRecord.html b/resources/templates/editRecord/editRecord.html new file mode 100644 index 00000000..c5c97213 --- /dev/null +++ b/resources/templates/editRecord/editRecord.html @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/resources/templates/editRecord/editRecord.js b/resources/templates/editRecord/editRecord.js new file mode 100644 index 00000000..eb3b2a3a --- /dev/null +++ b/resources/templates/editRecord/editRecord.js @@ -0,0 +1,32 @@ +import { LightningElement, api, wire } from "lwc"; +import { getRecord } from "lightning/uiRecordApi"; + +///TEMPLATE_IMPORTS/// + +export default class Edit///TEMPLATE_OBJECT_API_NAME///Record +extends LightningElement { + @api recordId; + @api objectApiName; + + ///TEMPLATE_VARIABLES/// + + @wire(getRecord, { recordId: "$recordId", fields: [NAME_FIELD] }) + record; + + get name() { + return this.record?.data?.fields?.Name?.value || ""; + } + + onSuccess(event) { + console.log("Updated record", event.detail); + // Dismiss modal on success + this.dismiss(event); + } + + dismiss(event) { + console.log("Dismissing modal", event.detail); + // TODO: Can we use window.history.back() here? + // eslint-disable-next-line no-restricted-globals + history.back(); + } +} diff --git a/resources/templates/editRecord/editRecord.js-meta.xml b/resources/templates/editRecord/editRecord.js-meta.xml new file mode 100644 index 00000000..b6ab7a7b --- /dev/null +++ b/resources/templates/editRecord/editRecord.js-meta.xml @@ -0,0 +1,16 @@ + + + 59.0 + true + ///TEMPLATE_EDIT_LWC_LABEL/// + Edits a ///TEMPLATE_OBJECT_API_NAME/// record. + + lightning__RecordPage + lightning__RecordAction + + + + ScreenAction + + + \ No newline at end of file diff --git a/resources/templates/viewRecord/viewRecord.css b/resources/templates/viewRecord/viewRecord.css new file mode 100644 index 00000000..4c70033b --- /dev/null +++ b/resources/templates/viewRecord/viewRecord.css @@ -0,0 +1 @@ +@import 'c/commonStyles'; diff --git a/resources/templates/viewRecord/viewRecord.html b/resources/templates/viewRecord/viewRecord.html new file mode 100644 index 00000000..4cae2d4e --- /dev/null +++ b/resources/templates/viewRecord/viewRecord.html @@ -0,0 +1,20 @@ + diff --git a/resources/templates/viewRecord/viewRecord.js b/resources/templates/viewRecord/viewRecord.js new file mode 100644 index 00000000..829b7979 --- /dev/null +++ b/resources/templates/viewRecord/viewRecord.js @@ -0,0 +1,23 @@ +import { LightningElement, api, wire } from "lwc"; +import { getRecord } from "lightning/uiRecordApi"; + +///TEMPLATE_IMPORTS/// + +export default class View///TEMPLATE_OBJECT_API_NAME///Record +extends LightningElement { + @api recordId; + @api objectApiName; + + get fields() { + return [ + ///TEMPLATE_FIELDS/// + ]; + } + + @wire(getRecord, { recordId: "$recordId", fields: "$fields" }) + record; + + get name() { + return this.record?.data?.fields?.Name?.value ?? ""; + } +} diff --git a/resources/templates/viewRecord/viewRecord.js-meta.xml b/resources/templates/viewRecord/viewRecord.js-meta.xml new file mode 100644 index 00000000..85787651 --- /dev/null +++ b/resources/templates/viewRecord/viewRecord.js-meta.xml @@ -0,0 +1,16 @@ + + + 59.0 + true + ///TEMPLATE_VIEW_LWC_LABEL/// + Component to view a single ///TEMPLATE_OBJECT_API_NAME///. + + lightning__RecordPage + lightning__RecordAction + + + + ScreenAction + + + \ No newline at end of file