Skip to content

Commit

Permalink
Merge branch 'bugfixes-and-enhancements'
Browse files Browse the repository at this point in the history
Rewriting history for cleanup, this commit squashes pulls #68 and #69
  • Loading branch information
tsalb committed Feb 6, 2021
2 parents 98a8fa3 + 0a9d2fd commit 24e5e51
Show file tree
Hide file tree
Showing 28 changed files with 859 additions and 3,152 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
**/luxon/**
**/luxon/**
**/fuseBasic/**
jsconfig.json
6 changes: 5 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ coverage/
# For meta files, etc
*.xml
*meta.xml
sfdx-project.json
sfdx-project.json

# For libs
**/luxon/**
**/fuseBasic/**
2 changes: 1 addition & 1 deletion utils-core/main/default/lwc/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@salesforce/eslint-config-lwc/recommended"
"extends": ["@salesforce/eslint-config-lwc/recommended"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,11 @@
sorted-direction={sortedDirection}
onsave={handleSave}
onrowselection={handleRowSelection}
></c-datatable>
>
<template if:true={showComposedActions}>
<div slot="composedActions">
<slot name="composedActions"></slot>
</div>
</template>
</c-datatable>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,26 @@ export default class CollectionDatatable extends LightningElement {
// https://salesforce.stackexchange.com/a/270624
@api useLoadStyleHackForOverflow;

// MessageService boundary, useful for when multiple instances are on same page
get uniqueBoundary() {
if (!this._uniqueBoundary) {
this._uniqueBoundary = generateUUID();
}
return this._uniqueBoundary;
}

get composedActionSlot() {
return this.template.querySelector('slot[name=composedActions]');
}

get messageService() {
return this.template.querySelector('c-message-service');
}

showComposedActions = true;

// private
_isRendered;
_messageService;
_displayTypeMap = new Map();
_initializationType;
_hasCustomPicklist;
Expand All @@ -93,14 +110,6 @@ export default class CollectionDatatable extends LightningElement {
_objectFieldsMap = new Map();
_referenceFieldsMap = new Map();

// MessageService boundary, useful for when multiple instances are on same page
get uniqueBoundary() {
if (!this._uniqueBoundary) {
this._uniqueBoundary = generateUUID();
}
return this._uniqueBoundary;
}

async connectedCallback() {
if (!this.recordCollection || !this.recordCollection.length) {
return;
Expand All @@ -122,7 +131,7 @@ export default class CollectionDatatable extends LightningElement {
return;
}
this._isRendered = true;
this._messageService = this.template.querySelector('c-message-service');
this.showComposedActions = this.composedActionSlot && this.composedActionSlot.assignedElements().length !== 0;
}

async initializeFromRecordId(recordId) {
Expand Down Expand Up @@ -274,7 +283,7 @@ export default class CollectionDatatable extends LightningElement {
if (this._recordTypeIdMap.size) {
// Picklist columns should have been initialized now.
// If this breaks, we need datatable.js to initiate this instead
this._messageService.publish({
this.messageService.publish({
key: 'picklistconfigload',
value: { recordTypeIdMap: recordTypeIdMap }
});
Expand Down
93 changes: 93 additions & 0 deletions utils-core/main/default/lwc/csvDatatable/csvDatatable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--
/**
* BSD 3-Clause License
*
* Copyright (c) 2021, james@sparkworks.io
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-->

<template>
<c-message-service boundary={uniqueBoundary}></c-message-service>

<div class="slds-is-relative">
<template if:true={showSpinner}>
<lightning-spinner alternative-text="Loading"></lightning-spinner>
</template>
<c-soql-datatable
title={title}
show-record-count={showRecordCount}
checkbox-type="Multi"
editable-fields={editableFields}
sortable-fields={sortableFields}
sorted-by={sortedBy}
sorted-direction={sortedDirection}
action-config-dev-name={actionConfigDevName}
lookup-config-dev-name={lookupConfigDevName}
use-relative-max-height={useRelativeMaxHeight}
custom-relative-max-height={customRelativeMaxHeight}
use-load-style-hack-for-overflow={useLoadStyleHackForOverflow}
>
<div slot="composedActions">
<lightning-layout>
<div class="slds-form-element">
<div class="slds-form-element__control">
<input
type="file"
class="slds-file-selector__input slds-assistive-text"
accept=".csv"
onclick={handleFileInputClicked}
onchange={handleFileInputChanged}
disabled={isFileInputDisabled}
id={uniqueBoundary}
aria-labelledby="file-selector-secondary-label"
/>
<label class="slds-file-selector__body" for={uniqueBoundary} id="file-selector-secondary-label">
<span class="slds-file-selector__button slds-button slds-button_neutral">
<lightning-icon
icon-name="utility:upload"
class="slds-button__icon slds-button__icon_left"
size="xx-small"
aria-hidden="true"
></lightning-icon>
Select CSV
</span>
</label>
</div>
</div>
<lightning-button
class="slds-p-left_x-small"
label="Apply CSV Values"
onclick={handleApplyValuesClick}
disabled={isApplyValuesDisabled}
></lightning-button>
</lightning-layout>
</div>
</c-soql-datatable>
</div>
</template>
Loading

0 comments on commit 24e5e51

Please sign in to comment.