@pnkx-lib/ui 1.9.555 → 1.9.557
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 +1 -0
- package/es/ui/PriceStatus.js +11 -11
- package/es/ui/SelectTable.js +29 -0
- package/es/ui/index.js +1 -0
- package/package.json +1 -1
- package/types/components/ui/PriceStatus.d.ts +5 -6
- package/types/components/ui/SelectTable.d.ts +3 -1
- package/types/components/ui/index.d.ts +1 -0
package/es/index.js
CHANGED
|
@@ -74,6 +74,7 @@ export { TableForm } from './ui/TableForm/index.js';
|
|
|
74
74
|
export { Descriptions } from './ui/Descriptions.js';
|
|
75
75
|
export { CustomeBulkActions } from './ui/CustomeBulkActions/index.js';
|
|
76
76
|
export { Clock } from './ui/Clock/index.js';
|
|
77
|
+
export { CATEGORY_PRICE_ENUM, PriceStatus, badgeStatusPriceConfig } from './ui/PriceStatus.js';
|
|
77
78
|
export { Input } from './fields/Input.js';
|
|
78
79
|
export { PnkxField } from './fields/PnkxField.js';
|
|
79
80
|
export { Select } from './fields/Select.js';
|
package/es/ui/PriceStatus.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
})(
|
|
12
|
-
const
|
|
4
|
+
var CATEGORY_PRICE_ENUM = /* @__PURE__ */ ((CATEGORY_PRICE_ENUM2) => {
|
|
5
|
+
CATEGORY_PRICE_ENUM2[CATEGORY_PRICE_ENUM2["CREATE"] = 0] = "CREATE";
|
|
6
|
+
CATEGORY_PRICE_ENUM2[CATEGORY_PRICE_ENUM2["WATING_CONFIRM"] = 1] = "WATING_CONFIRM";
|
|
7
|
+
CATEGORY_PRICE_ENUM2[CATEGORY_PRICE_ENUM2["WATING_APPROVE"] = 2] = "WATING_APPROVE";
|
|
8
|
+
CATEGORY_PRICE_ENUM2[CATEGORY_PRICE_ENUM2["APPROVE"] = 3] = "APPROVE";
|
|
9
|
+
CATEGORY_PRICE_ENUM2[CATEGORY_PRICE_ENUM2["DELETE"] = 4] = "DELETE";
|
|
10
|
+
return CATEGORY_PRICE_ENUM2;
|
|
11
|
+
})(CATEGORY_PRICE_ENUM || {});
|
|
12
|
+
const badgeStatusPriceConfig = {
|
|
13
13
|
[0 /* CREATE */]: { color: "bg-[#007BE5]", text: "Tạo mới" },
|
|
14
14
|
[1 /* WATING_CONFIRM */]: {
|
|
15
15
|
color: "bg-[#DD4338]",
|
|
@@ -27,7 +27,7 @@ const badgeStatusCategoryConfig = {
|
|
|
27
27
|
};
|
|
28
28
|
const PriceStatus = ({ status }) => {
|
|
29
29
|
//! State
|
|
30
|
-
const bagde =
|
|
30
|
+
const bagde = badgeStatusPriceConfig[Number(status)];
|
|
31
31
|
//! Function
|
|
32
32
|
const ItemStatus = ({
|
|
33
33
|
color,
|
|
@@ -42,4 +42,4 @@ const PriceStatus = ({ status }) => {
|
|
|
42
42
|
return /* @__PURE__ */ jsx(ItemStatus, { color: bagde?.color, statusName: bagde?.text });
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export {
|
|
45
|
+
export { CATEGORY_PRICE_ENUM, PriceStatus, badgeStatusPriceConfig };
|
package/es/ui/SelectTable.js
CHANGED
|
@@ -33,6 +33,8 @@ const SelectTable = ({
|
|
|
33
33
|
classNameLabel,
|
|
34
34
|
isShowLabel = false,
|
|
35
35
|
isShowCheckboxAll = false,
|
|
36
|
+
listIdDuplicate = [],
|
|
37
|
+
classNameRow = "",
|
|
36
38
|
...selectProps
|
|
37
39
|
}) => {
|
|
38
40
|
const [open, setOpen] = useState(false);
|
|
@@ -164,6 +166,29 @@ const SelectTable = ({
|
|
|
164
166
|
}
|
|
165
167
|
setOpen(visible);
|
|
166
168
|
};
|
|
169
|
+
const handleRowClick = (record) => {
|
|
170
|
+
{
|
|
171
|
+
const key = typeof rowKey === "function" ? rowKey(record) : record[rowKey];
|
|
172
|
+
const isSelected = currentSelectedKeys.includes(key);
|
|
173
|
+
if (isSelected) {
|
|
174
|
+
const newSelectedKeys = currentSelectedKeys.filter((k) => k !== key);
|
|
175
|
+
const newSelectedRows = value?.filter((row) => {
|
|
176
|
+
const rowKeyValue = typeof rowKey === "function" ? rowKey(row) : row[rowKey];
|
|
177
|
+
return rowKeyValue !== key;
|
|
178
|
+
}) || [];
|
|
179
|
+
onSelectChange(newSelectedKeys, newSelectedRows);
|
|
180
|
+
} else {
|
|
181
|
+
const newSelectedKeys = [...currentSelectedKeys, key];
|
|
182
|
+
const newSelectedRows = [...value || [], record];
|
|
183
|
+
onSelectChange(newSelectedKeys, newSelectedRows);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const handleRowClassName = (record) => {
|
|
188
|
+
const key = typeof rowKey === "function" ? rowKey(record) : record[rowKey];
|
|
189
|
+
const isValid = listIdDuplicate.includes(key);
|
|
190
|
+
return isValid ? classNameRow : "";
|
|
191
|
+
};
|
|
167
192
|
const dropdownRender = () => /* @__PURE__ */ jsx("div", { className: "select-table-dropdown", children: /* @__PURE__ */ jsx(
|
|
168
193
|
"div",
|
|
169
194
|
{
|
|
@@ -182,6 +207,10 @@ const SelectTable = ({
|
|
|
182
207
|
style: { overflowX: "hidden" },
|
|
183
208
|
loading: false,
|
|
184
209
|
onScroll: handleScroll,
|
|
210
|
+
onRow: (record) => ({
|
|
211
|
+
onClick: () => handleRowClick(record)
|
|
212
|
+
}),
|
|
213
|
+
rowClassName: handleRowClassName,
|
|
185
214
|
...tableProps
|
|
186
215
|
}
|
|
187
216
|
)
|
package/es/ui/index.js
CHANGED
|
@@ -75,6 +75,7 @@ export { TableForm } from './TableForm/index.js';
|
|
|
75
75
|
export { Descriptions } from './Descriptions.js';
|
|
76
76
|
export { CustomeBulkActions } from './CustomeBulkActions/index.js';
|
|
77
77
|
export { Clock } from './Clock/index.js';
|
|
78
|
+
export { CATEGORY_PRICE_ENUM, PriceStatus, badgeStatusPriceConfig } from './PriceStatus.js';
|
|
78
79
|
export { I as ID_TABLE_WRAPPER, a as MAX_TAG_COUNT, M as MAX_TAG_TEXT_LENGTH, T as TINY_API } from '../chunks/common-BcURBmQ-.js';
|
|
79
80
|
export { Sidebar } from './Sidebar/index.js';
|
|
80
81
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare enum CATEGORY_LIST_ENUM {
|
|
1
|
+
export declare enum CATEGORY_PRICE_ENUM {
|
|
3
2
|
CREATE = 0,// tạo mới
|
|
4
3
|
WATING_CONFIRM = 1,// đang xác nhận
|
|
5
4
|
WATING_APPROVE = 2,// đang chờ duyệt
|
|
@@ -12,9 +11,9 @@ type BadgeConfig = {
|
|
|
12
11
|
text: string;
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
|
-
export declare const
|
|
16
|
-
export interface
|
|
17
|
-
status:
|
|
14
|
+
export declare const badgeStatusPriceConfig: BadgeConfig;
|
|
15
|
+
export interface PriceStatusProps {
|
|
16
|
+
status: CATEGORY_PRICE_ENUM;
|
|
18
17
|
}
|
|
19
|
-
export declare const PriceStatus: ({ status }:
|
|
18
|
+
export declare const PriceStatus: ({ status }: PriceStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
export {};
|
|
@@ -35,5 +35,7 @@ export interface SelectTableProps<T = Record<string, unknown>> extends Omit<Sele
|
|
|
35
35
|
classNameLabel?: string;
|
|
36
36
|
isShowLabel?: boolean;
|
|
37
37
|
isShowCheckboxAll?: boolean;
|
|
38
|
+
listIdDuplicate?: React.Key[];
|
|
39
|
+
classNameRow?: string;
|
|
38
40
|
}
|
|
39
|
-
export declare const SelectTable: <T>({ columns, dataSource, selectedKeys, onSelectionChange, onLoadMore, onSearch, hasMore, loading, rowKey, tableProps, infiniteScroll, loadMoreThreshold, searchPlaceholder, displayField, selectedRows, customeContentTable, customeContainerTable, field, formState, label, required, isDisabledCheckbox, classNameContainer, classNameLabel, isShowLabel, isShowCheckboxAll, ...selectProps }: SelectTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const SelectTable: <T>({ columns, dataSource, selectedKeys, onSelectionChange, onLoadMore, onSearch, hasMore, loading, rowKey, tableProps, infiniteScroll, loadMoreThreshold, searchPlaceholder, displayField, selectedRows, customeContentTable, customeContainerTable, field, formState, label, required, isDisabledCheckbox, classNameContainer, classNameLabel, isShowLabel, isShowCheckboxAll, listIdDuplicate, classNameRow, ...selectProps }: SelectTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|