@pnkx-lib/ui 1.9.257 → 1.9.259
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/fields/Input.js +31 -16
- package/es/ui/index.js +16 -11
- package/package.json +1 -1
- package/types/components/ui/Table/index.d.ts +3 -2
package/es/fields/Input.js
CHANGED
|
@@ -1251,16 +1251,39 @@ const Input = (props) => {
|
|
|
1251
1251
|
const inputRef = useRef(null);
|
|
1252
1252
|
const [isComposing, setIsComposing] = useState(false);
|
|
1253
1253
|
//! Function
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1254
|
+
const handleChange = useCallback(
|
|
1255
|
+
(e) => {
|
|
1256
|
+
onChange?.(e);
|
|
1257
|
+
afterOnChange?.(e.target.value);
|
|
1258
|
+
},
|
|
1259
|
+
[onChange, afterOnChange, isComposing]
|
|
1260
|
+
);
|
|
1261
|
+
const handleCompositionStart = useCallback(() => {
|
|
1262
|
+
setIsComposing(true);
|
|
1263
|
+
}, []);
|
|
1264
|
+
const handleCompositionEnd = useCallback(
|
|
1265
|
+
(e) => {
|
|
1266
|
+
setIsComposing(false);
|
|
1267
|
+
console.log("vvvvv", e.currentTarget.value);
|
|
1268
|
+
const syntheticEvent = {
|
|
1269
|
+
target: {
|
|
1270
|
+
value: e.currentTarget.value,
|
|
1271
|
+
name
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
console.log(" syntheticEvent:", syntheticEvent);
|
|
1259
1275
|
setTimeout(() => {
|
|
1260
|
-
|
|
1276
|
+
handleChange(syntheticEvent);
|
|
1261
1277
|
}, 0);
|
|
1262
|
-
|
|
1263
|
-
|
|
1278
|
+
const input = inputRef.current?.input;
|
|
1279
|
+
if (input) {
|
|
1280
|
+
setTimeout(() => {
|
|
1281
|
+
input.scrollLeft = input.scrollWidth;
|
|
1282
|
+
}, 0);
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
[handleChange, name]
|
|
1286
|
+
);
|
|
1264
1287
|
const renderErrorMessage = () => {
|
|
1265
1288
|
if (!errorMessage) return null;
|
|
1266
1289
|
return /* @__PURE__ */ jsx(
|
|
@@ -1287,14 +1310,6 @@ const Input = (props) => {
|
|
|
1287
1310
|
}
|
|
1288
1311
|
return node;
|
|
1289
1312
|
};
|
|
1290
|
-
const handleChange = useCallback(
|
|
1291
|
-
(e) => {
|
|
1292
|
-
if (isComposing) return;
|
|
1293
|
-
onChange?.(e);
|
|
1294
|
-
afterOnChange?.(e.target.value);
|
|
1295
|
-
},
|
|
1296
|
-
[onChange, afterOnChange, isComposing]
|
|
1297
|
-
);
|
|
1298
1313
|
const renderInput = () => {
|
|
1299
1314
|
const isNumberInput = type === "number" || type === "money";
|
|
1300
1315
|
if (isNumberInput) {
|
package/es/ui/index.js
CHANGED
|
@@ -5164,6 +5164,8 @@ const useTableHeightWrapper = (options = {}) => {
|
|
|
5164
5164
|
}
|
|
5165
5165
|
});
|
|
5166
5166
|
const wrapperStyles = window.getComputedStyle(layoutWrapper);
|
|
5167
|
+
const wrapperPaddingTop = parseInt(wrapperStyles.paddingTop, 10) || 0;
|
|
5168
|
+
const wrapperPaddingBottom = parseInt(wrapperStyles.paddingBottom, 10) || 0;
|
|
5167
5169
|
const tableStyles = window.getComputedStyle(tableContainer);
|
|
5168
5170
|
const tablePaddingTop = parseInt(tableStyles.paddingTop, 10) || 0;
|
|
5169
5171
|
const tablePaddingBottom = parseInt(tableStyles.paddingBottom, 10) || 0;
|
|
@@ -5275,11 +5277,11 @@ const Table = ({
|
|
|
5275
5277
|
defaultEllipsis = true,
|
|
5276
5278
|
onDoubleClickRow,
|
|
5277
5279
|
setRowsSelected,
|
|
5280
|
+
handleSubmit,
|
|
5278
5281
|
...rest
|
|
5279
5282
|
}) => {
|
|
5280
5283
|
const status = filters?.status;
|
|
5281
5284
|
//! State
|
|
5282
|
-
const [data, setData] = useState([]);
|
|
5283
5285
|
const [openSetting, setOpenStting] = useState(false);
|
|
5284
5286
|
const paginationConfig = {
|
|
5285
5287
|
current: filters?.page,
|
|
@@ -5318,9 +5320,6 @@ const Table = ({
|
|
|
5318
5320
|
...ellipsisColumns
|
|
5319
5321
|
] : ellipsisColumns;
|
|
5320
5322
|
//! Function
|
|
5321
|
-
useEffect(() => {
|
|
5322
|
-
setData(Array.isArray(dataSource) ? dataSource : []);
|
|
5323
|
-
}, [JSON.stringify(dataSource)]);
|
|
5324
5323
|
const handleTableChange = (pagination, filters2, sorter) => {
|
|
5325
5324
|
if (sorter && onSort) {
|
|
5326
5325
|
onSort(sorter);
|
|
@@ -5354,8 +5353,7 @@ const Table = ({
|
|
|
5354
5353
|
minHeight: 200
|
|
5355
5354
|
// chiều cao tối thiểu
|
|
5356
5355
|
});
|
|
5357
|
-
|
|
5358
|
-
return /* @__PURE__ */ jsxs(
|
|
5356
|
+
const tableContent = /* @__PURE__ */ jsxs(
|
|
5359
5357
|
"div",
|
|
5360
5358
|
{
|
|
5361
5359
|
id: "layout-wrapper-table",
|
|
@@ -5371,9 +5369,9 @@ const Table = ({
|
|
|
5371
5369
|
menu,
|
|
5372
5370
|
groupHeadingButtonItems,
|
|
5373
5371
|
setFilters,
|
|
5374
|
-
setRowsSelected,
|
|
5375
5372
|
filters,
|
|
5376
|
-
noBreadcum
|
|
5373
|
+
noBreadcum,
|
|
5374
|
+
setRowsSelected
|
|
5377
5375
|
}
|
|
5378
5376
|
),
|
|
5379
5377
|
/* @__PURE__ */ jsx(
|
|
@@ -5385,9 +5383,9 @@ const Table = ({
|
|
|
5385
5383
|
Table$1,
|
|
5386
5384
|
{
|
|
5387
5385
|
rowKey,
|
|
5388
|
-
dataSource
|
|
5386
|
+
dataSource,
|
|
5389
5387
|
columns: columnsWithIndex,
|
|
5390
|
-
pagination: !isEmpty(
|
|
5388
|
+
pagination: !isEmpty(dataSource) ? paginationConfig : false,
|
|
5391
5389
|
loading,
|
|
5392
5390
|
rowSelection: rowsSelected ? rowSelection : void 0,
|
|
5393
5391
|
onChange: handleTableChange,
|
|
@@ -5398,7 +5396,6 @@ const Table = ({
|
|
|
5398
5396
|
locale: {
|
|
5399
5397
|
emptyText: /* @__PURE__ */ jsx(EmptyTable, {})
|
|
5400
5398
|
},
|
|
5401
|
-
rowClassName: (_, index) => `table-row-${index % 2 === 0 ? "even" : "odd"}`,
|
|
5402
5399
|
scroll: { y: tableHeight },
|
|
5403
5400
|
size,
|
|
5404
5401
|
...rest
|
|
@@ -5436,6 +5433,14 @@ const Table = ({
|
|
|
5436
5433
|
]
|
|
5437
5434
|
}
|
|
5438
5435
|
);
|
|
5436
|
+
const renderTable = () => {
|
|
5437
|
+
if (handleSubmit) {
|
|
5438
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children: tableContent });
|
|
5439
|
+
}
|
|
5440
|
+
return tableContent;
|
|
5441
|
+
};
|
|
5442
|
+
//! Render
|
|
5443
|
+
return renderTable();
|
|
5439
5444
|
};
|
|
5440
5445
|
const EmptyTable = () => {
|
|
5441
5446
|
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';
|
|
@@ -42,7 +42,8 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
|
|
|
42
42
|
bulkActionHandlers?: BulkActionHandlers;
|
|
43
43
|
size?: SizeType;
|
|
44
44
|
defaultEllipsis?: boolean;
|
|
45
|
+
handleSubmit?: FormEventHandler<any>;
|
|
45
46
|
setRowsSelected?: (newSelectedRowKeys: React.Key[]) => void;
|
|
46
47
|
}
|
|
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, setRowsSelected, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
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, setRowsSelected, handleSubmit, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
48
49
|
export {};
|