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