@pnkx-lib/ui 1.9.536 → 1.9.539

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.
@@ -1,213 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Button, Typography, Divider, Tag, Table } from '@pnkx-lib/ui';
3
- import { t as twMerge } from '../../chunks/bundle-mjs-BME7zF0Z.js';
4
- import { isString } from 'lodash';
5
- import { R as RemoveIconColor } from '../../chunks/table-Btvh90Co.js';
6
-
7
- const PlusIcon = ({
8
- size = 24,
9
- color = "currentColor",
10
- className,
11
- style,
12
- onClick,
13
- "aria-label": ariaLabel,
14
- title,
15
- ...props
16
- }) => /* @__PURE__ */ jsx(
17
- "div",
18
- {
19
- className,
20
- style: {
21
- width: size,
22
- height: size,
23
- cursor: onClick ? "pointer" : "default",
24
- ...style
25
- },
26
- onClick,
27
- role: onClick ? "button" : void 0,
28
- "aria-label": ariaLabel,
29
- title,
30
- ...props,
31
- children: /* @__PURE__ */ jsx(
32
- "svg",
33
- {
34
- width: "100%",
35
- height: "100%",
36
- viewBox: "0 0 24 24",
37
- fill: "none",
38
- xmlns: "http://www.w3.org/2000/svg",
39
- children: /* @__PURE__ */ jsx(
40
- "path",
41
- {
42
- fillRule: "evenodd",
43
- clipRule: "evenodd",
44
- d: "M12 12V6H11V12H5V13H11V19H12V13H18V12H12Z",
45
- fill: color
46
- }
47
- )
48
- }
49
- )
50
- }
51
- );
52
-
53
- const SaveIcon = ({
54
- width = 24,
55
- height = 24,
56
- color = "currentColor",
57
- // dùng màu kế thừa
58
- ...props
59
- }) => /* @__PURE__ */ jsx(
60
- "svg",
61
- {
62
- xmlns: "http://www.w3.org/2000/svg",
63
- width,
64
- height,
65
- fill: "none",
66
- viewBox: "0 0 24 24",
67
- ...props,
68
- children: /* @__PURE__ */ jsx(
69
- "path",
70
- {
71
- stroke: color,
72
- strokeLinecap: "round",
73
- strokeWidth: 1.5,
74
- d: "M6.6 20.4V15a1.2 1.2 0 0 1 1.2-1.2h8.4a1.2 1.2 0 0 1 1.2 1.2v6M15 7.2H7.8A1.2 1.2 0 0 1 6.6 6V2.4m14.398 4.197-3.595-3.595a2.057 2.057 0 0 0-1.455-.602H4.458A2.057 2.057 0 0 0 2.4 4.457v15.086c0 1.136.921 2.057 2.058 2.057h15.085a2.057 2.057 0 0 0 2.057-2.057V8.052c0-.546-.216-1.069-.602-1.455Z"
75
- }
76
- )
77
- }
78
- );
79
-
80
- const TrashCanIcon = (props) => /* @__PURE__ */ jsx(
81
- "svg",
82
- {
83
- width: "18",
84
- height: "18",
85
- viewBox: "0 0 24 24",
86
- fill: "none",
87
- xmlns: "http://www.w3.org/2000/svg",
88
- ...props,
89
- children: /* @__PURE__ */ jsx(
90
- "path",
91
- {
92
- d: "M18.893 18.0357L19.393 18.0402V18.0402L18.893 18.0357ZM4.00049 5.5C3.72435 5.5 3.50049 5.72386 3.50049 6C3.50049 6.27614 3.72435 6.5 4.00049 6.5V5.5ZM20.0005 6.5C20.2766 6.5 20.5005 6.27614 20.5005 6C20.5005 5.72386 20.2766 5.5 20.0005 5.5V6.5ZM10.5005 10C10.5005 9.72386 10.2766 9.5 10.0005 9.5C9.72435 9.5 9.50049 9.72386 9.50049 10H10.5005ZM9.50049 18C9.50049 18.2761 9.72435 18.5 10.0005 18.5C10.2766 18.5 10.5005 18.2761 10.5005 18H9.50049ZM14.5005 10C14.5005 9.72386 14.2766 9.5 14.0005 9.5C13.7243 9.5 13.5005 9.72386 13.5005 10H14.5005ZM13.5005 18C13.5005 18.2761 13.7243 18.5 14.0005 18.5C14.2766 18.5 14.5005 18.2761 14.5005 18H13.5005ZM19.0005 6L18.5005 5.99554L18.393 18.0312L18.893 18.0357L19.393 18.0402L19.5005 6.00446L19.0005 6ZM14.8932 22V21.5H9.00049V22V22.5H14.8932V22ZM5.00049 6H4.50049V18H5.00049H5.50049V6H5.00049ZM4.00049 6V6.5H5.00049V6V5.5H4.00049V6ZM5.00049 6V6.5H8.00049V6V5.5H5.00049V6ZM8.00049 6V6.5H16.0005V6V5.5H8.00049V6ZM16.0005 6V6.5H19.0005V6V5.5H16.0005V6ZM19.0005 6V6.5H20.0005V6V5.5H19.0005V6ZM8.00049 5.55556H8.50049C8.50049 3.92176 10.0105 2.5 12.0005 2.5V2V1.5C9.5722 1.5 7.50049 3.262 7.50049 5.55556H8.00049ZM12.0005 2V2.5C13.9905 2.5 15.5005 3.92176 15.5005 5.55556H16.0005H16.5005C16.5005 3.262 14.4288 1.5 12.0005 1.5V2ZM8.00049 5.55556H7.50049V6H8.00049H8.50049V5.55556H8.00049ZM16.0005 5.55556H15.5005V6H16.0005H16.5005V5.55556H16.0005ZM9.00049 22V21.5C7.06749 21.5 5.50049 19.933 5.50049 18H5.00049H4.50049C4.50049 20.4853 6.51521 22.5 9.00049 22.5V22ZM18.893 18.0357L18.393 18.0312C18.3759 19.952 16.814 21.5 14.8932 21.5V22V22.5C17.3628 22.5 19.371 20.5097 19.393 18.0402L18.893 18.0357ZM10.0005 10H9.50049V18H10.0005H10.5005V10H10.0005ZM14.0005 10H13.5005V18H14.0005H14.5005V10H14.0005Z",
93
- fill: props?.color || "#E0E0E0"
94
- }
95
- )
96
- }
97
- );
98
-
99
- const TableForm = (props) => {
100
- //! State
101
- const {
102
- data,
103
- totalItems,
104
- columns,
105
- handleSubmit,
106
- formFieldArray,
107
- rowKey,
108
- handleCancel,
109
- renderHeadingTable,
110
- hideCountNewItem,
111
- // positionButton = "right",
112
- defaultValues,
113
- rowsSelected,
114
- handleRemoveSelected,
115
- ...restProps
116
- } = props;
117
- const { fields, prepend } = formFieldArray;
118
- //! Function
119
- const handleAddNew = () => {
120
- prepend({ ...defaultValues, [rowKey]: `new_${Date.now()}` });
121
- };
122
- const newItemsCount = fields?.filter((field) => {
123
- if (rowKey && isString(rowKey)) {
124
- return typeof field?.[rowKey] === "string" && field?.[rowKey]?.startsWith("new_");
125
- }
126
- }).length;
127
- const totalItemsCount = fields?.length;
128
- const hasChanges = totalItemsCount > 0 && (newItemsCount > 0 || totalItemsCount !== (data?.length || 0));
129
- //! Render
130
- const onChangePage = restProps?.onChangePage ?? (() => {
131
- });
132
- const onChangePageSize = restProps?.onChangePageSize ?? (() => {
133
- });
134
- return /* @__PURE__ */ jsxs("div", { className: "table-wrapper", children: [
135
- /* @__PURE__ */ jsxs("div", { className: twMerge("mb-4 flex justify-between items-center"), children: [
136
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
137
- handleCancel && /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: handleCancel, shape: "round", children: "Huỷ" }),
138
- defaultValues && /* @__PURE__ */ jsx(
139
- Button,
140
- {
141
- type: "primary",
142
- onClick: handleAddNew,
143
- icon: /* @__PURE__ */ jsx(PlusIcon, {}),
144
- shape: "round",
145
- children: "Thêm mới"
146
- }
147
- ),
148
- handleSubmit && /* @__PURE__ */ jsxs(
149
- Button,
150
- {
151
- type: "primary",
152
- onClick: handleSubmit,
153
- disabled: fields.length === 0,
154
- icon: /* @__PURE__ */ jsx(SaveIcon, { width: 18, height: 18 }),
155
- shape: "round",
156
- className: "[&_.ant-btn-icon]:h-[18px]",
157
- children: [
158
- "Lưu ",
159
- hasChanges && `(${totalItemsCount})`
160
- ]
161
- }
162
- )
163
- ] }),
164
- rowsSelected && rowsSelected?.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
165
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
166
- /* @__PURE__ */ jsxs(Typography.Text, { children: [
167
- "Đã chọn ",
168
- rowsSelected?.length,
169
- " bản ghi"
170
- ] }),
171
- /* @__PURE__ */ jsx(Divider, { className: "mx-2 !h-6 ", type: "vertical" })
172
- ] }),
173
- /* @__PURE__ */ jsx(
174
- Button,
175
- {
176
- variant: "outlined",
177
- disabled: fields.length === 0,
178
- icon: /* @__PURE__ */ jsx(TrashCanIcon, { color: RemoveIconColor }),
179
- shape: "round",
180
- onClick: handleRemoveSelected,
181
- className: twMerge(
182
- "customContainButtonIcon_notNullFilter",
183
- "customContainButtonIcon"
184
- ),
185
- children: "Xoá tất cả"
186
- }
187
- )
188
- ] }),
189
- newItemsCount > 0 && !hideCountNewItem && /* @__PURE__ */ jsxs(Tag, { color: "blue", children: [
190
- newItemsCount,
191
- " mục mới"
192
- ] })
193
- ] }),
194
- /* @__PURE__ */ jsxs("div", { className: "bg-white h-full", id: "layout-wrapper-table", children: [
195
- /* @__PURE__ */ jsx("div", { className: "pl-2", children: renderHeadingTable && renderHeadingTable() }),
196
- /* @__PURE__ */ jsx(
197
- Table,
198
- {
199
- dataSource: fields,
200
- columns,
201
- totalItems,
202
- rowsSelected,
203
- rowKey,
204
- onChangePage,
205
- onChangePageSize,
206
- ...restProps
207
- }
208
- )
209
- ] })
210
- ] });
211
- };
212
-
213
- export { TableForm };
@@ -1,2 +0,0 @@
1
- export * from '../../components/ui/BulkActions/index'
2
- export {}
@@ -1,2 +0,0 @@
1
- export * from '../../components/ui/Clock/index'
2
- export {}
@@ -1,6 +0,0 @@
1
- export * from '../../components/ui/CustomeBulkActions/index'
2
- export {}
3
- import PnkxUI from '../../components/ui/CustomeBulkActions/index'
4
- export default PnkxUI
5
- export * from '../../components/ui/CustomeBulkActions/index'
6
- export {}
@@ -1,2 +0,0 @@
1
- export * from '../../components/ui/Table/index'
2
- export {}
@@ -1,2 +0,0 @@
1
- export * from '../../components/ui/TableCategory/index'
2
- export {}
@@ -1,2 +0,0 @@
1
- export * from '../../components/ui/TableForm/index'
2
- export {}