@webilix/nestjs-helper
Version:
Helper library for NestJS
46 lines • 2.7 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var ExportModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExportModule = void 0;
const common_1 = require("@nestjs/common");
const helper_library_1 = require("@webilix/helper-library");
const providers_1 = require("./providers");
const export_service_1 = require("./export.service");
let ExportModule = ExportModule_1 = class ExportModule {
static register(config) {
const getColor = (color, base) => (helper_library_1.Helper.COLOR.toHEX(helper_library_1.Helper.IS.STRING.color(color) ? color || base : base) || base).substring(1);
config = {
path: (config === null || config === void 0 ? void 0 : config.path) || '.export',
fontFA: (config === null || config === void 0 ? void 0 : config.fontFA) || 'IRANYekan',
fontEN: (config === null || config === void 0 ? void 0 : config.fontEN) || 'Arial',
backgroundColor: getColor(config === null || config === void 0 ? void 0 : config.backgroundColor, '#1D5B74'),
foregroundColor: getColor(config === null || config === void 0 ? void 0 : config.foregroundColor, '#FFFFFF'),
textColor: getColor(config === null || config === void 0 ? void 0 : config.textColor, '#000000'),
logo: (config === null || config === void 0 ? void 0 : config.logo) || undefined,
gotenberg: (config === null || config === void 0 ? void 0 : config.gotenberg) || undefined,
};
return {
module: ExportModule_1,
providers: [
{ provide: 'EXPORT_CONFIG', useValue: config },
export_service_1.ExportService,
providers_1.ExportCsvService,
providers_1.ExportExcelService,
providers_1.ExportPathService,
providers_1.ExportWordService,
],
exports: [export_service_1.ExportService],
};
}
};
exports.ExportModule = ExportModule;
exports.ExportModule = ExportModule = ExportModule_1 = __decorate([
(0, common_1.Module)({})
], ExportModule);
//# sourceMappingURL=export.module.js.map