@mamrp/components 1.4.1 → 1.4.2

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
@@ -4792,6 +4792,130 @@ function DraggablePaper({
4792
4792
  /* @__PURE__ */ React.createElement(Paper, { ref: nodeRef, ...props })
4793
4793
  );
4794
4794
  }
4795
+
4796
+ // src/data-table/index.tsx
4797
+ import ClearIcon from "@mui/icons-material/Clear";
4798
+ import { Box as Box23, Button as Button14 } from "@mui/material";
4799
+ import {
4800
+ MaterialReactTable,
4801
+ useMaterialReactTable
4802
+ } from "material-react-table";
4803
+ import { MRT_Localization_FA } from "material-react-table/locales/fa";
4804
+ import { useMemo } from "react";
4805
+ var customLocalization = {
4806
+ ...MRT_Localization_FA,
4807
+ mrt_columns_showHide_resetOrder: "\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u06CC \u062A\u0631\u062A\u06CC\u0628"
4808
+ };
4809
+ var DataTable = ({
4810
+ data,
4811
+ columns,
4812
+ isLoading = false,
4813
+ isRefetching = false,
4814
+ pagination,
4815
+ onPaginationChange,
4816
+ totalRows,
4817
+ manualPagination = true,
4818
+ columnFilters = [],
4819
+ onColumnFiltersChange,
4820
+ manualFiltering = true,
4821
+ onClearFilters,
4822
+ showClearFiltersButton = true,
4823
+ sorting = [],
4824
+ onSortingChange,
4825
+ manualSorting = false,
4826
+ enableStickyHeader = true,
4827
+ maxHeight = "calc(100vh - 200px)",
4828
+ density = "compact",
4829
+ enableColumnOrdering = true,
4830
+ enableGlobalFilter = false,
4831
+ enableColumnFilterModes = false,
4832
+ enableRowSelection = false,
4833
+ renderTopToolbarCustomActions,
4834
+ renderBottomToolbarCustomActions,
4835
+ tableOptions = {},
4836
+ localization = customLocalization
4837
+ }) => {
4838
+ const memoizedColumns = useMemo(() => columns, [columns]);
4839
+ const memoizedData = useMemo(() => data, [data]);
4840
+ const defaultRenderTopToolbarCustomActions = ({ table: table2 }) => {
4841
+ const showFilters = table2.getState().showColumnFilters;
4842
+ if (!showFilters || !showClearFiltersButton || !onClearFilters) return null;
4843
+ return /* @__PURE__ */ React.createElement(Box23, { sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(
4844
+ Box23,
4845
+ {
4846
+ display: "flex",
4847
+ alignItems: "center",
4848
+ justifyContent: "flex-start"
4849
+ },
4850
+ /* @__PURE__ */ React.createElement(
4851
+ Button14,
4852
+ {
4853
+ color: "secondary",
4854
+ onClick: onClearFilters,
4855
+ startIcon: /* @__PURE__ */ React.createElement(ClearIcon, null)
4856
+ },
4857
+ "\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u06CC \u0641\u06CC\u0644\u062A\u0631\u0647\u0627"
4858
+ )
4859
+ ));
4860
+ };
4861
+ const table = useMaterialReactTable({
4862
+ columns: memoizedColumns,
4863
+ data: memoizedData,
4864
+ localization,
4865
+ // Pagination
4866
+ manualPagination,
4867
+ onPaginationChange,
4868
+ pageCount: manualPagination ? Math.ceil(totalRows / pagination.pageSize) : void 0,
4869
+ rowCount: totalRows ?? 0,
4870
+ // Filtering
4871
+ manualFiltering,
4872
+ onColumnFiltersChange,
4873
+ enableColumnFilterModes,
4874
+ enableGlobalFilter,
4875
+ // Sorting
4876
+ manualSorting,
4877
+ onSortingChange,
4878
+ // Features
4879
+ enableColumnOrdering,
4880
+ enableRowSelection,
4881
+ enableStickyHeader,
4882
+ // State
4883
+ state: {
4884
+ pagination,
4885
+ columnFilters,
4886
+ sorting,
4887
+ isLoading,
4888
+ showProgressBars: isRefetching
4889
+ },
4890
+ // Styling
4891
+ muiTablePaperProps: { sx: { direction: "ltr" } },
4892
+ muiTableBodyCellProps: { sx: { textAlign: "center" } },
4893
+ muiTableHeadCellProps: {
4894
+ sx: {
4895
+ "& .Mui-TableHeadCell-Content": {
4896
+ flexDirection: "row-reverse",
4897
+ justifyContent: "center"
4898
+ }
4899
+ }
4900
+ },
4901
+ muiTableContainerProps: {
4902
+ sx: {
4903
+ maxHeight
4904
+ }
4905
+ },
4906
+ // Initial state
4907
+ initialState: {
4908
+ density
4909
+ },
4910
+ // Custom toolbars
4911
+ renderTopToolbarCustomActions: renderTopToolbarCustomActions || defaultRenderTopToolbarCustomActions,
4912
+ renderBottomToolbarCustomActions,
4913
+ // Override with any additional options
4914
+ ...tableOptions
4915
+ });
4916
+ return /* @__PURE__ */ React.createElement(MaterialReactTable, { table });
4917
+ };
4918
+ var data_table_default = DataTable;
4795
4919
  export {
4796
4920
  Page as Accordion,
4797
4921
  AdvancedSearchButton,
@@ -4799,6 +4923,7 @@ export {
4799
4923
  bascule_connection_button_default as ConnectToBasculeButton,
4800
4924
  CustomCheckbox,
4801
4925
  CustomTimePicker,
4926
+ data_table_default as DataTable,
4802
4927
  DateFilter,
4803
4928
  DateFilterRange,
4804
4929
  date_month_default as DateMonthPicker,