tnx-shared 5.1.403 → 5.1.404
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 +111 -28
- 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/base/component-base.d.ts +9 -0
- package/classes/base/component-base.d.ts.map +1 -1
- package/classes/base/data-form-base.d.ts +2 -1
- package/classes/base/data-form-base.d.ts.map +1 -1
- package/components/add-news/add-news.component.d.ts.map +1 -1
- package/components/autocomplete-picker/autocomplete-picker.component.d.ts +1 -1
- package/components/autocomplete-picker/autocomplete-picker.component.d.ts.map +1 -1
- package/components/crud/crud-form/crud-form.component.d.ts +5 -2
- package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
- package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.d.ts.map +1 -1
- package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.scss.shim.ngstyle.d.ts.map +1 -0
- package/components/file-explorer/services/file-object.service.d.ts +2 -0
- package/components/file-explorer/services/file-object.service.d.ts.map +1 -1
- package/components/workflow/process-workflow-form/process-workflow-form.component.d.ts +0 -1
- package/components/workflow/process-workflow-form/process-workflow-form.component.d.ts.map +1 -1
- package/esm2015/classes/base/component-base.js +44 -1
- package/esm2015/classes/base/data-form-base.js +6 -2
- package/esm2015/components/add-news/add-news.component.js +2 -1
- package/esm2015/components/autocomplete-picker/autocomplete-picker.component.js +13 -9
- package/esm2015/components/crud/crud-form/crud-form.component.js +23 -3
- package/esm2015/components/file-explorer/file-picker-dialog/file-picker-dialog.component.js +5 -3
- package/esm2015/components/file-explorer/services/file-object.service.js +7 -1
- package/esm2015/components/workflow/process-workflow-form/process-workflow-form.component.js +10 -19
- package/fesm2015/tnx-shared.js +99 -28
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
- package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.css.shim.ngstyle.d.ts.map +0 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -8027,6 +8027,49 @@ class ComponentBase {
|
|
|
8027
8027
|
show: false
|
|
8028
8028
|
});
|
|
8029
8029
|
}
|
|
8030
|
+
addDistinct(lst, value) {
|
|
8031
|
+
if (lst.indexOf(value) == -1) {
|
|
8032
|
+
lst.push(value);
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
addDistinctList(lst, lstValue) {
|
|
8036
|
+
if (!lstValue || !lstValue.length)
|
|
8037
|
+
return;
|
|
8038
|
+
lstValue.forEach(value => {
|
|
8039
|
+
if (lst.indexOf(value) == -1) {
|
|
8040
|
+
lst.push(value);
|
|
8041
|
+
}
|
|
8042
|
+
});
|
|
8043
|
+
}
|
|
8044
|
+
/**
|
|
8045
|
+
* Convert 1 array => N array
|
|
8046
|
+
* @param lst Mảng phần tử
|
|
8047
|
+
* @param fields Mảng các field, nếu field là kiểu array thì nghĩa là mún map distinct
|
|
8048
|
+
* @returns N Array
|
|
8049
|
+
*/
|
|
8050
|
+
multipleMap(lst, ...fields) {
|
|
8051
|
+
const result = [];
|
|
8052
|
+
const funcs = [];
|
|
8053
|
+
const rawFields = [];
|
|
8054
|
+
const _push = (lst, value) => lst.push(value);
|
|
8055
|
+
fields.forEach(field => {
|
|
8056
|
+
result.push([]);
|
|
8057
|
+
if (Array.isArray(field)) {
|
|
8058
|
+
funcs.push(this.addDistinct);
|
|
8059
|
+
rawFields.push(field[0]);
|
|
8060
|
+
}
|
|
8061
|
+
else {
|
|
8062
|
+
funcs.push(_push);
|
|
8063
|
+
rawFields.push(field);
|
|
8064
|
+
}
|
|
8065
|
+
});
|
|
8066
|
+
lst.forEach(item => {
|
|
8067
|
+
rawFields.forEach((field, index) => {
|
|
8068
|
+
funcs[index](result[index], item[field]);
|
|
8069
|
+
});
|
|
8070
|
+
});
|
|
8071
|
+
return result;
|
|
8072
|
+
}
|
|
8030
8073
|
_printPdf(baseService, id, rowData) {
|
|
8031
8074
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8032
8075
|
const itemDetail = (yield baseService.getDetail(id)).data;
|
|
@@ -13490,6 +13533,9 @@ class ControlTreeNode {
|
|
|
13490
13533
|
setCrudForm(crudForm) {
|
|
13491
13534
|
this._crudForm = crudForm;
|
|
13492
13535
|
}
|
|
13536
|
+
get crudForm() {
|
|
13537
|
+
return this.rootNode._crudForm;
|
|
13538
|
+
}
|
|
13493
13539
|
get parentModel() {
|
|
13494
13540
|
if (this.parentNode)
|
|
13495
13541
|
return this.parentNode.model;
|
|
@@ -13625,12 +13671,29 @@ class ControlTreeNode {
|
|
|
13625
13671
|
tableNode.model = [];
|
|
13626
13672
|
}
|
|
13627
13673
|
tableNode.model.splice(0, tableNode.model.length);
|
|
13674
|
+
tableNode.setDataSourceInternal(dataSource);
|
|
13675
|
+
}
|
|
13676
|
+
setDataSourceInternal(dataSource) {
|
|
13677
|
+
if (!(this.control instanceof TableSchema))
|
|
13678
|
+
return;
|
|
13628
13679
|
if (dataSource.length == 0) {
|
|
13629
|
-
|
|
13680
|
+
this.reinitChildNodes();
|
|
13630
13681
|
return;
|
|
13631
13682
|
}
|
|
13632
13683
|
for (let i = 0; i < dataSource.length; i++) {
|
|
13633
|
-
this.rootNode._crudForm.addNewRow(
|
|
13684
|
+
this.rootNode._crudForm.addNewRow(this.control, this.modelPath, null, true, dataSource[i], i == dataSource.length - 1);
|
|
13685
|
+
}
|
|
13686
|
+
}
|
|
13687
|
+
setValue(value) {
|
|
13688
|
+
if (this.control instanceof TableSchema) {
|
|
13689
|
+
this.setDataSourceInternal(value);
|
|
13690
|
+
}
|
|
13691
|
+
else if (this.control instanceof ContainerSchema) {
|
|
13692
|
+
this.parentNode.data[this.control.field] = value;
|
|
13693
|
+
this.crudForm.initControlDefaultValue(this.parentNode.data, this.control, this.parentNode.modelPath);
|
|
13694
|
+
}
|
|
13695
|
+
else {
|
|
13696
|
+
this.model = value;
|
|
13634
13697
|
}
|
|
13635
13698
|
}
|
|
13636
13699
|
}
|
|
@@ -14566,7 +14629,11 @@ class DataFormBase extends ComponentBaseWithButton {
|
|
|
14566
14629
|
schema.required = false;
|
|
14567
14630
|
}
|
|
14568
14631
|
_setModelValue(field, value) {
|
|
14569
|
-
this.crudForm.
|
|
14632
|
+
const node = this.crudForm._rootNode.getNodeByPath(field);
|
|
14633
|
+
this._setModelValueByNode(node, value);
|
|
14634
|
+
}
|
|
14635
|
+
_setModelValueByNode(node, value) {
|
|
14636
|
+
node.setValue(value);
|
|
14570
14637
|
this.crudForm.fireModelChanged();
|
|
14571
14638
|
}
|
|
14572
14639
|
modifyDetailData(data) {
|
|
@@ -23029,7 +23096,13 @@ class FileObjectService extends BaseService {
|
|
|
23029
23096
|
constructor(http, injector, _moduleConfigService) {
|
|
23030
23097
|
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.fileEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/FileObject`);
|
|
23031
23098
|
this._moduleConfigService = _moduleConfigService;
|
|
23099
|
+
this.thumborEndpoint = '';
|
|
23032
23100
|
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint;
|
|
23101
|
+
this.thumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.thumbor;
|
|
23102
|
+
}
|
|
23103
|
+
getFileUrlWithThumbor(fileId, width = 0, height = 0) {
|
|
23104
|
+
const url = `${this.thumborEndpoint}/unsafe/${width}x${height}/smart/${this.endPoint}/v5/FileObject/public/${fileId}/download`;
|
|
23105
|
+
return url;
|
|
23033
23106
|
}
|
|
23034
23107
|
copyMultipleFile(idsFile, idDesFolder) {
|
|
23035
23108
|
const url = `${this.serviceUri}/CopyMultipleFile?parentFolderId=${idDesFolder}`;
|
|
@@ -31388,7 +31461,9 @@ class FilePickerDialogComponent extends DataFormBase {
|
|
|
31388
31461
|
}
|
|
31389
31462
|
}
|
|
31390
31463
|
if (element.extension.toUpperCase() == '.PNG' || element.extension.toUpperCase() == '.JPG' || element.extension.toUpperCase() == '.JPEG') {
|
|
31391
|
-
result = '<div style="width:100%; margin-bottom: 15px;text-align: center;"><img style="display:block; margin:auto;" width="500" src="'
|
|
31464
|
+
result = '<div style="width:100%; margin-bottom: 15px;text-align: center;"><img style="display:block; margin:auto;" width="500" src="'
|
|
31465
|
+
+ this._fileObjectService.getFileUrlWithThumbor(element.id, 1080)
|
|
31466
|
+
+ '" /><p><em>Tiêu đề hình ảnh</em></p></div>';
|
|
31392
31467
|
}
|
|
31393
31468
|
else if (element.extension.toUpperCase() == '.MP3' || element.extension.toUpperCase() == '.WMA' || element.extension.toUpperCase() == '.FLAC' || element.extension.toUpperCase() == '.AAC' || element.extension.toUpperCase() == '.OGG') {
|
|
31394
31469
|
result = '<div style="width:100%; margin-bottom: 15px"><audio style="display: block;margin-left: auto;margin-right: auto;" controls><source src="' + this._fileObjectService.endPoint + '/v5/FileObject/public/' + element.id + '/download" type="audio/mpeg"></audio></div>';
|
|
@@ -31414,7 +31489,7 @@ class FilePickerDialogComponent extends DataFormBase {
|
|
|
31414
31489
|
FilePickerDialogComponent.decorators = [
|
|
31415
31490
|
{ type: Component, args: [{
|
|
31416
31491
|
selector: 'file-picker-dialog',
|
|
31417
|
-
template: "<crud-form #crudForm [(data)]=\"model.data\" [setting]=\"setting\" [context]=\"context\" [disableCaching]=\"true\"\r\n (onFormReady)=\"_handleFormReady($event)\">\r\n <ng-template #fileManager let-control=\"control\">\r\n <file-manager serviceCode=\"user\" entity=\"user\" entityKey=\"entityKey\" label=\"My folder\"
|
|
31492
|
+
template: "<crud-form #crudForm [(data)]=\"model.data\" [setting]=\"setting\" [context]=\"context\" [disableCaching]=\"true\"\r\n (onFormReady)=\"_handleFormReady($event)\">\r\n <ng-template #fileManager let-control=\"control\">\r\n <file-manager serviceCode=\"user\" entity=\"user\" [entityKey]=\"entityKey\" label=\"My folder\"\r\n [dataType]=\"model.data.fileType\" (onSelected)=\"selectedFile($event)\"></file-manager>\r\n </ng-template>\r\n</crud-form>\r\n<ng-template #buttonTemplate>\r\n <button type=\"button\" pButton icon=\"pi pi-save\" class=\"p-button-text\" [label]=\"'FORM.SAVE' | translate\"\r\n (click)=\"chooseFiles($event)\"></button>\r\n\r\n <button type=\"button\" pButton icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\r\n [label]=\"'FORM.CANCEL' | translate\" preventTab (click)=\"_handleCancel($event)\"></button>\r\n</ng-template>",
|
|
31418
31493
|
providers: [ComponentContextService],
|
|
31419
31494
|
styles: [""]
|
|
31420
31495
|
},] }
|
|
@@ -34967,25 +35042,16 @@ class ProcessWorkflowFormComponent extends DataFormBase {
|
|
|
34967
35042
|
roleIds: (_f = this.action.data.roleViewIds) !== null && _f !== void 0 ? _f : [],
|
|
34968
35043
|
type: EnumProcessWorkflowType.VIEW
|
|
34969
35044
|
};
|
|
34970
|
-
this.
|
|
34971
|
-
this.
|
|
34972
|
-
this.
|
|
34973
|
-
this.
|
|
34974
|
-
this.
|
|
34975
|
-
this.
|
|
34976
|
-
this.
|
|
34977
|
-
this.
|
|
35045
|
+
this.addDistinctList(this.dataAllowEdit.userIds, this.initValueForTargetForm.lstUserId);
|
|
35046
|
+
this.addDistinctList(this.dataAllowEdit.departmentIds, this.initValueForTargetForm.lstDonViId);
|
|
35047
|
+
this.addDistinctList(this.dataAllowEdit.groupIds, this.initValueForTargetForm.lstGroupId);
|
|
35048
|
+
this.addDistinctList(this.dataAllowEdit.roleIds, this.initValueForTargetForm.lstRoleId);
|
|
35049
|
+
this.addDistinctList(this.dataOnlyView.userIds, this.initValueForTargetForm.lstUserViewId);
|
|
35050
|
+
this.addDistinctList(this.dataOnlyView.departmentIds, this.initValueForTargetForm.lstDonViViewId);
|
|
35051
|
+
this.addDistinctList(this.dataOnlyView.groupIds, this.initValueForTargetForm.lstGroupViewId);
|
|
35052
|
+
this.addDistinctList(this.dataOnlyView.roleIds, this.initValueForTargetForm.lstRoleViewId);
|
|
34978
35053
|
this.formReady = true;
|
|
34979
35054
|
}
|
|
34980
|
-
addDistinct(dest, source) {
|
|
34981
|
-
if (!source || !source.length)
|
|
34982
|
-
return;
|
|
34983
|
-
source.forEach(item => {
|
|
34984
|
-
if (dest.indexOf(item) == -1) {
|
|
34985
|
-
dest.push(item);
|
|
34986
|
-
}
|
|
34987
|
-
});
|
|
34988
|
-
}
|
|
34989
35055
|
onFormInitialized(evt) {
|
|
34990
35056
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34991
35057
|
evt.model.id = this._commonService.guid();
|
|
@@ -39410,6 +39476,7 @@ class AddNewsComponent extends DataListBase {
|
|
|
39410
39476
|
}
|
|
39411
39477
|
modifyGridInfo(gridInfo) {
|
|
39412
39478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39479
|
+
gridInfo.fields = 'id,name,newsCategoryId,type,articleType,numberView,modified,releaseDate';
|
|
39413
39480
|
gridInfo.filters.splice(0, 0, this.newFilter('type', Operator.equal, 'NEWS'));
|
|
39414
39481
|
gridInfo.filters.splice(0, 0, this.newFilter('statusView', Operator.equal, ItemStatus.DaXuatBan));
|
|
39415
39482
|
gridInfo.filters.splice(0, 0, this.newFilter('releaseDate', Operator.lowerThanEqual, new Date()));
|
|
@@ -40357,14 +40424,18 @@ class AutoCompletePickerComponent extends ComponentBase {
|
|
|
40357
40424
|
this._commonService.addDistinct(arrDisplayField, arrField);
|
|
40358
40425
|
return arrField.toString();
|
|
40359
40426
|
}
|
|
40360
|
-
getDropdownOptions() {
|
|
40361
|
-
|
|
40427
|
+
getDropdownOptions(pageSize = null) {
|
|
40428
|
+
const result = new DropdownOptions({
|
|
40362
40429
|
displayField: this.control.displayField,
|
|
40363
40430
|
valueField: this.control.valueField,
|
|
40364
40431
|
fieldPlus: this.control.fieldPlus,
|
|
40365
40432
|
funcGetLabel: this.control.funcGetLabel,
|
|
40366
40433
|
plusUrl: this.control.plusUrl
|
|
40367
40434
|
});
|
|
40435
|
+
if (pageSize) {
|
|
40436
|
+
result.pageSize = pageSize;
|
|
40437
|
+
}
|
|
40438
|
+
return result;
|
|
40368
40439
|
}
|
|
40369
40440
|
showPickForm() {
|
|
40370
40441
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40591,7 +40662,7 @@ class AutoCompletePickerComponent extends ComponentBase {
|
|
|
40591
40662
|
if (this.value && this.value.length > 0) {
|
|
40592
40663
|
dataSource = yield this.control.baseService.getDataDropdownByFilter([
|
|
40593
40664
|
this.newFilter(this.control.valueField, Operator.in, this.value)
|
|
40594
|
-
], this.getDropdownOptions());
|
|
40665
|
+
], this.getDropdownOptions(this.value.length));
|
|
40595
40666
|
this.fireEventAfterGetDataDropDown(dataSource);
|
|
40596
40667
|
}
|
|
40597
40668
|
this.reStructureDataSource(dataSource);
|
|
@@ -40602,7 +40673,7 @@ class AutoCompletePickerComponent extends ComponentBase {
|
|
|
40602
40673
|
if (this.value) {
|
|
40603
40674
|
dataSource = yield this.control.baseService.getDataDropdownByFilter([
|
|
40604
40675
|
this.newFilter(this.control.valueField, Operator.equal, this.value)
|
|
40605
|
-
], this.getDropdownOptions());
|
|
40676
|
+
], this.getDropdownOptions(1));
|
|
40606
40677
|
this.fireEventAfterGetDataDropDown(dataSource);
|
|
40607
40678
|
}
|
|
40608
40679
|
this.reStructureDataSource(dataSource);
|
|
@@ -40659,7 +40730,7 @@ class AutoCompletePickerComponent extends ComponentBase {
|
|
|
40659
40730
|
const filters = [];
|
|
40660
40731
|
filters.push(this.newFilter(this.control.valueField, Operator.in, obj));
|
|
40661
40732
|
yield appendDefaultFilter(filters, this.control.defaultFilters);
|
|
40662
|
-
this.control.baseService.getDataDropdownByFilter(filters, this.getDropdownOptions()).then(res => {
|
|
40733
|
+
this.control.baseService.getDataDropdownByFilter(filters, this.getDropdownOptions(obj.length)).then(res => {
|
|
40663
40734
|
this.fireEventAfterGetDataDropDown(res);
|
|
40664
40735
|
this.reStructureDataSource(res);
|
|
40665
40736
|
this.results = this.dataSource;
|
|
@@ -40675,7 +40746,7 @@ class AutoCompletePickerComponent extends ComponentBase {
|
|
|
40675
40746
|
}
|
|
40676
40747
|
else {
|
|
40677
40748
|
if (obj != null) {
|
|
40678
|
-
this.control.baseService.getDataDropdownByFilter([this.newFilter(this.control.valueField, Operator.equal, obj)], this.getDropdownOptions()).then(res => {
|
|
40749
|
+
this.control.baseService.getDataDropdownByFilter([this.newFilter(this.control.valueField, Operator.equal, obj)], this.getDropdownOptions(1)).then(res => {
|
|
40679
40750
|
if (res.length > 0) {
|
|
40680
40751
|
this.fireEventAfterGetDataDropDown(res);
|
|
40681
40752
|
this.reStructureDataSource(res);
|