identity-admin 1.26.20 → 1.26.23
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.
- package/lib/assets/Amiri-Regular.ttf +0 -0
- package/lib/helpers/LocalizedStringHelper.d.ts +1 -1
- package/lib/helpers/LocalizedStringHelper.js +1 -1
- package/lib/helpers/ReportsGenerator.d.ts +1 -0
- package/lib/helpers/ReportsGenerator.js +30 -1
- package/lib/types/IResourceFile.d.ts +5 -0
- package/lib/types/helpers.d.ts +1 -3
- package/lib/types/helpers.js +0 -2
- package/package.json +2 -1
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IResourceFile } from
|
|
1
|
+
import { IResourceFile } from '../types/IResourceFile';
|
|
2
2
|
export default class LocalizedStringHelper {
|
|
3
3
|
static mapLocalizableString(recordParams: any, resource: IResourceFile): any;
|
|
4
4
|
private static getArrayOfLanguages;
|
|
@@ -18,4 +18,5 @@ export default class ReportsGenerator {
|
|
|
18
18
|
static CreatePdfFile(columns: Columns[], data: any[], name: string): Promise<Buffer>;
|
|
19
19
|
static getRows(columns: Columns[], data: any[]): any[][];
|
|
20
20
|
static getFieldValue(field: Columns, row: any): any;
|
|
21
|
+
static checkLocalizedStringExistence(columns: Columns[]): boolean;
|
|
21
22
|
}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,6 +40,7 @@ const node_xlsx_1 = __importDefault(require("node-xlsx"));
|
|
|
17
40
|
const lodash_1 = require("lodash");
|
|
18
41
|
const helpers_1 = require("../types/helpers");
|
|
19
42
|
const pdfjs_1 = __importDefault(require("pdfjs"));
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
20
44
|
var Languages;
|
|
21
45
|
(function (Languages) {
|
|
22
46
|
Languages["ARABIC"] = "ar";
|
|
@@ -39,9 +63,11 @@ class ReportsGenerator {
|
|
|
39
63
|
static CreatePdfFile(columns, data, name) {
|
|
40
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
65
|
const rows = this.getRows(columns, data);
|
|
66
|
+
const ArabicFont = new pdfjs_1.default.Font(fs.readFileSync(__dirname + '/../assets/Amiri-Regular.ttf'));
|
|
67
|
+
const localizedStringIsExisted = this.checkLocalizedStringExistence(columns);
|
|
42
68
|
const doc = new pdfjs_1.default.Document({
|
|
43
69
|
width: 861.12,
|
|
44
|
-
font: require('pdfjs/font/Helvetica'),
|
|
70
|
+
font: localizedStringIsExisted ? ArabicFont : require('pdfjs/font/Helvetica'),
|
|
45
71
|
});
|
|
46
72
|
const table = doc.table({
|
|
47
73
|
widths: columns.map((column) => '*'),
|
|
@@ -79,5 +105,8 @@ class ReportsGenerator {
|
|
|
79
105
|
return (0, lodash_1.get)(row, field.value);
|
|
80
106
|
}
|
|
81
107
|
}
|
|
108
|
+
static checkLocalizedStringExistence(columns) {
|
|
109
|
+
return columns.some((column) => column.type === helpers_1.FieldTypes.LOCALIZEDSTRING);
|
|
110
|
+
}
|
|
82
111
|
}
|
|
83
112
|
exports.default = ReportsGenerator;
|
|
@@ -361,6 +361,11 @@ export interface IFieldValue {
|
|
|
361
361
|
* @default false
|
|
362
362
|
*/
|
|
363
363
|
enableCreateNewButtonOnReference?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Used only with text field types like Text field or Localized string
|
|
366
|
+
* @default false
|
|
367
|
+
*/
|
|
368
|
+
textArea?: boolean;
|
|
364
369
|
}
|
|
365
370
|
export interface IVirtualValue {
|
|
366
371
|
/**
|
package/lib/types/helpers.d.ts
CHANGED
|
@@ -36,9 +36,7 @@ export declare enum FieldTypes {
|
|
|
36
36
|
RICH_TEXT_I = "RICH_TEXT_I",
|
|
37
37
|
RICH_TEXT_II = "RICH_TEXT_II",
|
|
38
38
|
EXTERNAL_LINK = "EXTERNAL_LINK",
|
|
39
|
-
MULTIPLE_TEXT = "MULTIPLE_TEXT"
|
|
40
|
-
TEXT_AREA = "TEXT_AREA",
|
|
41
|
-
LOCALIZED_TEXT_AREA = "LOCALIZED_TEXT_AREA"
|
|
39
|
+
MULTIPLE_TEXT = "MULTIPLE_TEXT"
|
|
42
40
|
}
|
|
43
41
|
export declare enum FileTypes {
|
|
44
42
|
ALL = "ALL",
|
package/lib/types/helpers.js
CHANGED
|
@@ -44,8 +44,6 @@ var FieldTypes;
|
|
|
44
44
|
FieldTypes["RICH_TEXT_II"] = "RICH_TEXT_II";
|
|
45
45
|
FieldTypes["EXTERNAL_LINK"] = "EXTERNAL_LINK";
|
|
46
46
|
FieldTypes["MULTIPLE_TEXT"] = "MULTIPLE_TEXT";
|
|
47
|
-
FieldTypes["TEXT_AREA"] = "TEXT_AREA";
|
|
48
|
-
FieldTypes["LOCALIZED_TEXT_AREA"] = "LOCALIZED_TEXT_AREA";
|
|
49
47
|
})(FieldTypes = exports.FieldTypes || (exports.FieldTypes = {}));
|
|
50
48
|
var FileTypes;
|
|
51
49
|
(function (FileTypes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "identity-admin",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/Dashboard.js",
|
|
6
6
|
"types": "lib/Dashbord.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@types/mongoose": "^5.11.97",
|
|
31
31
|
"@types/passport-local-mongoose": "^6.1.1",
|
|
32
32
|
"@types/react": "^18.2.45",
|
|
33
|
+
"copyfiles": "^2.4.1",
|
|
33
34
|
"express": "^4.18.1",
|
|
34
35
|
"express-validator": "^6.14.2",
|
|
35
36
|
"i18n": "^0.15.0",
|