@pnkx-lib/ui 1.9.292 → 1.9.294
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/ErrorMessage.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
|
|
4
4
|
const ErrorMessage = React__default.memo(
|
|
5
|
-
({ errorMessage
|
|
5
|
+
({ errorMessage }) => {
|
|
6
6
|
if (!errorMessage) return null;
|
|
7
7
|
return /* @__PURE__ */ jsx("div", { className: "ml-2 text-red-600", children: errorMessage });
|
|
8
8
|
}
|
package/es/ui/Sidebar.js
CHANGED
|
@@ -155,7 +155,8 @@ const Sidebar = ({ children, menu, userInfo }) => {
|
|
|
155
155
|
};
|
|
156
156
|
acc.push(group);
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
const path = `/${itemChildren.path}/${itemSub.path}`;
|
|
159
|
+
group.options.push(renderItem(itemSub.name, path));
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
);
|
|
@@ -258,7 +259,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
|
|
|
258
259
|
openSubCollapse && "absolute"
|
|
259
260
|
),
|
|
260
261
|
children: /* @__PURE__ */ jsx("nav", { className: twMerge("flex mt-2 flex-1 flex-col px-2"), children: /* @__PURE__ */ jsx("ul", { role: "list", className: twMerge("-mx-2 space-y-1 relative"), children: newMenu.flatMap((item) => {
|
|
261
|
-
const isActiveMainMenu = activeMainMenu === item.
|
|
262
|
+
const isActiveMainMenu = activeMainMenu === item.code;
|
|
262
263
|
const isActivePathUrl = pathUrl === item.path;
|
|
263
264
|
const isActive = isActiveMainMenu || isActivePathUrl;
|
|
264
265
|
return /* @__PURE__ */ jsx(
|
|
@@ -280,7 +281,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
|
|
|
280
281
|
{
|
|
281
282
|
onClick: () => {
|
|
282
283
|
setCollapse(false);
|
|
283
|
-
setActiveMainMenu(item
|
|
284
|
+
setActiveMainMenu(item?.code);
|
|
284
285
|
setOpenSubCollapse(true);
|
|
285
286
|
},
|
|
286
287
|
className: twMerge(
|
|
@@ -318,7 +319,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
|
|
|
318
319
|
"flex flex-1 transition-all duration-300 flex-col"
|
|
319
320
|
),
|
|
320
321
|
children: /* @__PURE__ */ jsx("ul", { role: "list", className: twMerge("cursor-pointer ml-[10px]"), children: newMenu?.map((sub) => {
|
|
321
|
-
const isActiveMainMenu = activeMainMenu === sub.
|
|
322
|
+
const isActiveMainMenu = activeMainMenu === sub.code;
|
|
322
323
|
if (!isActiveMainMenu) return null;
|
|
323
324
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
324
325
|
/* @__PURE__ */ jsx(
|
|
@@ -383,7 +384,7 @@ const Sidebar = ({ children, menu, userInfo }) => {
|
|
|
383
384
|
) })
|
|
384
385
|
] }, itemSubMenu.path);
|
|
385
386
|
}) })
|
|
386
|
-
] }, sub
|
|
387
|
+
] }, sub?.code);
|
|
387
388
|
}) })
|
|
388
389
|
}
|
|
389
390
|
)
|
package/es/ui/index.js
CHANGED
|
@@ -5392,6 +5392,7 @@ const Table = ({
|
|
|
5392
5392
|
const status = filters?.status;
|
|
5393
5393
|
//! State
|
|
5394
5394
|
const [openSetting, setOpenStting] = useState(false);
|
|
5395
|
+
const tableContainerRef = useRef(null);
|
|
5395
5396
|
const rowSelection = {
|
|
5396
5397
|
selectedRowKeys: rowsSelected,
|
|
5397
5398
|
onChange: onSelect,
|
|
@@ -5425,7 +5426,7 @@ const Table = ({
|
|
|
5425
5426
|
return "default";
|
|
5426
5427
|
}
|
|
5427
5428
|
};
|
|
5428
|
-
const handleTableChange = (
|
|
5429
|
+
const handleTableChange = (_pagination, _filters, sorter) => {
|
|
5429
5430
|
if (sorter && onSort) {
|
|
5430
5431
|
onSort(sorter);
|
|
5431
5432
|
}
|
|
@@ -5458,6 +5459,18 @@ const Table = ({
|
|
|
5458
5459
|
minHeight: 200
|
|
5459
5460
|
// chiều cao tối thiểu
|
|
5460
5461
|
});
|
|
5462
|
+
useEffect(() => {
|
|
5463
|
+
const scrollToTop = () => {
|
|
5464
|
+
if (tableContainerRef.current) {
|
|
5465
|
+
const tableBody = tableContainerRef.current.querySelector(".ant-table-body");
|
|
5466
|
+
if (tableBody) {
|
|
5467
|
+
tableBody.scrollTop = 0;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
};
|
|
5471
|
+
const timeoutId = setTimeout(scrollToTop, 0);
|
|
5472
|
+
return () => clearTimeout(timeoutId);
|
|
5473
|
+
}, [filters.page]);
|
|
5461
5474
|
const tableContent = /* @__PURE__ */ jsxs(
|
|
5462
5475
|
"div",
|
|
5463
5476
|
{
|
|
@@ -5482,6 +5495,7 @@ const Table = ({
|
|
|
5482
5495
|
/* @__PURE__ */ jsxs(
|
|
5483
5496
|
"div",
|
|
5484
5497
|
{
|
|
5498
|
+
ref: tableContainerRef,
|
|
5485
5499
|
id: "table_content",
|
|
5486
5500
|
className: "bg-[#FFFFFF] p-2 rounded-bl-lg rounded-br-lg",
|
|
5487
5501
|
children: [
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { ControllerRenderProps, UseFormStateReturn } from 'react-hook-form';
|
|
3
2
|
import { TextAreaProps as TextAreaPropsAntd } from 'antd/es/input';
|
|
4
3
|
export interface TextAreaProps extends TextAreaPropsAntd {
|
|
@@ -9,4 +8,4 @@ export interface TextAreaProps extends TextAreaPropsAntd {
|
|
|
9
8
|
afterOnChange?: (value: string) => void;
|
|
10
9
|
required?: boolean;
|
|
11
10
|
}
|
|
12
|
-
export declare const Textarea:
|
|
11
|
+
export declare const Textarea: import('react').ForwardRefExoticComponent<TextAreaProps & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -4,4 +4,4 @@ export interface ErrorMessageProps {
|
|
|
4
4
|
isTouched?: boolean;
|
|
5
5
|
isSubmitted?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const ErrorMessage: React.MemoExoticComponent<({ errorMessage
|
|
7
|
+
export declare const ErrorMessage: React.MemoExoticComponent<({ errorMessage }: ErrorMessageProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
@@ -5,6 +5,7 @@ export type MenuType = {
|
|
|
5
5
|
isShow?: boolean;
|
|
6
6
|
isPrivateRoute?: boolean;
|
|
7
7
|
icon?: ReactNode;
|
|
8
|
+
code?: string;
|
|
8
9
|
isShowLabel?: boolean;
|
|
9
10
|
component?: React.LazyExoticComponent<React.MemoExoticComponent<any>> | React.ExoticComponent<any> | ReactNode | React.FC;
|
|
10
11
|
componentProps?: Record<string, any>;
|