tnx-shared 5.3.270 → 5.3.271
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 +70 -23
- 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/crud/crud-form/crud-form.component.d.ts +1 -0
- package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
- package/esm2015/classes/form-schema.js +2 -1
- package/esm2015/components/crud/crud-form/crud-form.component.js +28 -4
- package/fesm2015/tnx-shared.js +28 -3
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -845,6 +845,7 @@ class CrudFormSetting {
|
|
|
845
845
|
this.hiddenKySoSimCaNhan = false;
|
|
846
846
|
this.hiddenKySoUsbCaNhan = false;
|
|
847
847
|
this.hiddenKySoDonVi = false;
|
|
848
|
+
this.arrFieldMustValidate = [];
|
|
848
849
|
this.getCustomDataTrinhKy = (rowData) => ({});
|
|
849
850
|
for (const key in init) {
|
|
850
851
|
this[key] = init[key];
|
|
@@ -13657,10 +13658,11 @@ class CrudFormComponent extends ComponentBase {
|
|
|
13657
13658
|
return 'string';
|
|
13658
13659
|
}
|
|
13659
13660
|
validateForm(setValidateForm = true) {
|
|
13661
|
+
var _a;
|
|
13660
13662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13661
|
-
if (setValidateForm) {
|
|
13663
|
+
if (setValidateForm || ((_a = this.setting.arrFieldMustValidate) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
13662
13664
|
this._inValidForm = false;
|
|
13663
|
-
yield this.validateModel(this._rootNode);
|
|
13665
|
+
yield this.validateModel(this._rootNode, setValidateForm);
|
|
13664
13666
|
if (this._inValidForm) {
|
|
13665
13667
|
setTimeout(() => {
|
|
13666
13668
|
this.focusToFirstErrorControl();
|
|
@@ -13671,9 +13673,16 @@ class CrudFormComponent extends ComponentBase {
|
|
|
13671
13673
|
return true;
|
|
13672
13674
|
});
|
|
13673
13675
|
}
|
|
13674
|
-
validateModel(currentNode) {
|
|
13676
|
+
validateModel(currentNode, setValidateForm = true) {
|
|
13677
|
+
var _a;
|
|
13675
13678
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13676
13679
|
for (const childNode of currentNode.childNodes) {
|
|
13680
|
+
if (!setValidateForm && ((_a = this.setting.arrFieldMustValidate) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
13681
|
+
if (!this.setting.arrFieldMustValidate.includes(childNode.field)) {
|
|
13682
|
+
this.removeAllErrorByNodes(childNode);
|
|
13683
|
+
continue;
|
|
13684
|
+
}
|
|
13685
|
+
}
|
|
13677
13686
|
if (!childNode.control) {
|
|
13678
13687
|
if (childNode.childNodes == null) {
|
|
13679
13688
|
continue;
|
|
@@ -13990,6 +13999,22 @@ class CrudFormComponent extends ComponentBase {
|
|
|
13990
13999
|
this._removeError(field);
|
|
13991
14000
|
}
|
|
13992
14001
|
}
|
|
14002
|
+
removeAllErrorByNodes(currentNode) {
|
|
14003
|
+
var _a, _b;
|
|
14004
|
+
currentNode.parentNode.model._errors[currentNode.field] = [];
|
|
14005
|
+
if (!((_a = currentNode.childNodes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
14006
|
+
return;
|
|
14007
|
+
}
|
|
14008
|
+
for (const childNode of currentNode.childNodes) {
|
|
14009
|
+
if (!((_b = childNode.childNodes) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
14010
|
+
this.removeAllErrorByNodes(childNode);
|
|
14011
|
+
continue;
|
|
14012
|
+
}
|
|
14013
|
+
for (const node of childNode.childNodes) {
|
|
14014
|
+
this.removeAllErrorByNodes(node);
|
|
14015
|
+
}
|
|
14016
|
+
}
|
|
14017
|
+
}
|
|
13993
14018
|
cacheControlValue(control, value, parentPath) {
|
|
13994
14019
|
if (control && control.enableCaching) {
|
|
13995
14020
|
this.cachedValues[parentPath + '.' + control.field] = value;
|