Giter VIP home page Giter VIP logo

file-upload's Introduction

File Upload LWC

File Upload LWC contains two themable Lightning Web Components that let users upload files to a record page via drag and drop and assign the created ContentVersion records a Type__c value.

Component Use when...
uploadFilesByType All users can view and upload files to any Type__c
uploadFilesByMetadata Users need to be restricted on the Type__c of files they can upload and view. See Notes on using uploadFilesByMetadata below for instructions on setup

Preview

Demo

Features

  • Drag and Drop to upload files
  • Assign uploaded files a ContentVersion.Type__c value
  • Filter files by Filename
  • Datatable Options:
    • Show datatable section
    • Show delete record column
    • Show edit record column
    • download record column
  • Theming Options:
    • Bold filename
    • Background & Border color of uploader dropzone
    • Color of Type badge component
    • Colors of datatable action icon buttons

Component Properties

Property Description Type Default Value
Record Id Enter recordId if used on a Lightning Record Page or {!recordId} if used on an Experience Cloud record page (Required) String recordId
LOB (** uploadFilesByMetadata only) Line of business String
Allowed File Extensions Comma-separated list of file extensions that can be uploaded in the format .ext, such as .pdf, .jpg, or png. String
Show Table Component Display tables of files underneath the file upload component, grouped by ContentVersion.Type__c Checkbox Checked
Bold Filename Display filename in bold in table component Checkbox
Use Delete Column in Table Let users delete files within the table component Checkbox Checked
Use Edit Column in Table Let users delete the file Type of a file within the table component Checkbox Checked
Use Download Column in Table Let users download files from the table component Checkbox Checked
Badge Color String (Lightning) or Color (Experience) Customize color of Badge #ecebea
Edit Icon Color String (Lightning) or Color (Experience) Customize color of Edit icon #706e6b
Preview Icon Color String (Lightning) or Color (Experience) Customize color of Preview Icon #706e6b
Download Icon Color String (Lightning) or Color (Experience) Customize color of Download Icon #706e6b
Delete Icon Color String (Lightning) or Color (Experience) Customize color of Delete Icon #c23934
Uploader Background Color String (Lightning) or Color (Experience) Customize color of uploader dropzone #5eb4ff
Uploader Outline Color String (Lightning) or Color (Experience) Customize color of uploader dashed outline #fafcfe

Requirements

Development

Clone project

git clone https://github.com/cloworm/file-upload

Install dependencies

npm i

Run LWC tests

npm run test

Run Apex tests

npm run test:apex

Lint LWC

npm run lint

Deploy to a sandbox

sfdx force:source:deploy -p force-app/main/default -u {org-alias}

or, Deploy to a scratch org

sfdx force:source:push -p force-app/main/default -u {org-alias}

Notes on using uploadFilesByMetadata

DocumentType__mdt

Field Notes
DeveloperName Should follow pattern Internal${LOB__c}View/Partner${LOB__c}View or Internal${LOB__c}Upload/Partner${LOB__c}Upload
LOB__c "Line of Business" corresponding to the record page the LWC will be implemented in
Profile__c Populate picklist options with profiles from your org
Type__c Semi colon separated list of strings corresponding to options in the ContentVersion.Type__c picklist. (Ex: "Category A; Category B; CategoryC")
View_Upload __c Choose whether the record is a view or upload permission definition

file-upload's People

Contributors

cloworm avatar

Stargazers

Michael Gagne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.