@pnkx-lib/ui 1.9.236 → 1.9.238
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/ConfirmModal.js +1 -1
- package/es/ui/UploadComponent.js +8 -2
- package/es/ui/UploadImage.js +5 -2
- package/es/ui/index.js +13 -10
- package/package.json +1 -1
- package/types/components/ui/Table/index.d.ts +11 -11
- package/types/components/ui/UploadComponent.d.ts +2 -0
- package/types/components/ui/UploadImage.d.ts +1 -0
package/es/ui/ConfirmModal.js
CHANGED
|
@@ -101,7 +101,7 @@ const ConfirmModal = ({
|
|
|
101
101
|
};
|
|
102
102
|
//! Function
|
|
103
103
|
//! Render
|
|
104
|
-
return /* @__PURE__ */ jsx(Modal, { ...restProps, footer: null, closeIcon: null, width: 400, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
104
|
+
return /* @__PURE__ */ jsx(Modal, { ...restProps, footer: null, closeIcon: null, width: 400, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
105
105
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
106
106
|
/* @__PURE__ */ jsx("div", { className: "max-w-fit", children: /* @__PURE__ */ jsx(IconType, {}) }),
|
|
107
107
|
/* @__PURE__ */ jsxs("div", { children: [
|
package/es/ui/UploadComponent.js
CHANGED
|
@@ -33,9 +33,11 @@ const UploadComponent = ({
|
|
|
33
33
|
customStyleContainer,
|
|
34
34
|
required,
|
|
35
35
|
styleImageDefault,
|
|
36
|
+
imageValue,
|
|
37
|
+
errorMessage,
|
|
36
38
|
...restProps
|
|
37
39
|
}) => {
|
|
38
|
-
const [imageUrl, setImageUrl] = useState(
|
|
40
|
+
const [imageUrl, setImageUrl] = useState(imageValue);
|
|
39
41
|
const [loading, setLoading] = useState(false);
|
|
40
42
|
const handleUpload = async (options) => {
|
|
41
43
|
const { file } = options;
|
|
@@ -121,7 +123,11 @@ const UploadComponent = ({
|
|
|
121
123
|
) }),
|
|
122
124
|
/* @__PURE__ */ jsx("p", { className: "ant-upload-text text-[#116DFF] text-[14px] font-[400]", children: "Tải hình ảnh lên" }),
|
|
123
125
|
/* @__PURE__ */ jsx("p", { className: "ant-upload-hint text-[14px] font-[400]", children: "Ảnh có kích thước 400x400 px và dung lượng dưới 1MB" })
|
|
124
|
-
] }) }) })
|
|
126
|
+
] }) }) }),
|
|
127
|
+
errorMessage && /* @__PURE__ */ jsxs("p", { className: "text-red-600 text-sm mt-1", children: [
|
|
128
|
+
" ",
|
|
129
|
+
errorMessage
|
|
130
|
+
] })
|
|
125
131
|
] });
|
|
126
132
|
};
|
|
127
133
|
|
package/es/ui/UploadImage.js
CHANGED
|
@@ -9,19 +9,22 @@ const UploadImage = ({
|
|
|
9
9
|
customStyleContainer,
|
|
10
10
|
customStyleUpload,
|
|
11
11
|
styleImageDefault,
|
|
12
|
-
control
|
|
12
|
+
control,
|
|
13
|
+
errorMessage
|
|
13
14
|
}) => {
|
|
14
15
|
return /* @__PURE__ */ jsx(
|
|
15
16
|
Controller,
|
|
16
17
|
{
|
|
17
18
|
name,
|
|
18
19
|
control,
|
|
19
|
-
render: ({ field: { onChange } }) => /* @__PURE__ */ jsx(
|
|
20
|
+
render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
|
|
20
21
|
UploadComponent,
|
|
21
22
|
{
|
|
22
23
|
onUploadSuccess: onChange,
|
|
23
24
|
label,
|
|
25
|
+
imageValue: value,
|
|
24
26
|
required,
|
|
27
|
+
errorMessage,
|
|
25
28
|
customStyleContainer,
|
|
26
29
|
customStyleUpload,
|
|
27
30
|
styleImageDefault
|
package/es/ui/index.js
CHANGED
|
@@ -5181,11 +5181,11 @@ const Table = ({
|
|
|
5181
5181
|
size = "small",
|
|
5182
5182
|
defaultEllipsis = true,
|
|
5183
5183
|
onDoubleClickRow,
|
|
5184
|
+
handleSubmit,
|
|
5184
5185
|
...rest
|
|
5185
5186
|
}) => {
|
|
5186
|
-
const status = filters?.status;
|
|
5187
5187
|
//! State
|
|
5188
|
-
const
|
|
5188
|
+
const status = filters?.status;
|
|
5189
5189
|
const [openSetting, setOpenStting] = useState(false);
|
|
5190
5190
|
const paginationConfig = {
|
|
5191
5191
|
current: filters?.page,
|
|
@@ -5224,9 +5224,6 @@ const Table = ({
|
|
|
5224
5224
|
...ellipsisColumns
|
|
5225
5225
|
] : ellipsisColumns;
|
|
5226
5226
|
//! Function
|
|
5227
|
-
useEffect(() => {
|
|
5228
|
-
setData(Array.isArray(dataSource) ? dataSource : []);
|
|
5229
|
-
}, [JSON.stringify(dataSource)]);
|
|
5230
5227
|
const handleTableChange = (pagination, filters2, sorter) => {
|
|
5231
5228
|
if (sorter && onSort) {
|
|
5232
5229
|
onSort(sorter);
|
|
@@ -5260,8 +5257,7 @@ const Table = ({
|
|
|
5260
5257
|
minHeight: 200
|
|
5261
5258
|
// chiều cao tối thiểu
|
|
5262
5259
|
});
|
|
5263
|
-
|
|
5264
|
-
return /* @__PURE__ */ jsxs(
|
|
5260
|
+
const tableContent = /* @__PURE__ */ jsxs(
|
|
5265
5261
|
"div",
|
|
5266
5262
|
{
|
|
5267
5263
|
id: "layout-wrapper-table",
|
|
@@ -5290,9 +5286,9 @@ const Table = ({
|
|
|
5290
5286
|
Table$1,
|
|
5291
5287
|
{
|
|
5292
5288
|
rowKey,
|
|
5293
|
-
dataSource
|
|
5289
|
+
dataSource,
|
|
5294
5290
|
columns: columnsWithIndex,
|
|
5295
|
-
pagination: !isEmpty(
|
|
5291
|
+
pagination: !isEmpty(dataSource) ? paginationConfig : false,
|
|
5296
5292
|
loading,
|
|
5297
5293
|
rowSelection: rowsSelected ? rowSelection : void 0,
|
|
5298
5294
|
onChange: handleTableChange,
|
|
@@ -5303,7 +5299,6 @@ const Table = ({
|
|
|
5303
5299
|
locale: {
|
|
5304
5300
|
emptyText: /* @__PURE__ */ jsx(EmptyTable, {})
|
|
5305
5301
|
},
|
|
5306
|
-
rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
|
|
5307
5302
|
scroll: { y: tableHeight },
|
|
5308
5303
|
size,
|
|
5309
5304
|
...rest
|
|
@@ -5341,6 +5336,14 @@ const Table = ({
|
|
|
5341
5336
|
]
|
|
5342
5337
|
}
|
|
5343
5338
|
);
|
|
5339
|
+
const renderTable = () => {
|
|
5340
|
+
if (handleSubmit) {
|
|
5341
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: tableContent });
|
|
5342
|
+
}
|
|
5343
|
+
return tableContent;
|
|
5344
|
+
};
|
|
5345
|
+
//! Render
|
|
5346
|
+
return renderTable();
|
|
5344
5347
|
};
|
|
5345
5348
|
const EmptyTable = () => {
|
|
5346
5349
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center text-center", children: [
|
package/package.json
CHANGED
|
@@ -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';
|
|
@@ -6,10 +6,10 @@ import { BulkActionHandlers, InitialFiltersSearch } from '@pnkx-lib/core';
|
|
|
6
6
|
import { MenuType } from '../Sidebar';
|
|
7
7
|
import { GroupHeadingButtonItem } from './HeadingTable/components/GroupHeadingButton';
|
|
8
8
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
9
|
-
interface RowCommon {
|
|
9
|
+
export interface RowCommon {
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}
|
|
12
|
-
type ColumnTypes<T> = Exclude<TableProps<T>["columns"], undefined>;
|
|
12
|
+
export type ColumnTypes<T> = Exclude<TableProps<T>["columns"], undefined>;
|
|
13
13
|
export type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {})[];
|
|
14
14
|
export type TableColumnsType<T> = TableColumnsTypeAntd<T> & TableColumnsTypeEditable<T>;
|
|
15
15
|
export type TFilters = {
|
|
@@ -32,16 +32,16 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
|
|
|
32
32
|
titleSettingTableModal?: string;
|
|
33
33
|
showSetting?: boolean;
|
|
34
34
|
setColumns?: (newColumns: TableColumnsType<T>) => void;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
defaultEllipsis?: boolean;
|
|
36
|
+
size?: SizeType;
|
|
37
|
+
setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
|
|
38
|
+
showIndexColumn?: boolean;
|
|
37
39
|
menu: Array<MenuType>;
|
|
38
40
|
groupHeadingButtonItems?: GroupHeadingButtonItem[];
|
|
39
|
-
showIndexColumn?: boolean;
|
|
40
|
-
setFilters: (nextFilter: InitialFiltersSearch<TFilters>) => void;
|
|
41
41
|
noBreadcum?: boolean;
|
|
42
42
|
bulkActionHandlers?: BulkActionHandlers;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
renderHeadingSearch?: () => ReactNode;
|
|
44
|
+
rightHeadingContent?: ReactNode;
|
|
45
|
+
handleSubmit?: FormEventHandler<any>;
|
|
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 {};
|
|
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, handleSubmit, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
|