tnx-shared 5.1.214 → 5.1.215
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 +202 -25
- 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/data-form-base.d.ts.map +1 -1
- package/classes/base/data-list-base.d.ts.map +1 -1
- package/classes/base/tree-list-base.d.ts +1 -0
- package/classes/base/tree-list-base.d.ts.map +1 -1
- package/components/crud/tree-table/tree-table.component.d.ts +4 -1
- package/components/crud/tree-table/tree-table.component.d.ts.map +1 -1
- package/esm2015/classes/base/data-form-base.js +5 -5
- package/esm2015/classes/base/data-list-base.js +12 -7
- package/esm2015/classes/base/tree-list-base.js +9 -1
- package/esm2015/components/crud/tree-table/tree-table.component.js +165 -4
- package/fesm2015/tnx-shared.js +183 -12
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -17222,6 +17222,9 @@
|
|
|
17222
17222
|
else {
|
|
17223
17223
|
this.model.formState = exports.FormState.VIEW;
|
|
17224
17224
|
}
|
|
17225
|
+
if (this.model.data.isBuildInAll && !this._userService.isSuperUser()) {
|
|
17226
|
+
this.model.formState = exports.FormState.VIEW;
|
|
17227
|
+
}
|
|
17225
17228
|
}
|
|
17226
17229
|
this.__isFormView = this._isFormView();
|
|
17227
17230
|
};
|
|
@@ -17606,10 +17609,7 @@
|
|
|
17606
17609
|
};
|
|
17607
17610
|
DataFormBase.prototype.disableBuildInField = function () {
|
|
17608
17611
|
if (!this._isFormAddNew()) {
|
|
17609
|
-
if (this.model.data.
|
|
17610
|
-
this.setting.schema['code'].disabled = true;
|
|
17611
|
-
}
|
|
17612
|
-
if (this.model.data.isBuildInAll) {
|
|
17612
|
+
if (this.model.data.isBuildInAll && !this._userService.isSuperUser()) {
|
|
17613
17613
|
this.setting.schema.forEach(function (item) {
|
|
17614
17614
|
item.disabled = true;
|
|
17615
17615
|
});
|
|
@@ -22282,9 +22282,10 @@
|
|
|
22282
22282
|
|
|
22283
22283
|
var TreeTableComponent = /** @class */ (function (_super) {
|
|
22284
22284
|
__extends(TreeTableComponent, _super);
|
|
22285
|
-
function TreeTableComponent(injector, _crudService, _notifierService) {
|
|
22285
|
+
function TreeTableComponent(injector, _crudService, _translateService, _notifierService) {
|
|
22286
22286
|
var _this = _super.call(this, injector) || this;
|
|
22287
22287
|
_this._crudService = _crudService;
|
|
22288
|
+
_this._translateService = _translateService;
|
|
22288
22289
|
_this._notifierService = _notifierService;
|
|
22289
22290
|
_this.model = new CrudListData();
|
|
22290
22291
|
_this.setting = new CrudListSetting();
|
|
@@ -22368,15 +22369,177 @@
|
|
|
22368
22369
|
// this.getColorSetting();
|
|
22369
22370
|
// this.getColumnSetting(colGroup);
|
|
22370
22371
|
// this.getPageSetting();
|
|
22371
|
-
|
|
22372
|
+
this.extendColumns(this.setting.cols);
|
|
22372
22373
|
// this.formatColumns(this.setting.cols);
|
|
22373
22374
|
// this.applyColumnSetting();
|
|
22374
22375
|
this.buildFilterColumn(this.setting.cols);
|
|
22375
22376
|
}
|
|
22376
22377
|
};
|
|
22378
|
+
TreeTableComponent.prototype.extendColumns = function (cols, appendCol) {
|
|
22379
|
+
var _this = this;
|
|
22380
|
+
if (appendCol === void 0) { appendCol = true; }
|
|
22381
|
+
if (!cols) {
|
|
22382
|
+
return;
|
|
22383
|
+
}
|
|
22384
|
+
this.setting.advanceData.fieldNeedGetRef = [];
|
|
22385
|
+
var temp = [];
|
|
22386
|
+
var tmpCols = __spread(cols);
|
|
22387
|
+
if (this.setting.columnSetting.details) {
|
|
22388
|
+
this.setting.columnSetting.details.forEach(function (colReorder) {
|
|
22389
|
+
for (var i = 0; i < cols.length; i++) {
|
|
22390
|
+
if (cols[i].field == colReorder.columnCode) {
|
|
22391
|
+
temp.push(cols[i]);
|
|
22392
|
+
cols.splice(i, 1);
|
|
22393
|
+
}
|
|
22394
|
+
}
|
|
22395
|
+
});
|
|
22396
|
+
// Còn lại những code mà không được cấu hình thì ghép lại theo index được khai báo
|
|
22397
|
+
var tempCols_1 = [];
|
|
22398
|
+
cols.forEach(function (col) {
|
|
22399
|
+
var indexColOld = tmpCols.findIndex(function (p) { return p.field == col.field; });
|
|
22400
|
+
if (indexColOld == 0) {
|
|
22401
|
+
temp.splice(0, 0, col);
|
|
22402
|
+
}
|
|
22403
|
+
else {
|
|
22404
|
+
// Tìm vị trí của cột phía trước trong list reorder mới
|
|
22405
|
+
var indexColBeforeNew = temp.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
|
|
22406
|
+
while (indexColBeforeNew == -1) {
|
|
22407
|
+
tempCols_1.splice(0, 0, col);
|
|
22408
|
+
// Tìm vị trí của cột trước cột đang kiểm tra trong list cột gốc
|
|
22409
|
+
indexColOld = tmpCols.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
|
|
22410
|
+
indexColBeforeNew = temp.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
|
|
22411
|
+
}
|
|
22412
|
+
// => Đến khi thấy thì add cột hiện tại và list tạm vào vị trí chèn
|
|
22413
|
+
if (indexColBeforeNew == temp.length - 1) {
|
|
22414
|
+
temp.push.apply(temp, __spread([col], tempCols_1));
|
|
22415
|
+
}
|
|
22416
|
+
else {
|
|
22417
|
+
temp.splice.apply(temp, __spread([indexColBeforeNew + 1, 0, col], tempCols_1));
|
|
22418
|
+
}
|
|
22419
|
+
tempCols_1 = [];
|
|
22420
|
+
}
|
|
22421
|
+
});
|
|
22422
|
+
}
|
|
22423
|
+
else {
|
|
22424
|
+
}
|
|
22425
|
+
cols.splice(0, cols.length);
|
|
22426
|
+
cols.splice.apply(cols, __spread([0, 0], temp));
|
|
22427
|
+
var firstColVisible = null;
|
|
22428
|
+
var foundItemShowEditLink = false;
|
|
22429
|
+
temp.splice(0, temp.length);
|
|
22430
|
+
var tmpCol = null;
|
|
22431
|
+
var _loop_1 = function (ind) {
|
|
22432
|
+
var element = cols[ind];
|
|
22433
|
+
if (element.rawColumn) {
|
|
22434
|
+
return "continue";
|
|
22435
|
+
}
|
|
22436
|
+
temp.push(element);
|
|
22437
|
+
var config = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == element.field; });
|
|
22438
|
+
if (config && config.visible !== undefined && config.visible !== null) {
|
|
22439
|
+
element.visible = config.visible;
|
|
22440
|
+
}
|
|
22441
|
+
if (element.label) {
|
|
22442
|
+
element.label = this_1._translateService.instant(element.label);
|
|
22443
|
+
}
|
|
22444
|
+
if (config && config.textAlign !== undefined && config.textAlign !== null) {
|
|
22445
|
+
element.textAlign = config.textAlign;
|
|
22446
|
+
}
|
|
22447
|
+
if (config && config.width !== undefined && config.width !== null) {
|
|
22448
|
+
element.width = config.width;
|
|
22449
|
+
}
|
|
22450
|
+
if (element.dataType == null || element.dataType == undefined || element.dataType == '') {
|
|
22451
|
+
element.dataType = exports.DataType.string;
|
|
22452
|
+
}
|
|
22453
|
+
if (element.visible
|
|
22454
|
+
|| (this_1.setting.groupColumn
|
|
22455
|
+
&& element.field == this_1.setting.groupColumn.field)) {
|
|
22456
|
+
if (element.baseService != null) {
|
|
22457
|
+
element.controlType = exports.ControlType.dropdown;
|
|
22458
|
+
if (!element.rawColumn) {
|
|
22459
|
+
this_1.setting.advanceData.fieldNeedGetRef.push(element);
|
|
22460
|
+
element[KeyFieldGetRefType] = exports.EnumGetRefType.SERVER;
|
|
22461
|
+
if (element.valueField == null) {
|
|
22462
|
+
element.valueField = 'id';
|
|
22463
|
+
}
|
|
22464
|
+
if (element.displayField == null) {
|
|
22465
|
+
element.displayField = 'ten';
|
|
22466
|
+
}
|
|
22467
|
+
tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true }));
|
|
22468
|
+
var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
|
|
22469
|
+
if (configRefField && configRefField.visible != null) {
|
|
22470
|
+
tmpCol.visible = configRefField.visible;
|
|
22471
|
+
}
|
|
22472
|
+
temp.push(tmpCol);
|
|
22473
|
+
element.visible = false;
|
|
22474
|
+
if (!firstColVisible) {
|
|
22475
|
+
firstColVisible = tmpCol;
|
|
22476
|
+
}
|
|
22477
|
+
}
|
|
22478
|
+
}
|
|
22479
|
+
else if (element.dataSource && element.dataSource.length > 0) {
|
|
22480
|
+
element.controlType = exports.ControlType.dropdown;
|
|
22481
|
+
if (!element.rawColumn) {
|
|
22482
|
+
this_1.setting.advanceData.fieldNeedGetRef.push(element);
|
|
22483
|
+
element[KeyFieldGetRefType] = exports.EnumGetRefType.LOCAL;
|
|
22484
|
+
tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, baseService: null, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true, generatedRefColumn: true }));
|
|
22485
|
+
var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
|
|
22486
|
+
if (configRefField && configRefField.visible != null) {
|
|
22487
|
+
tmpCol.visible = configRefField.visible;
|
|
22488
|
+
}
|
|
22489
|
+
temp.push(tmpCol);
|
|
22490
|
+
element.visible = false;
|
|
22491
|
+
if (!firstColVisible) {
|
|
22492
|
+
firstColVisible = tmpCol;
|
|
22493
|
+
}
|
|
22494
|
+
}
|
|
22495
|
+
}
|
|
22496
|
+
else if (!firstColVisible) {
|
|
22497
|
+
firstColVisible = element;
|
|
22498
|
+
}
|
|
22499
|
+
}
|
|
22500
|
+
else if (element.forceGetData) {
|
|
22501
|
+
if (element.baseService != null) {
|
|
22502
|
+
this_1.setting.advanceData.fieldNeedGetRef.push(element);
|
|
22503
|
+
element[KeyFieldGetRefType] = exports.EnumGetRefType.SERVER;
|
|
22504
|
+
if (element.valueField == null) {
|
|
22505
|
+
element.valueField = 'id';
|
|
22506
|
+
}
|
|
22507
|
+
if (element.displayField == null) {
|
|
22508
|
+
element.displayField = 'ten';
|
|
22509
|
+
}
|
|
22510
|
+
element.visible = false;
|
|
22511
|
+
}
|
|
22512
|
+
}
|
|
22513
|
+
if (element.showEditLink) {
|
|
22514
|
+
foundItemShowEditLink = true;
|
|
22515
|
+
}
|
|
22516
|
+
};
|
|
22517
|
+
var this_1 = this;
|
|
22518
|
+
for (var ind in cols) {
|
|
22519
|
+
_loop_1(ind);
|
|
22520
|
+
}
|
|
22521
|
+
if (!foundItemShowEditLink && firstColVisible) {
|
|
22522
|
+
firstColVisible.showEditLink = true;
|
|
22523
|
+
}
|
|
22524
|
+
cols.length = 0;
|
|
22525
|
+
cols.push.apply(cols, __spread(temp));
|
|
22526
|
+
this.setting.advanceData.fieldNeedGetRef.sort(multipleSort({ name: 'sort', primer: function (a) { return a == null; } }, 'order'));
|
|
22527
|
+
this.setting.advanceData.fieldHasMaximumLength = [];
|
|
22528
|
+
this.setting.advanceData.fieldHasMaximumWord = [];
|
|
22529
|
+
cols.forEach(function (col) {
|
|
22530
|
+
if (!col.visible)
|
|
22531
|
+
return;
|
|
22532
|
+
if (col.maxWordDisplay) {
|
|
22533
|
+
_this.setting.advanceData.fieldHasMaximumWord.push(col);
|
|
22534
|
+
}
|
|
22535
|
+
else if (col.maxLengthDisplay) {
|
|
22536
|
+
_this.setting.advanceData.fieldHasMaximumLength.push(col);
|
|
22537
|
+
}
|
|
22538
|
+
});
|
|
22539
|
+
};
|
|
22377
22540
|
TreeTableComponent.prototype.createSearchSchema = function () {
|
|
22378
22541
|
return __awaiter(this, void 0, void 0, function () {
|
|
22379
|
-
var searchInfo, _a, _b, col, control, e_1_1,
|
|
22542
|
+
var searchInfo, _a, _b, col, control, e_1_1, _loop_2, this_2, _c, _d, field;
|
|
22380
22543
|
var e_1, _e, _f, e_2, _g;
|
|
22381
22544
|
return __generator(this, function (_h) {
|
|
22382
22545
|
switch (_h.label) {
|
|
@@ -22481,23 +22644,23 @@
|
|
|
22481
22644
|
return [7 /*endfinally*/];
|
|
22482
22645
|
case 8:
|
|
22483
22646
|
if (searchInfo.fieldSearchText) {
|
|
22484
|
-
|
|
22647
|
+
_loop_2 = function (field) {
|
|
22485
22648
|
if (searchInfo.fieldSearchText.indexOf(field) == -1) {
|
|
22486
22649
|
searchInfo.fieldSearchText.push(field);
|
|
22487
22650
|
if (!searchInfo.tooltipSearchText) {
|
|
22488
22651
|
searchInfo.tooltipSearchText = 'Tìm kiếm theo các trường:';
|
|
22489
22652
|
}
|
|
22490
|
-
var col =
|
|
22653
|
+
var col = this_2.setting.modelSchemas.find(function (p) { return p.field == field; });
|
|
22491
22654
|
if (col != null) {
|
|
22492
22655
|
searchInfo.tooltipSearchText += " \"" + col.name + "\",";
|
|
22493
22656
|
}
|
|
22494
22657
|
}
|
|
22495
22658
|
};
|
|
22496
|
-
|
|
22659
|
+
this_2 = this;
|
|
22497
22660
|
try {
|
|
22498
22661
|
for (_c = __values(searchInfo.fieldSearchText), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
22499
22662
|
field = _d.value;
|
|
22500
|
-
|
|
22663
|
+
_loop_2(field);
|
|
22501
22664
|
}
|
|
22502
22665
|
}
|
|
22503
22666
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -22954,21 +23117,21 @@
|
|
|
22954
23117
|
};
|
|
22955
23118
|
TreeTableComponent.prototype.preProcessData = function (dataSource) {
|
|
22956
23119
|
return __awaiter(this, void 0, void 0, function () {
|
|
22957
|
-
var colHasPipe,
|
|
23120
|
+
var colHasPipe, _loop_3, this_3, colHasPipe_1, colHasPipe_1_1, col;
|
|
22958
23121
|
var e_5, _a;
|
|
22959
23122
|
return __generator(this, function (_b) {
|
|
22960
23123
|
colHasPipe = this.setting.cols.filter(function (x) { return x.pipe; });
|
|
22961
|
-
|
|
23124
|
+
_loop_3 = function (col) {
|
|
22962
23125
|
var e_6, _a;
|
|
22963
|
-
var
|
|
22964
|
-
|
|
23126
|
+
var _loop_4 = function (item) {
|
|
23127
|
+
this_3.transform(col.pipe, col.asyncPipe, item[col.field]).then(function (rs) {
|
|
22965
23128
|
item["pipe__" + col.field + " "] = rs;
|
|
22966
23129
|
});
|
|
22967
23130
|
};
|
|
22968
23131
|
try {
|
|
22969
23132
|
for (var dataSource_1 = (e_6 = void 0, __values(dataSource)), dataSource_1_1 = dataSource_1.next(); !dataSource_1_1.done; dataSource_1_1 = dataSource_1.next()) {
|
|
22970
23133
|
var item = dataSource_1_1.value;
|
|
22971
|
-
|
|
23134
|
+
_loop_4(item);
|
|
22972
23135
|
}
|
|
22973
23136
|
}
|
|
22974
23137
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
@@ -22979,11 +23142,11 @@
|
|
|
22979
23142
|
finally { if (e_6) throw e_6.error; }
|
|
22980
23143
|
}
|
|
22981
23144
|
};
|
|
22982
|
-
|
|
23145
|
+
this_3 = this;
|
|
22983
23146
|
try {
|
|
22984
23147
|
for (colHasPipe_1 = __values(colHasPipe), colHasPipe_1_1 = colHasPipe_1.next(); !colHasPipe_1_1.done; colHasPipe_1_1 = colHasPipe_1.next()) {
|
|
22985
23148
|
col = colHasPipe_1_1.value;
|
|
22986
|
-
|
|
23149
|
+
_loop_3(col);
|
|
22987
23150
|
}
|
|
22988
23151
|
}
|
|
22989
23152
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
@@ -23184,6 +23347,7 @@
|
|
|
23184
23347
|
TreeTableComponent.ctorParameters = function () { return [
|
|
23185
23348
|
{ type: i0.Injector },
|
|
23186
23349
|
{ type: CrudService },
|
|
23350
|
+
{ type: i2.TranslateService },
|
|
23187
23351
|
{ type: NotifierService }
|
|
23188
23352
|
]; };
|
|
23189
23353
|
TreeTableComponent.propDecorators = {
|
|
@@ -24544,7 +24708,7 @@
|
|
|
24544
24708
|
};
|
|
24545
24709
|
DataListBase.prototype._getDataSource = function (response) {
|
|
24546
24710
|
return __awaiter(this, void 0, void 0, function () {
|
|
24547
|
-
var dataSource, lstItemId, statusNotAllowEdits_1, userIdCurrent, fieldKey_1, callBackWhenNotHaveStatus, _baseService, dataTask_1, result;
|
|
24711
|
+
var dataSource, lstItemId, funcModifyItem, statusNotAllowEdits_1, userIdCurrent, fieldKey_1, callBackWhenNotHaveStatus, _baseService, dataTask_1, result;
|
|
24548
24712
|
var _this = this;
|
|
24549
24713
|
return __generator(this, function (_a) {
|
|
24550
24714
|
switch (_a.label) {
|
|
@@ -24558,20 +24722,25 @@
|
|
|
24558
24722
|
});
|
|
24559
24723
|
dataSource = response.data;
|
|
24560
24724
|
lstItemId = [];
|
|
24725
|
+
funcModifyItem = function (item, index) {
|
|
24726
|
+
item._index = (_this.setting.pageSetting.page - 1) * _this.setting.pageSetting.pageSize + 1 + index;
|
|
24727
|
+
lstItemId.push(item.id);
|
|
24728
|
+
if ((item.isBuildInAll || item.isBuildIn)
|
|
24729
|
+
&& !_this._userService.isSuperUser()) {
|
|
24730
|
+
item.__disableEdit = true;
|
|
24731
|
+
item.__disableDelete = true;
|
|
24732
|
+
}
|
|
24733
|
+
};
|
|
24561
24734
|
if (this.setting.workflowSetting) {
|
|
24562
24735
|
statusNotAllowEdits_1 = this.setting.workflowSetting.statuses.filter(function (p) { return !p.options.choPhepSua; }).map(function (item) { return item.trangThaiContainer.ma; });
|
|
24563
24736
|
dataSource.forEach(function (item, index) {
|
|
24564
|
-
item._index = (_this.setting.pageSetting.page - 1) * _this.setting.pageSetting.pageSize + 1 + index;
|
|
24565
|
-
// item.currentStateCode = item.currentStateCode;
|
|
24566
24737
|
item.__disableEdit = statusNotAllowEdits_1.indexOf(item.currentStateCode) > -1;
|
|
24567
|
-
|
|
24738
|
+
funcModifyItem(item, index);
|
|
24568
24739
|
});
|
|
24569
24740
|
}
|
|
24570
24741
|
else {
|
|
24571
24742
|
dataSource.forEach(function (item, index) {
|
|
24572
|
-
item
|
|
24573
|
-
// item.currentStateCode = item.currentStateCode;
|
|
24574
|
-
lstItemId.push(item.id);
|
|
24743
|
+
funcModifyItem(item, index);
|
|
24575
24744
|
});
|
|
24576
24745
|
}
|
|
24577
24746
|
if (!(this.setting.workflowSettingNew
|
|
@@ -55556,6 +55725,13 @@
|
|
|
55556
55725
|
_this.fieldParent = 'idParent';
|
|
55557
55726
|
_this.valueParentRoot = null;
|
|
55558
55727
|
_this.levelOpen = 1;
|
|
55728
|
+
_this.funcModifyItem = function (item) {
|
|
55729
|
+
if ((item.isBuildInAll || item.isBuildIn)
|
|
55730
|
+
&& !_this._userService.isSuperUser()) {
|
|
55731
|
+
item.__disableEdit = true;
|
|
55732
|
+
item.__disableDelete = true;
|
|
55733
|
+
}
|
|
55734
|
+
};
|
|
55559
55735
|
return _this;
|
|
55560
55736
|
}
|
|
55561
55737
|
TreeListBase.prototype.ngOnInit = function () {
|
|
@@ -55596,6 +55772,7 @@
|
|
|
55596
55772
|
level: level,
|
|
55597
55773
|
children: []
|
|
55598
55774
|
};
|
|
55775
|
+
_this.funcModifyItem(item);
|
|
55599
55776
|
result.push(node);
|
|
55600
55777
|
_this.createTreeData(dataSource, node.children, node.data.id, level + 1, __spread(lstIdParent, [item.id]));
|
|
55601
55778
|
});
|