df-ae-forms-package 1.0.91 → 1.0.93

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/dist/index.js CHANGED
@@ -4566,7 +4566,7 @@ formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChan
4566
4566
  position: 'sticky',
4567
4567
  bottom: 0,
4568
4568
  zIndex: 5
4569
- }, children: jsxRuntime.jsxs("button", { onClick: onAddEntry, disabled: dataEntries.length >= maxEntries, style: {
4569
+ }, children: jsxRuntime.jsxs("button", { onClick: () => { console.log('[TableView] Add Entry button clicked (grid view)', 'entries:', dataEntries.length, 'max:', maxEntries); onAddEntry(); }, disabled: dataEntries.length >= maxEntries, style: {
4570
4570
  padding: '8px 16px',
4571
4571
  backgroundColor: dataEntries.length >= maxEntries ? '#f3f4f6' : '#10b981',
4572
4572
  color: dataEntries.length >= maxEntries ? '#9ca3af' : '#ffffff',
@@ -4688,7 +4688,7 @@ formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChan
4688
4688
  borderRadius: '8px',
4689
4689
  display: 'flex',
4690
4690
  justifyContent: 'center'
4691
- }, children: jsxRuntime.jsxs("button", { onClick: onAddEntry, disabled: dataEntries.length >= maxEntries, style: {
4691
+ }, children: jsxRuntime.jsxs("button", { onClick: () => { console.log('[TableView] Add Entry button clicked (list view)', 'entries:', dataEntries.length, 'max:', maxEntries); onAddEntry(); }, disabled: dataEntries.length >= maxEntries, style: {
4692
4692
  padding: '8px 16px',
4693
4693
  backgroundColor: dataEntries.length >= maxEntries ? '#f3f4f6' : '#10b981',
4694
4694
  color: dataEntries.length >= maxEntries ? '#9ca3af' : '#ffffff',
@@ -4938,6 +4938,10 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
4938
4938
  // In edit/preview modes, don't handle value changes as components are read-only
4939
4939
  }, [mode, onValueChange]);
4940
4940
  const handleAddEntry = React.useCallback(() => {
4941
+ console.log('[DfFormDataGrid] handleAddEntry called');
4942
+ console.log('[DfFormDataGrid] gridComponents:', gridComponents.length, gridComponents.map(c => c.id));
4943
+ console.log('[DfFormDataGrid] current entries:', properties.entries?.length);
4944
+ console.log('[DfFormDataGrid] onValueChange exists:', !!onValueChange);
4941
4945
  // Use timestamp and random string to ensure uniqueness even if entries are deleted
4942
4946
  const uniqueSuffix = `${Date.now()}-${Math.random().toString(36).substr(2, 5)}`;
4943
4947
  const newEntryId = `entry-${uniqueSuffix}`;
@@ -4959,13 +4963,19 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
4959
4963
  }),
4960
4964
  styles: {}
4961
4965
  };
4966
+ console.log('[DfFormDataGrid] newEntry created:', newEntry.id, 'with', newEntry.components.length, 'components');
4962
4967
  const updatedEntries = [...properties.entries, newEntry];
4968
+ console.log('[DfFormDataGrid] updatedEntries count:', updatedEntries.length);
4963
4969
  if (onValueChange) {
4970
+ console.log('[DfFormDataGrid] calling onValueChange with updated entries');
4964
4971
  onValueChange({
4965
4972
  id,
4966
4973
  value: { ...properties, entries: updatedEntries }
4967
4974
  });
4968
4975
  }
4976
+ else {
4977
+ console.log('[DfFormDataGrid] WARNING: onValueChange is not defined!');
4978
+ }
4969
4979
  onEntryAdd?.();
4970
4980
  }, [properties, onValueChange, id, onEntryAdd, gridComponents]);
4971
4981
  const handleRemoveEntry = React.useCallback((entryIndex) => {
@@ -5062,7 +5072,7 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
5062
5072
  , {
5063
5073
  // Cast to FormComponentType[] to satisfy TableView typing; gridComponents
5064
5074
  // are always child form components of the datagrid.
5065
- templateComponents: gridComponents, dataEntries: dataEntries, renderFormComponent: renderFormComponent || renderComponent, mode: mode, allowAddRemoveEntries: properties.datagrid?.allowAddRemoveEntries ?? true, addAnotherText: properties.datagrid?.addAnotherText ?? 'Add Entry', removeText: properties.datagrid?.removeText ?? 'Remove', maxEntries: properties.datagrid?.maxEntries ?? 10, minEntries: properties.datagrid?.minEntries ?? 1, displayAsGrid: properties.datagrid?.displayAsGrid ?? true, onAddEntry: onEntryAdd ? onEntryAdd : handleAddEntry, onRemoveEntry: onEntryRemove ? onEntryRemove : handleRemoveEntry, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, columnView: properties.datagrid?.columnView, shouldShowComponent: shouldShowComponent })) }))] }));
5075
+ templateComponents: gridComponents, dataEntries: dataEntries, renderFormComponent: renderFormComponent || renderComponent, mode: mode, allowAddRemoveEntries: properties.datagrid?.allowAddRemoveEntries ?? true, addAnotherText: properties.datagrid?.addAnotherText ?? 'Add Entry', removeText: properties.datagrid?.removeText ?? 'Remove', maxEntries: properties.datagrid?.maxEntries ?? 10, minEntries: properties.datagrid?.minEntries ?? 1, displayAsGrid: properties.datagrid?.displayAsGrid ?? true, onAddEntry: handleAddEntry, onRemoveEntry: handleRemoveEntry, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, columnView: properties.datagrid?.columnView, shouldShowComponent: shouldShowComponent })) }))] }));
5066
5076
  };
5067
5077
 
5068
5078
  const DraggableChild = ({ child, selectedChild, mode, onChildSelect, onChildDelete, renderFormComponent, isOverlay = false, isChildrenEditMode = false, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue }) => {
@@ -6542,8 +6552,10 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6542
6552
  });
6543
6553
  onFormDataChange?.(updatedComponents);
6544
6554
  }, onValueChange: (change) => {
6555
+ console.log('[DfFormPreview] datagrid onValueChange received:', change.id, 'hasEntries:', change.value && typeof change.value === 'object' && 'entries' in change.value);
6545
6556
  // Handle datagrid value changes (entries updates)
6546
6557
  if (change.id === component.id && change.value && typeof change.value === 'object' && 'entries' in change.value) {
6558
+ console.log('[DfFormPreview] datagrid entries update - entries count:', change.value.entries?.length);
6547
6559
  // Update localFormComponents with new entries structure
6548
6560
  const updatedComponents = localFormComponents.map(comp => {
6549
6561
  if (comp.id === component.id) {
@@ -6554,6 +6566,8 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6554
6566
  }
6555
6567
  return comp;
6556
6568
  });
6569
+ // CRITICAL: Update local state immediately so new entries render without Angular round-trip
6570
+ setLocalFormComponents(updatedComponents);
6557
6571
  onFormDataChange?.(updatedComponents);
6558
6572
  // Also update formValues for nested components
6559
6573
  if (change.value.entries && Array.isArray(change.value.entries)) {