@pnkx-lib/ui 1.9.254 → 1.9.256

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
@@ -4734,6 +4734,9 @@ const ButtonBadge = (props) => {
4734
4734
  const { buttonItem, active, setFilters, filters } = props;
4735
4735
  const handleClick = () => {
4736
4736
  setFilters({ ...filters, status: buttonItem?.status });
4737
+ if (props.setRowsSelected) {
4738
+ props.setRowsSelected([]);
4739
+ }
4737
4740
  };
4738
4741
  return /* @__PURE__ */ jsxs(
4739
4742
  Button,
@@ -4763,14 +4766,15 @@ const ButtonBadge = (props) => {
4763
4766
  );
4764
4767
  };
4765
4768
  const GroupHeadingButton = (props) => {
4766
- const { groupHeadingButtonItems, setFilters, filters } = props;
4769
+ const { groupHeadingButtonItems, setFilters, filters, setRowsSelected } = props;
4767
4770
  return /* @__PURE__ */ jsx("div", { className: "pb-[15px]", children: groupHeadingButtonItems?.map((i, index) => /* @__PURE__ */ jsx(
4768
4771
  ButtonBadge,
4769
4772
  {
4770
4773
  buttonItem: i,
4771
4774
  active: i?.status === filters?.status,
4772
4775
  setFilters,
4773
- filters
4776
+ filters,
4777
+ setRowsSelected
4774
4778
  },
4775
4779
  index
4776
4780
  )) });
@@ -4800,7 +4804,8 @@ const HeadingTable = (props) => {
4800
4804
  groupHeadingButtonItems,
4801
4805
  setFilters,
4802
4806
  filters,
4803
- noBreadcum
4807
+ noBreadcum,
4808
+ setRowsSelected
4804
4809
  } = props;
4805
4810
  return /* @__PURE__ */ jsxs(
4806
4811
  Heading,
@@ -4819,6 +4824,7 @@ const HeadingTable = (props) => {
4819
4824
  {
4820
4825
  groupHeadingButtonItems,
4821
4826
  setFilters,
4827
+ setRowsSelected,
4822
4828
  filters
4823
4829
  }
4824
4830
  ),
@@ -4898,37 +4904,38 @@ const DropListActions = ({
4898
4904
  };
4899
4905
  const renderContentPopover = () => {
4900
4906
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: !isEmpty(listIcon) && listIcon?.map(
4901
- (item, index) => (
4902
- // IsShow(item?.arrShow) && (
4903
- /* @__PURE__ */ jsxs(
4904
- "button",
4905
- {
4906
- className: twMerge(
4907
- "flex gap-4 px-3 py-2 rounded-sm transition duration-200 hover:rounded-sm",
4908
- IsShow(item?.arrShow) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
4909
- ),
4910
- disabled: IsShow(item?.arrShow) ? false : true,
4911
- onClick: item?.showConfirmModal ? () => {
4912
- toggle();
4913
- setNotifyContent({
4914
- title: item?.title || "",
4915
- content: item?.content || "",
4916
- typeIcon: item?.typeIcon,
4917
- handleCancel: () => {
4918
- toggle();
4919
- },
4920
- handleSubmit: item?.action
4921
- });
4922
- } : item?.action,
4923
- children: [
4924
- IsShow(item?.arrShow) ? item.iconDropList : item.iconDisable,
4925
- /* @__PURE__ */ jsx("span", { children: item.name || "" })
4926
- ]
4907
+ (item, index) => item?.showTitle && /* @__PURE__ */ jsxs(
4908
+ "button",
4909
+ {
4910
+ className: twMerge(
4911
+ "flex gap-4 px-3 py-2 rounded-sm transition duration-200 hover:rounded-sm",
4912
+ IsShow(item?.arrShow) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
4913
+ ),
4914
+ disabled: IsShow(item?.arrShow) ? false : true,
4915
+ onClick: () => {
4916
+ toggle();
4917
+ setNotifyContent({
4918
+ title: item?.title || "",
4919
+ content: item?.content || "",
4920
+ typeIcon: item?.typeIcon,
4921
+ handleCancel: () => {
4922
+ toggle();
4923
+ },
4924
+ handleSubmit: () => {
4925
+ if (item?.action) {
4926
+ item?.action();
4927
+ }
4928
+ toggle();
4929
+ }
4930
+ });
4927
4931
  },
4928
- index
4929
- )
4932
+ children: [
4933
+ IsShow(item?.arrShow) ? item.iconDropList : item.iconDisable,
4934
+ /* @__PURE__ */ jsx("span", { children: item.name || "" })
4935
+ ]
4936
+ },
4937
+ index
4930
4938
  )
4931
- // )
4932
4939
  ) });
4933
4940
  };
4934
4941
  //! Render
@@ -4961,7 +4968,7 @@ const BulkActions = ({
4961
4968
  title: "Xác nhận khôi phục",
4962
4969
  content: "Bạn có chắc chắn muốn khôi phục không?",
4963
4970
  arrShow: [CATEGORY_LIST_ENUM?.DELETE, CATEGORY_LIST_ENUM?.REJECT],
4964
- showConfirmModal: true
4971
+ showTitle: true
4965
4972
  },
4966
4973
  {
4967
4974
  icon: /* @__PURE__ */ jsx(SendApprovalIcon, { stroke: "white" }),
@@ -4973,7 +4980,7 @@ const BulkActions = ({
4973
4980
  title: "Xác nhận gửi duyệt",
4974
4981
  content: "Bạn có chắc chắn muốn gửi duyệt không?",
4975
4982
  arrShow: [CATEGORY_LIST_ENUM?.DRAFT],
4976
- showConfirmModal: true
4983
+ showTitle: true
4977
4984
  },
4978
4985
  {
4979
4986
  icon: /* @__PURE__ */ jsx(CancelSendApprovalIcon, { stroke: "white" }),
@@ -4985,7 +4992,7 @@ const BulkActions = ({
4985
4992
  title: "Xác nhận hủy gửi duyệt",
4986
4993
  content: "Bạn có chắc chắn muốn hủy gửi duyệt không?",
4987
4994
  arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
4988
- showConfirmModal: true
4995
+ showTitle: true
4989
4996
  },
4990
4997
  {
4991
4998
  icon: /* @__PURE__ */ jsx(RefuseApprovalIcon, { stroke: "white" }),
@@ -4996,7 +5003,8 @@ const BulkActions = ({
4996
5003
  typeIcon: "error",
4997
5004
  title: "Xác nhận từ chối duyệt",
4998
5005
  content: "Bạn có chắc chắn muốn từ chối duyệt không? Hành động này không thể hoàn tác.",
4999
- arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL]
5006
+ arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
5007
+ showTitle: true
5000
5008
  },
5001
5009
  {
5002
5010
  icon: /* @__PURE__ */ jsx(ApprovalIcon, { stroke: "white" }),
@@ -5008,7 +5016,7 @@ const BulkActions = ({
5008
5016
  title: "Xác nhận duyệt",
5009
5017
  content: "Bạn có chắc chắn muốn duyệt không?",
5010
5018
  arrShow: [CATEGORY_LIST_ENUM?.WATING_APPROVAL],
5011
- showConfirmModal: true
5019
+ showTitle: true
5012
5020
  },
5013
5021
  {
5014
5022
  icon: /* @__PURE__ */ jsx(CancelApprovalIcon, { stroke: "white" }),
@@ -5020,7 +5028,7 @@ const BulkActions = ({
5020
5028
  title: "Xác nhận hủy duyệt",
5021
5029
  content: "Bạn có chắc chắn muốn hủy duyệt không?",
5022
5030
  arrShow: [CATEGORY_LIST_ENUM?.ACTIVE],
5023
- showConfirmModal: true
5031
+ showTitle: true
5024
5032
  },
5025
5033
  {
5026
5034
  icon: /* @__PURE__ */ jsx(DeleteIcon, { fill: "white" }),
@@ -5036,7 +5044,7 @@ const BulkActions = ({
5036
5044
  CATEGORY_LIST_ENUM?.ACTIVE,
5037
5045
  CATEGORY_LIST_ENUM?.INACTIVE
5038
5046
  ],
5039
- showConfirmModal: false
5047
+ showTitle: false
5040
5048
  },
5041
5049
  {
5042
5050
  icon: /* @__PURE__ */ jsx(ActivateIcon, { stroke: "white" }),
@@ -5048,7 +5056,7 @@ const BulkActions = ({
5048
5056
  title: "Xác nhận kích hoạt",
5049
5057
  content: "Bạn có chắc chắn muốn kích hoạt không?",
5050
5058
  arrShow: [CATEGORY_LIST_ENUM?.INACTIVE],
5051
- showConfirmModal: true
5059
+ showTitle: true
5052
5060
  },
5053
5061
  {
5054
5062
  icon: /* @__PURE__ */ jsx(InActiveIcon, { stroke: "white" }),
@@ -5060,7 +5068,7 @@ const BulkActions = ({
5060
5068
  title: "Xác nhận vô hiệu hóa",
5061
5069
  content: "Bạn có chắc chắn muốn vô hiệu hóa không?",
5062
5070
  arrShow: [CATEGORY_LIST_ENUM?.ACTIVE],
5063
- showConfirmModal: true
5071
+ showTitle: true
5064
5072
  }
5065
5073
  ];
5066
5074
  const { open, shouldRender, toggle } = useToggle();
@@ -5269,6 +5277,7 @@ const Table = ({
5269
5277
  size = "small",
5270
5278
  defaultEllipsis = true,
5271
5279
  onDoubleClickRow,
5280
+ setRowsSelected,
5272
5281
  ...rest
5273
5282
  }) => {
5274
5283
  const status = filters?.status;
@@ -5365,6 +5374,7 @@ const Table = ({
5365
5374
  menu,
5366
5375
  groupHeadingButtonItems,
5367
5376
  setFilters,
5377
+ setRowsSelected,
5368
5378
  filters,
5369
5379
  noBreadcum
5370
5380
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.254",
4
+ "version": "1.9.256",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -17,7 +17,7 @@ export type TListIcon = {
17
17
  content?: string;
18
18
  typeIcon?: ConfirmModalProps["typeIcon"];
19
19
  name?: string;
20
- showConfirmModal?: boolean;
20
+ showTitle?: boolean;
21
21
  };
22
22
  export declare const BulkActions: ({ quantity, handleDelete, handleSubmitForApproval, handleCancelSubmission, handleApprove, handleCancelApproval, handleReject, handleDeactivate, handleActivate, handleRestore, status, typeBulkaction, }: IBulkActionsProps) => import("react/jsx-runtime").JSX.Element;
23
23
  export {};
@@ -9,5 +9,6 @@ export interface GroupHeadingButtonProps {
9
9
  groupHeadingButtonItems?: GroupHeadingButtonItem[];
10
10
  setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
11
11
  filters: InitialFiltersSearch<TFilters>;
12
+ setRowsSelected?: (newSelectedRowKeys: React.Key[]) => void;
12
13
  }
13
14
  export declare const GroupHeadingButton: (props: GroupHeadingButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -12,5 +12,6 @@ export interface IHeadingCatgoryProps {
12
12
  setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
13
13
  filters: InitialFiltersSearch<TFilters>;
14
14
  noBreadcum?: boolean;
15
+ setRowsSelected?: (newSelectedRowKeys: React.Key[]) => void;
15
16
  }
16
17
  export declare const HeadingTable: (props: IHeadingCatgoryProps) => import("react/jsx-runtime").JSX.Element;
@@ -42,6 +42,7 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
42
42
  bulkActionHandlers?: BulkActionHandlers;
43
43
  size?: SizeType;
44
44
  defaultEllipsis?: boolean;
45
+ setRowsSelected?: (newSelectedRowKeys: React.Key[]) => void;
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
+ 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;
47
48
  export {};