@pnkx-lib/ui 1.9.257 → 1.9.258

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.
@@ -1250,6 +1250,7 @@ const Input = (props) => {
1250
1250
  const errorMessage = get(errors, name)?.message;
1251
1251
  const inputRef = useRef(null);
1252
1252
  const [isComposing, setIsComposing] = useState(false);
1253
+ console.log(" isComposing:", isComposing);
1253
1254
  //! Function
1254
1255
  const handleCompositionStart = () => setIsComposing(true);
1255
1256
  const handleCompositionEnd = () => {
@@ -1289,6 +1290,7 @@ const Input = (props) => {
1289
1290
  };
1290
1291
  const handleChange = useCallback(
1291
1292
  (e) => {
1293
+ console.log(" ccccc:", e.target.value);
1292
1294
  if (isComposing) return;
1293
1295
  onChange?.(e);
1294
1296
  afterOnChange?.(e.target.value);
package/es/ui/index.js CHANGED
@@ -5164,6 +5164,8 @@ const useTableHeightWrapper = (options = {}) => {
5164
5164
  }
5165
5165
  });
5166
5166
  const wrapperStyles = window.getComputedStyle(layoutWrapper);
5167
+ const wrapperPaddingTop = parseInt(wrapperStyles.paddingTop, 10) || 0;
5168
+ const wrapperPaddingBottom = parseInt(wrapperStyles.paddingBottom, 10) || 0;
5167
5169
  const tableStyles = window.getComputedStyle(tableContainer);
5168
5170
  const tablePaddingTop = parseInt(tableStyles.paddingTop, 10) || 0;
5169
5171
  const tablePaddingBottom = parseInt(tableStyles.paddingBottom, 10) || 0;
@@ -5275,11 +5277,11 @@ const Table = ({
5275
5277
  defaultEllipsis = true,
5276
5278
  onDoubleClickRow,
5277
5279
  setRowsSelected,
5280
+ handleSubmit,
5278
5281
  ...rest
5279
5282
  }) => {
5280
5283
  const status = filters?.status;
5281
5284
  //! State
5282
- const [data, setData] = useState([]);
5283
5285
  const [openSetting, setOpenStting] = useState(false);
5284
5286
  const paginationConfig = {
5285
5287
  current: filters?.page,
@@ -5318,9 +5320,6 @@ const Table = ({
5318
5320
  ...ellipsisColumns
5319
5321
  ] : ellipsisColumns;
5320
5322
  //! Function
5321
- useEffect(() => {
5322
- setData(Array.isArray(dataSource) ? dataSource : []);
5323
- }, [JSON.stringify(dataSource)]);
5324
5323
  const handleTableChange = (pagination, filters2, sorter) => {
5325
5324
  if (sorter && onSort) {
5326
5325
  onSort(sorter);
@@ -5354,8 +5353,7 @@ const Table = ({
5354
5353
  minHeight: 200
5355
5354
  // chiều cao tối thiểu
5356
5355
  });
5357
- //! Render
5358
- return /* @__PURE__ */ jsxs(
5356
+ const tableContent = /* @__PURE__ */ jsxs(
5359
5357
  "div",
5360
5358
  {
5361
5359
  id: "layout-wrapper-table",
@@ -5371,9 +5369,9 @@ const Table = ({
5371
5369
  menu,
5372
5370
  groupHeadingButtonItems,
5373
5371
  setFilters,
5374
- setRowsSelected,
5375
5372
  filters,
5376
- noBreadcum
5373
+ noBreadcum,
5374
+ setRowsSelected
5377
5375
  }
5378
5376
  ),
5379
5377
  /* @__PURE__ */ jsx(
@@ -5385,9 +5383,9 @@ const Table = ({
5385
5383
  Table$1,
5386
5384
  {
5387
5385
  rowKey,
5388
- dataSource: data,
5386
+ dataSource,
5389
5387
  columns: columnsWithIndex,
5390
- pagination: !isEmpty(data) ? paginationConfig : false,
5388
+ pagination: !isEmpty(dataSource) ? paginationConfig : false,
5391
5389
  loading,
5392
5390
  rowSelection: rowsSelected ? rowSelection : void 0,
5393
5391
  onChange: handleTableChange,
@@ -5398,7 +5396,6 @@ const Table = ({
5398
5396
  locale: {
5399
5397
  emptyText: /* @__PURE__ */ jsx(EmptyTable, {})
5400
5398
  },
5401
- rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
5402
5399
  scroll: { y: tableHeight },
5403
5400
  size,
5404
5401
  ...rest
@@ -5436,6 +5433,14 @@ const Table = ({
5436
5433
  ]
5437
5434
  }
5438
5435
  );
5436
+ const renderTable = () => {
5437
+ if (handleSubmit) {
5438
+ return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: tableContent });
5439
+ }
5440
+ return tableContent;
5441
+ };
5442
+ //! Render
5443
+ return renderTable();
5439
5444
  };
5440
5445
  const EmptyTable = () => {
5441
5446
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.257",
4
+ "version": "1.9.258",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -1,4 +1,4 @@
1
- import { default as React, ReactNode } from 'react';
1
+ import { default as React, FormEventHandler, ReactNode } from 'react';
2
2
  import { TableColumnsType as TableColumnsTypeAntd } from 'antd';
3
3
  import { TableProps } from 'antd/lib/table';
4
4
  import { SorterResult } from 'antd/es/table/interface';
@@ -42,7 +42,8 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
42
42
  bulkActionHandlers?: BulkActionHandlers;
43
43
  size?: SizeType;
44
44
  defaultEllipsis?: boolean;
45
+ handleSubmit?: FormEventHandler<any>;
45
46
  setRowsSelected?: (newSelectedRowKeys: React.Key[]) => void;
46
47
  }
47
- 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, setRowsSelected, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
48
+ 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, setRowsSelected, handleSubmit, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
48
49
  export {};