@pnkx-lib/ui 1.9.234 → 1.9.235

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/es/ui/index.js CHANGED
@@ -5183,9 +5183,8 @@ const Table = ({
5183
5183
  onDoubleClickRow,
5184
5184
  ...rest
5185
5185
  }) => {
5186
- const status = filters?.status;
5187
5186
  //! State
5188
- const [data, setData] = useState([]);
5187
+ const status = filters?.status;
5189
5188
  const [openSetting, setOpenStting] = useState(false);
5190
5189
  const paginationConfig = {
5191
5190
  current: filters?.page,
@@ -5224,9 +5223,6 @@ const Table = ({
5224
5223
  ...ellipsisColumns
5225
5224
  ] : ellipsisColumns;
5226
5225
  //! Function
5227
- useEffect(() => {
5228
- setData(Array.isArray(dataSource) ? dataSource : []);
5229
- }, [JSON.stringify(dataSource)]);
5230
5226
  const handleTableChange = (pagination, filters2, sorter) => {
5231
5227
  if (sorter && onSort) {
5232
5228
  onSort(sorter);
@@ -5290,9 +5286,9 @@ const Table = ({
5290
5286
  Table$1,
5291
5287
  {
5292
5288
  rowKey,
5293
- dataSource: data,
5289
+ dataSource,
5294
5290
  columns: columnsWithIndex,
5295
- pagination: !isEmpty(data) ? paginationConfig : false,
5291
+ pagination: !isEmpty(dataSource) ? paginationConfig : false,
5296
5292
  loading,
5297
5293
  rowSelection: rowsSelected ? rowSelection : void 0,
5298
5294
  onChange: handleTableChange,
@@ -5303,7 +5299,6 @@ const Table = ({
5303
5299
  locale: {
5304
5300
  emptyText: /* @__PURE__ */ jsx(EmptyTable, {})
5305
5301
  },
5306
- rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
5307
5302
  scroll: { y: tableHeight },
5308
5303
  size,
5309
5304
  ...rest
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.234",
4
+ "version": "1.9.235",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -0,0 +1,42 @@
1
+ import { default as React } from 'react';
2
+ import { TableProps } from 'antd/lib/table';
3
+ import { SorterResult } from 'antd/es/table/interface';
4
+ import { SizeType } from 'antd/es/config-provider/SizeContext';
5
+ import { InitialFiltersSearch } from '@pnkx-lib/core';
6
+ import * as yup from "yup";
7
+ interface RowCommon {
8
+ [x: string]: any;
9
+ }
10
+ type ColumnTypes<T> = Exclude<TableProps<T>["columns"], undefined>;
11
+ export type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {})[];
12
+ export type TFilters = {
13
+ status?: any;
14
+ };
15
+ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
16
+ dataSource?: T[];
17
+ columns: TableColumnsTypeEditable<T>;
18
+ loading?: boolean;
19
+ totalItems?: number;
20
+ filters: InitialFiltersSearch<TFilters>;
21
+ onChangePage: (page: number) => void;
22
+ onChangePageSize: (size: number) => void;
23
+ onSort?: (sortField: SorterResult<T> | SorterResult<T>[]) => void;
24
+ rowsSelected?: React.Key[];
25
+ onSelect: (newSelectedRowKeys: React.Key[]) => void;
26
+ onRowClick?: (record: T) => void;
27
+ rowKey?: string | ((record: T) => string);
28
+ onDoubleClickRow?: (record: T) => void;
29
+ titleSettingTableModal?: string;
30
+ showSetting?: boolean;
31
+ setColumns?: (newColumns: TableColumnsTypeEditable<T>) => void;
32
+ defaultEllipsis?: boolean;
33
+ size?: SizeType;
34
+ setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
35
+ showIndexColumn?: boolean;
36
+ editable?: boolean;
37
+ onSave?: (data: T) => void;
38
+ schema?: yup.AnyObjectSchema;
39
+ initialValueForm?: T;
40
+ }
41
+ export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, titleSettingTableModal, showSetting, setColumns, showIndexColumn, setFilters, editable, onSave, schema, onDoubleClickRow, defaultEllipsis, size, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
42
+ export {};
@@ -32,16 +32,16 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
32
32
  titleSettingTableModal?: string;
33
33
  showSetting?: boolean;
34
34
  setColumns?: (newColumns: TableColumnsType<T>) => void;
35
- renderHeadingSearch?: () => ReactNode;
36
- rightHeadingContent?: ReactNode;
35
+ defaultEllipsis?: boolean;
36
+ size?: SizeType;
37
+ setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
38
+ showIndexColumn?: boolean;
37
39
  menu: Array<MenuType>;
38
40
  groupHeadingButtonItems?: GroupHeadingButtonItem[];
39
- showIndexColumn?: boolean;
40
- setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
41
41
  noBreadcum?: boolean;
42
42
  bulkActionHandlers?: BulkActionHandlers;
43
- size?: SizeType;
44
- defaultEllipsis?: boolean;
43
+ renderHeadingSearch?: () => ReactNode;
44
+ rightHeadingContent?: ReactNode;
45
45
  }
46
46
  export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, titleSettingTableModal, showSetting, setColumns, renderHeadingSearch, rightHeadingContent, menu, groupHeadingButtonItems, showIndexColumn, setFilters, noBreadcum, bulkActionHandlers, size, defaultEllipsis, onDoubleClickRow, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
47
47
  export {};