Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gl-w-frontend

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-w-frontend - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

lib/scripts/core/services/data/core-services-data.service.d.ts

2

lib/bundle.d.ts

@@ -6,2 +6,3 @@ export * from './scripts/core/services/array/core-services-array.service';

export * from './scripts/core/services/date/core-services-date.service';
export * from './scripts/core/services/data/core-services-data.service';
export * from './scripts/core/services/elements/core-services-elements.service';

@@ -20,3 +21,2 @@ export * from './scripts/core/services/image/core-services-image.service';

export * from './scripts/core/services/date/core-services-date.interface';
export * from './scripts/core/services/date/core-services-date.interface';
export * from './scripts/core/services/elements/core-services-elements.interface';

@@ -23,0 +23,0 @@ export * from './scripts/core/services/input/core-services-input.interface';

@@ -6,2 +6,3 @@ export * from './scripts/core/services/array/core-services-array.service';

export * from './scripts/core/services/date/core-services-date.service';
export * from './scripts/core/services/data/core-services-data.service';
export * from './scripts/core/services/elements/core-services-elements.service';

@@ -20,3 +21,2 @@ export * from './scripts/core/services/image/core-services-image.service';

export * from './scripts/core/services/date/core-services-date.interface';
export * from './scripts/core/services/date/core-services-date.interface';
export * from './scripts/core/services/elements/core-services-elements.interface';

@@ -23,0 +23,0 @@ export * from './scripts/core/services/input/core-services-input.interface';

@@ -1,1 +0,1 @@

export*from"./scripts/core/services/array/core-services-array.service";export*from"./scripts/core/services/attachment/core-services-attachment.service";export*from"./scripts/core/services/browser/core-services-browser.service";export*from"./scripts/core/services/combobox/core-services-combobox.service";export*from"./scripts/core/services/date/core-services-date.service";export*from"./scripts/core/services/elements/core-services-elements.service";export*from"./scripts/core/services/image/core-services-image.service";export*from"./scripts/core/services/input/core-services-input.service";export*from"./scripts/core/services/internationalization/core-services-internationalization.service";export*from"./scripts/core/services/string/core-services-string.service";export*from"./scripts/core/services/url/core-services-url.service";export*from"./scripts/services/export/excel/services-export-excel.service";export*from"./scripts/statics/alignment/statics.alignment.static";export*from"./scripts/statics/colors/statics.color.static";export*from"./scripts/statics/fonts/statics.font.static";export*from"./scripts/core/services/browser/core-services-browser.interface";export*from"./scripts/core/services/combobox/core-services-combobox.interface";export*from"./scripts/core/services/date/core-services-date.interface";export*from"./scripts/core/services/date/core-services-date.interface";export*from"./scripts/core/services/elements/core-services-elements.interface";export*from"./scripts/core/services/input/core-services-input.interface";export*from"./scripts/core/services/internationalization/core-services-internationalization.interface";export*from"./scripts/core/services/menu/core-services-menu.interfaces";export*from"./scripts/core/services/string/core-services-string-interface";export*from"./scripts/services/export/excel/services-export-excel.interface";export*from"./scripts/statics/alignment/statics.alignment.interface";export*from"./scripts/statics/colors/statics.color.interface";export*from"./scripts/statics/fonts/statics.font.interface";
export*from"./scripts/core/services/array/core-services-array.service";export*from"./scripts/core/services/attachment/core-services-attachment.service";export*from"./scripts/core/services/browser/core-services-browser.service";export*from"./scripts/core/services/combobox/core-services-combobox.service";export*from"./scripts/core/services/date/core-services-date.service";export*from"./scripts/core/services/data/core-services-data.service";export*from"./scripts/core/services/elements/core-services-elements.service";export*from"./scripts/core/services/image/core-services-image.service";export*from"./scripts/core/services/input/core-services-input.service";export*from"./scripts/core/services/internationalization/core-services-internationalization.service";export*from"./scripts/core/services/string/core-services-string.service";export*from"./scripts/core/services/url/core-services-url.service";export*from"./scripts/services/export/excel/services-export-excel.service";export*from"./scripts/statics/alignment/statics.alignment.static";export*from"./scripts/statics/colors/statics.color.static";export*from"./scripts/statics/fonts/statics.font.static";export*from"./scripts/core/services/browser/core-services-browser.interface";export*from"./scripts/core/services/combobox/core-services-combobox.interface";export*from"./scripts/core/services/date/core-services-date.interface";export*from"./scripts/core/services/elements/core-services-elements.interface";export*from"./scripts/core/services/input/core-services-input.interface";export*from"./scripts/core/services/internationalization/core-services-internationalization.interface";export*from"./scripts/core/services/menu/core-services-menu.interfaces";export*from"./scripts/core/services/string/core-services-string-interface";export*from"./scripts/services/export/excel/services-export-excel.interface";export*from"./scripts/statics/alignment/statics.alignment.interface";export*from"./scripts/statics/colors/statics.color.interface";export*from"./scripts/statics/fonts/statics.font.interface";

@@ -1,2 +0,3 @@

export declare type IExcelFileName = string | null;
export declare type TExcelFileName = string | null;
export declare type TExcelExport = 'Single' | 'Multiple';
export interface IExcelResult {

@@ -6,1 +7,20 @@ code: number;

}
export interface IExcelExportSingleArray {
userData: any[];
sheetName: string;
fileName: string;
}
export interface IExcelExportMultipleArray {
data: IArrayMatrixToExcel[];
fileName?: TExcelFileName;
}
export interface IExcelJsonToFileProps {
Title: string;
Author: string;
Company: string;
Category: string;
}
export interface IArrayMatrixToExcel {
content: any[];
sheetName: string;
}
import { Subject } from 'rxjs';
import { IArrayMatrixToExcel, TExcelFileName, IExcelJsonToFileProps } from './services-export-excel.interface';
declare class Core {
excelFileToJson(file: File, sheet?: number): Promise<object>;
jsonToFile(userData: any[], sheetName: string, fileName: string, properties: IExcelJsonToFileProps): Promise<File>;
}
export declare const ExcelCore: Core;
export declare const ExcelConversor: Core;
declare class Export {
status$: Subject<string>;
exportDatabase(userData: any[], sheetName: string, fileName: string): Promise<string>;
exportMultipleDatabase(data: IArrayMatrixToExcel[], fileName?: TExcelFileName): Promise<string>;
private static saveFile;
exportDatabase(userData: any[], sheetName: string, fileName: string, firstSheet?: boolean): Promise<string>;
private static saveFileFromMultiple;
private exportExcel;
private clearSubject;

@@ -11,0 +16,0 @@ }

@@ -13,2 +13,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { DateGet } from '../../../core/services/date/core-services-date.service';
import { DataConversor } from '../../../core/services/data/core-services-data.service';
class Core {

@@ -26,6 +27,3 @@ excelFileToJson(file, sheet = 0) {

const workbookName = workbook.SheetNames[sheet];
const json = Excel.utils.sheet_to_json(workbook.Sheets[workbookName], {
blankrows: false,
header: 'A'
});
const json = Excel.utils.sheet_to_json(workbook.Sheets[workbookName]);
resolve(json);

@@ -36,4 +34,31 @@ };

}
jsonToFile(userData, sheetName, fileName, properties) {
return new Promise(resolve => {
const currentDate = DateGet.currentDateString('YYYYMMDD_HHmmss');
const _fileName = fileName == null ? `Export ${currentDate}` : `${fileName}`;
const fileNameWidthDate = `${_fileName} ${currentDate}.xlsx`;
const ws = Excel.utils.json_to_sheet(userData);
const wb = Excel.utils.book_new();
Excel.utils.book_append_sheet(wb, ws, 'Base');
const file = Excel.write(wb, {
Props: {
Title: properties.Title,
Author: properties.Author,
Company: properties.Company,
Category: properties.Category
},
bookType: 'xlsx',
type: 'binary'
});
const type = 'application/octet-stream';
const content = new Blob([DataConversor.binaryStringToArrayBuffer(file)], { type });
const excelFile = new File([content], fileNameWidthDate, {
lastModified: new Date().getMilliseconds(),
type
});
resolve(excelFile);
});
}
}
export const ExcelCore = new Core();
export const ExcelConversor = new Core();
class Export {

@@ -43,2 +68,19 @@ constructor() {

}
exportDatabase(userData, sheetName, fileName) {
const single = { userData, fileName, sheetName };
const multiple = {
data: [],
fileName: ''
};
return this.exportExcel('Single', single, multiple);
}
exportMultipleDatabase(data, fileName = null) {
const single = {
userData: [],
fileName: '',
sheetName: ''
};
const multiple = { data, fileName };
return this.exportExcel('Multiple', single, multiple);
}
static saveFile(content, sheetName, _fileName = null) {

@@ -57,15 +99,38 @@ return __awaiter(this, void 0, void 0, function* () {

}
exportDatabase(userData, sheetName, fileName, firstSheet = true) {
this.status$.next('Criando planilha do Excel...');
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
const result = yield Export.saveFile(userData, sheetName, fileName);
this.status$.next(result.message);
if (result.code === 200) {
resolve(result.message);
static saveFileFromMultiple(data, fileName = null) {
return __awaiter(this, void 0, void 0, function* () {
const currentDate = DateGet.currentDateString('YYYYMMDD_HHmmss');
const currentFileName = fileName == null ? `Export ${currentDate}` : `${fileName}`;
const fileNameWidthDate = `${currentFileName} ${currentDate}.xlsx`;
const wb = Excel.utils.book_new();
for (const sheet of data) {
const ws = Excel.utils.json_to_sheet(sheet.content);
Excel.utils.book_append_sheet(wb, ws, sheet.sheetName);
}
else {
throw new Error(result.message);
}
}));
yield Excel.writeFile(wb, fileNameWidthDate, { cellStyles: true });
ExportExcel.clearSubject();
return { code: 200, message: 'File saved successfully' };
});
}
exportExcel(type, singleData, multipleData) {
return __awaiter(this, void 0, void 0, function* () {
this.status$.next('Creating Excel workbook...');
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
let result;
if (type === 'Single') {
result = yield Export.saveFile(singleData.userData, singleData.sheetName, singleData.fileName);
}
else {
result = yield Export.saveFileFromMultiple(multipleData.data, multipleData.fileName);
}
this.status$.next(result.message);
if (result.code === 200) {
resolve(result.message);
}
else {
throw new Error(result.message);
}
}));
});
}
clearSubject() {

@@ -72,0 +137,0 @@ this.status$.observers.map(x => x.complete());

@@ -1,1 +0,1 @@

var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};import{Subject}from"rxjs";import*as Excel from"xlsx";import{DateGet}from"../../../core/services/date/core-services-date.service";class Core{excelFileToJson(file,sheet=0){return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){const fileArray=yield file.arrayBuffer();const reader=new FileReader;reader.onload=e=>{const data=new Uint8Array(fileArray);const workbook=Excel.read(data,{type:"array",sheets:sheet});const workbookName=workbook.SheetNames[sheet];const json=Excel.utils.sheet_to_json(workbook.Sheets[workbookName],{blankrows:false,header:"A"});resolve(json)};reader.readAsArrayBuffer(file)})))}}export const ExcelCore=new Core;class Export{constructor(){this.status$=new Subject}static saveFile(content,sheetName,_fileName=null){return __awaiter(this,void 0,void 0,(function*(){const currentDate=DateGet.currentDateString("YYYYMMDD_HHmmss");const fileName=_fileName==null?`Export ${currentDate}`:`${_fileName}`;const fileNameWidthDate=`${fileName} ${currentDate}.xlsx`;const ws=Excel.utils.json_to_sheet(content);const wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);yield Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true});ExportExcel.clearSubject();return{code:200,message:"File saved successfully"}}))}exportDatabase(userData,sheetName,fileName,firstSheet=true){this.status$.next("Criando planilha do Excel...");return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){const result=yield Export.saveFile(userData,sheetName,fileName);this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}})))}clearSubject(){this.status$.observers.map(x=>x.complete())}}export const ExportExcel=new Export;
var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};import{Subject}from"rxjs";import*as Excel from"xlsx";import{DateGet}from"../../../core/services/date/core-services-date.service";import{DataConversor}from"../../../core/services/data/core-services-data.service";class Core{excelFileToJson(file,sheet=0){return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){const fileArray=yield file.arrayBuffer();const reader=new FileReader;reader.onload=e=>{const data=new Uint8Array(fileArray);const workbook=Excel.read(data,{type:"array",sheets:sheet});const workbookName=workbook.SheetNames[sheet];const json=Excel.utils.sheet_to_json(workbook.Sheets[workbookName]);resolve(json)};reader.readAsArrayBuffer(file)})))}jsonToFile(userData,sheetName,fileName,properties){return new Promise(resolve=>{const currentDate=DateGet.currentDateString("YYYYMMDD_HHmmss");const _fileName=fileName==null?`Export ${currentDate}`:`${fileName}`;const fileNameWidthDate=`${_fileName} ${currentDate}.xlsx`;const ws=Excel.utils.json_to_sheet(userData);const wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,"Base");const file=Excel.write(wb,{Props:{Title:properties.Title,Author:properties.Author,Company:properties.Company,Category:properties.Category},bookType:"xlsx",type:"binary"});const type="application/octet-stream";const content=new Blob([DataConversor.binaryStringToArrayBuffer(file)],{type:type});const excelFile=new File([content],fileNameWidthDate,{lastModified:(new Date).getMilliseconds(),type:type});resolve(excelFile)})}}export const ExcelConversor=new Core;class Export{constructor(){this.status$=new Subject}exportDatabase(userData,sheetName,fileName){const single={userData:userData,fileName:fileName,sheetName:sheetName};const multiple={data:[],fileName:""};return this.exportExcel("Single",single,multiple)}exportMultipleDatabase(data,fileName=null){const single={userData:[],fileName:"",sheetName:""};const multiple={data:data,fileName:fileName};return this.exportExcel("Multiple",single,multiple)}static saveFile(content,sheetName,_fileName=null){return __awaiter(this,void 0,void 0,(function*(){const currentDate=DateGet.currentDateString("YYYYMMDD_HHmmss");const fileName=_fileName==null?`Export ${currentDate}`:`${_fileName}`;const fileNameWidthDate=`${fileName} ${currentDate}.xlsx`;const ws=Excel.utils.json_to_sheet(content);const wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);yield Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true});ExportExcel.clearSubject();return{code:200,message:"File saved successfully"}}))}static saveFileFromMultiple(data,fileName=null){return __awaiter(this,void 0,void 0,(function*(){const currentDate=DateGet.currentDateString("YYYYMMDD_HHmmss");const currentFileName=fileName==null?`Export ${currentDate}`:`${fileName}`;const fileNameWidthDate=`${currentFileName} ${currentDate}.xlsx`;const wb=Excel.utils.book_new();for(const sheet of data){const ws=Excel.utils.json_to_sheet(sheet.content);Excel.utils.book_append_sheet(wb,ws,sheet.sheetName)}yield Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true});ExportExcel.clearSubject();return{code:200,message:"File saved successfully"}}))}exportExcel(type,singleData,multipleData){return __awaiter(this,void 0,void 0,(function*(){this.status$.next("Creating Excel workbook...");return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){let result;if(type==="Single"){result=yield Export.saveFile(singleData.userData,singleData.sheetName,singleData.fileName)}else{result=yield Export.saveFileFromMultiple(multipleData.data,multipleData.fileName)}this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}})))}))}clearSubject(){this.status$.observers.map(x=>x.complete())}}export const ExportExcel=new Export;
{
"name": "gl-w-frontend",
"version": "2.2.1",
"version": "2.3.0",
"description": "Common code for using among web front-end development such as ES6+ and TypeScript",

@@ -5,0 +5,0 @@ "main": "lib/bundle.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc