tnx-shared 5.3.266 → 5.3.268
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/bundles/tnx-shared.umd.js +180 -1
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/classes/form-schema.d.ts +1 -0
- package/classes/form-schema.d.ts.map +1 -1
- package/components/entity-picker/entity-picker.component.d.ts.map +1 -1
- package/esm2015/classes/form-schema.js +2 -1
- package/esm2015/components/entity-picker/entity-picker.component.js +2 -1
- package/esm2015/components/html-preview/html-preview.component.js +2 -2
- package/esm2015/public-api.js +2 -1
- package/esm2015/services/common.service.js +11 -1
- package/esm2015/services/latex.service.js +105 -0
- package/fesm2015/tnx-shared.js +110 -2
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
- package/public-api.d.ts.map +1 -1
- package/services/common.service.d.ts +1 -0
- package/services/common.service.d.ts.map +1 -1
- package/services/latex.service.d.ts +11 -0
- package/services/latex.service.d.ts.map +1 -0
- package/services/latex.service.ngfactory.d.ts.map +1 -0
- package/tnx-shared.metadata.json +1 -1
|
@@ -1651,6 +1651,7 @@
|
|
|
1651
1651
|
_this.ignoreWorkflow = false;
|
|
1652
1652
|
_this.rowButtonTemplate = null;
|
|
1653
1653
|
_this.rowButtonBeforeTemplate = null;
|
|
1654
|
+
_this.hiddenPageSetting = false;
|
|
1654
1655
|
for (var key in init) {
|
|
1655
1656
|
_this[key] = init[key];
|
|
1656
1657
|
}
|
|
@@ -4864,6 +4865,16 @@
|
|
|
4864
4865
|
var diff = (maxLength < stringIndex.length) ? 0 : maxLength - stringIndex.length;
|
|
4865
4866
|
return "" + Array(diff).map(function (x) { return ''; }).join(' ') + stringIndex;
|
|
4866
4867
|
};
|
|
4868
|
+
CommonService.prototype.dataURItoBlob = function (dataURI) {
|
|
4869
|
+
var byteString = window.atob(dataURI);
|
|
4870
|
+
var arrayBuffer = new ArrayBuffer(byteString.length);
|
|
4871
|
+
var int8Array = new Uint8Array(arrayBuffer);
|
|
4872
|
+
for (var i = 0; i < byteString.length; i++) {
|
|
4873
|
+
int8Array[i] = byteString.charCodeAt(i);
|
|
4874
|
+
}
|
|
4875
|
+
var blob = new Blob([int8Array], { type: 'image/png' });
|
|
4876
|
+
return blob;
|
|
4877
|
+
};
|
|
4867
4878
|
return CommonService;
|
|
4868
4879
|
}());
|
|
4869
4880
|
CommonService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CommonService_Factory() { return new CommonService(i0__namespace.ɵɵinject(ModuleConfigService)); }, token: CommonService, providedIn: "root" });
|
|
@@ -42512,6 +42523,172 @@
|
|
|
42512
42523
|
{ type: NotifierService }
|
|
42513
42524
|
]; };
|
|
42514
42525
|
|
|
42526
|
+
var LatexService = /** @class */ (function () {
|
|
42527
|
+
function LatexService(_commonService, _templateInstanceService, _fileObjectService) {
|
|
42528
|
+
this._commonService = _commonService;
|
|
42529
|
+
this._templateInstanceService = _templateInstanceService;
|
|
42530
|
+
this._fileObjectService = _fileObjectService;
|
|
42531
|
+
}
|
|
42532
|
+
// replace latex to image
|
|
42533
|
+
LatexService.prototype.replaceLatexData = function (data, oldData, fields, fontSize, ignoreCheckEdited) {
|
|
42534
|
+
if (ignoreCheckEdited === void 0) { ignoreCheckEdited = false; }
|
|
42535
|
+
var _a;
|
|
42536
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42537
|
+
var fields_1, fields_1_1, field, pattern, patternChild, temp, lstLatex, lstLatexDistint, _loop_1, this_1, lstLatexDistint_1, lstLatexDistint_1_1, latexItem, state_1, e_1_1, e_2_1, _b_1;
|
|
42538
|
+
var e_2, _c, e_1, _d;
|
|
42539
|
+
return __generator(this, function (_e) {
|
|
42540
|
+
switch (_e.label) {
|
|
42541
|
+
case 0:
|
|
42542
|
+
_e.trys.push([0, 16, , 17]);
|
|
42543
|
+
_e.label = 1;
|
|
42544
|
+
case 1:
|
|
42545
|
+
_e.trys.push([1, 13, 14, 15]);
|
|
42546
|
+
fields_1 = __values(fields), fields_1_1 = fields_1.next();
|
|
42547
|
+
_e.label = 2;
|
|
42548
|
+
case 2:
|
|
42549
|
+
if (!!fields_1_1.done) return [3 /*break*/, 12];
|
|
42550
|
+
field = fields_1_1.value;
|
|
42551
|
+
pattern = /\\\(.*?\\\)|\$\$.*?\$\$|\$.*?\$|\\\[.*?\\\]/gm;
|
|
42552
|
+
patternChild = /\\\(|\\\)|\$\$|\$\$|\$|\$|\\\[|\\\]/gm;
|
|
42553
|
+
if (!(data[field] && data[field] != oldData[field] || ignoreCheckEdited)) return [3 /*break*/, 11];
|
|
42554
|
+
temp = data[field];
|
|
42555
|
+
lstLatex = data[field].match(pattern);
|
|
42556
|
+
lstLatexDistint = lstLatex === null || lstLatex === void 0 ? void 0 : lstLatex.filter(function (current, index, self) { return self.indexOf(current) === index; });
|
|
42557
|
+
if (!(lstLatexDistint === null || lstLatexDistint === void 0 ? void 0 : lstLatexDistint.length)) {
|
|
42558
|
+
data[field + 'Print'] = temp;
|
|
42559
|
+
return [3 /*break*/, 11];
|
|
42560
|
+
}
|
|
42561
|
+
_loop_1 = function (latexItem) {
|
|
42562
|
+
var latex, base64, imageName, imageBlob, imageFile, uploadFile, preIndex, lstLatexSame, i, index, alignCenter, image, lastIndexOfParagraph, styleIndex;
|
|
42563
|
+
return __generator(this, function (_f) {
|
|
42564
|
+
switch (_f.label) {
|
|
42565
|
+
case 0:
|
|
42566
|
+
latex = latexItem.replace(patternChild, '');
|
|
42567
|
+
return [4 /*yield*/, this_1._templateInstanceService.laTexToBase64Image(latex, fontSize)];
|
|
42568
|
+
case 1:
|
|
42569
|
+
base64 = _f.sent();
|
|
42570
|
+
if (!base64.success) {
|
|
42571
|
+
return [2 /*return*/, { value: false }];
|
|
42572
|
+
}
|
|
42573
|
+
imageName = 'latex.png';
|
|
42574
|
+
imageBlob = this_1._commonService.dataURItoBlob(base64.data.replace('data:image/png;base64,', ''));
|
|
42575
|
+
imageFile = new File([imageBlob], imageName, { type: 'image/png' });
|
|
42576
|
+
return [4 /*yield*/, this_1._fileObjectService.uploadWithByteArray(imageFile)];
|
|
42577
|
+
case 2:
|
|
42578
|
+
uploadFile = _f.sent();
|
|
42579
|
+
if (!uploadFile) {
|
|
42580
|
+
return [2 /*return*/, { value: false }];
|
|
42581
|
+
}
|
|
42582
|
+
preIndex = temp.indexOf(latexItem);
|
|
42583
|
+
if (preIndex < 0) {
|
|
42584
|
+
return [2 /*return*/, "continue"];
|
|
42585
|
+
}
|
|
42586
|
+
lstLatexSame = lstLatex.filter(function (x) { return x == latexItem; });
|
|
42587
|
+
for (i = 0; i < lstLatexSame.length; i++) {
|
|
42588
|
+
index = temp.indexOf(latexItem, preIndex + i);
|
|
42589
|
+
alignCenter = ((_a = latexItem.match(/\$\$|\$\$|\\\[|\\\]/gm)) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
42590
|
+
image = "<img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" >";
|
|
42591
|
+
if (!fontSize) {
|
|
42592
|
+
image = "<img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" height=\"16.32px\">";
|
|
42593
|
+
}
|
|
42594
|
+
if (alignCenter) {
|
|
42595
|
+
lastIndexOfParagraph = temp.substring(0, index).lastIndexOf('<p');
|
|
42596
|
+
if (lastIndexOfParagraph < 0) {
|
|
42597
|
+
image = "<p style=\"text-align: center;\"><img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" ></p>";
|
|
42598
|
+
if (!fontSize) {
|
|
42599
|
+
image = "<p style=\"text-align: center;\"><img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" height=\"16.32px\" ></p>";
|
|
42600
|
+
}
|
|
42601
|
+
}
|
|
42602
|
+
else {
|
|
42603
|
+
image = "<img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" >";
|
|
42604
|
+
if (!fontSize) {
|
|
42605
|
+
image = "<img src=\"" + this_1._fileObjectService.getUrlImage(uploadFile) + "\" height=\"16.32px\" >";
|
|
42606
|
+
}
|
|
42607
|
+
styleIndex = temp.substring(0, index).lastIndexOf('<p style=');
|
|
42608
|
+
if (styleIndex < 0) {
|
|
42609
|
+
temp = temp.substring(0, lastIndexOfParagraph + 2) + ' style="text-align: center;"' + temp.substring(lastIndexOfParagraph + 2);
|
|
42610
|
+
}
|
|
42611
|
+
else {
|
|
42612
|
+
temp = temp.substring(0, styleIndex + 10) + 'text-align: center;' + temp.substring(styleIndex + 10);
|
|
42613
|
+
}
|
|
42614
|
+
}
|
|
42615
|
+
}
|
|
42616
|
+
index = temp.indexOf(latexItem);
|
|
42617
|
+
temp = temp.substring(0, index) + image + temp.substring(index + latexItem.length);
|
|
42618
|
+
}
|
|
42619
|
+
return [2 /*return*/];
|
|
42620
|
+
}
|
|
42621
|
+
});
|
|
42622
|
+
};
|
|
42623
|
+
this_1 = this;
|
|
42624
|
+
_e.label = 3;
|
|
42625
|
+
case 3:
|
|
42626
|
+
_e.trys.push([3, 8, 9, 10]);
|
|
42627
|
+
lstLatexDistint_1 = (e_1 = void 0, __values(lstLatexDistint)), lstLatexDistint_1_1 = lstLatexDistint_1.next();
|
|
42628
|
+
_e.label = 4;
|
|
42629
|
+
case 4:
|
|
42630
|
+
if (!!lstLatexDistint_1_1.done) return [3 /*break*/, 7];
|
|
42631
|
+
latexItem = lstLatexDistint_1_1.value;
|
|
42632
|
+
return [5 /*yield**/, _loop_1(latexItem)];
|
|
42633
|
+
case 5:
|
|
42634
|
+
state_1 = _e.sent();
|
|
42635
|
+
if (typeof state_1 === "object")
|
|
42636
|
+
return [2 /*return*/, state_1.value];
|
|
42637
|
+
_e.label = 6;
|
|
42638
|
+
case 6:
|
|
42639
|
+
lstLatexDistint_1_1 = lstLatexDistint_1.next();
|
|
42640
|
+
return [3 /*break*/, 4];
|
|
42641
|
+
case 7: return [3 /*break*/, 10];
|
|
42642
|
+
case 8:
|
|
42643
|
+
e_1_1 = _e.sent();
|
|
42644
|
+
e_1 = { error: e_1_1 };
|
|
42645
|
+
return [3 /*break*/, 10];
|
|
42646
|
+
case 9:
|
|
42647
|
+
try {
|
|
42648
|
+
if (lstLatexDistint_1_1 && !lstLatexDistint_1_1.done && (_d = lstLatexDistint_1.return)) _d.call(lstLatexDistint_1);
|
|
42649
|
+
}
|
|
42650
|
+
finally { if (e_1) throw e_1.error; }
|
|
42651
|
+
return [7 /*endfinally*/];
|
|
42652
|
+
case 10:
|
|
42653
|
+
data[field + 'Print'] = temp;
|
|
42654
|
+
_e.label = 11;
|
|
42655
|
+
case 11:
|
|
42656
|
+
fields_1_1 = fields_1.next();
|
|
42657
|
+
return [3 /*break*/, 2];
|
|
42658
|
+
case 12: return [3 /*break*/, 15];
|
|
42659
|
+
case 13:
|
|
42660
|
+
e_2_1 = _e.sent();
|
|
42661
|
+
e_2 = { error: e_2_1 };
|
|
42662
|
+
return [3 /*break*/, 15];
|
|
42663
|
+
case 14:
|
|
42664
|
+
try {
|
|
42665
|
+
if (fields_1_1 && !fields_1_1.done && (_c = fields_1.return)) _c.call(fields_1);
|
|
42666
|
+
}
|
|
42667
|
+
finally { if (e_2) throw e_2.error; }
|
|
42668
|
+
return [7 /*endfinally*/];
|
|
42669
|
+
case 15: return [2 /*return*/, true];
|
|
42670
|
+
case 16:
|
|
42671
|
+
_b_1 = _e.sent();
|
|
42672
|
+
return [2 /*return*/, false];
|
|
42673
|
+
case 17: return [2 /*return*/];
|
|
42674
|
+
}
|
|
42675
|
+
});
|
|
42676
|
+
});
|
|
42677
|
+
};
|
|
42678
|
+
return LatexService;
|
|
42679
|
+
}());
|
|
42680
|
+
LatexService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LatexService_Factory() { return new LatexService(i0__namespace.ɵɵinject(CommonService), i0__namespace.ɵɵinject(TemplateInstanceService), i0__namespace.ɵɵinject(FileObjectService)); }, token: LatexService, providedIn: "root" });
|
|
42681
|
+
LatexService.decorators = [
|
|
42682
|
+
{ type: i0.Injectable, args: [{
|
|
42683
|
+
providedIn: "root",
|
|
42684
|
+
},] }
|
|
42685
|
+
];
|
|
42686
|
+
LatexService.ctorParameters = function () { return [
|
|
42687
|
+
{ type: CommonService },
|
|
42688
|
+
{ type: TemplateInstanceService },
|
|
42689
|
+
{ type: FileObjectService }
|
|
42690
|
+
]; };
|
|
42691
|
+
|
|
42515
42692
|
var ItemStatus;
|
|
42516
42693
|
(function (ItemStatus) {
|
|
42517
42694
|
ItemStatus[ItemStatus["ChoDuyet"] = 0] = "ChoDuyet";
|
|
@@ -46794,6 +46971,7 @@
|
|
|
46794
46971
|
this.setting.hiddenAdvanceSearch = this.control.hiddenAdvanceSearch;
|
|
46795
46972
|
this.setting.fieldSearchText = this.control.fieldSearchText;
|
|
46796
46973
|
this.setting.showEditLink = !this.readOnly;
|
|
46974
|
+
this.setting.hiddenPageSetting = this.control.hiddenPageSetting;
|
|
46797
46975
|
this.plusUrl = this.control.plusUrl;
|
|
46798
46976
|
// Todo: HieuND
|
|
46799
46977
|
this.control.columns.forEach(function (column) {
|
|
@@ -50800,7 +50978,7 @@
|
|
|
50800
50978
|
HtmlPreviewComponent.decorators = [
|
|
50801
50979
|
{ type: i0.Component, args: [{
|
|
50802
50980
|
selector: 'html-preview',
|
|
50803
|
-
template: "<div class=\"preview-box\" [ngClass]=\"{ 'disabled-box': control.disabled }\" id=\"math-preview-box-{{id}}\" [ngStyle]=\"{'height': control.disabled ? 'auto' : control.height + 'px'}\">\n <tn-custom-scrollbar [showScrollHorizontal]=\"true\">\n <div #mathContent id=\"mathPreview-{{id}}\"></div>\n </tn-custom-scrollbar>\n</div>",
|
|
50981
|
+
template: "<div class=\"preview-box\" [ngClass]=\"{ 'disabled-box': control.disabled }\" id=\"math-preview-box-{{id}}\" [ngStyle]=\"{'height': control.disabled ? 'auto' : control.height + 'px', 'min-height': control.height + 'px'}\">\n <tn-custom-scrollbar [showScrollHorizontal]=\"true\">\n <div #mathContent id=\"mathPreview-{{id}}\"></div>\n </tn-custom-scrollbar>\n</div>",
|
|
50804
50982
|
providers: [
|
|
50805
50983
|
ComponentContextService,
|
|
50806
50984
|
{
|
|
@@ -55831,6 +56009,7 @@
|
|
|
55831
56009
|
exports.LabelSchema = LabelSchema;
|
|
55832
56010
|
exports.LabelWFNhomTrangThai = LabelWFNhomTrangThai;
|
|
55833
56011
|
exports.LabelWorkflowCoreStatus = LabelWorkflowCoreStatus;
|
|
56012
|
+
exports.LatexService = LatexService;
|
|
55834
56013
|
exports.LengthValidator = LengthValidator;
|
|
55835
56014
|
exports.ListHelperService = ListHelperService;
|
|
55836
56015
|
exports.LocalCacheService = LocalCacheService;
|