tnx-shared 5.1.402 → 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 +52 -40
- 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 +1 -0
- package/classes/form-schema.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/esm2015/classes/base/component-base.js +7 -5
- package/esm2015/classes/form-schema.js +1 -1
- 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/fesm2015/tnx-shared.js +52 -40
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- 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()) {
|
|
@@ -44774,11 +44790,6 @@
|
|
|
44774
44790
|
this.fieldValue = this.control.valueField;
|
|
44775
44791
|
if (this.control.dataSource == null || this.control.dataSource.length == 0) {
|
|
44776
44792
|
this.bindDataSource(this.control.serviceUri, this.control.baseService);
|
|
44777
|
-
// if (this.control.serviceUri) {
|
|
44778
|
-
// }
|
|
44779
|
-
// else if(this.control.baseService) {
|
|
44780
|
-
//
|
|
44781
|
-
// }
|
|
44782
44793
|
}
|
|
44783
44794
|
else {
|
|
44784
44795
|
this.dataSourceInternal = this.control.dataSource;
|
|
@@ -44801,11 +44812,11 @@
|
|
|
44801
44812
|
var _this = this;
|
|
44802
44813
|
var _a, _b;
|
|
44803
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
|
+
});
|
|
44804
44819
|
if (baseService instanceof BaseService) {
|
|
44805
|
-
var dropdownOptions = new DropdownOptions({
|
|
44806
|
-
displayField: (_a = this.control.displayField) !== null && _a !== void 0 ? _a : 'ten',
|
|
44807
|
-
valueField: (_b = this.control.valueField) !== null && _b !== void 0 ? _b : 'id',
|
|
44808
|
-
});
|
|
44809
44820
|
baseService.getDataDropdown(dropdownOptions).then(function (res) {
|
|
44810
44821
|
_this.dataSourceInternal = res;
|
|
44811
44822
|
_this.gotData = true;
|
|
@@ -44817,13 +44828,9 @@
|
|
|
44817
44828
|
console.log(err);
|
|
44818
44829
|
});
|
|
44819
44830
|
}
|
|
44820
|
-
|
|
44821
|
-
baseService.
|
|
44822
|
-
|
|
44823
|
-
// const valueField = this.control.valueField ?? 'code';
|
|
44824
|
-
_this.dataSourceInternal = res.map(function (item) {
|
|
44825
|
-
return { id: item.value, ten: item.label };
|
|
44826
|
-
});
|
|
44831
|
+
if (baseService instanceof MasterDataService) {
|
|
44832
|
+
baseService.getDataDropdown(this.control.groupCode, null, dropdownOptions).then(function (res) {
|
|
44833
|
+
_this.dataSourceInternal = res;
|
|
44827
44834
|
if (_this.wroteValue)
|
|
44828
44835
|
_this.fixValue();
|
|
44829
44836
|
_this.onReady.emit(_this.control.field);
|
|
@@ -44832,14 +44839,19 @@
|
|
|
44832
44839
|
_this.onReady.emit(_this.control.field);
|
|
44833
44840
|
});
|
|
44834
44841
|
}
|
|
44842
|
+
return;
|
|
44835
44843
|
}
|
|
44836
|
-
|
|
44844
|
+
if (serviceUri) {
|
|
44837
44845
|
this._dropDownService.getDataSource(serviceUri).then(function (rs) {
|
|
44838
44846
|
var arr = [];
|
|
44839
|
-
|
|
44840
|
-
|
|
44841
|
-
|
|
44842
|
-
|
|
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;
|
|
44843
44855
|
_this.gotData = true;
|
|
44844
44856
|
if (_this.wroteValue) {
|
|
44845
44857
|
_this.fixValue();
|