@pnkx-lib/ui 1.9.521 → 1.9.524

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
@@ -23835,6 +23835,7 @@ const TableForm = (props) => {
23835
23835
  rowKey,
23836
23836
  handleCancel,
23837
23837
  renderHeadingTable,
23838
+ hideCountNewItem,
23838
23839
  // positionButton = "right",
23839
23840
  defaultValues,
23840
23841
  rowsSelected,
@@ -23913,7 +23914,7 @@ const TableForm = (props) => {
23913
23914
  }
23914
23915
  )
23915
23916
  ] }),
23916
- newItemsCount > 0 && /* @__PURE__ */ jsxs(Tag, { color: "blue", children: [
23917
+ newItemsCount > 0 && !hideCountNewItem && /* @__PURE__ */ jsxs(Tag, { color: "blue", children: [
23917
23918
  newItemsCount,
23918
23919
  " mục mới"
23919
23920
  ] })
@@ -24077,7 +24078,13 @@ const ListDataConvert = ({
24077
24078
  content: "Bạn có chắc chắn muốn từ chối xác nhận không?",
24078
24079
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24079
24080
  showTitle: true,
24080
- countLevel: [COUNT_LEVEL.TWO_LEVEL]
24081
+ countLevel: [COUNT_LEVEL.TWO_LEVEL],
24082
+ arrShows: [
24083
+ {
24084
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24085
+ level: [COUNT_LEVEL.TWO_LEVEL]
24086
+ }
24087
+ ]
24081
24088
  },
24082
24089
  {
24083
24090
  icon: /* @__PURE__ */ jsx(CancelSendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24088,9 +24095,15 @@ const ListDataConvert = ({
24088
24095
  typeIcon: "error",
24089
24096
  title: "Xác nhận huỷ gửi xác nhận",
24090
24097
  content: "Bạn có chắc chắn muốn huỷ gửi xác nhận không?",
24091
- arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
24098
+ arrShow: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
24092
24099
  showTitle: true,
24093
- countLevel: [COUNT_LEVEL.TWO_LEVEL]
24100
+ countLevel: [COUNT_LEVEL.TWO_LEVEL],
24101
+ arrShows: [
24102
+ {
24103
+ status: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
24104
+ level: [COUNT_LEVEL.TWO_LEVEL]
24105
+ }
24106
+ ]
24094
24107
  },
24095
24108
  {
24096
24109
  icon: /* @__PURE__ */ jsx(ConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24103,7 +24116,13 @@ const ListDataConvert = ({
24103
24116
  content: "Bạn có chắc chắn muốn xác nhận không?",
24104
24117
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24105
24118
  showTitle: true,
24106
- countLevel: [COUNT_LEVEL.TWO_LEVEL]
24119
+ countLevel: [COUNT_LEVEL.TWO_LEVEL],
24120
+ arrShows: [
24121
+ {
24122
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24123
+ level: [COUNT_LEVEL.TWO_LEVEL]
24124
+ }
24125
+ ]
24107
24126
  },
24108
24127
  {
24109
24128
  icon: /* @__PURE__ */ jsx(SendConfirmIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24116,7 +24135,13 @@ const ListDataConvert = ({
24116
24135
  content: "Bạn có chắc chắn muốn gửi xác nhận không?",
24117
24136
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24118
24137
  showTitle: true,
24119
- countLevel: [COUNT_LEVEL.TWO_LEVEL]
24138
+ countLevel: [COUNT_LEVEL.TWO_LEVEL],
24139
+ arrShows: [
24140
+ {
24141
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24142
+ level: [COUNT_LEVEL.TWO_LEVEL]
24143
+ }
24144
+ ]
24120
24145
  },
24121
24146
  {
24122
24147
  icon: /* @__PURE__ */ jsx(SendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24129,7 +24154,17 @@ const ListDataConvert = ({
24129
24154
  content: "Bạn có chắc chắn muốn gửi duyệt không?",
24130
24155
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
24131
24156
  showTitle: true,
24132
- countLevel: [COUNT_LEVEL.ONE_LEVEL]
24157
+ countLevel: [COUNT_LEVEL.ONE_LEVEL],
24158
+ arrShows: [
24159
+ {
24160
+ status: [CATEGORY_PRICE_LIST_ENUM?.CREATED],
24161
+ level: [COUNT_LEVEL.ONE_LEVEL]
24162
+ },
24163
+ {
24164
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24165
+ level: [COUNT_LEVEL.ONE_LEVEL]
24166
+ }
24167
+ ]
24133
24168
  },
24134
24169
  {
24135
24170
  icon: /* @__PURE__ */ jsx(CancelSendApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24142,7 +24177,17 @@ const ListDataConvert = ({
24142
24177
  content: "Bạn có chắc chắn muốn hủy gửi duyệt không?",
24143
24178
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
24144
24179
  showTitle: true,
24145
- countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
24180
+ countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL],
24181
+ arrShows: [
24182
+ {
24183
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24184
+ level: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
24185
+ },
24186
+ {
24187
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
24188
+ level: [COUNT_LEVEL.ONE_LEVEL]
24189
+ }
24190
+ ]
24146
24191
  },
24147
24192
  {
24148
24193
  icon: /* @__PURE__ */ jsx(RejectApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24155,7 +24200,17 @@ const ListDataConvert = ({
24155
24200
  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.",
24156
24201
  arrShow: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
24157
24202
  showTitle: true,
24158
- countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
24203
+ countLevel: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL],
24204
+ arrShows: [
24205
+ {
24206
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_APPROVAL],
24207
+ level: [COUNT_LEVEL.ONE_LEVEL, COUNT_LEVEL.TWO_LEVEL]
24208
+ },
24209
+ {
24210
+ status: [CATEGORY_PRICE_LIST_ENUM?.WAITING_CONFIRM],
24211
+ level: [COUNT_LEVEL.ONE_LEVEL]
24212
+ }
24213
+ ]
24159
24214
  },
24160
24215
  {
24161
24216
  icon: /* @__PURE__ */ jsx(ApproveIcon, { className: "w-6 -h-6", size: 22, color: "#B2B7C2" }),
@@ -24189,19 +24244,25 @@ const DropListActions = ({
24189
24244
  }) => {
24190
24245
  //! State
24191
24246
  //! Function
24192
- const IsShow = (arrStatus, arrLevel) => {
24193
- return arrStatus.includes(status) && arrLevel.includes(countLevel);
24247
+ const IsShow = (arrShows) => {
24248
+ console.log("arrShows", arrShows);
24249
+ if (!arrShows || arrShows.length === 0) return false;
24250
+ return arrShows.some((cond) => {
24251
+ const okStatus = !cond.status || cond.status.length === 0 || cond.status.includes(status);
24252
+ const okLevel = !cond.level || cond.level.length === 0 || cond.level.includes(countLevel);
24253
+ return okStatus && okLevel;
24254
+ });
24194
24255
  };
24195
24256
  const renderContentPopover = () => {
24196
24257
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: !isEmpty(listIcon) && listIcon?.map(
24197
- (item, index) => item?.showTitle && IsShow(item?.arrShow, item?.countLevel) && /* @__PURE__ */ jsxs(
24258
+ (item, index) => item?.showTitle && IsShow(item?.arrShows) && /* @__PURE__ */ jsxs(
24198
24259
  "button",
24199
24260
  {
24200
24261
  className: twMerge(
24201
24262
  "flex gap-4 px-3 py-2 rounded-sm transition duration-200 hover:rounded-sm",
24202
- IsShow(item?.arrShow, item?.countLevel) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
24263
+ IsShow(item?.arrShows) ? "hover:bg-[#F5F6F7] cursor-pointer" : "text-[#B2B7C2] cursor-not-allowed"
24203
24264
  ),
24204
- disabled: IsShow(item?.arrShow, item?.countLevel) ? false : true,
24265
+ disabled: IsShow(item?.arrShows) ? false : true,
24205
24266
  onClick: () => {
24206
24267
  toggle();
24207
24268
  setNotifyContent({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.521",
4
+ "version": "1.9.524",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -22,5 +22,9 @@ export type TListIcon = {
22
22
  name?: string;
23
23
  showTitle?: boolean;
24
24
  countLevel?: COUNT_LEVEL[];
25
+ arrShows?: {
26
+ status?: CATEGORY_PRICE_LIST_ENUM[];
27
+ level?: COUNT_LEVEL[];
28
+ }[];
25
29
  };
26
30
  export declare const ListDataConvert: ({ isApproved, typeService, handleBulkAction, handleBulkActionPrice, }: CustomeBulkActionsProps) => TListIcon[];
@@ -1,13 +1,17 @@
1
1
  import { ConfirmModalProps } from '../ConfirmModal';
2
- import { CATEGORY_LIST_ENUM, COUNT_LEVEL } from '../CategoryStatus';
2
+ import { CATEGORY_LIST_ENUM, CATEGORY_PRICE_LIST_ENUM, COUNT_LEVEL } from '../CategoryStatus';
3
3
  export interface DropListActionsProps {
4
4
  listIcon: TListIcon[];
5
- status?: unknown;
5
+ status: CATEGORY_PRICE_LIST_ENUM;
6
6
  setNotifyContent: React.Dispatch<React.SetStateAction<ConfirmModalProps>>;
7
7
  toggle: () => void;
8
8
  contentDropList?: React.ReactNode;
9
- countLevel?: COUNT_LEVEL;
9
+ countLevel: COUNT_LEVEL;
10
10
  }
11
+ export type typeArrShows = {
12
+ status?: CATEGORY_PRICE_LIST_ENUM[];
13
+ level?: COUNT_LEVEL[];
14
+ };
11
15
  export type TListIcon = {
12
16
  icon: React.ReactNode;
13
17
  iconDisable: React.ReactNode;
@@ -20,5 +24,6 @@ export type TListIcon = {
20
24
  name?: string;
21
25
  showTitle?: boolean;
22
26
  countLevel: COUNT_LEVEL[];
27
+ arrShows: typeArrShows[];
23
28
  };
24
29
  export declare const DropListActions: ({ listIcon, status, setNotifyContent, toggle, contentDropList, countLevel, }: DropListActionsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,17 @@
1
1
  import { TypeBulkActions, TypeCategoryBulkActions } from '../../../constants/bulkAction';
2
2
  import { default as React } from 'react';
3
3
  import { BulkActionHandlers, BulkActionPriceHandlers } from '@pnkx-lib/core';
4
- import { COUNT_LEVEL } from '../CategoryStatus';
4
+ import { CATEGORY_PRICE_LIST_ENUM, COUNT_LEVEL } from '../CategoryStatus';
5
5
  interface CustomeBulkActionsProps {
6
6
  quantity?: number;
7
- status?: unknown;
7
+ status: CATEGORY_PRICE_LIST_ENUM;
8
8
  isApproved?: boolean;
9
9
  typeBulkaction?: TypeBulkActions;
10
10
  typeService?: TypeCategoryBulkActions;
11
11
  handleBulkAction?: BulkActionHandlers;
12
12
  handleBulkActionPrice?: BulkActionPriceHandlers;
13
13
  contentDropList?: React.ReactNode;
14
- countLevel?: COUNT_LEVEL;
14
+ countLevel: COUNT_LEVEL;
15
15
  }
16
16
  export declare const CustomeBulkActions: ({ quantity, status, isApproved, typeBulkaction, typeService, handleBulkAction, handleBulkActionPrice, contentDropList, countLevel, }: CustomeBulkActionsProps) => import("react/jsx-runtime").JSX.Element;
17
17
  declare const _default: React.MemoExoticComponent<({ quantity, status, isApproved, typeBulkaction, typeService, handleBulkAction, handleBulkActionPrice, contentDropList, countLevel, }: CustomeBulkActionsProps) => import("react/jsx-runtime").JSX.Element>;
@@ -8,7 +8,7 @@ export interface TableFormProps<T> extends Omit<TableCommonProps<T>, "onChangePa
8
8
  handleSubmit?: () => Promise<void>;
9
9
  formFieldArray: UseFieldArrayReturn<any, any, any>;
10
10
  handleCancel?: () => void;
11
- hideCreateButton?: boolean;
11
+ hideCountNewItem?: boolean;
12
12
  renderHeadingTable?: () => React.ReactNode;
13
13
  handleRemoveSelected?: () => void;
14
14
  }