diff --git a/package.json b/package.json index 54db63a..d81f2c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lwc-utils", - "version": "1.5.3", + "version": "1.5.4", "scripts": { "eslint:validate": "eslint **/lwc/**/*.js", "prettier:validate": "prettier --check '**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}'", diff --git a/sfdx-project.json b/sfdx-project.json index 91b7e6c..5633a02 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -4,8 +4,8 @@ "path": "utils-core", "default": true, "package": "LWC Utils", - "versionName": "ver 1.5.3", - "versionNumber": "1.5.3.NEXT", + "versionName": "ver 1.5.4", + "versionNumber": "1.5.4.NEXT", "postInstallUrl": "https://github.com/tsalb/lwc-utils/releases", "releaseNotesUrl": "https://github.com/tsalb/lwc-utils/releases" }, @@ -13,13 +13,13 @@ "path": "utils-recipes", "default": false, "package": "LWC Utils Recipes", - "versionName": "ver 1.5.1", - "versionNumber": "1.5.1.NEXT", + "versionName": "ver 1.5.4", + "versionNumber": "1.5.4.NEXT", "postInstallUrl": "https://github.com/tsalb/lwc-utils/releases", "releaseNotesUrl": "https://github.com/tsalb/lwc-utils/releases", "dependencies": [ { - "package": "LWC Utils@1.5.3-1" + "package": "LWC Utils@1.5.4-1" } ] } @@ -29,26 +29,10 @@ "sourceApiVersion": "51.0", "packageAliases": { "LWC Utils Recipes": "0Ho1Q000000blJnSAI", - "LWC Utils Recipes@1.0.0-0": "04t1Q000001QhP3QAK", - "LWC Utils Recipes@1.0.1-1": "04t1Q000001QhTFQA0", - "LWC Utils Recipes@1.1.0-2": "04t1Q000001QhWnQAK", - "LWC Utils Recipes@1.2.0-1": "04t1Q000001QhvYQAS", - "LWC Utils Recipes@1.4.0-1": "04t1Q000001Qhy3QAC", - "LWC Utils Recipes@1.5.0-1": "04t1Q000001Qi0xQAC", - "LWC Utils Recipes@1.5.1-1": "04t1Q000001Qi2PQAS", + "LWC Utils Recipes@1.5.4-1": "04t1Q000001Qi2jQAC", "LWC Utils": "0Ho1Q000000blJiSAI", - "LWC Utils@1.0.0-0": "04t1Q000001QhOyQAK", - "LWC Utils@1.0.1-1": "04t1Q000001QhRsQAK", - "LWC Utils@1.0.2-1": "04t1Q000001QhTAQA0", - "LWC Utils@1.1.0-1": "04t1Q000001QhWdQAK", - "LWC Utils@1.1.1-2": "04t1Q000001QhnjQAC", - "LWC Utils@1.2.0-1": "04t1Q000001QhtwQAC", - "LWC Utils@1.2.1-1": "04t1Q000001QhvEQAS", - "LWC Utils@1.3.0-1": "04t1Q000001QhvTQAS", "LWC Utils@1.4.0-3": "04t1Q000001QhyDQAS", "LWC Utils@1.5.0-1": "04t1Q000001Qi0sQAC", - "LWC Utils@1.5.1-2": "04t1Q000001Qi2KQAS", - "LWC Utils@1.5.2-1": "04t1Q000001Qi2UQAS", - "LWC Utils@1.5.3-1": "04t1Q000001Qi2ZQAS" + "LWC Utils@1.5.4-1": "04t1Q000001Qi2eQAC" } } \ No newline at end of file diff --git a/utils-core/main/default/lwc/csvDatatable/csvDatatable.js-meta.xml b/utils-core/main/default/lwc/csvDatatable/csvDatatable.js-meta.xml index 1cf4475..08f8087 100644 --- a/utils-core/main/default/lwc/csvDatatable/csvDatatable.js-meta.xml +++ b/utils-core/main/default/lwc/csvDatatable/csvDatatable.js-meta.xml @@ -13,8 +13,8 @@ - - + + diff --git a/utils-core/main/default/lwc/datatable/datatable.js b/utils-core/main/default/lwc/datatable/datatable.js index d00dcef..f97ad3e 100644 --- a/utils-core/main/default/lwc/datatable/datatable.js +++ b/utils-core/main/default/lwc/datatable/datatable.js @@ -290,8 +290,6 @@ export default class Datatable extends LightningElement { this._draftValuesMap = new Map(); this._draftSuccessIds = new Set(); this._fuseData = undefined; - this._hasEditablePicklist = false; - this._hasEditableLookup = false; this._originalTableData = []; } @@ -313,8 +311,6 @@ export default class Datatable extends LightningElement { // private - global search _fuseData; - _hasEditablePicklist = false; - _hasEditableLookup = false; _originalTableData = []; // For future enhancements @@ -324,7 +320,6 @@ export default class Datatable extends LightningElement { this._notifySingleError('getObjectInfo error', error); } else if (data) { this._objectInfo = data; - //console.log(this._objectInfo); } } @@ -335,7 +330,6 @@ export default class Datatable extends LightningElement { this._notifySingleError('getActionConfig error', error); } else if (data) { this._actionConfigs = data; - //console.log(this._actionConfigs); // Table Actions this.primaryConfig = this._actionConfigs.find(cfg => cfg.Type__c === TABLE_ACTION_STRING && cfg.Order__c === 1); @@ -364,6 +358,7 @@ export default class Datatable extends LightningElement { this._notifySingleError('getLookupEditConfig error', error); } else if (data) { this._lookupConfigData = data; + this._initializeLookupConfigData(); } } @@ -396,15 +391,13 @@ export default class Datatable extends LightningElement { // Keeps lexical scope correct handleEditableCellRendered = () => { + // This event is emitted from every editable cell, which is why needs to be debounced window.clearTimeout(this._delayEditableCellRendered); // eslint-disable-next-line @lwc/lwc/no-async-operation this._delayEditableCellRendered = setTimeout(() => { - if (this._hasEditableLookup) { - this._initializeLookupConfigData(); - } - if (this._hasEditablePicklist) { - this._initializeRecordTypeIdData(); - } + // Editable cells need these even if the pencil icon is not enabled + this._initializeLookupConfigData(); + this._initializeRecordTypeIdData(); }, 500); }; @@ -525,7 +518,6 @@ export default class Datatable extends LightningElement { } } }; - //console.log(flowPayload); this.messageService.dialogService(flowPayload); } @@ -660,11 +652,8 @@ export default class Datatable extends LightningElement { this._draftValuesMap.set(draft[this.keyField], { ...changedData, ...draft }); }); - //console.log(this._draftValuesMap); - if (this._draftValuesMap.size > 0) { this.draftValues = [...this._draftValuesMap.values()]; - //console.log(this.draftValues); } } @@ -678,10 +667,8 @@ export default class Datatable extends LightningElement { // Avoid using the event because the payload doesn't have name compound fields async handleSave() { if (!this.isSaveToServer) { - //console.log(this.draftValues); // For collectionDatatable we just write user values to tableData, regardless of validation const rowKeyToDraftValuesMap = new Map(this.draftValues.map(draft => [draft[this.keyField], draft])); - //console.log(rowKeyToDraftValuesMap); // Sets draft values directly onto tableData this.tableData = this.tableData.map(row => { const rowDraftValues = rowKeyToDraftValuesMap.get(row[this.keyField]); @@ -709,15 +696,10 @@ export default class Datatable extends LightningElement { ]) ); - //console.log(rowKeyToRowNumberMap); - //console.log(this.draftValues); - // On partial save rows, this helps signal which rows succeeded by clearing them out this.showSpinner = true; const saveResults = await tableService.updateDraftValues(this.draftValues, rowKeyToRowNumberMap); - //console.log(saveResults); - if (saveResults.errors.rows && Object.keys(saveResults.errors.rows).length) { this.saveErrors = saveResults.errors; } @@ -777,18 +759,8 @@ export default class Datatable extends LightningElement { } } if (col.type === 'customLookup') { - // Initiate apex wire adapter here before editable cells fully render + // Warm the getLookupConfig wire adapter before editable cells fully render this._lookupConfigDevName = this.lookupConfigDevName || DATATABLE_LOOKUP_CONFIG_DEFAULT; - // Supports global search - if (col.editable && !this._hasEditableLookup) { - this._hasEditableLookup = true; - } - } - if (col.type === 'customPicklist') { - // Supports global search - if (col.editable && !this._hasEditablePicklist) { - this._hasEditablePicklist = true; - } } finalColumns.push(col); } @@ -865,7 +837,6 @@ export default class Datatable extends LightningElement { _getRowActions(row, doneCallback) { let actions = []; - //console.log(this.rowActionConfigs); // These are pre-sorted by order by server this.rowActionConfigs.forEach(cfg => { // "Native" actions @@ -940,6 +911,7 @@ export default class Datatable extends LightningElement { } _initializeLookupConfigData() { + // Calling function assumes this._lookupConfigData is populated this.messageService.publish({ key: 'lookupconfigload', value: { lookupConfigs: this._lookupConfigData } }); }