tnx-shared 5.1.400 → 5.1.403
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 +116 -65
- 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 +2 -2
- package/classes/base/component-base.d.ts.map +1 -1
- package/classes/form-schema.d.ts +2 -0
- package/classes/form-schema.d.ts.map +1 -1
- package/components/address/address.component.d.ts.map +1 -1
- package/components/check-box-list/check-box-list.component.d.ts.map +1 -1
- package/components/crud/crud-form/crud-form.component.d.ts +3 -2
- package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
- package/components/radio-button-list/radio-button-list.component.d.ts.map +1 -1
- package/components/tn-app-notification/tn-app-notification.component.d.ts +1 -1
- package/components/tn-app-notification/tn-app-notification.component.d.ts.map +1 -1
- package/configs/component-context.constant.d.ts.map +1 -1
- package/esm2015/classes/base/component-base.js +7 -5
- package/esm2015/classes/form-schema.js +1 -1
- package/esm2015/components/address/address.component.js +8 -5
- package/esm2015/components/check-box-list/check-box-list.component.js +18 -22
- package/esm2015/components/crud/crud-form/crud-form.component.js +30 -16
- package/esm2015/components/radio-button-list/radio-button-list.component.js +1 -1
- package/esm2015/components/tn-app-notification/tn-app-notification.component.js +31 -19
- package/esm2015/configs/component-context.constant.js +1 -1
- package/esm2015/services/notification.service.js +17 -1
- package/fesm2015/tnx-shared.js +105 -62
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/notification.service.d.ts +5 -1
- package/services/notification.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
|
@@ -9189,8 +9189,8 @@
|
|
|
9189
9189
|
});
|
|
9190
9190
|
;
|
|
9191
9191
|
/**
|
|
9192
|
-
|
|
9193
|
-
|
|
9192
|
+
* On destroy
|
|
9193
|
+
*/
|
|
9194
9194
|
ComponentBase.prototype.ngOnDestroy = function () {
|
|
9195
9195
|
var e_1, _a;
|
|
9196
9196
|
// Unsubscribe from all subscriptions
|
|
@@ -9613,10 +9613,12 @@
|
|
|
9613
9613
|
value_2 = this_1._getValueFromDatasource(itemSelected, schema.multiple, tmpSchema.funcGetLabel);
|
|
9614
9614
|
}
|
|
9615
9615
|
else if (schema instanceof CheckboxControlSchema || schema instanceof SwitchControlSchema) {
|
|
9616
|
-
if (!value_2)
|
|
9616
|
+
if (!value_2) {
|
|
9617
9617
|
value_2 = 'Không';
|
|
9618
|
-
|
|
9618
|
+
}
|
|
9619
|
+
else {
|
|
9619
9620
|
value_2 = 'Có';
|
|
9621
|
+
}
|
|
9620
9622
|
}
|
|
9621
9623
|
_b.label = 19;
|
|
9622
9624
|
case 19:
|
|
@@ -13036,7 +13038,7 @@
|
|
|
13036
13038
|
_this.eventType = exports.EventType;
|
|
13037
13039
|
// Doc tu cau hinh tham so he thong
|
|
13038
13040
|
_this.limitSize = 0;
|
|
13039
|
-
_this.formControls =
|
|
13041
|
+
_this.formControls = {};
|
|
13040
13042
|
_this.funcCheckUniqueField = {};
|
|
13041
13043
|
_this.beforeData = {};
|
|
13042
13044
|
_this.cachedValues = {};
|
|
@@ -14262,18 +14264,22 @@
|
|
|
14262
14264
|
for (var field in model) {
|
|
14263
14265
|
if (field != '_errors' && field != '_status' && field != '_source') {
|
|
14264
14266
|
var subUniqueKeyControl = void 0;
|
|
14265
|
-
if (uniqueKeyControl != null && uniqueKeyControl !== '')
|
|
14267
|
+
if (uniqueKeyControl != null && uniqueKeyControl !== '') {
|
|
14266
14268
|
subUniqueKeyControl = uniqueKeyControl + '.' + field;
|
|
14267
|
-
|
|
14269
|
+
}
|
|
14270
|
+
else {
|
|
14268
14271
|
subUniqueKeyControl = field;
|
|
14272
|
+
}
|
|
14269
14273
|
var control = this.formControls[subUniqueKeyControl];
|
|
14270
14274
|
if (!control)
|
|
14271
14275
|
continue;
|
|
14272
14276
|
var subPath = void 0;
|
|
14273
|
-
if (path != null && path !== '')
|
|
14277
|
+
if (path != null && path !== '') {
|
|
14274
14278
|
subPath = path + '.' + field;
|
|
14275
|
-
|
|
14279
|
+
}
|
|
14280
|
+
else {
|
|
14276
14281
|
subPath = field;
|
|
14282
|
+
}
|
|
14277
14283
|
var subModel = model[field];
|
|
14278
14284
|
if (subModel instanceof Array) {
|
|
14279
14285
|
var index = 0;
|
|
@@ -15882,32 +15888,40 @@
|
|
|
15882
15888
|
});
|
|
15883
15889
|
Object.defineProperty(ControlTreeNode.prototype, "model", {
|
|
15884
15890
|
get: function () {
|
|
15885
|
-
if (this.parentNode)
|
|
15891
|
+
if (this.parentNode) {
|
|
15886
15892
|
return this.parentNode.data[this.field];
|
|
15887
|
-
|
|
15893
|
+
}
|
|
15894
|
+
else {
|
|
15888
15895
|
return this.data;
|
|
15896
|
+
}
|
|
15889
15897
|
},
|
|
15890
15898
|
set: function (val) {
|
|
15891
|
-
if (this.parentNode)
|
|
15899
|
+
if (this.parentNode) {
|
|
15892
15900
|
this.parentNode.data[this.field] = val;
|
|
15893
|
-
|
|
15901
|
+
}
|
|
15902
|
+
else {
|
|
15894
15903
|
this.data = val;
|
|
15904
|
+
}
|
|
15895
15905
|
},
|
|
15896
15906
|
enumerable: false,
|
|
15897
15907
|
configurable: true
|
|
15898
15908
|
});
|
|
15899
15909
|
Object.defineProperty(ControlTreeNode.prototype, "value", {
|
|
15900
15910
|
get: function () {
|
|
15901
|
-
if (this.parentNode)
|
|
15911
|
+
if (this.parentNode) {
|
|
15902
15912
|
return this.parentNode.data[this.field];
|
|
15903
|
-
|
|
15913
|
+
}
|
|
15914
|
+
else {
|
|
15904
15915
|
return this.data;
|
|
15916
|
+
}
|
|
15905
15917
|
},
|
|
15906
15918
|
set: function (val) {
|
|
15907
|
-
if (this.parentNode)
|
|
15919
|
+
if (this.parentNode) {
|
|
15908
15920
|
this.parentNode.data[this.field] = val;
|
|
15909
|
-
|
|
15921
|
+
}
|
|
15922
|
+
else {
|
|
15910
15923
|
this.data = val;
|
|
15924
|
+
}
|
|
15911
15925
|
},
|
|
15912
15926
|
enumerable: false,
|
|
15913
15927
|
configurable: true
|
|
@@ -15974,8 +15988,9 @@
|
|
|
15974
15988
|
};
|
|
15975
15989
|
ControlTreeNode.prototype.findInTree = function (node, modelPath) {
|
|
15976
15990
|
var e_33, _d;
|
|
15977
|
-
if (node.modelPath != null && node.modelPath.toLowerCase() == modelPath.toLowerCase())
|
|
15991
|
+
if (node.modelPath != null && node.modelPath.toLowerCase() == modelPath.toLowerCase()) {
|
|
15978
15992
|
return node;
|
|
15993
|
+
}
|
|
15979
15994
|
else {
|
|
15980
15995
|
try {
|
|
15981
15996
|
for (var _e = __values(node.childNodes), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -15999,8 +16014,9 @@
|
|
|
15999
16014
|
};
|
|
16000
16015
|
ControlTreeNode.prototype.findSchemaInTree = function (node, schemaPath) {
|
|
16001
16016
|
var e_34, _d;
|
|
16002
|
-
if (node.schemaPath != null && node.schemaPath.toLowerCase() == schemaPath.toLowerCase())
|
|
16017
|
+
if (node.schemaPath != null && node.schemaPath.toLowerCase() == schemaPath.toLowerCase()) {
|
|
16003
16018
|
return node;
|
|
16019
|
+
}
|
|
16004
16020
|
else {
|
|
16005
16021
|
try {
|
|
16006
16022
|
for (var _e = __values(node.childNodes), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -42315,6 +42331,22 @@
|
|
|
42315
42331
|
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.notificationCRUDEndpoint;
|
|
42316
42332
|
return _this;
|
|
42317
42333
|
}
|
|
42334
|
+
NotificationService.prototype.getAllUserReadNotification = function () {
|
|
42335
|
+
var url = this.serviceUri + "/AllUserReadNotification";
|
|
42336
|
+
return this.defaultGet(url);
|
|
42337
|
+
};
|
|
42338
|
+
NotificationService.prototype.getAllUserNotification = function () {
|
|
42339
|
+
var url = this.serviceUri + "/AllUserNotification";
|
|
42340
|
+
return this.defaultGet(url);
|
|
42341
|
+
};
|
|
42342
|
+
NotificationService.prototype.getReadUserNotification = function (gridInfo) {
|
|
42343
|
+
var url = this.serviceUri + "/UserReadNotification";
|
|
42344
|
+
return this.defaultPost(url, gridInfo);
|
|
42345
|
+
};
|
|
42346
|
+
NotificationService.prototype.getUserNotification = function (gridInfo) {
|
|
42347
|
+
var url = this.serviceUri + "/UserNotification";
|
|
42348
|
+
return this.defaultPost(url, gridInfo);
|
|
42349
|
+
};
|
|
42318
42350
|
NotificationService.prototype.sendNotification = function (data) {
|
|
42319
42351
|
return this.defaultPost(this.serviceUri + "/InsertToManyUser/", data);
|
|
42320
42352
|
};
|
|
@@ -43838,6 +43870,9 @@
|
|
|
43838
43870
|
});
|
|
43839
43871
|
AddressComponent.prototype.ngOnInit = function () {
|
|
43840
43872
|
var _this = this;
|
|
43873
|
+
if (!this.control.baseService) {
|
|
43874
|
+
this.control.baseService = this._addressService;
|
|
43875
|
+
}
|
|
43841
43876
|
this.control._component = this;
|
|
43842
43877
|
_super.prototype.ngOnInit.call(this);
|
|
43843
43878
|
// Nếu đã ẩn quận huyện thì phải ẩn luôn cả phường xã
|
|
@@ -43851,7 +43886,7 @@
|
|
|
43851
43886
|
label: 'Tỉnh/Thành phố',
|
|
43852
43887
|
placeholder: 'Chọn tỉnh/thành phố',
|
|
43853
43888
|
required: this.control.required && this.control.requiredProvince,
|
|
43854
|
-
baseService: this.
|
|
43889
|
+
baseService: this.control.baseService,
|
|
43855
43890
|
defaultFilters: [{ field: 'level', operator: exports.Operator.equal, value: exports.ENUM_DON_VI_HANH_CHINH.THANH_PHO.toString() }],
|
|
43856
43891
|
valueField: 'id',
|
|
43857
43892
|
displayField: 'name',
|
|
@@ -43868,7 +43903,7 @@
|
|
|
43868
43903
|
label: 'Quận/Huyện',
|
|
43869
43904
|
placeholder: 'Chọn quận/huyện',
|
|
43870
43905
|
required: this.control.required && this.control.requiredDistrict,
|
|
43871
|
-
baseService: this.
|
|
43906
|
+
baseService: this.control.baseService,
|
|
43872
43907
|
defaultFilters: [{ field: 'level', operator: exports.Operator.equal, value: exports.ENUM_DON_VI_HANH_CHINH.QUAN_HUYEN.toString() }],
|
|
43873
43908
|
bindingFilters: [{ field: 'parentId', operator: exports.Operator.equal, sourceField: 'idProvince', subField: 'idRoot' }],
|
|
43874
43909
|
valueField: 'id',
|
|
@@ -43884,7 +43919,7 @@
|
|
|
43884
43919
|
label: 'Phường/Xã',
|
|
43885
43920
|
placeholder: 'Chọn phường/xã',
|
|
43886
43921
|
required: this.control.required && this.control.requiredWard,
|
|
43887
|
-
baseService: this.
|
|
43922
|
+
baseService: this.control.baseService,
|
|
43888
43923
|
defaultFilters: [{ field: 'level', operator: exports.Operator.equal, value: exports.ENUM_DON_VI_HANH_CHINH.PHUONG_XA.toString() }],
|
|
43889
43924
|
bindingFilters: [{ field: 'parentId', operator: exports.Operator.equal, sourceField: 'idDistrict', subField: 'idRoot' }],
|
|
43890
43925
|
valueField: 'id',
|
|
@@ -43957,7 +43992,7 @@
|
|
|
43957
43992
|
street: this._modelData.street,
|
|
43958
43993
|
no: this._modelData.no
|
|
43959
43994
|
};
|
|
43960
|
-
this.
|
|
43995
|
+
this.control.baseService.getAll([
|
|
43961
43996
|
this.newFilter('id', exports.Operator.in, values)
|
|
43962
43997
|
], 'id,name').then(function (res) { return _this.handleResponse(res, '', function (data) {
|
|
43963
43998
|
if (_this._modelData.idProvince) {
|
|
@@ -44755,11 +44790,6 @@
|
|
|
44755
44790
|
this.fieldValue = this.control.valueField;
|
|
44756
44791
|
if (this.control.dataSource == null || this.control.dataSource.length == 0) {
|
|
44757
44792
|
this.bindDataSource(this.control.serviceUri, this.control.baseService);
|
|
44758
|
-
// if (this.control.serviceUri) {
|
|
44759
|
-
// }
|
|
44760
|
-
// else if(this.control.baseService) {
|
|
44761
|
-
//
|
|
44762
|
-
// }
|
|
44763
44793
|
}
|
|
44764
44794
|
else {
|
|
44765
44795
|
this.dataSourceInternal = this.control.dataSource;
|
|
@@ -44782,11 +44812,11 @@
|
|
|
44782
44812
|
var _this = this;
|
|
44783
44813
|
var _a, _b;
|
|
44784
44814
|
if (baseService) {
|
|
44815
|
+
var dropdownOptions = new DropdownOptions({
|
|
44816
|
+
displayField: (_a = this.control.displayField) !== null && _a !== void 0 ? _a : 'ten',
|
|
44817
|
+
valueField: (_b = this.control.valueField) !== null && _b !== void 0 ? _b : 'id',
|
|
44818
|
+
});
|
|
44785
44819
|
if (baseService instanceof BaseService) {
|
|
44786
|
-
var dropdownOptions = new DropdownOptions({
|
|
44787
|
-
displayField: (_a = this.control.displayField) !== null && _a !== void 0 ? _a : 'ten',
|
|
44788
|
-
valueField: (_b = this.control.valueField) !== null && _b !== void 0 ? _b : 'id',
|
|
44789
|
-
});
|
|
44790
44820
|
baseService.getDataDropdown(dropdownOptions).then(function (res) {
|
|
44791
44821
|
_this.dataSourceInternal = res;
|
|
44792
44822
|
_this.gotData = true;
|
|
@@ -44798,13 +44828,9 @@
|
|
|
44798
44828
|
console.log(err);
|
|
44799
44829
|
});
|
|
44800
44830
|
}
|
|
44801
|
-
|
|
44802
|
-
baseService.
|
|
44803
|
-
|
|
44804
|
-
// const valueField = this.control.valueField ?? 'code';
|
|
44805
|
-
_this.dataSourceInternal = res.map(function (item) {
|
|
44806
|
-
return { id: item.value, ten: item.label };
|
|
44807
|
-
});
|
|
44831
|
+
if (baseService instanceof MasterDataService) {
|
|
44832
|
+
baseService.getDataDropdown(this.control.groupCode, null, dropdownOptions).then(function (res) {
|
|
44833
|
+
_this.dataSourceInternal = res;
|
|
44808
44834
|
if (_this.wroteValue)
|
|
44809
44835
|
_this.fixValue();
|
|
44810
44836
|
_this.onReady.emit(_this.control.field);
|
|
@@ -44813,14 +44839,19 @@
|
|
|
44813
44839
|
_this.onReady.emit(_this.control.field);
|
|
44814
44840
|
});
|
|
44815
44841
|
}
|
|
44842
|
+
return;
|
|
44816
44843
|
}
|
|
44817
|
-
|
|
44844
|
+
if (serviceUri) {
|
|
44818
44845
|
this._dropDownService.getDataSource(serviceUri).then(function (rs) {
|
|
44819
44846
|
var arr = [];
|
|
44820
|
-
|
|
44821
|
-
|
|
44822
|
-
|
|
44823
|
-
|
|
44847
|
+
for (var i = 0; i < rs.data.length; i++) {
|
|
44848
|
+
arr.push({
|
|
44849
|
+
label: rs.data[i][_this.control.displayField],
|
|
44850
|
+
title: rs.data[i][_this.control.displayField],
|
|
44851
|
+
value: rs.data[i][_this.control.valueField]
|
|
44852
|
+
});
|
|
44853
|
+
}
|
|
44854
|
+
_this.dataSourceInternal = arr;
|
|
44824
44855
|
_this.gotData = true;
|
|
44825
44856
|
if (_this.wroteValue) {
|
|
44826
44857
|
_this.fixValue();
|
|
@@ -54606,15 +54637,15 @@
|
|
|
54606
54637
|
_this.url = '';
|
|
54607
54638
|
_this.urldetail = '';
|
|
54608
54639
|
_this.notifications = [];
|
|
54609
|
-
_this.rootContext.subscribe(
|
|
54640
|
+
_this.rootContext.subscribe(ComCtxConstants.NOTIFICATION.NOTIFICATION_CHANGE, function (rs) {
|
|
54610
54641
|
_this.refreshNotification();
|
|
54611
54642
|
});
|
|
54612
54643
|
_this._signalRService.start('NotificationHub', TopicReloadNotification, function (data) {
|
|
54613
54644
|
_this.refreshNotification();
|
|
54614
54645
|
});
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54646
|
+
_this.rootContext.subscribe(ComCtxConstants.NOTIFICATION.NOTIFICATION_RELOAD, function (res) {
|
|
54647
|
+
_this.refreshNotification();
|
|
54648
|
+
});
|
|
54618
54649
|
_this.environment = _this._moduleConfigService.getConfig().environment;
|
|
54619
54650
|
return _this;
|
|
54620
54651
|
}
|
|
@@ -54673,9 +54704,7 @@
|
|
|
54673
54704
|
return;
|
|
54674
54705
|
}
|
|
54675
54706
|
var gridInfo = new GridInfo({
|
|
54676
|
-
filters: [
|
|
54677
|
-
this.newFilter('userId', exports.Operator.equal, this.userId)
|
|
54678
|
-
],
|
|
54707
|
+
filters: [],
|
|
54679
54708
|
pageInfo: {
|
|
54680
54709
|
page: 1,
|
|
54681
54710
|
pageSize: this.maxNotification
|
|
@@ -54685,12 +54714,9 @@
|
|
|
54685
54714
|
],
|
|
54686
54715
|
fields: ''
|
|
54687
54716
|
});
|
|
54688
|
-
var readedFilters = [
|
|
54689
|
-
this.newFilter('userId', exports.Operator.equal, this.userId),
|
|
54690
|
-
this.newFilter('readedTime', exports.Operator.isNull, '1')
|
|
54691
|
-
];
|
|
54692
54717
|
Promise.all([
|
|
54693
|
-
this._notificationService.
|
|
54718
|
+
this._notificationService.getUserNotification(gridInfo)
|
|
54719
|
+
.then(function (res) { return _this.handleResponse(res, '', function (f) {
|
|
54694
54720
|
_this.notifications = res.data;
|
|
54695
54721
|
if (!res.success || res.data == null) {
|
|
54696
54722
|
_this._notifierService.showWarningByResponse(res);
|
|
@@ -54699,7 +54725,7 @@
|
|
|
54699
54725
|
_this.bounceNoti = true;
|
|
54700
54726
|
_this.afterGetNotication();
|
|
54701
54727
|
}); }),
|
|
54702
|
-
this._notificationService.
|
|
54728
|
+
this._notificationService.getAllUserReadNotification().then(function (res) {
|
|
54703
54729
|
if (res.data == null || !res.success) {
|
|
54704
54730
|
_this._notifierService.showWarningByResponse(res);
|
|
54705
54731
|
return;
|
|
@@ -54709,14 +54735,39 @@
|
|
|
54709
54735
|
]);
|
|
54710
54736
|
};
|
|
54711
54737
|
TnAppNotificationComponent.prototype.afterGetNotication = function () {
|
|
54712
|
-
|
|
54713
|
-
|
|
54714
|
-
|
|
54715
|
-
|
|
54716
|
-
|
|
54717
|
-
|
|
54718
|
-
|
|
54719
|
-
|
|
54738
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54739
|
+
var idsUserCreated, userRes, lstUserInfo;
|
|
54740
|
+
return __generator(this, function (_a) {
|
|
54741
|
+
switch (_a.label) {
|
|
54742
|
+
case 0:
|
|
54743
|
+
idsUserCreated = [];
|
|
54744
|
+
this.notifications.forEach(function (element) {
|
|
54745
|
+
if (element.createdUserId == null) {
|
|
54746
|
+
return;
|
|
54747
|
+
}
|
|
54748
|
+
idsUserCreated.push(element.createdUserId);
|
|
54749
|
+
});
|
|
54750
|
+
if (idsUserCreated.length === 0) {
|
|
54751
|
+
return [2 /*return*/];
|
|
54752
|
+
}
|
|
54753
|
+
return [4 /*yield*/, this._userV5Service.getAll([this.newFilter('id', exports.Operator.in, idsUserCreated)], 'avatar,id')];
|
|
54754
|
+
case 1:
|
|
54755
|
+
userRes = _a.sent();
|
|
54756
|
+
if (!userRes.success || !userRes.data || userRes.data.length === 0) {
|
|
54757
|
+
return [2 /*return*/];
|
|
54758
|
+
}
|
|
54759
|
+
lstUserInfo = userRes.data;
|
|
54760
|
+
this.notifications.forEach(function (notification) {
|
|
54761
|
+
if (!notification.createdUserId) {
|
|
54762
|
+
return;
|
|
54763
|
+
}
|
|
54764
|
+
var userInfo = lstUserInfo.find(function (x) { return x.id === notification.createdUserId; });
|
|
54765
|
+
if (!userInfo) {
|
|
54766
|
+
return;
|
|
54767
|
+
}
|
|
54768
|
+
notification.avatar = userInfo.avatar;
|
|
54769
|
+
});
|
|
54770
|
+
return [2 /*return*/];
|
|
54720
54771
|
}
|
|
54721
54772
|
});
|
|
54722
54773
|
});
|