@mamrp/components 1.4.3 → 1.4.5

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.mjs CHANGED
@@ -4823,6 +4823,10 @@ var DataTable = ({
4823
4823
  sorting = [],
4824
4824
  onSortingChange,
4825
4825
  manualSorting = false,
4826
+ columnVisibility = {},
4827
+ onColumnVisibilityChange,
4828
+ columnOrder = [],
4829
+ onColumnOrderChange,
4826
4830
  enableStickyHeader = true,
4827
4831
  maxHeight = "calc(100vh - 200px)",
4828
4832
  density = "compact",
@@ -4830,6 +4834,8 @@ var DataTable = ({
4830
4834
  enableGlobalFilter = false,
4831
4835
  enableColumnFilterModes = false,
4832
4836
  enableRowSelection = false,
4837
+ showColumnFilters,
4838
+ onShowColumnFiltersChange,
4833
4839
  renderTopToolbarCustomActions,
4834
4840
  renderBottomToolbarCustomActions,
4835
4841
  tableOptions = {},
@@ -4838,8 +4844,8 @@ var DataTable = ({
4838
4844
  const memoizedColumns = useMemo(() => columns, [columns]);
4839
4845
  const memoizedData = useMemo(() => data, [data]);
4840
4846
  const defaultRenderTopToolbarCustomActions = ({ table: table2 }) => {
4841
- const showFilters = table2.getState().showColumnFilters;
4842
- if (!showFilters || !showClearFiltersButton || !onClearFilters) return null;
4847
+ const currentShowFilters = showColumnFilters !== void 0 ? showColumnFilters : table2.getState().showColumnFilters;
4848
+ if (!currentShowFilters || !showClearFiltersButton || !onClearFilters) return null;
4843
4849
  return /* @__PURE__ */ React.createElement(Box23, { sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(
4844
4850
  Box23,
4845
4851
  {
@@ -4862,32 +4868,39 @@ var DataTable = ({
4862
4868
  columns: memoizedColumns,
4863
4869
  data: memoizedData,
4864
4870
  localization,
4865
- // Pagination
4871
+ // === صفحه‌بندی ===
4866
4872
  manualPagination,
4867
4873
  onPaginationChange,
4868
4874
  pageCount: manualPagination ? Math.ceil(totalRows / pagination.pageSize) : void 0,
4869
4875
  rowCount: totalRows ?? 0,
4870
- // Filtering
4876
+ // === فیلترینگ ===
4871
4877
  manualFiltering,
4872
4878
  onColumnFiltersChange,
4873
4879
  enableColumnFilterModes,
4874
4880
  enableGlobalFilter,
4875
- // Sorting
4881
+ // === مرتب‌سازی ===
4876
4882
  manualSorting,
4877
4883
  onSortingChange,
4878
- // Features
4884
+ // === ویژگی‌ها ===
4879
4885
  enableColumnOrdering,
4880
4886
  enableRowSelection,
4881
4887
  enableStickyHeader,
4882
- // State
4888
+ // === وضعیت جدول ===
4883
4889
  state: {
4884
4890
  pagination,
4885
- columnFilters,
4891
+ // columnFilters, // غیرفعال شده - فیلترها از طریق useTableState مدیریت می‌شوند
4886
4892
  sorting,
4893
+ columnVisibility,
4894
+ ...showColumnFilters !== void 0 && { showColumnFilters },
4895
+ ...columnOrder && Array.isArray(columnOrder) && columnOrder.length > 0 && { columnOrder },
4887
4896
  isLoading,
4888
4897
  showProgressBars: isRefetching
4889
4898
  },
4890
- // Styling
4899
+ // === Event Handlers ===
4900
+ onColumnVisibilityChange,
4901
+ ...onShowColumnFiltersChange && { onShowColumnFiltersChange },
4902
+ ...onColumnOrderChange && { onColumnOrderChange },
4903
+ // === استایل‌دهی ===
4891
4904
  muiTablePaperProps: { sx: { direction: "ltr" } },
4892
4905
  muiTableBodyCellProps: { sx: { textAlign: "center" } },
4893
4906
  muiTableHeadCellProps: {
@@ -4903,14 +4916,14 @@ var DataTable = ({
4903
4916
  maxHeight
4904
4917
  }
4905
4918
  },
4906
- // Initial state
4919
+ // === حالت اولیه ===
4907
4920
  initialState: {
4908
4921
  density
4909
4922
  },
4910
- // Custom toolbars
4923
+ // === تولبارهای سفارشی ===
4911
4924
  renderTopToolbarCustomActions: renderTopToolbarCustomActions || defaultRenderTopToolbarCustomActions,
4912
4925
  renderBottomToolbarCustomActions,
4913
- // Override with any additional options
4926
+ // 🔧 اعمال تنظیمات اضافی
4914
4927
  ...tableOptions
4915
4928
  });
4916
4929
  return /* @__PURE__ */ React.createElement(MaterialReactTable, { table });