@masterteam/form-builder 0.0.52 → 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.
@@ -1402,7 +1402,12 @@ class FBFieldConditions {
1402
1402
  propertyItems = computed(() => this.availableFields().map((field) => ({
1403
1403
  key: field.key,
1404
1404
  name: field.name,
1405
- description: field.type ? `${field.name} (${field.type})` : field.name,
1405
+ // The key ends the tooltip because it is the only thing that separates
1406
+ // two same-named fields (a level's "Status" from a task's); repeating
1407
+ // just the name would echo what the chip already shows.
1408
+ description: field.type
1409
+ ? `${field.name} (${field.type}) — ${field.key}`
1410
+ : `${field.name} — ${field.key}`,
1406
1411
  hasValues: isValueBackedViewType(field.type),
1407
1412
  })), ...(ngDevMode ? [{ debugName: "propertyItems" }] : /* istanbul ignore next */ []));
1408
1413
  /** Toolbar labels */
@@ -1522,6 +1527,21 @@ class FBFieldForm {
1522
1527
  allSections = input([], ...(ngDevMode ? [{ debugName: "allSections" }] : /* istanbul ignore next */ []));
1523
1528
  mode = input('builder', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1524
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 */ []));
1525
1545
  // UI State
1526
1546
  submitting = signal(false, ...(ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []));
1527
1547
  deleting = signal(false, ...(ngDevMode ? [{ debugName: "deleting" }] : /* istanbul ignore next */ []));
@@ -1560,7 +1580,7 @@ class FBFieldForm {
1560
1580
  labelArControl = new FormControl('', { nonNullable: true });
1561
1581
  /** Whether the field already had a custom label when the dialog opened. */
1562
1582
  hadInitialLabel = signal(false, ...(ngDevMode ? [{ debugName: "hadInitialLabel" }] : /* istanbul ignore next */ []));
1563
- formConfig = {
1583
+ formConfig = computed(() => ({
1564
1584
  sections: [
1565
1585
  {
1566
1586
  key: 'section-form',
@@ -1575,6 +1595,10 @@ class FBFieldForm {
1575
1595
  toggleShape: 'card',
1576
1596
  colSpan: 12,
1577
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(),
1578
1602
  },
1579
1603
  {
1580
1604
  key: 'hiddenInCreation',
@@ -1607,7 +1631,7 @@ class FBFieldForm {
1607
1631
  ],
1608
1632
  },
1609
1633
  ],
1610
- };
1634
+ }), ...(ngDevMode ? [{ debugName: "formConfig" }] : /* istanbul ignore next */ []));
1611
1635
  /** Simplified form config for manageProperties mode: only size */
1612
1636
  managePropertiesFormConfig = {
1613
1637
  sections: [
@@ -1635,7 +1659,7 @@ class FBFieldForm {
1635
1659
  };
1636
1660
  activeFormConfig = computed(() => this.isManageProperties()
1637
1661
  ? this.managePropertiesFormConfig
1638
- : this.formConfig, ...(ngDevMode ? [{ debugName: "activeFormConfig" }] : /* istanbul ignore next */ []));
1662
+ : this.formConfig(), ...(ngDevMode ? [{ debugName: "activeFormConfig" }] : /* istanbul ignore next */ []));
1639
1663
  constructor() {
1640
1664
  effect(() => {
1641
1665
  const data = this.initialData();
@@ -1646,7 +1670,9 @@ class FBFieldForm {
1646
1670
  '100': 'l',
1647
1671
  };
1648
1672
  this.formControl.patchValue({
1649
- isRequired: data.isRequired ?? false,
1673
+ isRequired: this.isConnectionField()
1674
+ ? false
1675
+ : (data.isRequired ?? false),
1650
1676
  hiddenInCreation: data.hiddenInCreation ?? false,
1651
1677
  hiddenInEditForm: data.hiddenInEditForm ?? false,
1652
1678
  size: widthToSize[data.width] ?? 'l',
@@ -1701,7 +1727,9 @@ class FBFieldForm {
1701
1727
  if (!this.isManageProperties()) {
1702
1728
  payload['hiddenInCreation'] = formValue.hiddenInCreation ?? false;
1703
1729
  payload['hiddenInEditForm'] = formValue.hiddenInEditForm ?? false;
1704
- payload['isRequired'] = formValue.isRequired ?? false;
1730
+ payload['isRequired'] = this.isConnectionField()
1731
+ ? false
1732
+ : (formValue.isRequired ?? false);
1705
1733
  payload['showConditionalDisplayFormula'] =
1706
1734
  this.showHideControl.value ?? false;
1707
1735
  payload['conditionalDisplayFormula'] = this.showHideControl.value