@pnkx-lib/ui 1.9.342 → 1.9.343

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/index.js CHANGED
@@ -2,7 +2,7 @@ export { Button } from './ui/Button.js';
2
2
  export { CascaderField } from './ui/Cascader.js';
3
3
  export { ErrorMessage } from './ui/ErrorMessage.js';
4
4
  export { Typography } from './ui/Typography.js';
5
- export { BulkActions, Table } from './ui/index.js';
5
+ export { ActionRowTable, BulkActions, Table } from './ui/index.js';
6
6
  export { Modal } from './ui/Modal.js';
7
7
  export { Tooltip } from './ui/Tooltip.js';
8
8
  export { Tabs } from './ui/Tabs.js';
package/es/ui/index.js CHANGED
@@ -1,12 +1,12 @@
1
- export { Button } from './Button.js';
1
+ import { Button } from './Button.js';
2
2
  export { CascaderField } from './Cascader.js';
3
3
  export { ErrorMessage } from './ErrorMessage.js';
4
4
  import { Typography } from './Typography.js';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
  import { useState, useCallback, useEffect, useRef } from 'react';
7
7
  import { Select, Input, Pagination, Table as Table$1, Tooltip as Tooltip$1 } from 'antd';
8
- import { TypeStatusTable, TypeBulkActions } from '../constants/index.js';
9
- export { PAGE_NUMBER, PAGE_SIZE, SORT, START_PAGE, START_PAGE_SIZE, TypeActionRowTable } from '../constants/index.js';
8
+ import { TypeStatusTable, TypeActionRowTable, TypeBulkActions } from '../constants/index.js';
9
+ export { PAGE_NUMBER, PAGE_SIZE, SORT, START_PAGE, START_PAGE_SIZE } from '../constants/index.js';
10
10
  export { Modal } from './Modal.js';
11
11
  import { Tooltip } from './Tooltip.js';
12
12
  export { Tabs } from './Tabs.js';
@@ -55,8 +55,8 @@ import { ConfirmModal } from './ConfirmModal.js';
55
55
  export { ErrorBoundary } from './ErrorBoundary.js';
56
56
  import { CATEGORY_LIST_ENUM } from './CategoryStatus.js';
57
57
  export { CategoryStatus, badgeStatusCategoryConfig } from './CategoryStatus.js';
58
- import { isEmpty, isBoolean } from 'lodash';
59
58
  import { useToggle } from '@pnkx-lib/core';
59
+ import { isEmpty, isBoolean } from 'lodash';
60
60
  import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
61
61
  export { BreadcrumbHeading } from './BreadcrumbHeading.js';
62
62
  export { Card } from './Card.js';
@@ -463,6 +463,15 @@ const EmptyTable = () => {
463
463
  ] });
464
464
  };
465
465
 
466
+ const EditIcon = ({ stroke, fill = "#007BE5" }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 14, height: 15, fill: "none", children: /* @__PURE__ */ jsx(
467
+ "path",
468
+ {
469
+ fill,
470
+ stroke,
471
+ d: "m1.177 11.137.711.237-.711-.237ZM1.8 9.264l-.712-.238.712.238Zm.644-1.043.53.53-.53-.53ZM8.667 2l-.53-.53.53.53ZM12 5.333l.53.53-.53-.53Zm-6.222 6.222-.53-.53.53.53Zm-1.042.644.237.711-.237-.711Zm-1.873.624.237.712-.237-.712Zm2.574-.95-.452-.598.452.599Zm-.263.163-.333-.672.333.672Zm7.629-9.11-.672.333.672-.333Zm0 1.48-.672-.333.672.333Zm-3.21-3.21.333.673-.333-.672Zm1.48 0-.333.673.333-.672Zm-9.11 7.63.673.333-.672-.333Zm.163-.263-.599-.452.6.452Zm-1.26 4.066-.706.252.706-.252Zm.505.505-.252.706.252-.706ZM8.364 2.303a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm2.272 4.394a.75.75 0 0 0 1.061-1.06l-1.06 1.06ZM7 12.917a.75.75 0 0 0 0 1.5v-1.5Zm5.833 1.5a.75.75 0 0 0 0-1.5v1.5Zm-11.656-3.28.711.237.624-1.873-.711-.237-.712-.238L.465 10.9l.712.238ZM2.445 8.22l.53.53 6.222-6.22L8.667 2l-.53-.53-6.222 6.22.53.531ZM12 5.333l-.53-.53-6.222 6.221.53.53.53.53 6.222-6.22-.53-.53ZM4.736 12.2l-.237-.712-1.873.625.237.711.237.712 1.873-.625-.237-.711Zm1.042-.644-.53-.53c-.18.18-.222.219-.263.25l.452.599.451.598c.144-.108.269-.235.42-.387l-.53-.53Zm-1.042.644.237.711c.204-.068.373-.122.535-.202l-.334-.672-.333-.672c-.047.023-.1.043-.342.123l.237.712Zm.7-.325-.451-.6a.92.92 0 0 1-.144.09l.333.672.334.672c.134-.067.261-.146.38-.236l-.451-.598ZM12 2l-.53.53c.497.497.608.622.661.73l.672-.334.672-.333c-.19-.383-.533-.712-.945-1.124L12 2Zm0 3.333.53.53c.412-.411.755-.74.945-1.124l-.672-.333-.672-.333c-.053.107-.164.233-.661.73l.53.53Zm.803-2.407-.672.333a.917.917 0 0 1 0 .814l.672.333.672.333a2.417 2.417 0 0 0 0-2.146l-.672.333ZM8.667 2l.53.53c.497-.497.622-.608.73-.661l-.334-.672L9.26.525c-.383.19-.712.533-1.124.944l.53.53ZM12 2l.53-.53c-.411-.412-.74-.755-1.124-.945l-.333.672-.333.672c.107.053.232.164.73.661L12 2Zm-2.407-.803.333.672a.917.917 0 0 1 .814 0l.333-.672.333-.672a2.417 2.417 0 0 0-2.146 0l.333.672ZM1.801 9.264l.711.237c.081-.242.1-.295.124-.342l-.672-.333-.672-.334c-.08.161-.135.33-.203.534l.712.238Zm.644-1.043-.53-.53c-.152.152-.279.276-.388.42l.6.452.598.452a2.99 2.99 0 0 1 .25-.263l-.53-.53Zm-.481.605.672.333c.025-.05.055-.1.089-.144l-.599-.452-.599-.452c-.09.12-.168.247-.235.381l.672.334Zm-.787 2.31L.465 10.9c-.13.393-.246.737-.312 1.016-.063.267-.118.617.007.966l.706-.252.706-.252c.028.078-.007.088.041-.119.046-.196.135-.463.275-.884l-.711-.237Zm1.686 1.687-.237-.711c-.421.14-.688.228-.884.274-.208.049-.197.014-.12.041l-.251.707-.252.706c.349.124.698.07.966.007.278-.066.622-.181 1.015-.312l-.237-.712ZM.866 12.63l-.706.252c.16.447.511.8.96.96l.251-.707.252-.707a.083.083 0 0 1-.05-.05l-.707.252Zm6.967-9.796-.53.53 3.333 3.334.53-.53.531-.53-3.333-3.334-.53.53ZM7 13.666v.75h5.833v-1.5H7v.75Z"
472
+ }
473
+ ) });
474
+
466
475
  const RestoreIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 22, height: 22, fill: "none", children: /* @__PURE__ */ jsx(
467
476
  "path",
468
477
  {
@@ -590,6 +599,65 @@ const MoreIcon = ({ stroke, fill }) => /* @__PURE__ */ jsx("svg", { xmlns: "http
590
599
  }
591
600
  ) });
592
601
 
602
+ const ActionRowTable = ({
603
+ type,
604
+ contentTooltip,
605
+ handleClick
606
+ }) => {
607
+ //! State
608
+ const {
609
+ shouldRender: shouldRenderDelete,
610
+ open: openDelete,
611
+ toggle: toggleDelete
612
+ } = useToggle();
613
+ //! Function
614
+ const handleDelete = () => {
615
+ handleClick?.();
616
+ toggleDelete();
617
+ };
618
+ const renderAction = () => {
619
+ switch (type) {
620
+ case TypeActionRowTable.EDIT:
621
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tooltip, { title: contentTooltip, children: /* @__PURE__ */ jsx(
622
+ Button,
623
+ {
624
+ onClick: handleClick,
625
+ type: "text",
626
+ className: "cursor-pointer",
627
+ shape: "circle",
628
+ icon: /* @__PURE__ */ jsx(EditIcon, { fill: "#007BE5" })
629
+ }
630
+ ) }) });
631
+ case TypeActionRowTable.DELETE:
632
+ return /* @__PURE__ */ jsx(Tooltip, { title: contentTooltip, children: /* @__PURE__ */ jsx(
633
+ Button,
634
+ {
635
+ onClick: toggleDelete,
636
+ type: "text",
637
+ className: "cursor-pointer",
638
+ shape: "circle",
639
+ icon: /* @__PURE__ */ jsx(DeleteIcon, { fill: "#DD4338" })
640
+ }
641
+ ) });
642
+ }
643
+ };
644
+ //! Render
645
+ return /* @__PURE__ */ jsxs("div", { children: [
646
+ shouldRenderDelete && /* @__PURE__ */ jsx(
647
+ ConfirmModal,
648
+ {
649
+ title: "Xác nhận xóa",
650
+ content: "Bạn có chắc chắn muốn xóa không? Hành động này không thể hoàn tác.",
651
+ typeIcon: "error",
652
+ open: openDelete,
653
+ handleCancel: toggleDelete,
654
+ handleSubmit: handleDelete
655
+ }
656
+ ),
657
+ renderAction()
658
+ ] });
659
+ };
660
+
593
661
  const BulkAction = ({
594
662
  quantity = 0,
595
663
  listIcon,
@@ -882,4 +950,4 @@ const BulkActions = ({
882
950
  ] });
883
951
  };
884
952
 
885
- export { BulkActions, CATEGORY_LIST_ENUM, ConfirmModal, Popover, Table, Tooltip, TypeBulkActions, TypeStatusTable, Typography };
953
+ export { ActionRowTable, BulkActions, Button, CATEGORY_LIST_ENUM, ConfirmModal, Popover, Table, Tooltip, TypeActionRowTable, TypeBulkActions, TypeStatusTable, Typography };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.342",
4
+ "version": "1.9.343",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { TypeActionRowTable } from '../../../../constants/table';
3
+ export interface ActionRowTableProps {
4
+ type: TypeActionRowTable;
5
+ handleClick?: () => void;
6
+ contentTooltip?: React.ReactNode;
7
+ content?: React.ReactNode;
8
+ diabled?: boolean;
9
+ }
10
+ export declare const ActionRowTable: ({ type, contentTooltip, handleClick, }: ActionRowTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -50,6 +50,7 @@ export * from './Image';
50
50
  export * from './ConfirmModal';
51
51
  export * from './ErrorBoundary';
52
52
  export * from './CategoryStatus';
53
+ export * from '../ui/Table/ActionRowTable';
53
54
  export * from '../../constants/index';
54
55
  export * from './BulkActions';
55
56
  export * from './BreadcrumbHeading';