@pnkx-lib/ui 1.9.256 → 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
@@ -4629,7 +4629,7 @@ const SettingTable = (props) => {
4629
4629
  const handleOkModal = () => {
4630
4630
  setOpen(false);
4631
4631
  };
4632
- const onSubmit = (data) => {
4632
+ const onSubmit = () => {
4633
4633
  setOpen(false);
4634
4634
  if (setDefaultSettingColumnItems) {
4635
4635
  setDefaultSettingColumnItems(columns);
@@ -4686,7 +4686,6 @@ const SettingTable = (props) => {
4686
4686
  open,
4687
4687
  title: title || titleHeader(),
4688
4688
  closable: true,
4689
- onClose: handleCloseModal,
4690
4689
  onOk: handleOkModal,
4691
4690
  className: "setting-table-modal",
4692
4691
  footer: null,
@@ -5278,11 +5277,11 @@ const Table = ({
5278
5277
  defaultEllipsis = true,
5279
5278
  onDoubleClickRow,
5280
5279
  setRowsSelected,
5280
+ handleSubmit,
5281
5281
  ...rest
5282
5282
  }) => {
5283
5283
  const status = filters?.status;
5284
5284
  //! State
5285
- const [data, setData] = useState([]);
5286
5285
  const [openSetting, setOpenStting] = useState(false);
5287
5286
  const paginationConfig = {
5288
5287
  current: filters?.page,
@@ -5321,9 +5320,6 @@ const Table = ({
5321
5320
  ...ellipsisColumns
5322
5321
  ] : ellipsisColumns;
5323
5322
  //! Function
5324
- useEffect(() => {
5325
- setData(Array.isArray(dataSource) ? dataSource : []);
5326
- }, [JSON.stringify(dataSource)]);
5327
5323
  const handleTableChange = (pagination, filters2, sorter) => {
5328
5324
  if (sorter && onSort) {
5329
5325
  onSort(sorter);
@@ -5357,8 +5353,7 @@ const Table = ({
5357
5353
  minHeight: 200
5358
5354
  // chiều cao tối thiểu
5359
5355
  });
5360
- //! Render
5361
- return /* @__PURE__ */ jsxs(
5356
+ const tableContent = /* @__PURE__ */ jsxs(
5362
5357
  "div",
5363
5358
  {
5364
5359
  id: "layout-wrapper-table",
@@ -5374,9 +5369,9 @@ const Table = ({
5374
5369
  menu,
5375
5370
  groupHeadingButtonItems,
5376
5371
  setFilters,
5377
- setRowsSelected,
5378
5372
  filters,
5379
- noBreadcum
5373
+ noBreadcum,
5374
+ setRowsSelected
5380
5375
  }
5381
5376
  ),
5382
5377
  /* @__PURE__ */ jsx(
@@ -5388,9 +5383,9 @@ const Table = ({
5388
5383
  Table$1,
5389
5384
  {
5390
5385
  rowKey,
5391
- dataSource: data,
5386
+ dataSource,
5392
5387
  columns: columnsWithIndex,
5393
- pagination: !isEmpty(data) ? paginationConfig : false,
5388
+ pagination: !isEmpty(dataSource) ? paginationConfig : false,
5394
5389
  loading,
5395
5390
  rowSelection: rowsSelected ? rowSelection : void 0,
5396
5391
  onChange: handleTableChange,
@@ -5401,7 +5396,6 @@ const Table = ({
5401
5396
  locale: {
5402
5397
  emptyText: /* @__PURE__ */ jsx(EmptyTable, {})
5403
5398
  },
5404
- rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
5405
5399
  scroll: { y: tableHeight },
5406
5400
  size,
5407
5401
  ...rest
@@ -5439,6 +5433,14 @@ const Table = ({
5439
5433
  ]
5440
5434
  }
5441
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();
5442
5444
  };
5443
5445
  const EmptyTable = () => {
5444
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.256",
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 {};