@masterteam/form-builder 0.0.53 → 0.0.54
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.
|
@@ -1527,6 +1527,21 @@ class FBFieldForm {
|
|
|
1527
1527
|
allSections = input([], ...(ngDevMode ? [{ debugName: "allSections" }] : /* istanbul ignore next */ []));
|
|
1528
1528
|
mode = input('builder', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1529
1529
|
isManageProperties = computed(() => this.mode() === 'manageProperties', ...(ngDevMode ? [{ debugName: "isManageProperties" }] : /* istanbul ignore next */ []));
|
|
1530
|
+
/**
|
|
1531
|
+
* Connection requiredness is owned by
|
|
1532
|
+
* `propertyMetadata.configuration.sourceLevels[].isOptional`, not by the
|
|
1533
|
+
* form field's legacy `isRequired` flag.
|
|
1534
|
+
*/
|
|
1535
|
+
isConnectionField = computed(() => {
|
|
1536
|
+
const field = this.initialData();
|
|
1537
|
+
const viewType = field?.propertyMetadata?.viewType ??
|
|
1538
|
+
field?.property?.viewType ??
|
|
1539
|
+
field?.data?.viewType ??
|
|
1540
|
+
field?.type;
|
|
1541
|
+
return (String(viewType ?? '')
|
|
1542
|
+
.trim()
|
|
1543
|
+
.toLowerCase() === 'connection');
|
|
1544
|
+
}, ...(ngDevMode ? [{ debugName: "isConnectionField" }] : /* istanbul ignore next */ []));
|
|
1530
1545
|
// UI State
|
|
1531
1546
|
submitting = signal(false, ...(ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []));
|
|
1532
1547
|
deleting = signal(false, ...(ngDevMode ? [{ debugName: "deleting" }] : /* istanbul ignore next */ []));
|
|
@@ -1565,7 +1580,7 @@ class FBFieldForm {
|
|
|
1565
1580
|
labelArControl = new FormControl('', { nonNullable: true });
|
|
1566
1581
|
/** Whether the field already had a custom label when the dialog opened. */
|
|
1567
1582
|
hadInitialLabel = signal(false, ...(ngDevMode ? [{ debugName: "hadInitialLabel" }] : /* istanbul ignore next */ []));
|
|
1568
|
-
formConfig = {
|
|
1583
|
+
formConfig = computed(() => ({
|
|
1569
1584
|
sections: [
|
|
1570
1585
|
{
|
|
1571
1586
|
key: 'section-form',
|
|
@@ -1580,6 +1595,10 @@ class FBFieldForm {
|
|
|
1580
1595
|
toggleShape: 'card',
|
|
1581
1596
|
colSpan: 12,
|
|
1582
1597
|
order: 1,
|
|
1598
|
+
// Not applicable to a Connection, so it is not offered at all
|
|
1599
|
+
// rather than shown greyed out. `hidden` also disables the control
|
|
1600
|
+
// and resets it to `false`, which is the value onSubmit writes.
|
|
1601
|
+
hidden: this.isConnectionField(),
|
|
1583
1602
|
},
|
|
1584
1603
|
{
|
|
1585
1604
|
key: 'hiddenInCreation',
|
|
@@ -1612,7 +1631,7 @@ class FBFieldForm {
|
|
|
1612
1631
|
],
|
|
1613
1632
|
},
|
|
1614
1633
|
],
|
|
1615
|
-
};
|
|
1634
|
+
}), ...(ngDevMode ? [{ debugName: "formConfig" }] : /* istanbul ignore next */ []));
|
|
1616
1635
|
/** Simplified form config for manageProperties mode: only size */
|
|
1617
1636
|
managePropertiesFormConfig = {
|
|
1618
1637
|
sections: [
|
|
@@ -1640,7 +1659,7 @@ class FBFieldForm {
|
|
|
1640
1659
|
};
|
|
1641
1660
|
activeFormConfig = computed(() => this.isManageProperties()
|
|
1642
1661
|
? this.managePropertiesFormConfig
|
|
1643
|
-
: this.formConfig, ...(ngDevMode ? [{ debugName: "activeFormConfig" }] : /* istanbul ignore next */ []));
|
|
1662
|
+
: this.formConfig(), ...(ngDevMode ? [{ debugName: "activeFormConfig" }] : /* istanbul ignore next */ []));
|
|
1644
1663
|
constructor() {
|
|
1645
1664
|
effect(() => {
|
|
1646
1665
|
const data = this.initialData();
|
|
@@ -1651,7 +1670,9 @@ class FBFieldForm {
|
|
|
1651
1670
|
'100': 'l',
|
|
1652
1671
|
};
|
|
1653
1672
|
this.formControl.patchValue({
|
|
1654
|
-
isRequired:
|
|
1673
|
+
isRequired: this.isConnectionField()
|
|
1674
|
+
? false
|
|
1675
|
+
: (data.isRequired ?? false),
|
|
1655
1676
|
hiddenInCreation: data.hiddenInCreation ?? false,
|
|
1656
1677
|
hiddenInEditForm: data.hiddenInEditForm ?? false,
|
|
1657
1678
|
size: widthToSize[data.width] ?? 'l',
|
|
@@ -1706,7 +1727,9 @@ class FBFieldForm {
|
|
|
1706
1727
|
if (!this.isManageProperties()) {
|
|
1707
1728
|
payload['hiddenInCreation'] = formValue.hiddenInCreation ?? false;
|
|
1708
1729
|
payload['hiddenInEditForm'] = formValue.hiddenInEditForm ?? false;
|
|
1709
|
-
payload['isRequired'] =
|
|
1730
|
+
payload['isRequired'] = this.isConnectionField()
|
|
1731
|
+
? false
|
|
1732
|
+
: (formValue.isRequired ?? false);
|
|
1710
1733
|
payload['showConditionalDisplayFormula'] =
|
|
1711
1734
|
this.showHideControl.value ?? false;
|
|
1712
1735
|
payload['conditionalDisplayFormula'] = this.showHideControl.value
|