mmhglobal-dynamicform 2.0.0 → 2.0.2
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/README.md +9 -0
- package/esm2020/lib/components/fieldbase.component.mjs +7 -1
- package/esm2020/lib/services/main.service.mjs +7 -3
- package/esm2020/lib/zgrid/zgrid.component.mjs +13 -1
- package/esm2020/lib/ztextarea/ztextarea.component.mjs +6 -2
- package/esm2020/lib/zudf/zudf.component.mjs +16 -6
- package/fesm2015/mmhglobal-dynamicform.mjs +40 -9
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +40 -8
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -474,6 +474,12 @@ class FieldBase {
|
|
|
474
474
|
this.setRequire = (status) => {
|
|
475
475
|
this.componentProperties.isRequired = status;
|
|
476
476
|
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
|
|
477
|
+
if (this.data.Type === 'ztexteditor') {
|
|
478
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
482
|
+
}
|
|
477
483
|
};
|
|
478
484
|
}
|
|
479
485
|
initComponent() {
|
|
@@ -2458,8 +2464,10 @@ class MainService {
|
|
|
2458
2464
|
const referenceId = group.parentReferenceId || "0";
|
|
2459
2465
|
//const pathSegment = this.router.url.split("/");
|
|
2460
2466
|
//const lastSegment = pathSegment[pathSegment.length - 1];
|
|
2461
|
-
const
|
|
2462
|
-
const
|
|
2467
|
+
const currentNavigationParam = this.getNavigationCurrentParam();
|
|
2468
|
+
const navigationSegments = currentNavigationParam ? currentNavigationParam.split('/') : null;
|
|
2469
|
+
const defaultAction = group.isCloneNew ? 'new' : 'edit';
|
|
2470
|
+
const actionSegment = group.isCloneNew ? (navigationSegments ? navigationSegments[navigationSegments.length - 1] : 'new') : defaultAction;
|
|
2463
2471
|
if (group.isListForm) {
|
|
2464
2472
|
this.tryUpdateGroupTrigger(false);
|
|
2465
2473
|
this.setNavigationParams([referenceId, 'new']);
|
|
@@ -2752,6 +2760,8 @@ class MainService {
|
|
|
2752
2760
|
}
|
|
2753
2761
|
if (!fg.valid) {
|
|
2754
2762
|
this.componentErrorHandler.showFormGroupErrorMessage(group, fg);
|
|
2763
|
+
fg.markAsTouched();
|
|
2764
|
+
fg.markAllAsTouched();
|
|
2755
2765
|
return false;
|
|
2756
2766
|
}
|
|
2757
2767
|
return true;
|
|
@@ -7498,8 +7508,7 @@ class ZtextareaComponent extends InputFieldBase {
|
|
|
7498
7508
|
super.focusOnDefault(this.focus.bind(this));
|
|
7499
7509
|
}
|
|
7500
7510
|
setCharCounterDisplayStr() {
|
|
7501
|
-
|
|
7502
|
-
const characterCount = ((_a = this.group.zModel[this.data.Value]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
7511
|
+
const characterCount = ZComponentHelper.getValueWithoutContinuousSpaces(this.group.zModel[this.data.Value]).length;
|
|
7503
7512
|
this.charCounterDisplayStr = `${characterCount} ${this.data.MaxLength ? (' / ' + this.data.MaxLength) : ''}`;
|
|
7504
7513
|
}
|
|
7505
7514
|
onChange(event, fieldValue) {
|
|
@@ -8982,6 +8991,12 @@ class ZgridComponent extends DataListingFieldBase {
|
|
|
8982
8991
|
const validators = [];
|
|
8983
8992
|
if (col.IsRequired) {
|
|
8984
8993
|
validators.push(Validators.required);
|
|
8994
|
+
if (col.Type === 'ztexteditor') {
|
|
8995
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
8996
|
+
}
|
|
8997
|
+
else {
|
|
8998
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
8999
|
+
}
|
|
8985
9000
|
}
|
|
8986
9001
|
if (col.ValidatorPattern) {
|
|
8987
9002
|
validators.push(Validators.pattern(col.ValidatorPattern));
|
|
@@ -9049,6 +9064,12 @@ class ZgridComponent extends DataListingFieldBase {
|
|
|
9049
9064
|
const validators = [];
|
|
9050
9065
|
if (col.IsRequired) {
|
|
9051
9066
|
validators.push(Validators.required);
|
|
9067
|
+
if (col.Type === 'ztexteditor') {
|
|
9068
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
9069
|
+
}
|
|
9070
|
+
else {
|
|
9071
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
9072
|
+
}
|
|
9052
9073
|
}
|
|
9053
9074
|
if (col.ValidatorPattern) {
|
|
9054
9075
|
validators.push(Validators.pattern(col.ValidatorPattern));
|
|
@@ -11627,6 +11648,12 @@ class ZudfComponent {
|
|
|
11627
11648
|
this.setRequire = (status) => {
|
|
11628
11649
|
this.componentProperties.isRequired = status;
|
|
11629
11650
|
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
|
|
11651
|
+
if (this.data.Type === 'ztexteditor') {
|
|
11652
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
11653
|
+
}
|
|
11654
|
+
else {
|
|
11655
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
11656
|
+
}
|
|
11630
11657
|
};
|
|
11631
11658
|
}
|
|
11632
11659
|
ngOnInit() {
|
|
@@ -11828,7 +11855,7 @@ class ZudfComponent {
|
|
|
11828
11855
|
}
|
|
11829
11856
|
else {
|
|
11830
11857
|
// before generate FormControl, we need to add 2 attribute to the field when render.
|
|
11831
|
-
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11858
|
+
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11832
11859
|
if (containerName) {
|
|
11833
11860
|
field['containerName'] = containerName;
|
|
11834
11861
|
;
|
|
@@ -11847,7 +11874,7 @@ class ZudfComponent {
|
|
|
11847
11874
|
zudfGroup[containerName].push(field.Value);
|
|
11848
11875
|
}
|
|
11849
11876
|
}
|
|
11850
|
-
// set the list of dropdown option to the variable
|
|
11877
|
+
// set the list of dropdown option to the variable
|
|
11851
11878
|
if (this.isDropdownType(field.Type) && field.ZDataOptionName && field.DropdownOptions) {
|
|
11852
11879
|
this.group.zData[field.ZDataOptionName] = Object.assign([], eval('this.' + field.DropdownOptions));
|
|
11853
11880
|
}
|
|
@@ -11870,7 +11897,7 @@ class ZudfComponent {
|
|
|
11870
11897
|
if (!zudfGroup['fieldRequiredDefaultUser']) {
|
|
11871
11898
|
zudfGroup['fieldRequiredDefaultUser'] = [];
|
|
11872
11899
|
}
|
|
11873
|
-
// keep a list of default user need to be filled in the scope
|
|
11900
|
+
// keep a list of default user need to be filled in the scope
|
|
11874
11901
|
zudfGroup['fieldRequiredDefaultUser'].push({
|
|
11875
11902
|
fieldName: field.Name,
|
|
11876
11903
|
childFields: field.ChildFields
|
|
@@ -11980,7 +12007,7 @@ class ZudfComponent {
|
|
|
11980
12007
|
updatedModelData[prefixedPropertyName] = updatedNestedObject;
|
|
11981
12008
|
}
|
|
11982
12009
|
else {
|
|
11983
|
-
// Add the property to the output object with the component prefix
|
|
12010
|
+
// Add the property to the output object with the component prefix
|
|
11984
12011
|
let prefixedPropertyName;
|
|
11985
12012
|
if (containerPrefix) {
|
|
11986
12013
|
prefixedPropertyName = `${this.componentPrefix}_${containerPrefix}_${propertyName}`;
|
|
@@ -12216,7 +12243,7 @@ class ZudfComponent {
|
|
|
12216
12243
|
}
|
|
12217
12244
|
}
|
|
12218
12245
|
clearContainerRelatedFieldValue(group, containerName) {
|
|
12219
|
-
// after set to grid, clear the zmodel.
|
|
12246
|
+
// after set to grid, clear the zmodel.
|
|
12220
12247
|
this.clearContainerFieldElementValue(containerName);
|
|
12221
12248
|
}
|
|
12222
12249
|
removeGridRow(gridValue, gridDataSource, dataItem, index) {
|
|
@@ -12244,6 +12271,10 @@ class ZudfComponent {
|
|
|
12244
12271
|
for (const key of Object.keys(fg.controls)) {
|
|
12245
12272
|
this.setContainerFieldErrorAsNull(fg, key);
|
|
12246
12273
|
}
|
|
12274
|
+
// Check is the formgroup value again.
|
|
12275
|
+
if (fg.valid) {
|
|
12276
|
+
return true;
|
|
12277
|
+
}
|
|
12247
12278
|
// Show the error message for the form
|
|
12248
12279
|
this.componentErrorHandlerService.showFormGroupErrorMessage(this.group, fg);
|
|
12249
12280
|
// Return false to indicate that the form is not valid
|