@akinon/akitable 1.1.1 → 1.2.1
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/dist/cjs/akitable.d.ts +1 -1
- package/dist/cjs/akitable.d.ts.map +1 -1
- package/dist/cjs/akitable.js +3 -13
- package/dist/cjs/common/theme-overrides.d.ts.map +1 -1
- package/dist/cjs/common/theme-overrides.js +2 -0
- package/dist/cjs/components/EditableCell.d.ts +1 -1
- package/dist/cjs/components/EditableCell.d.ts.map +1 -1
- package/dist/cjs/components/datatable.css +4 -0
- package/dist/cjs/components/datatable.d.ts.map +1 -1
- package/dist/cjs/components/datatable.js +10 -14
- package/dist/cjs/components/error.d.ts.map +1 -1
- package/dist/cjs/components/footer.d.ts +1 -1
- package/dist/cjs/components/footer.d.ts.map +1 -1
- package/dist/cjs/components/header.css +1 -0
- package/dist/cjs/components/header.d.ts +1 -1
- package/dist/cjs/components/header.d.ts.map +1 -1
- package/dist/cjs/components/pagination.d.ts +0 -1
- package/dist/cjs/components/pagination.d.ts.map +1 -1
- package/dist/cjs/components/pagination.js +0 -1
- package/dist/cjs/i18n/index.d.ts +2 -4
- package/dist/cjs/i18n/index.d.ts.map +1 -1
- package/dist/cjs/types.d.ts +18 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/akitable.d.ts +1 -1
- package/dist/esm/akitable.d.ts.map +1 -1
- package/dist/esm/akitable.js +3 -13
- package/dist/esm/common/theme-overrides.d.ts.map +1 -1
- package/dist/esm/common/theme-overrides.js +2 -0
- package/dist/esm/components/EditableCell.d.ts +1 -1
- package/dist/esm/components/EditableCell.d.ts.map +1 -1
- package/dist/esm/components/datatable.css +4 -0
- package/dist/esm/components/datatable.d.ts.map +1 -1
- package/dist/esm/components/datatable.js +10 -14
- package/dist/esm/components/error.d.ts.map +1 -1
- package/dist/esm/components/footer.d.ts +1 -1
- package/dist/esm/components/footer.d.ts.map +1 -1
- package/dist/esm/components/header.css +1 -0
- package/dist/esm/components/header.d.ts +1 -1
- package/dist/esm/components/header.d.ts.map +1 -1
- package/dist/esm/components/pagination.d.ts +0 -1
- package/dist/esm/components/pagination.d.ts.map +1 -1
- package/dist/esm/components/pagination.js +0 -1
- package/dist/esm/i18n/index.d.ts +2 -4
- package/dist/esm/i18n/index.d.ts.map +1 -1
- package/dist/esm/types.d.ts +18 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +32 -27
- package/dist/cjs/components/pagination.css +0 -3
- package/dist/esm/components/pagination.css +0 -3
package/dist/cjs/akitable.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akitable.d.ts","sourceRoot":"","sources":["../../src/akitable.tsx"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,
|
|
1
|
+
{"version":3,"file":"akitable.d.ts","sourceRoot":"","sources":["../../src/akitable.tsx"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,sBAwE5C,CAAC"}
|
package/dist/cjs/akitable.js
CHANGED
|
@@ -25,24 +25,14 @@ const header_1 = require("./components/header");
|
|
|
25
25
|
* needs in enterprise applications.
|
|
26
26
|
*/
|
|
27
27
|
const Akitable = (props) => {
|
|
28
|
-
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit } = props;
|
|
29
|
-
const handleGetSplittedDataByPagination = ({ result }) => {
|
|
30
|
-
if (!pagination)
|
|
31
|
-
return result;
|
|
32
|
-
const { page, size } = pagination;
|
|
33
|
-
const startIndex = (page - 1) * size;
|
|
34
|
-
const endIndex = startIndex + size;
|
|
35
|
-
return result.slice(startIndex, endIndex);
|
|
36
|
-
};
|
|
28
|
+
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit, onChangeSorter } = props;
|
|
37
29
|
// If there is a pagination object, table data should be accessed from type AkitablePaginatedData.
|
|
38
30
|
// If not, table data should be accessed from type AkitableData.
|
|
39
31
|
const handleGetParsedData = () => {
|
|
40
32
|
if (pagination) {
|
|
41
33
|
const result = data;
|
|
42
34
|
const total = (result === null || result === void 0 ? void 0 : result.count) || 0;
|
|
43
|
-
const parsedData =
|
|
44
|
-
result: (result === null || result === void 0 ? void 0 : result.results) || []
|
|
45
|
-
});
|
|
35
|
+
const parsedData = (result === null || result === void 0 ? void 0 : result.results) || [];
|
|
46
36
|
return { total, parsedData };
|
|
47
37
|
}
|
|
48
38
|
const result = data;
|
|
@@ -57,7 +47,7 @@ const Akitable = (props) => {
|
|
|
57
47
|
react_1.default.createElement(antd_1.ConfigProvider, { theme: theme_overrides_1.themeOverrides },
|
|
58
48
|
react_1.default.createElement(header_1.AkitableHeader, Object.assign({}, header)),
|
|
59
49
|
react_1.default.createElement(controls_1.AkitableControls, null),
|
|
60
|
-
react_1.default.createElement(datatable_1.AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit }),
|
|
50
|
+
react_1.default.createElement(datatable_1.AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit, onChangeSorter: onChangeSorter }),
|
|
61
51
|
react_1.default.createElement(footer_1.AkitableFooter, Object.assign({}, footer)))))));
|
|
62
52
|
};
|
|
63
53
|
exports.Akitable = Akitable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-overrides.d.ts","sourceRoot":"","sources":["../../../src/common/theme-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,WAAW,EAAE,MAAM,MAAM,CAAC;AAEvD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"theme-overrides.d.ts","sourceRoot":"","sources":["../../../src/common/theme-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,WAAW,EAAE,MAAM,MAAM,CAAC;AAEvD,eAAO,MAAM,cAAc,EAAE,WAqE5B,CAAC"}
|
|
@@ -52,6 +52,8 @@ exports.themeOverrides = {
|
|
|
52
52
|
colorText: ui_theme_1.theme.colors.ebonyClay['900'],
|
|
53
53
|
cellPaddingInline: 28,
|
|
54
54
|
colorBgBase: ui_theme_1.theme.colors.neutral['50'],
|
|
55
|
+
fontSize: 14,
|
|
56
|
+
rowHoverBg: ui_theme_1.theme.colors.azure['90'],
|
|
55
57
|
algorithm: antd_1.theme.defaultAlgorithm
|
|
56
58
|
},
|
|
57
59
|
Button: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './datatable.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableData } from '../types';
|
|
3
|
+
import type { AkitableData } from '../types';
|
|
4
4
|
interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
editing: boolean;
|
|
6
6
|
dataIndex: string | string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAoCtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAOzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAGL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAOzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAGL,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,sBA8K9D,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AkitableDataTable = void 0;
|
|
13
4
|
require("./datatable.css");
|
|
@@ -24,7 +15,7 @@ const EditableCell_1 = require("./EditableCell");
|
|
|
24
15
|
const { t } = i18n_1.i18n;
|
|
25
16
|
const AkitableDataTable = (props) => {
|
|
26
17
|
const { isLoading, selectedRowKeys, setSelectedRowKeys, actions } = (0, akitable_context_1.useAkitableContext)();
|
|
27
|
-
const { columns, data, rowKey, onRowClick, onRowEdit } = props;
|
|
18
|
+
const { columns, data, rowKey, onRowClick, onRowEdit, onChangeSorter } = props;
|
|
28
19
|
const [form] = akiform_1.Akiform.useForm();
|
|
29
20
|
const [localColumns, setLocalColumns] = react_1.default.useState(columns);
|
|
30
21
|
const [editingKey, setEditingKey] = react_1.default.useState(null);
|
|
@@ -35,6 +26,11 @@ const AkitableDataTable = (props) => {
|
|
|
35
26
|
const onSelectChange = (newSelectedRowKeys) => {
|
|
36
27
|
setSelectedRowKeys === null || setSelectedRowKeys === void 0 ? void 0 : setSelectedRowKeys(newSelectedRowKeys);
|
|
37
28
|
};
|
|
29
|
+
const handleOnChangeSorter = (sorter) => {
|
|
30
|
+
if (typeof onChangeSorter === 'function') {
|
|
31
|
+
onChangeSorter(sorter);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
38
34
|
const rowSelection = {
|
|
39
35
|
selectedRowKeys,
|
|
40
36
|
onChange: onSelectChange
|
|
@@ -64,17 +60,17 @@ const AkitableDataTable = (props) => {
|
|
|
64
60
|
title: t('edit'),
|
|
65
61
|
render: (record) => {
|
|
66
62
|
const isRowEditing = checkIsEditingRow(getRowKeyData(record));
|
|
67
|
-
const handleOnClickSaveButton = () =>
|
|
63
|
+
const handleOnClickSaveButton = async () => {
|
|
68
64
|
try {
|
|
69
65
|
setIsLoadingSaveButton(true);
|
|
70
|
-
|
|
66
|
+
await onRowEdit(record, form.getFieldsValue());
|
|
71
67
|
setEditingKey(null);
|
|
72
68
|
form.resetFields();
|
|
73
69
|
}
|
|
74
70
|
finally {
|
|
75
71
|
setIsLoadingSaveButton(false);
|
|
76
72
|
}
|
|
77
|
-
}
|
|
73
|
+
};
|
|
78
74
|
const handleOnClickEditButton = (e) => {
|
|
79
75
|
if (!isLoadingSaveButton) {
|
|
80
76
|
form.resetFields();
|
|
@@ -114,6 +110,6 @@ const AkitableDataTable = (props) => {
|
|
|
114
110
|
'is-selectable': !!onRowClick && !checkIsEditingRow(getRowKeyData(record)),
|
|
115
111
|
'akitable-row-pending': record.rowStatus === types_1.AkitableRowStatus.PENDING,
|
|
116
112
|
'akitable-row-error': record.rowStatus === types_1.AkitableRowStatus.ERROR
|
|
117
|
-
}), rowSelection: hasActions ? rowSelection : undefined }))));
|
|
113
|
+
}), rowSelection: hasActions ? rowSelection : undefined, onChange: (_, __, sorter) => handleOnChangeSorter(sorter) }))));
|
|
118
114
|
};
|
|
119
115
|
exports.AkitableDataTable = AkitableDataTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,eAAO,MAAM,cAAc,GAAI,wBAAwB,aAAa,sBAqBnE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './footer.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableFooterProps } from '../types';
|
|
3
|
+
import type { AkitableFooterProps } from '../types';
|
|
4
4
|
export declare const AkitableFooter: (props: AkitableFooterProps) => React.JSX.Element | null;
|
|
5
5
|
//# sourceMappingURL=footer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,6BAsBxD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './header.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableHeaderProps } from '../types';
|
|
3
|
+
import type { AkitableHeaderProps } from '../types';
|
|
4
4
|
export declare const AkitableHeader: (props: AkitableHeaderProps) => React.JSX.Element | null;
|
|
5
5
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,6BA4ExD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,eAAO,MAAM,kBAAkB,yBAuC9B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AkitablePagination = void 0;
|
|
4
|
-
require("./pagination.css");
|
|
5
4
|
const ui_pagination_1 = require("@akinon/ui-pagination");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const akitable_context_1 = require("../akitable-context");
|
package/dist/cjs/i18n/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,eAAO,MAAM,IAAI,EAAE,iBAOjB,CAAC"}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { TableColumnType } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
export type AnyObject = Record<PropertyKey, any>;
|
|
4
|
+
export type SortOrder = 'descend' | 'ascend' | null;
|
|
5
|
+
export interface SorterResult {
|
|
6
|
+
column?: AkitableColumn;
|
|
7
|
+
order?: SortOrder;
|
|
8
|
+
field?: string | readonly string[];
|
|
9
|
+
columnKey?: string;
|
|
10
|
+
}
|
|
3
11
|
type RowClickEvent = (record: AkitableData, event?: React.MouseEvent<HTMLElement>, rowIndex?: number) => void;
|
|
4
12
|
type RowEditCallback = (modifiedRecord: AkitableData, payload: AkitableData) => void | Promise<void>;
|
|
5
13
|
export type PaginationChangeEvent = (page: number, size: number) => void;
|
|
14
|
+
export type TableOnChangeSorter = SorterResult | SorterResult[];
|
|
15
|
+
export type SorterChangeEvent = (sorter: TableOnChangeSorter) => void;
|
|
6
16
|
export interface AkitableProps {
|
|
7
17
|
/**
|
|
8
18
|
* Actions available for the table rows.
|
|
@@ -48,6 +58,10 @@ export interface AkitableProps {
|
|
|
48
58
|
* Callback for row edit events.
|
|
49
59
|
*/
|
|
50
60
|
onRowEdit?: RowEditCallback;
|
|
61
|
+
/**
|
|
62
|
+
* Callback for sorter changes.
|
|
63
|
+
*/
|
|
64
|
+
onChangeSorter?: SorterChangeEvent;
|
|
51
65
|
}
|
|
52
66
|
export interface AkitableHeaderProps {
|
|
53
67
|
/**
|
|
@@ -86,6 +100,10 @@ export interface AkitableDataTableProps {
|
|
|
86
100
|
* Callback for row edit events.
|
|
87
101
|
*/
|
|
88
102
|
onRowEdit?: RowEditCallback;
|
|
103
|
+
/**
|
|
104
|
+
* Callback for sorter changes.
|
|
105
|
+
*/
|
|
106
|
+
onChangeSorter?: SorterChangeEvent;
|
|
89
107
|
}
|
|
90
108
|
export type AkitablePageSizes = 20 | 50 | 100 | 250;
|
|
91
109
|
export interface AkitablePaginationProps {
|
package/dist/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,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sBAAsB,GACzB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,EAAE,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC;;OAEG;IAEH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;CAClD"}
|
package/dist/esm/akitable.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"akitable.d.ts","sourceRoot":"","sources":["../../src/akitable.tsx"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,
|
|
1
|
+
{"version":3,"file":"akitable.d.ts","sourceRoot":"","sources":["../../src/akitable.tsx"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,sBAwE5C,CAAC"}
|
package/dist/esm/akitable.js
CHANGED
|
@@ -22,24 +22,14 @@ import { AkitableHeader } from './components/header';
|
|
|
22
22
|
* needs in enterprise applications.
|
|
23
23
|
*/
|
|
24
24
|
export const Akitable = (props) => {
|
|
25
|
-
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit } = props;
|
|
26
|
-
const handleGetSplittedDataByPagination = ({ result }) => {
|
|
27
|
-
if (!pagination)
|
|
28
|
-
return result;
|
|
29
|
-
const { page, size } = pagination;
|
|
30
|
-
const startIndex = (page - 1) * size;
|
|
31
|
-
const endIndex = startIndex + size;
|
|
32
|
-
return result.slice(startIndex, endIndex);
|
|
33
|
-
};
|
|
25
|
+
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit, onChangeSorter } = props;
|
|
34
26
|
// If there is a pagination object, table data should be accessed from type AkitablePaginatedData.
|
|
35
27
|
// If not, table data should be accessed from type AkitableData.
|
|
36
28
|
const handleGetParsedData = () => {
|
|
37
29
|
if (pagination) {
|
|
38
30
|
const result = data;
|
|
39
31
|
const total = (result === null || result === void 0 ? void 0 : result.count) || 0;
|
|
40
|
-
const parsedData =
|
|
41
|
-
result: (result === null || result === void 0 ? void 0 : result.results) || []
|
|
42
|
-
});
|
|
32
|
+
const parsedData = (result === null || result === void 0 ? void 0 : result.results) || [];
|
|
43
33
|
return { total, parsedData };
|
|
44
34
|
}
|
|
45
35
|
const result = data;
|
|
@@ -54,6 +44,6 @@ export const Akitable = (props) => {
|
|
|
54
44
|
React.createElement(ConfigProvider, { theme: themeOverrides },
|
|
55
45
|
React.createElement(AkitableHeader, Object.assign({}, header)),
|
|
56
46
|
React.createElement(AkitableControls, null),
|
|
57
|
-
React.createElement(AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit }),
|
|
47
|
+
React.createElement(AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit, onChangeSorter: onChangeSorter }),
|
|
58
48
|
React.createElement(AkitableFooter, Object.assign({}, footer)))))));
|
|
59
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-overrides.d.ts","sourceRoot":"","sources":["../../../src/common/theme-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,WAAW,EAAE,MAAM,MAAM,CAAC;AAEvD,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"theme-overrides.d.ts","sourceRoot":"","sources":["../../../src/common/theme-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,WAAW,EAAE,MAAM,MAAM,CAAC;AAEvD,eAAO,MAAM,cAAc,EAAE,WAqE5B,CAAC"}
|
|
@@ -49,6 +49,8 @@ export const themeOverrides = {
|
|
|
49
49
|
colorText: theme.colors.ebonyClay['900'],
|
|
50
50
|
cellPaddingInline: 28,
|
|
51
51
|
colorBgBase: theme.colors.neutral['50'],
|
|
52
|
+
fontSize: 14,
|
|
53
|
+
rowHoverBg: theme.colors.azure['90'],
|
|
52
54
|
algorithm: antdTheme.defaultAlgorithm
|
|
53
55
|
},
|
|
54
56
|
Button: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './datatable.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableData } from '../types';
|
|
3
|
+
import type { AkitableData } from '../types';
|
|
4
4
|
interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
editing: boolean;
|
|
6
6
|
dataIndex: string | string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"EditableCell.d.ts","sourceRoot":"","sources":["../../../src/components/EditableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAoCtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAOzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAGL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAOzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAGL,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,sBA8K9D,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import './datatable.css';
|
|
11
2
|
import { Akiform } from '@akinon/akiform';
|
|
12
3
|
import { Button } from '@akinon/ui-button';
|
|
@@ -21,7 +12,7 @@ import EditableCell from './EditableCell';
|
|
|
21
12
|
const { t } = i18n;
|
|
22
13
|
export const AkitableDataTable = (props) => {
|
|
23
14
|
const { isLoading, selectedRowKeys, setSelectedRowKeys, actions } = useAkitableContext();
|
|
24
|
-
const { columns, data, rowKey, onRowClick, onRowEdit } = props;
|
|
15
|
+
const { columns, data, rowKey, onRowClick, onRowEdit, onChangeSorter } = props;
|
|
25
16
|
const [form] = Akiform.useForm();
|
|
26
17
|
const [localColumns, setLocalColumns] = React.useState(columns);
|
|
27
18
|
const [editingKey, setEditingKey] = React.useState(null);
|
|
@@ -32,6 +23,11 @@ export const AkitableDataTable = (props) => {
|
|
|
32
23
|
const onSelectChange = (newSelectedRowKeys) => {
|
|
33
24
|
setSelectedRowKeys === null || setSelectedRowKeys === void 0 ? void 0 : setSelectedRowKeys(newSelectedRowKeys);
|
|
34
25
|
};
|
|
26
|
+
const handleOnChangeSorter = (sorter) => {
|
|
27
|
+
if (typeof onChangeSorter === 'function') {
|
|
28
|
+
onChangeSorter(sorter);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
35
31
|
const rowSelection = {
|
|
36
32
|
selectedRowKeys,
|
|
37
33
|
onChange: onSelectChange
|
|
@@ -61,17 +57,17 @@ export const AkitableDataTable = (props) => {
|
|
|
61
57
|
title: t('edit'),
|
|
62
58
|
render: (record) => {
|
|
63
59
|
const isRowEditing = checkIsEditingRow(getRowKeyData(record));
|
|
64
|
-
const handleOnClickSaveButton = () =>
|
|
60
|
+
const handleOnClickSaveButton = async () => {
|
|
65
61
|
try {
|
|
66
62
|
setIsLoadingSaveButton(true);
|
|
67
|
-
|
|
63
|
+
await onRowEdit(record, form.getFieldsValue());
|
|
68
64
|
setEditingKey(null);
|
|
69
65
|
form.resetFields();
|
|
70
66
|
}
|
|
71
67
|
finally {
|
|
72
68
|
setIsLoadingSaveButton(false);
|
|
73
69
|
}
|
|
74
|
-
}
|
|
70
|
+
};
|
|
75
71
|
const handleOnClickEditButton = (e) => {
|
|
76
72
|
if (!isLoadingSaveButton) {
|
|
77
73
|
form.resetFields();
|
|
@@ -111,5 +107,5 @@ export const AkitableDataTable = (props) => {
|
|
|
111
107
|
'is-selectable': !!onRowClick && !checkIsEditingRow(getRowKeyData(record)),
|
|
112
108
|
'akitable-row-pending': record.rowStatus === AkitableRowStatus.PENDING,
|
|
113
109
|
'akitable-row-error': record.rowStatus === AkitableRowStatus.ERROR
|
|
114
|
-
}), rowSelection: hasActions ? rowSelection : undefined }))));
|
|
110
|
+
}), rowSelection: hasActions ? rowSelection : undefined, onChange: (_, __, sorter) => handleOnChangeSorter(sorter) }))));
|
|
115
111
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,eAAO,MAAM,cAAc,GAAI,wBAAwB,aAAa,sBAqBnE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './footer.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableFooterProps } from '../types';
|
|
3
|
+
import type { AkitableFooterProps } from '../types';
|
|
4
4
|
export declare const AkitableFooter: (props: AkitableFooterProps) => React.JSX.Element | null;
|
|
5
5
|
//# sourceMappingURL=footer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/components/footer.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,6BAsBxD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './header.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { AkitableHeaderProps } from '../types';
|
|
3
|
+
import type { AkitableHeaderProps } from '../types';
|
|
4
4
|
export declare const AkitableHeader: (props: AkitableHeaderProps) => React.JSX.Element | null;
|
|
5
5
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/header.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,6BA4ExD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,eAAO,MAAM,kBAAkB,yBAuC9B,CAAC"}
|
package/dist/esm/i18n/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,eAAO,MAAM,IAAI,EAAE,iBAOjB,CAAC"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { TableColumnType } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
export type AnyObject = Record<PropertyKey, any>;
|
|
4
|
+
export type SortOrder = 'descend' | 'ascend' | null;
|
|
5
|
+
export interface SorterResult {
|
|
6
|
+
column?: AkitableColumn;
|
|
7
|
+
order?: SortOrder;
|
|
8
|
+
field?: string | readonly string[];
|
|
9
|
+
columnKey?: string;
|
|
10
|
+
}
|
|
3
11
|
type RowClickEvent = (record: AkitableData, event?: React.MouseEvent<HTMLElement>, rowIndex?: number) => void;
|
|
4
12
|
type RowEditCallback = (modifiedRecord: AkitableData, payload: AkitableData) => void | Promise<void>;
|
|
5
13
|
export type PaginationChangeEvent = (page: number, size: number) => void;
|
|
14
|
+
export type TableOnChangeSorter = SorterResult | SorterResult[];
|
|
15
|
+
export type SorterChangeEvent = (sorter: TableOnChangeSorter) => void;
|
|
6
16
|
export interface AkitableProps {
|
|
7
17
|
/**
|
|
8
18
|
* Actions available for the table rows.
|
|
@@ -48,6 +58,10 @@ export interface AkitableProps {
|
|
|
48
58
|
* Callback for row edit events.
|
|
49
59
|
*/
|
|
50
60
|
onRowEdit?: RowEditCallback;
|
|
61
|
+
/**
|
|
62
|
+
* Callback for sorter changes.
|
|
63
|
+
*/
|
|
64
|
+
onChangeSorter?: SorterChangeEvent;
|
|
51
65
|
}
|
|
52
66
|
export interface AkitableHeaderProps {
|
|
53
67
|
/**
|
|
@@ -86,6 +100,10 @@ export interface AkitableDataTableProps {
|
|
|
86
100
|
* Callback for row edit events.
|
|
87
101
|
*/
|
|
88
102
|
onRowEdit?: RowEditCallback;
|
|
103
|
+
/**
|
|
104
|
+
* Callback for sorter changes.
|
|
105
|
+
*/
|
|
106
|
+
onChangeSorter?: SorterChangeEvent;
|
|
89
107
|
}
|
|
90
108
|
export type AkitablePageSizes = 20 | 50 | 100 | 250;
|
|
91
109
|
export interface AkitablePaginationProps {
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;AAEpD,MAAM,WAAW,YAAY;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G;IAEH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;CAClD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/akitable",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -9,38 +9,39 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"antd": "5.
|
|
13
|
-
"clsx": "^2.
|
|
14
|
-
"react-error-boundary": "^
|
|
15
|
-
"@akinon/
|
|
16
|
-
"@akinon/
|
|
17
|
-
"@akinon/
|
|
18
|
-
"@akinon/
|
|
19
|
-
"@akinon/ui-
|
|
20
|
-
"@akinon/ui-
|
|
21
|
-
"@akinon/ui-
|
|
22
|
-
"@akinon/ui-
|
|
23
|
-
"@akinon/ui-
|
|
24
|
-
"@akinon/ui-
|
|
25
|
-
"@akinon/ui-
|
|
26
|
-
"@akinon/ui-
|
|
27
|
-
"@akinon/ui-
|
|
28
|
-
"@akinon/ui-
|
|
29
|
-
"@akinon/ui-theme": "1.0
|
|
30
|
-
"@akinon/ui-
|
|
31
|
-
"@akinon/ui-
|
|
12
|
+
"antd": "^5.27.0",
|
|
13
|
+
"clsx": "^2.1.1",
|
|
14
|
+
"react-error-boundary": "^6.0.0",
|
|
15
|
+
"@akinon/akilocale": "1.2.0",
|
|
16
|
+
"@akinon/icons": "1.1.0",
|
|
17
|
+
"@akinon/ui-button": "1.3.0",
|
|
18
|
+
"@akinon/akiform": "1.1.1",
|
|
19
|
+
"@akinon/ui-input": "1.1.0",
|
|
20
|
+
"@akinon/ui-select": "1.3.0",
|
|
21
|
+
"@akinon/ui-progress": "1.1.0",
|
|
22
|
+
"@akinon/ui-card": "1.1.0",
|
|
23
|
+
"@akinon/ui-skeleton": "1.1.0",
|
|
24
|
+
"@akinon/ui-space": "1.3.0",
|
|
25
|
+
"@akinon/ui-pagination": "1.3.0",
|
|
26
|
+
"@akinon/ui-result": "1.3.0",
|
|
27
|
+
"@akinon/ui-typography": "1.1.0",
|
|
28
|
+
"@akinon/ui-steps": "1.1.0",
|
|
29
|
+
"@akinon/ui-theme": "1.1.0",
|
|
30
|
+
"@akinon/ui-spin": "1.3.0",
|
|
31
|
+
"@akinon/ui-table": "1.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"clean-package": "2.2.0",
|
|
35
35
|
"copyfiles": "^2.4.1",
|
|
36
36
|
"rimraf": "^5.0.5",
|
|
37
37
|
"typescript": "*",
|
|
38
|
-
"@akinon/
|
|
39
|
-
"@akinon/
|
|
38
|
+
"@akinon/utils": "1.1.0",
|
|
39
|
+
"@akinon/typescript-config": "1.1.0",
|
|
40
|
+
"@akinon/vitest-config": "1.1.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"react": "
|
|
43
|
-
"react-dom": "
|
|
43
|
+
"react": "^18 || ^19",
|
|
44
|
+
"react-dom": "^18 || ^19"
|
|
44
45
|
},
|
|
45
46
|
"clean-package": "../../../clean-package.config.json",
|
|
46
47
|
"types": "dist/esm/index.d.ts",
|
|
@@ -54,10 +55,14 @@
|
|
|
54
55
|
},
|
|
55
56
|
"scripts": {
|
|
56
57
|
"build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
|
|
57
|
-
"build:esm": "tsc --outDir dist/esm",
|
|
58
58
|
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
59
|
-
"
|
|
59
|
+
"build:esm": "tsc --outDir dist/esm",
|
|
60
60
|
"clean": "rimraf dist/",
|
|
61
|
+
"copy:files": "copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/esm && copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/cjs",
|
|
62
|
+
"test": "vitest",
|
|
63
|
+
"test:coverage": "vitest run --coverage",
|
|
64
|
+
"test:run": "vitest run",
|
|
65
|
+
"test:ui": "vitest --ui",
|
|
61
66
|
"typecheck": "tsc --noEmit"
|
|
62
67
|
}
|
|
63
68
|
}
|