@pnkx-lib/ui 1.9.556 → 1.9.558

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
@@ -75,6 +75,7 @@ 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
77
  export { CATEGORY_PRICE_ENUM, PriceStatus, badgeStatusPriceConfig } from './ui/PriceStatus.js';
78
+ export { badgeStatusclinicalConfig } from './ui/ClinicalStatus.js';
78
79
  export { Input } from './fields/Input.js';
79
80
  export { PnkxField } from './fields/PnkxField.js';
80
81
  export { Select } from './fields/Select.js';
@@ -0,0 +1,48 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+ import { t as twMerge } from '../chunks/bundle-mjs-BBFHkixS.js';
4
+
5
+ const badgeStatusclinicalConfig = {
6
+ [0 /* WAITING */]: {
7
+ color: "bg-[#722ED1]",
8
+ text: "Chờ tiếp đón"
9
+ },
10
+ [1 /* INPROGRESS */]: {
11
+ color: "bg-[#007BE5]",
12
+ text: "Đang tiếp đón"
13
+ },
14
+ [2 /* SKIPPED */]: {
15
+ color: "bg-[#B2B7C2]",
16
+ text: "Bỏ qua"
17
+ },
18
+ [3 /* COMPLETED */]: {
19
+ color: "bg-[#27CD7F]",
20
+ text: "Đã tiếp đón"
21
+ },
22
+ [4 /* CANCELLED */]: {
23
+ color: "bg-[#DD4338]",
24
+ text: "Huỷ tiếp đón"
25
+ },
26
+ [5 /* CLOSED */]: {
27
+ color: "bg-[#DA9438]",
28
+ text: "Đóng hồ sơ"
29
+ }
30
+ };
31
+ const ClinicalStatus = ({ status }) => {
32
+ const bagde = badgeStatusclinicalConfig[Number(status)];
33
+ //! Function
34
+ const ItemStatus = ({
35
+ color,
36
+ statusName
37
+ }) => {
38
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
39
+ /* @__PURE__ */ jsx("div", { className: twMerge("w-3 h-3 rounded-sm", color || "") }),
40
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-normal", children: statusName || "" })
41
+ ] }) });
42
+ };
43
+ //! Render
44
+ return /* @__PURE__ */ jsx(ItemStatus, { color: bagde?.color, statusName: bagde?.text });
45
+ };
46
+ const ClinicalStatus$1 = React__default.memo(ClinicalStatus);
47
+
48
+ export { badgeStatusclinicalConfig, ClinicalStatus$1 as default };
@@ -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
@@ -76,6 +76,7 @@ export { Descriptions } from './Descriptions.js';
76
76
  export { CustomeBulkActions } from './CustomeBulkActions/index.js';
77
77
  export { Clock } from './Clock/index.js';
78
78
  export { CATEGORY_PRICE_ENUM, PriceStatus, badgeStatusPriceConfig } from './PriceStatus.js';
79
+ export { badgeStatusclinicalConfig } from './ClinicalStatus.js';
79
80
  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';
80
81
  export { Sidebar } from './Sidebar/index.js';
81
82
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.556",
4
+ "version": "1.9.558",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ declare enum CATEGORY_CLINICAL_ENUM {
3
+ WAITING = 0,// CHỜ TIẾP ĐÓN
4
+ INPROGRESS = 1,// ĐANG TIẾP ĐÓN
5
+ SKIPPED = 2,// BỎ QUA
6
+ COMPLETED = 3,// ĐÃ TIẾP ĐÓN
7
+ CANCELLED = 4,// HỦY TIẾP ĐÓN
8
+ CLOSED = 5
9
+ }
10
+ type BadgeConfig = {
11
+ [key: number]: {
12
+ color: string;
13
+ text: string;
14
+ };
15
+ };
16
+ export declare const badgeStatusclinicalConfig: BadgeConfig;
17
+ export interface ClinicalStatusProps {
18
+ status: CATEGORY_CLINICAL_ENUM;
19
+ }
20
+ declare const _default: React.MemoExoticComponent<({ status }: ClinicalStatusProps) => import("react/jsx-runtime").JSX.Element>;
21
+ export default _default;
@@ -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;
@@ -76,3 +76,4 @@ export * from './Descriptions';
76
76
  export * from './CustomeBulkActions';
77
77
  export * from './Clock';
78
78
  export * from './PriceStatus';
79
+ export * from './ClinicalStatus';
@@ -0,0 +1,6 @@
1
+ export * from '../components/ui/ClinicalStatus'
2
+ export {}
3
+ import PnkxUI from '../components/ui/ClinicalStatus'
4
+ export default PnkxUI
5
+ export * from '../components/ui/ClinicalStatus'
6
+ export {}