fonteva-design-guide
Version:
## Dev, Build and Test
98 lines (96 loc) • 3.9 kB
JavaScript
//import { LightningElement, api, wire, track} from 'lwc';
//import { generateId, cleanName, fireEvent, isValidUrl, valueProvided, addSitePrefix } from 'c/utils';
//import getPostSignature from '@salesforce/apex/Framework.FileController.getPostSignature';
//import getInfo from '@salesforce/apex/Framework.FileController.getInfo';
//import SLDS_BaseV2 from '@salesforce/resourceUrl/SLDS_BaseV2';
//import browse from '@salesforce/label/c.Browse';
//import uploadingFileUpload from '@salesforce/label/c.Uploading_File_Upload';
export default class PfmInputFile extends LightningElement {
// @api tabIndex;
// @api name;
// @api val;
// @api required;
// @wire(getInfo)
// infoObj;
// uniqueId;
// iframeUrl;
// @track uploading = false;
// browseLabel = browse;
// uploadingLabel = uploadingFileUpload;
// loadingIcon = SLDS_BaseV2+'/img/spinners/slds_spinner_brand.gif';
//
// @api
// setCustomValidity() {}
//
// @api
// reportValidity() {}
//
// @api
// checkValidity() {
// if ((this.required && !valueProvided(this.val)) || isValidUrl(this.val)) {
// return false;
// }
// return true;
// }
//
// saveUrl(evt,location) {
// if (evt) {
// location = evt.target.value;
// }
// this.val = location;
// fireEvent(this,'valuechanged',{field : this.name, value: location });
// }
//
// connectedCallback() {
// this.uniqueId = generateId(8);
// this.iframeUrl = addSitePrefix('/apex/Framework__FileUploadFrame?identifier=='+this.uniqueId);
// var self = this;
// window.addEventListener("message",
// function receiveMessage(event)
// {
// if (event.data.identifier === self.uniqueId) {
// var location = event.data.data.Location;
// self.saveUrl(null,location);
// self.uploading = false;
// }
// },
// false);
// }
//
// uploadFileToServer() {
// this.uploading = true;
// let fileChooser = this.template.querySelector('input');
// let file = fileChooser.files[0];
// this.doUpload(generateId(8), cleanName(file.name), file.type, file,this).then(result => {
// }).catch(error => {
// });
// }
//
// doUpload(prefix,fileName,fileType,file,self) {
// var params = {
// Key: self.infoObj.data.orgId + '/' + prefix + fileName,
// ContentType: fileType,
// Body: file
// };
// return new Promise(function(resolve,reject){
// getPostSignature({key : params.Key,usePublicBucket : false}).then(result => {
// self.template.querySelector('iframe').contentWindow.postMessage({
// identifier: self.uniqueId,
// params: params,
// bucketName: result.bucketName,
// region : result.region,
// signature: result.signature,
// policyJson: result.policyJson,
// isoDate: result.isoDate,
// credential: result.credential,
// expires: result.expires,
// usePublicBucket : false
// }, '*');
// resolve();
// })
// .catch(error => {
// reject(error);
// });
// });
// }
}