@dooherceg/material-react-table 3.2.16 → 3.2.17

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.d.ts CHANGED
@@ -2214,11 +2214,23 @@ interface MRT_FormFieldEntry<TData extends MRT_RowData> {
2214
2214
  sectionId: string | undefined;
2215
2215
  order: number | undefined;
2216
2216
  }
2217
+ type MRT_FormRenderEntry<TData extends MRT_RowData> = (MRT_FormFieldEntry<TData> & {
2218
+ kind: 'column';
2219
+ }) | {
2220
+ additionalField: MRT_FormAdditionalField<TData>;
2221
+ kind: 'additional';
2222
+ order: number | undefined;
2223
+ sectionId: string | undefined;
2224
+ };
2217
2225
  declare const sortByOrder: <T extends {
2218
2226
  order?: number | undefined;
2219
2227
  }>(items: T[]) => T[];
2220
2228
  declare const resolveFormFields: <TData extends MRT_RowData>(table: MRT_TableInstance<TData>) => MRT_FormFieldEntry<TData>[];
2221
- declare const groupFieldsBySection: <TData extends MRT_RowData>(formFields: MRT_FormFieldEntry<TData>[]) => Record<string, MRT_FormFieldEntry<TData>[]>;
2229
+ declare const groupFieldsBySection: <T extends {
2230
+ sectionId: string | undefined;
2231
+ }>(formFields: T[]) => Record<string, T[]>;
2232
+ declare const toColumnRenderEntries: <TData extends MRT_RowData>(formFields: MRT_FormFieldEntry<TData>[]) => MRT_FormRenderEntry<TData>[];
2233
+ declare const toAdditionalRenderEntries: <TData extends MRT_RowData>(additionalFields: MRT_FormAdditionalField<TData>[]) => MRT_FormRenderEntry<TData>[];
2222
2234
  declare const buildDefaultValues: <TData extends MRT_RowData>(table: MRT_TableInstance<TData>, initialValues: Record<string, unknown> | undefined, mode: "create" | "edit") => Record<string, unknown>;
2223
2235
 
2224
2236
  interface MRT_NewEntryFormProviderProps<TData extends MRT_RowData> {
@@ -2328,4 +2340,4 @@ interface MRT_TopToolbarProps<TData extends MRT_RowData> {
2328
2340
  }
2329
2341
  declare const MRT_TopToolbar: <TData extends MRT_RowData>({ table, }: MRT_TopToolbarProps<TData>) => react.JSX.Element;
2330
2342
 
2331
- export { type Action, type ActionRowRenderContext, type ActionToolbarRenderContext, CHECKBOX_DISPLAY_COLUMN_ID, type ColumnType, type ColumnTypeResolver, type CreateDeleteActionOptions, type CreateEditActionOptions, type CreateExportActionOptions, type CustomOnDeleteActionContext, type CustomOnEditActionContext, type CustomOnExportActionContext, type DeleteActionRowRenderContext, type DeleteActionToolbarRenderContext, type DeleteConfirmationConfig, type DistributiveOmit, type DropdownOption, type ExportActionRowRenderContext, type ExportActionToolbarRenderContext, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_ActiveExportsState, MRT_AdvancedFilters, type MRT_AdvancedFiltersProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, type MRT_ExportDefinition, type MRT_ExportFileResponse, type MRT_ExportParams, MRT_ExportsToolbar, type MRT_ExportsToolbarProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOperator, type MRT_FilterOperatorDefinition, type MRT_FilterOperatorEditComponentProps, type MRT_FilterOperatorValueShape, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, type MRT_FilterRule, type MRT_FiltersLogicOperator, type MRT_FiltersState, type MRT_FormActionButtonRenderProps, type MRT_FormAdditionalField, type MRT_FormAdditionalFieldRenderProps, type MRT_FormCallbackProps, type MRT_FormConfig, type MRT_FormCustomAction, type MRT_FormFieldConfig, type MRT_FormFieldEntry, type MRT_FormFieldRenderProps, type MRT_FormSectionConfig, type MRT_GetRowId, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_IconColumnDef, type MRT_Icons, type MRT_IconsListEntry, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_ModalPosition, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, type MRT_NewEntryFormActionsContextValue, type MRT_NewEntryFormActionsProps, type MRT_NewEntryFormProps, MRT_NewEntryFormProvider, type MRT_NewEntryFormProviderProps, MRT_NewEntryModal, type MRT_NewEntryModalOverrides, type MRT_NewEntryModalProps, type MRT_NewEntryModalState, type MRT_NonIconColumnDef, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowManipulationInput, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowReorderingSelectionState, type MRT_RowSelectionState, type MRT_RowVirtualizer, type MRT_SavedFilter, type MRT_SavedFilters, MRT_SelectAllMenu, type MRT_SelectAllMenuProps, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_SelectionCountBadge, type MRT_SelectionCountBadgeProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, type MRT_TableConfig, MRT_TableContainer, type MRT_TableContainerProps, type MRT_TableData, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_TreeRowReorderEvent, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactServerTable, type MaterialReactServerTableProps, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type OnDeleteActionContext, type OnEditActionContext, type OnExportActionContext, type Prettify, RHF_FormProvider, type RHF_FormProviderProps, type UseServerTableStateOptions, type UseServerTableStateReturn, type Xor, buildDefaultValues, cellKeyboardShortcuts, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, resolveFormFields, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
2343
+ export { type Action, type ActionRowRenderContext, type ActionToolbarRenderContext, CHECKBOX_DISPLAY_COLUMN_ID, type ColumnType, type ColumnTypeResolver, type CreateDeleteActionOptions, type CreateEditActionOptions, type CreateExportActionOptions, type CustomOnDeleteActionContext, type CustomOnEditActionContext, type CustomOnExportActionContext, type DeleteActionRowRenderContext, type DeleteActionToolbarRenderContext, type DeleteConfirmationConfig, type DistributiveOmit, type DropdownOption, type ExportActionRowRenderContext, type ExportActionToolbarRenderContext, type LiteralUnion, MRT_ActionMenuItem, type MRT_ActionMenuItemProps, type MRT_ActiveExportsState, MRT_AdvancedFilters, type MRT_AdvancedFiltersProps, type MRT_AggregationFn, MRT_AggregationFns, type MRT_AggregationOption, MRT_BottomToolbar, type MRT_BottomToolbarProps, type MRT_Cell, type MRT_Column, MRT_ColumnActionMenu, type MRT_ColumnActionMenuProps, type MRT_ColumnDef, type MRT_ColumnFilterFnsState, type MRT_ColumnFiltersState, type MRT_ColumnHelper, type MRT_ColumnOrderState, MRT_ColumnPinningButtons, type MRT_ColumnPinningButtonsProps, type MRT_ColumnPinningState, type MRT_ColumnSizingInfoState, type MRT_ColumnSizingState, type MRT_ColumnVirtualizer, MRT_CopyButton, type MRT_CopyButtonProps, MRT_DefaultColumn, MRT_DefaultDisplayColumn, type MRT_DefinedColumnDef, type MRT_DefinedTableOptions, type MRT_DensityState, type MRT_DisplayColumnDef, type MRT_DisplayColumnIds, MRT_EditActionButtons, type MRT_EditActionButtonsProps, MRT_EditCellTextField, type MRT_EditCellTextFieldProps, MRT_EditRowModal, type MRT_EditRowModalProps, MRT_ExpandAllButton, type MRT_ExpandAllButtonProps, MRT_ExpandButton, type MRT_ExpandButtonProps, type MRT_ExpandedState, type MRT_ExportDefinition, type MRT_ExportFileResponse, type MRT_ExportParams, MRT_ExportsToolbar, type MRT_ExportsToolbarProps, type MRT_FilterFn, MRT_FilterFns, type MRT_FilterOperator, type MRT_FilterOperatorDefinition, type MRT_FilterOperatorEditComponentProps, type MRT_FilterOperatorValueShape, type MRT_FilterOption, MRT_FilterOptionMenu, type MRT_FilterOptionMenuProps, type MRT_FilterRule, type MRT_FiltersLogicOperator, type MRT_FiltersState, type MRT_FormActionButtonRenderProps, type MRT_FormAdditionalField, type MRT_FormAdditionalFieldRenderProps, type MRT_FormCallbackProps, type MRT_FormConfig, type MRT_FormCustomAction, type MRT_FormFieldConfig, type MRT_FormFieldEntry, type MRT_FormFieldRenderProps, type MRT_FormRenderEntry, type MRT_FormSectionConfig, type MRT_GetRowId, MRT_GrabHandleButton, type MRT_GrabHandleButtonProps, type MRT_GroupColumnDef, type MRT_GroupingState, type MRT_Header, type MRT_HeaderGroup, type MRT_IconColumnDef, type MRT_Icons, type MRT_IconsListEntry, type MRT_InternalFilterOption, MRT_LinearProgressBar, type MRT_LinearProgressBarProps, type MRT_Localization, type MRT_ModalPosition, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, type MRT_NewEntryFormActionsContextValue, type MRT_NewEntryFormActionsProps, type MRT_NewEntryFormProps, MRT_NewEntryFormProvider, type MRT_NewEntryFormProviderProps, MRT_NewEntryModal, type MRT_NewEntryModalOverrides, type MRT_NewEntryModalProps, type MRT_NewEntryModalState, type MRT_NonIconColumnDef, type MRT_PaginationState, type MRT_Row, MRT_RowActionMenu, type MRT_RowActionMenuProps, type MRT_RowData, type MRT_RowManipulationInput, type MRT_RowModel, MRT_RowPinButton, type MRT_RowPinButtonProps, type MRT_RowReorderingSelectionState, type MRT_RowSelectionState, type MRT_RowVirtualizer, type MRT_SavedFilter, type MRT_SavedFilters, MRT_SelectAllMenu, type MRT_SelectAllMenuProps, MRT_SelectCheckbox, type MRT_SelectCheckboxProps, MRT_SelectionCountBadge, type MRT_SelectionCountBadgeProps, MRT_ShowHideColumnsButton, type MRT_ShowHideColumnsButtonProps, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, type MRT_ShowHideColumnsMenuItemsProps, type MRT_ShowHideColumnsMenuProps, type MRT_SortingFn, MRT_SortingFns, type MRT_SortingOption, type MRT_SortingState, type MRT_StatefulTableOptions, MRT_Table, MRT_TableBody, MRT_TableBodyCell, type MRT_TableBodyCellProps, MRT_TableBodyCellValue, type MRT_TableBodyCellValueProps, type MRT_TableBodyProps, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, type MRT_TableBodyRowGrabHandleProps, MRT_TableBodyRowPinButton, type MRT_TableBodyRowPinButtonProps, type MRT_TableBodyRowProps, type MRT_TableConfig, MRT_TableContainer, type MRT_TableContainerProps, type MRT_TableData, MRT_TableDetailPanel, type MRT_TableDetailPanelProps, MRT_TableFooter, MRT_TableFooterCell, type MRT_TableFooterCellProps, type MRT_TableFooterProps, MRT_TableFooterRow, type MRT_TableFooterRowProps, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, type MRT_TableHeadCellColumnActionsButtonProps, MRT_TableHeadCellFilterLabel, type MRT_TableHeadCellFilterLabelProps, MRT_TableHeadCellGrabHandle, type MRT_TableHeadCellGrabHandleProps, type MRT_TableHeadCellProps, MRT_TableHeadCellResizeHandle, type MRT_TableHeadCellResizeHandleProps, MRT_TableHeadCellSortLabel, type MRT_TableHeadCellSortLabelProps, type MRT_TableHeadProps, MRT_TableHeadRow, type MRT_TableHeadRowProps, type MRT_TableInstance, MRT_TableLoadingOverlay, type MRT_TableLoadingOverlayProps, type MRT_TableOptions, MRT_TablePagination, type MRT_TablePaginationProps, MRT_TablePaper, type MRT_TablePaperProps, type MRT_TableProps, type MRT_TableState, type MRT_Theme, MRT_ToggleDensePaddingButton, type MRT_ToggleDensePaddingButtonProps, MRT_ToggleFiltersButton, type MRT_ToggleFiltersButtonProps, MRT_ToggleGlobalFilterButton, type MRT_ToggleGlobalFilterButtonProps, MRT_ToggleRowActionMenuButton, type MRT_ToggleRowActionMenuButtonProps, MRT_ToolbarAlertBanner, type MRT_ToolbarAlertBannerProps, MRT_ToolbarDropZone, type MRT_ToolbarDropZoneProps, MRT_ToolbarInternalButtons, type MRT_ToolbarInternalButtonsProps, MRT_TopToolbar, type MRT_TopToolbarProps, type MRT_TreeRowReorderEvent, type MRT_Updater, type MRT_VirtualItem, type MRT_VirtualizerOptions, type MRT_VisibilityState, MaterialReactServerTable, type MaterialReactServerTableProps, MaterialReactTable, type MaterialReactTableProps, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, type OnDeleteActionContext, type OnEditActionContext, type OnExportActionContext, type Prettify, RHF_FormProvider, type RHF_FormProviderProps, type UseServerTableStateOptions, type UseServerTableStateReturn, type Xor, buildDefaultValues, cellKeyboardShortcuts, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, resolveFormFields, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, toAdditionalRenderEntries, toColumnRenderEntries, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
package/dist/index.esm.js CHANGED
@@ -6945,6 +6945,8 @@ const resolveFormFields = (table) => {
6945
6945
  });
6946
6946
  };
6947
6947
  // Groups form fields by their sectionId, returning an id → entries map.
6948
+ // Generic over any entry shape carrying a sectionId — used for column-only entries
6949
+ // (MRT_FormFieldEntry) and for merged column + additional field entries (MRT_FormRenderEntry) alike.
6948
6950
  const groupFieldsBySection = (formFields) => formFields.reduce((acc, field) => {
6949
6951
  var _a;
6950
6952
  if (field.sectionId === undefined)
@@ -6952,6 +6954,17 @@ const groupFieldsBySection = (formFields) => formFields.reduce((acc, field) => {
6952
6954
  const existingFields = (_a = acc[field.sectionId]) !== null && _a !== void 0 ? _a : [];
6953
6955
  return Object.assign(Object.assign({}, acc), { [field.sectionId]: [...existingFields, field] });
6954
6956
  }, {});
6957
+ // ─── Merging column fields with additional fields ────────────────────────────
6958
+ // Wraps resolved column fields as MRT_FormRenderEntry — tags each with kind: 'column'.
6959
+ const toColumnRenderEntries = (formFields) => formFields.map((formField) => (Object.assign(Object.assign({}, formField), { kind: 'column' })));
6960
+ // Wraps additionalFields as MRT_FormRenderEntry, carrying over their own order/section
6961
+ // so they sort and group alongside column fields instead of always rendering last.
6962
+ const toAdditionalRenderEntries = (additionalFields) => additionalFields.map((additionalField) => ({
6963
+ additionalField,
6964
+ kind: 'additional',
6965
+ order: additionalField.order,
6966
+ sectionId: additionalField.section,
6967
+ }));
6955
6968
  // ─── Default Values ───────────────────────────────────────────────────────────
6956
6969
  // Resolves a defaultValue that may be a static value or a zero-argument factory function.
6957
6970
  const resolveDefaultValue = (defaultValue) => {
@@ -7014,19 +7027,26 @@ const MRT_NewEntryFormSectionBlock = ({ expandMoreIcon: ExpandIcon, sectionConfi
7014
7027
  // Uses the same MRT_NewEntryFormSectionBlock and Stack/grid containers as MRT_NewEntryForm
7015
7028
  // so the skeleton is pixel-identical to the real form — only the inputs are replaced by Skeletons.
7016
7029
  const MRT_NewEntryFormSkeleton = ({ table, }) => {
7017
- var _a;
7030
+ var _a, _b;
7018
7031
  const { formConfig, icons } = table.options;
7019
7032
  const sections = (_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.sections) !== null && _a !== void 0 ? _a : [];
7020
- const allFields = resolveFormFields(table);
7021
- // Group field entries by section for accurate per-section skeleton cell counts.
7022
- const fieldsBySectionId = groupFieldsBySection(allFields);
7023
- // Fields with no section assignment — rendered after all sections, same as the real form.
7024
- const unsectionedFields = allFields.filter(({ sectionId }) => sectionId === undefined);
7025
- const unsectionedCells = Array.from({ length: unsectionedFields.length });
7033
+ // Merge column fields and additional fields — additionalFields are placed into
7034
+ // sections/unsectioned alongside column fields in the real form (MRT_NewEntryForm),
7035
+ // so the skeleton must count them the same way to avoid a cell-count mismatch
7036
+ // once loading finishes.
7037
+ const allEntries = [
7038
+ ...toColumnRenderEntries(resolveFormFields(table)),
7039
+ ...toAdditionalRenderEntries((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.additionalFields) !== null && _b !== void 0 ? _b : []),
7040
+ ];
7041
+ // Group entries by section for accurate per-section skeleton cell counts.
7042
+ const entriesBySectionId = groupFieldsBySection(allEntries);
7043
+ // Entries with no section assignment — rendered after all sections, same as the real form.
7044
+ const unsectionedEntries = allEntries.filter(({ sectionId }) => sectionId === undefined);
7045
+ const unsectionedCells = Array.from({ length: unsectionedEntries.length });
7026
7046
  return (jsxs(Stack, { gap: 2, children: [sections.map((section) => {
7027
7047
  var _a, _b;
7028
7048
  const fieldCells = Array.from({
7029
- length: (_b = (_a = fieldsBySectionId[section.id]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
7049
+ length: (_b = (_a = entriesBySectionId[section.id]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
7030
7050
  });
7031
7051
  return (jsx(MRT_NewEntryFormSectionBlock, { expandMoreIcon: icons.ExpandMoreIcon, sectionConfig: section, children: fieldCells.map((_, index) => (jsx(Skeleton, { height: '40px', variant: "rounded" }, index))) }, section.id));
7032
7052
  }), unsectionedCells.length > 0 && (jsx(Stack, { gap: 2, sx: (formConfig === null || formConfig === void 0 ? void 0 : formConfig.columns)
@@ -7081,27 +7101,32 @@ const MRT_NewEntryForm = ({ table, }) => {
7081
7101
  if (newEntryModal.isLoading) {
7082
7102
  return jsx(MRT_NewEntryFormSkeleton, { table: table });
7083
7103
  }
7084
- // Collect all eligible form fields from the table's leaf columns sorted by order.
7104
+ // Collect all eligible form fields from the table's leaf columns.
7085
7105
  const allFormFields = resolveFormFields(table);
7086
7106
  const additionalFields = (_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.additionalFields) !== null && _b !== void 0 ? _b : [];
7107
+ // Merge column fields and additional fields into one list so they can be sorted and
7108
+ // grouped together by their shared order/section — an additionalField's order is
7109
+ // otherwise only ever compared against other additional fields, never column fields.
7110
+ const allEntries = [
7111
+ ...toColumnRenderEntries(allFormFields),
7112
+ ...toAdditionalRenderEntries(additionalFields),
7113
+ ];
7087
7114
  // Sections sorted by their order value — lower numbers appear first.
7088
7115
  const sortedSections = sortByOrder((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.sections) !== null && _c !== void 0 ? _c : []);
7089
- // Fields without a section assignment — rendered after all sections.
7090
- const unsectionedFields = sortByOrder(allFormFields.filter(({ sectionId }) => sectionId === undefined));
7091
- // Map of sectionId → its fields, used when rendering each section block.
7092
- const fieldsBySection = groupFieldsBySection(allFormFields);
7093
- // Additional fields sorted by order — rendered after all column fields.
7094
- const sortedAdditionalFields = sortByOrder(additionalFields);
7116
+ // Entries without a section assignment — rendered after all sections.
7117
+ const unsectionedEntries = sortByOrder(allEntries.filter(({ sectionId }) => sectionId === undefined));
7118
+ // Map of sectionId → its entries, used when rendering each section block.
7119
+ const entriesBySection = groupFieldsBySection(allEntries);
7095
7120
  return (jsxs(Stack, { gap: 2, children: [sortedSections.map((sectionConfig) => {
7096
7121
  var _a;
7097
- const sectionFields = sortByOrder((_a = fieldsBySection[sectionConfig.id]) !== null && _a !== void 0 ? _a : []);
7098
- return (jsx(MRT_NewEntryFormSectionBlock, { expandMoreIcon: ExpandMoreIcon, sectionConfig: sectionConfig, children: sectionFields.map(({ columnId, columnDef, fieldConfig }) => (jsx(FormFieldControl, { columnDef: columnDef, columnId: columnId, fieldConfig: fieldConfig, table: table }, columnId))) }, sectionConfig.id));
7099
- }), unsectionedFields.length > 0 && (jsx(Stack, { gap: 2, sx: (formConfig === null || formConfig === void 0 ? void 0 : formConfig.columns)
7122
+ const sectionEntries = sortByOrder((_a = entriesBySection[sectionConfig.id]) !== null && _a !== void 0 ? _a : []);
7123
+ return (jsx(MRT_NewEntryFormSectionBlock, { expandMoreIcon: ExpandMoreIcon, sectionConfig: sectionConfig, children: sectionEntries.map((entry) => entry.kind === 'column' ? (jsx(FormFieldControl, { columnDef: entry.columnDef, columnId: entry.columnId, fieldConfig: entry.fieldConfig, table: table }, entry.columnId)) : (jsx(MRT_NewEntryFormAdditionalFieldControl, { additionalField: entry.additionalField, table: table }, entry.additionalField.name))) }, sectionConfig.id));
7124
+ }), unsectionedEntries.length > 0 && (jsx(Stack, { gap: 2, sx: (formConfig === null || formConfig === void 0 ? void 0 : formConfig.columns)
7100
7125
  ? {
7101
7126
  display: 'grid',
7102
7127
  gridTemplateColumns: `repeat(${formConfig.columns}, 1fr)`,
7103
7128
  }
7104
- : undefined, children: unsectionedFields.map(({ columnId, columnDef, fieldConfig }) => (jsx(FormFieldControl, { columnDef: columnDef, columnId: columnId, fieldConfig: fieldConfig, table: table }, columnId))) })), sortedAdditionalFields.map((additionalField) => (jsx(MRT_NewEntryFormAdditionalFieldControl, { additionalField: additionalField, table: table }, additionalField.name)))] }));
7129
+ : undefined, children: unsectionedEntries.map((entry) => entry.kind === 'column' ? (jsx(FormFieldControl, { columnDef: entry.columnDef, columnId: entry.columnId, fieldConfig: entry.fieldConfig, table: table }, entry.columnId)) : (jsx(MRT_NewEntryFormAdditionalFieldControl, { additionalField: entry.additionalField, table: table }, entry.additionalField.name))) }))] }));
7105
7130
  };
7106
7131
 
7107
7132
  const MRT_NewEntryFormActionsContext = createContext(null);
@@ -7149,6 +7174,20 @@ const MRT_NewEntryFormProvider = ({ table, children, }) => {
7149
7174
  const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
7150
7175
  const defaultValues = buildDefaultValues(table, newEntryModal.initialValues, mode);
7151
7176
  const methods = useForm({ defaultValues });
7177
+ // useForm's `defaultValues` is only read once, at first mount. The modal is
7178
+ // opened before the backend data arrives (newEntryModal.isLoading: true,
7179
+ // initialValues: undefined) and stays mounted through the whole loading ->
7180
+ // loaded transition, so once initialValues actually arrives it would
7181
+ // otherwise never reach the already-initialized form. Reset once loading
7182
+ // finishes to pick up the real values.
7183
+ useEffect(() => {
7184
+ if (!newEntryModal.isLoading) {
7185
+ methods.reset(defaultValues);
7186
+ }
7187
+ // Only re-run when the loading flag flips — defaultValues is recomputed
7188
+ // every render and must not itself retrigger this (that would wipe out
7189
+ // in-progress user edits on every keystroke-driven re-render).
7190
+ }, [newEntryModal.isLoading]);
7152
7191
  // Validates the form and calls the consumer's onSave on success.
7153
7192
  const handleSave = methods.handleSubmit(() => __awaiter(void 0, void 0, void 0, function* () {
7154
7193
  var _a;
@@ -8963,5 +9002,5 @@ const MRT_ToolbarAlertBanner = (_a) => {
8963
9002
  positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
8964
9003
  };
8965
9004
 
8966
- export { CHECKBOX_DISPLAY_COLUMN_ID, MRT_ActionMenuItem, MRT_AdvancedFilters, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_ExportsToolbar, MRT_FilterFns, MRT_FilterOptionMenu, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, MRT_NewEntryFormProvider, MRT_NewEntryModal, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectAllMenu, MRT_SelectCheckbox, MRT_SelectionCountBadge, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactServerTable, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, RHF_FormProvider, buildDefaultValues, cellKeyboardShortcuts, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, resolveFormFields, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
9005
+ export { CHECKBOX_DISPLAY_COLUMN_ID, MRT_ActionMenuItem, MRT_AdvancedFilters, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_ExportsToolbar, MRT_FilterFns, MRT_FilterOptionMenu, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, MRT_NewEntryFormProvider, MRT_NewEntryModal, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectAllMenu, MRT_SelectCheckbox, MRT_SelectionCountBadge, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactServerTable, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, RHF_FormProvider, buildDefaultValues, cellKeyboardShortcuts, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getDefaultColumnPinningState, getIsAllPagesSelectionActive, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, resolveFormFields, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, toAdditionalRenderEntries, toColumnRenderEntries, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
8967
9006
  //# sourceMappingURL=index.esm.js.map