@pnkx-lib/ui 1.9.236 → 1.9.237
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 +3 -8
- package/package.json +1 -1
- package/types/components/ui/EditableTable/index.d.ts +14 -0
- package/types/components/ui/Table/index.d.ts +8 -9
- 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
|
@@ -5183,9 +5183,8 @@ const Table = ({
|
|
|
5183
5183
|
onDoubleClickRow,
|
|
5184
5184
|
...rest
|
|
5185
5185
|
}) => {
|
|
5186
|
-
const status = filters?.status;
|
|
5187
5186
|
//! State
|
|
5188
|
-
const
|
|
5187
|
+
const status = filters?.status;
|
|
5189
5188
|
const [openSetting, setOpenStting] = useState(false);
|
|
5190
5189
|
const paginationConfig = {
|
|
5191
5190
|
current: filters?.page,
|
|
@@ -5224,9 +5223,6 @@ const Table = ({
|
|
|
5224
5223
|
...ellipsisColumns
|
|
5225
5224
|
] : ellipsisColumns;
|
|
5226
5225
|
//! Function
|
|
5227
|
-
useEffect(() => {
|
|
5228
|
-
setData(Array.isArray(dataSource) ? dataSource : []);
|
|
5229
|
-
}, [JSON.stringify(dataSource)]);
|
|
5230
5226
|
const handleTableChange = (pagination, filters2, sorter) => {
|
|
5231
5227
|
if (sorter && onSort) {
|
|
5232
5228
|
onSort(sorter);
|
|
@@ -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
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefaultValues } from 'react-hook-form';
|
|
2
|
+
import { TableColumnsType as TableColumnsTypeAntd } from 'antd';
|
|
3
|
+
import { ColumnTypes, RowCommon, TableCommonProps } from '../Table';
|
|
4
|
+
import * as yup from "yup";
|
|
5
|
+
export interface EditableTableCommonProps<T> extends TableCommonProps<T> {
|
|
6
|
+
onSave?: (data: T) => void;
|
|
7
|
+
schema?: yup.AnyObjectSchema;
|
|
8
|
+
initialValueForm?: DefaultValues<T>;
|
|
9
|
+
}
|
|
10
|
+
export type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {
|
|
11
|
+
editable?: boolean;
|
|
12
|
+
})[];
|
|
13
|
+
export type TableColumnsType<T> = TableColumnsTypeAntd<T> & TableColumnsTypeEditable<T>;
|
|
14
|
+
export declare const EditableTable: <T extends RowCommon>({ onSave, schema, initialValueForm, rowKey, columns, ...rest }: EditableTableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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,15 @@ 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
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 {};
|