gemcap-be-common 1.4.62 → 1.4.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,6 +29,21 @@ export interface IExcelJsCell {
|
|
|
29
29
|
border?: Partial<ExcelJS.Borders>;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
export declare const cellStyles: {
|
|
33
|
+
title: {
|
|
34
|
+
font: {
|
|
35
|
+
bold: boolean;
|
|
36
|
+
};
|
|
37
|
+
border: {
|
|
38
|
+
bottom: {
|
|
39
|
+
style: ExcelJS.BorderStyle;
|
|
40
|
+
color: {
|
|
41
|
+
argb: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
32
47
|
export declare const convertDataToFile: (dataToConvert: {
|
|
33
48
|
[sheetName: string]: any[];
|
|
34
49
|
}[]) => Promise<any>;
|
|
@@ -63,3 +78,9 @@ export declare const convertDataToFileWithStyle: (dataToConvert: {
|
|
|
63
78
|
export declare const addHeaderToData: (header: {
|
|
64
79
|
[key: string]: string;
|
|
65
80
|
}, data: object[]) => {}[];
|
|
81
|
+
export declare const getColumnsWidths: (sheetNames: string[], columnWidth: {
|
|
82
|
+
[columnLetter: string]: number;
|
|
83
|
+
}) => {};
|
|
84
|
+
export declare const getSheetsOptions: (sheetNames: string[], options: {
|
|
85
|
+
showGridLines: boolean;
|
|
86
|
+
}) => {};
|
package/helpers/excel.helper.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.addHeaderToData = exports.convertDataToFileWithStyle = exports.convertDataToFileWithStyleOld = exports.convertDataToFile = exports.NUMBER_FORMATS = void 0;
|
|
29
|
+
exports.getSheetsOptions = exports.getColumnsWidths = exports.addHeaderToData = exports.convertDataToFileWithStyle = exports.convertDataToFileWithStyleOld = exports.convertDataToFile = exports.cellStyles = exports.NUMBER_FORMATS = void 0;
|
|
30
30
|
const XLSX = __importStar(require("xlsx"));
|
|
31
31
|
const XLSXStyle = __importStar(require("xlsx-js-style"));
|
|
32
32
|
const exceljs_1 = __importDefault(require("exceljs"));
|
|
@@ -42,6 +42,14 @@ exports.NUMBER_FORMATS = {
|
|
|
42
42
|
currencyFull$: '$#,##0.00',
|
|
43
43
|
currencyShort$: '$#,##0',
|
|
44
44
|
};
|
|
45
|
+
exports.cellStyles = {
|
|
46
|
+
title: {
|
|
47
|
+
font: { bold: true },
|
|
48
|
+
border: {
|
|
49
|
+
bottom: { style: 'medium', color: { argb: 'FF000000' } },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
45
53
|
const defaultColumnWidth = 20;
|
|
46
54
|
const convertDataToFile = async (dataToConvert) => {
|
|
47
55
|
const wb = XLSX.utils.book_new();
|
|
@@ -229,3 +237,19 @@ const addHeaderToData = (header, data) => {
|
|
|
229
237
|
return [header, ...processedItems];
|
|
230
238
|
};
|
|
231
239
|
exports.addHeaderToData = addHeaderToData;
|
|
240
|
+
const getColumnsWidths = (sheetNames, columnWidth) => {
|
|
241
|
+
return sheetNames.reduce((acc, sheetName) => {
|
|
242
|
+
return {
|
|
243
|
+
...acc,
|
|
244
|
+
[sheetName]: columnWidth,
|
|
245
|
+
};
|
|
246
|
+
}, {});
|
|
247
|
+
};
|
|
248
|
+
exports.getColumnsWidths = getColumnsWidths;
|
|
249
|
+
const getSheetsOptions = (sheetNames, options) => {
|
|
250
|
+
return sheetNames.reduce((acc, sheetName) => ({
|
|
251
|
+
...acc,
|
|
252
|
+
[sheetName]: options,
|
|
253
|
+
}), {});
|
|
254
|
+
};
|
|
255
|
+
exports.getSheetsOptions = getSheetsOptions;
|
package/helpers/excel.helper.ts
CHANGED
|
@@ -34,6 +34,15 @@ export interface IExcelJsCell {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export const cellStyles = {
|
|
38
|
+
title: {
|
|
39
|
+
font: { bold: true },
|
|
40
|
+
border: {
|
|
41
|
+
bottom: { style: 'medium' as ExcelJS.BorderStyle, color: { argb: 'FF000000' } },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
37
46
|
const defaultColumnWidth = 20;
|
|
38
47
|
|
|
39
48
|
export const convertDataToFile = async (dataToConvert: { [sheetName: string]: any[] }[]) => {
|
|
@@ -109,7 +118,7 @@ const checkData = (dataToConvert: { [sheetName: string]: IExcelDataCellWithStyle
|
|
|
109
118
|
});
|
|
110
119
|
});
|
|
111
120
|
}
|
|
112
|
-
}
|
|
121
|
+
};
|
|
113
122
|
|
|
114
123
|
export const convertDataToFileWithStyleOld = async (
|
|
115
124
|
dataToConvert: { [sheetName: string]: IExcelDataCellWithStyles[][] },
|
|
@@ -260,4 +269,23 @@ export const addHeaderToData = (header: { [key: string]: string }, data: object[
|
|
|
260
269
|
};
|
|
261
270
|
const processedItems = data.map(filterAndReorder);
|
|
262
271
|
return [header, ...processedItems];
|
|
263
|
-
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export const getColumnsWidths = (sheetNames: string[], columnWidth: { [columnLetter: string]: number }) => {
|
|
275
|
+
return sheetNames.reduce((acc, sheetName) => {
|
|
276
|
+
return {
|
|
277
|
+
...acc,
|
|
278
|
+
[sheetName]: columnWidth,
|
|
279
|
+
};
|
|
280
|
+
}, {});
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export const getSheetsOptions = (sheetNames: string[], options: { showGridLines: boolean }) => {
|
|
284
|
+
return sheetNames.reduce(
|
|
285
|
+
(acc, sheetName) => ({
|
|
286
|
+
...acc,
|
|
287
|
+
[sheetName]: options,
|
|
288
|
+
}),
|
|
289
|
+
{},
|
|
290
|
+
);
|
|
291
|
+
};
|
|
@@ -103,7 +103,7 @@ export declare const sharepointFoldersDictionary: {
|
|
|
103
103
|
export type TSharepointFolderKey = keyof typeof sharepointFoldersDictionary;
|
|
104
104
|
export type TSharepointFolderValue = typeof sharepointFoldersDictionary[TSharepointFolderKey];
|
|
105
105
|
export type TSharepointFolder = typeof sharepointFoldersDictionary[TSharepointFolderKey];
|
|
106
|
-
declare enum EProspectPriority {
|
|
106
|
+
export declare enum EProspectPriority {
|
|
107
107
|
LOW = "LOW",
|
|
108
108
|
MEDIUM = "MEDIUM",
|
|
109
109
|
HIGH = "HIGH"
|
package/models/Prospect.model.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Prospect = exports.ProspectSchema = exports.ProspectValidationSchema = exports.ProspectInfoValidationSchema = exports.ProspectInfoExternalValidationSchema = exports.baseFields = exports.externalProspectInitialInfo = exports.initialFileGroups = exports.NO_ROW_ID = exports.prospectFileGroupsMap = exports.prospectFileGroups = exports.EProspectFileGroups = exports.EProspectDeclineReason = exports.EProspectStatusDict = exports.EProspectStatus = exports.sharepointFoldersDictionary = exports.prospectFieldsDictionary = void 0;
|
|
6
|
+
exports.Prospect = exports.ProspectSchema = exports.ProspectValidationSchema = exports.ProspectInfoValidationSchema = exports.ProspectInfoExternalValidationSchema = exports.baseFields = exports.externalProspectInitialInfo = exports.initialFileGroups = exports.NO_ROW_ID = exports.prospectFileGroupsMap = exports.prospectFileGroups = exports.EProspectFileGroups = exports.EProspectDeclineReason = exports.EProspectStatusDict = exports.EProspectStatus = exports.EProspectPriority = exports.sharepointFoldersDictionary = exports.prospectFieldsDictionary = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const joi_1 = __importDefault(require("joi"));
|
|
9
9
|
const _models_1 = require("./_models");
|
|
@@ -136,7 +136,7 @@ var EProspectPriority;
|
|
|
136
136
|
EProspectPriority["LOW"] = "LOW";
|
|
137
137
|
EProspectPriority["MEDIUM"] = "MEDIUM";
|
|
138
138
|
EProspectPriority["HIGH"] = "HIGH";
|
|
139
|
-
})(EProspectPriority || (EProspectPriority = {}));
|
|
139
|
+
})(EProspectPriority || (exports.EProspectPriority = EProspectPriority = {}));
|
|
140
140
|
var EProspectStatus;
|
|
141
141
|
(function (EProspectStatus) {
|
|
142
142
|
EProspectStatus["PROSPECT"] = "PROSPECT";
|
package/models/Prospect.model.ts
CHANGED
|
@@ -153,7 +153,7 @@ export type TSharepointFolderKey = keyof typeof sharepointFoldersDictionary;
|
|
|
153
153
|
export type TSharepointFolderValue = typeof sharepointFoldersDictionary[TSharepointFolderKey];
|
|
154
154
|
export type TSharepointFolder = typeof sharepointFoldersDictionary[TSharepointFolderKey];
|
|
155
155
|
|
|
156
|
-
enum EProspectPriority {
|
|
156
|
+
export enum EProspectPriority {
|
|
157
157
|
LOW = 'LOW',
|
|
158
158
|
MEDIUM = 'MEDIUM',
|
|
159
159
|
HIGH = 'HIGH',
|