@messaia/cdk 17.0.8 → 17.1.0-rc01
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/esm2022/lib/base/components/generic-form-base.component.mjs +2 -2
- package/esm2022/lib/forms/components/generic-form/generic-form.component.mjs +3 -3
- package/esm2022/lib/forms/functions/decorators.mjs +3 -5
- package/esm2022/lib/forms/functions/functions.mjs +7 -4
- package/esm2022/lib/forms/models/form-field-group-definition.mjs +5 -2
- package/fesm2022/messaia-cdk.mjs +15 -11
- package/fesm2022/messaia-cdk.mjs.map +1 -1
- package/lib/forms/functions/functions.d.ts +2 -1
- package/lib/forms/models/form-field-group-definition.d.ts +4 -0
- package/package.json +1 -1
package/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -7371,7 +7371,10 @@ class FormFieldGroupDefinition {
|
|
|
7371
7371
|
* Instance of an object associated with the form field group.
|
|
7372
7372
|
*/
|
|
7373
7373
|
instance;
|
|
7374
|
-
|
|
7374
|
+
/**
|
|
7375
|
+
* Indicates whether the form field group is hidden.
|
|
7376
|
+
*/
|
|
7377
|
+
hidden;
|
|
7375
7378
|
/**
|
|
7376
7379
|
* Constructor for the FormFieldGroupDefinition class.
|
|
7377
7380
|
* @param init - Optional partial data to initialize the form field group.
|
|
@@ -7409,7 +7412,7 @@ function getFormDefinition(origin) {
|
|
|
7409
7412
|
* @param origin
|
|
7410
7413
|
* @returns
|
|
7411
7414
|
*/
|
|
7412
|
-
function getFormGroups(origin) {
|
|
7415
|
+
function getFormGroups(origin, type, args) {
|
|
7413
7416
|
/* Check if origin is not defined */
|
|
7414
7417
|
if (!origin) {
|
|
7415
7418
|
throw new Error('Origin object must be defined.');
|
|
@@ -7420,7 +7423,10 @@ function getFormGroups(origin) {
|
|
|
7420
7423
|
var groups = Array.from(mainFieldGroups).map(([_, value], i) => new FormFieldGroupDefinition({
|
|
7421
7424
|
name: value[0].groupName || undefined,
|
|
7422
7425
|
header: value[0].groupHeader,
|
|
7423
|
-
|
|
7426
|
+
type: type,
|
|
7427
|
+
instance: origin,
|
|
7428
|
+
index: args?.index ?? i,
|
|
7429
|
+
hidden: args?.hidden,
|
|
7424
7430
|
groups: Object.values((value).reduce(function (r, a) {
|
|
7425
7431
|
if (a.row) {
|
|
7426
7432
|
r[a.row] = (r[a.row] || []);
|
|
@@ -7434,7 +7440,7 @@ function getFormGroups(origin) {
|
|
|
7434
7440
|
}));
|
|
7435
7441
|
/* Get object groups */
|
|
7436
7442
|
var objectFieldGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
|
|
7437
|
-
if (objectFieldGroups) {
|
|
7443
|
+
if (objectFieldGroups && Array.isArray(objectFieldGroups)) {
|
|
7438
7444
|
groups = groups.concat(objectFieldGroups);
|
|
7439
7445
|
}
|
|
7440
7446
|
/* Sort the groups by index */
|
|
@@ -7539,16 +7545,14 @@ function FormFieldGroup(type, args) {
|
|
|
7539
7545
|
/* Create an instance of the group object */
|
|
7540
7546
|
var instance = Reflect.construct(type, []);
|
|
7541
7547
|
/* Get from groups */
|
|
7542
|
-
var groups = getFormGroups(instance);
|
|
7548
|
+
var groups = getFormGroups(instance, type, args);
|
|
7543
7549
|
/* Get the header of the groups or create one using the property name */
|
|
7544
7550
|
var groupHeader = args?.header || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyKey;
|
|
7545
7551
|
/* Get the fields from the groups */
|
|
7546
7552
|
groups?.forEach((x, i) => {
|
|
7547
7553
|
Object.assign(x, {
|
|
7548
|
-
name: propertyKey,
|
|
7554
|
+
name: args?.name ?? x.name ?? propertyKey,
|
|
7549
7555
|
header: groupHeader,
|
|
7550
|
-
type: type,
|
|
7551
|
-
instance: args?.instance || instance,
|
|
7552
7556
|
index: args?.index || i
|
|
7553
7557
|
});
|
|
7554
7558
|
/* Set the name of the group in the fields */
|
|
@@ -14964,7 +14968,7 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
14964
14968
|
this.toolbarMenuItems.forEach((x, i) => x.index ??= i);
|
|
14965
14969
|
}
|
|
14966
14970
|
/* Create the from fields using the entity type */
|
|
14967
|
-
this.fieldGroups = this.formDefinition?.fieldGroups;
|
|
14971
|
+
this.fieldGroups = this.formDefinition?.fieldGroups?.filter(x => !x.hidden);
|
|
14968
14972
|
}
|
|
14969
14973
|
/**
|
|
14970
14974
|
* Builds a new form
|
|
@@ -21164,7 +21168,7 @@ class VdGenericFormComponent {
|
|
|
21164
21168
|
this.buildFields();
|
|
21165
21169
|
}
|
|
21166
21170
|
/* Get filed rows */
|
|
21167
|
-
let fieldRows = this.fieldGroups?.filter(x => x.name?.trim() == this.groupName?.trim())[0]?.groups;
|
|
21171
|
+
let fieldRows = this.fieldGroups?.filter(x => x.name?.trim() == this.groupName?.trim() && !x.hidden)[0]?.groups;
|
|
21168
21172
|
if (fieldRows) {
|
|
21169
21173
|
this.fieldRows = fieldRows.map(a => { return [...a.map(y => { return { ...y }; })]; });
|
|
21170
21174
|
}
|
|
@@ -21349,7 +21353,7 @@ class VdGenericFormComponent {
|
|
|
21349
21353
|
/* Get form definition */
|
|
21350
21354
|
this.formDefinition = getFormDefinition(new this.classType());
|
|
21351
21355
|
/* Create the from fields using the entity type */
|
|
21352
|
-
this.fieldGroups = this.formDefinition?.fieldGroups?.map(a => { return { ...a }; });
|
|
21356
|
+
this.fieldGroups = this.formDefinition?.fieldGroups?.filter(x => !x.hidden)?.map(a => { return { ...a }; });
|
|
21353
21357
|
}
|
|
21354
21358
|
/**
|
|
21355
21359
|
* Log to console
|