@akinon/akitable 0.3.11 → 0.4.0
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.map +1 -1
- package/dist/cjs/akitable.js +3 -3
- package/dist/cjs/components/EditableCell.d.ts.map +1 -1
- package/dist/cjs/components/actions.d.ts.map +1 -1
- package/dist/cjs/components/actions.js +2 -3
- package/dist/cjs/components/datatable.d.ts.map +1 -1
- package/dist/cjs/components/datatable.js +3 -4
- package/dist/cjs/components/error.d.ts.map +1 -1
- package/dist/cjs/components/error.js +3 -3
- package/dist/cjs/i18n/index.d.ts +1 -1
- package/dist/cjs/i18n/index.d.ts.map +1 -1
- package/dist/cjs/types.d.ts +1 -3
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/akitable.d.ts.map +1 -1
- package/dist/esm/akitable.js +3 -3
- package/dist/esm/components/EditableCell.d.ts.map +1 -1
- package/dist/esm/components/actions.d.ts.map +1 -1
- package/dist/esm/components/actions.js +2 -3
- package/dist/esm/components/datatable.d.ts.map +1 -1
- package/dist/esm/components/datatable.js +3 -4
- package/dist/esm/components/error.d.ts.map +1 -1
- package/dist/esm/components/error.js +3 -3
- package/dist/esm/i18n/index.d.ts +1 -1
- package/dist/esm/i18n/index.d.ts.map +1 -1
- package/dist/esm/types.d.ts +1 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +19 -24
|
@@ -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,EAAuC,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,eAAO,MAAM,QAAQ,UAAW,aAAa,
|
|
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,EAAuC,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,eAAO,MAAM,QAAQ,UAAW,aAAa,sBAgE5C,CAAC"}
|
package/dist/cjs/akitable.js
CHANGED
|
@@ -14,12 +14,12 @@ const error_1 = require("./components/error");
|
|
|
14
14
|
const footer_1 = require("./components/footer");
|
|
15
15
|
const header_1 = require("./components/header");
|
|
16
16
|
const Akitable = (props) => {
|
|
17
|
-
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit
|
|
17
|
+
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit } = props;
|
|
18
18
|
let parsedData = [];
|
|
19
19
|
let total;
|
|
20
20
|
// If there is a pagination object, table data should be accessed from type AkitablePaginatedData.
|
|
21
21
|
// If not, table data should be accessed from type AkitableData.
|
|
22
|
-
if (
|
|
22
|
+
if (pagination) {
|
|
23
23
|
const result = data;
|
|
24
24
|
total = (result === null || result === void 0 ? void 0 : result.count) || 0;
|
|
25
25
|
parsedData = (result === null || result === void 0 ? void 0 : result.results) || [];
|
|
@@ -35,7 +35,7 @@ const Akitable = (props) => {
|
|
|
35
35
|
react_1.default.createElement(antd_1.ConfigProvider, { theme: theme_overrides_1.themeOverrides },
|
|
36
36
|
react_1.default.createElement(header_1.AkitableHeader, Object.assign({}, header)),
|
|
37
37
|
react_1.default.createElement(controls_1.AkitableControls, null),
|
|
38
|
-
react_1.default.createElement(datatable_1.AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit
|
|
38
|
+
react_1.default.createElement(datatable_1.AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit }),
|
|
39
39
|
react_1.default.createElement(footer_1.AkitableFooter, Object.assign({}, footer)))))));
|
|
40
40
|
};
|
|
41
41
|
exports.Akitable = Akitable;
|
|
@@ -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;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,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,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,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":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAIvB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,eAAe,yBA0D3B,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AkitableActions = void 0;
|
|
4
4
|
require("./actions.css");
|
|
5
|
-
const icons_1 = require("@akinon/icons");
|
|
6
5
|
const ui_button_1 = require("@akinon/ui-button");
|
|
7
6
|
const ui_select_1 = require("@akinon/ui-select");
|
|
8
7
|
const react_1 = require("react");
|
|
@@ -27,9 +26,9 @@ const AkitableActions = () => {
|
|
|
27
26
|
action === null || action === void 0 ? void 0 : action.onSelect(selectedRowKeys);
|
|
28
27
|
};
|
|
29
28
|
return (react_1.default.createElement("div", { className: "akitable-actions" },
|
|
30
|
-
react_1.default.createElement(ui_select_1.Select, { placeholder: t('selectAction'), value: selectedAction, options: options, onChange: handleActionChange, disabled: isLoading || (pagination === null || pagination === void 0 ? void 0 : pagination.total) === 0, allowClear: true }),
|
|
29
|
+
react_1.default.createElement(ui_select_1.Select, { placeholder: t('selectAction'), value: selectedAction, options: options, onChange: value => handleActionChange(value), disabled: isLoading || (pagination === null || pagination === void 0 ? void 0 : pagination.total) === 0, allowClear: true }),
|
|
31
30
|
selectedAction && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
32
|
-
react_1.default.createElement(ui_button_1.Button, { type: "primary", icon:
|
|
31
|
+
react_1.default.createElement(ui_button_1.Button, { type: "primary", icon: "katalogkontrol", disabled: isLoading || !hasSelections, onClick: handleActionTrigger }, t('apply')),
|
|
33
32
|
hasSelections && (react_1.default.createElement("span", { className: "akitable-actions-info" }, t('selectedCount', { count: selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length })))))));
|
|
34
33
|
};
|
|
35
34
|
exports.AkitableActions = AkitableActions;
|
|
@@ -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,EAAgC,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIhF,eAAO,MAAM,iBAAiB,UAAW,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,EAAgC,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIhF,eAAO,MAAM,iBAAiB,UAAW,sBAAsB,sBAsH9D,CAAC"}
|
|
@@ -14,7 +14,7 @@ const EditableCell_1 = require("./EditableCell");
|
|
|
14
14
|
const { t } = i18n_1.i18n;
|
|
15
15
|
const AkitableDataTable = (props) => {
|
|
16
16
|
const { isLoading, selectedRowKeys, setSelectedRowKeys, actions } = (0, akitable_context_1.useAkitableContext)();
|
|
17
|
-
const { columns, data, rowKey, onRowClick, onRowEdit
|
|
17
|
+
const { columns, data, rowKey, onRowClick, onRowEdit } = props;
|
|
18
18
|
const [form] = akiform_1.Akiform.useForm();
|
|
19
19
|
const [localColumns, setLocalColumns] = react_1.default.useState(columns);
|
|
20
20
|
const [editingKey, setEditingKey] = react_1.default.useState(null);
|
|
@@ -32,7 +32,6 @@ const AkitableDataTable = (props) => {
|
|
|
32
32
|
* 2. Look up the existing columns and if editable is set to true, add onCell method to the column
|
|
33
33
|
*/
|
|
34
34
|
react_1.default.useEffect(() => {
|
|
35
|
-
setLocalColumns(columns);
|
|
36
35
|
if (!onRowEdit) {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
@@ -52,7 +51,7 @@ const AkitableDataTable = (props) => {
|
|
|
52
51
|
render: (record) => {
|
|
53
52
|
const isRowEditing = record.id === editingKey;
|
|
54
53
|
return isRowEditing ? (react_1.default.createElement("span", null,
|
|
55
|
-
react_1.default.createElement(ui_button_1.Button, {
|
|
54
|
+
react_1.default.createElement(ui_button_1.Button, { size: "small", onClick: () => {
|
|
56
55
|
onRowEdit(record, form.getFieldsValue());
|
|
57
56
|
setEditingKey(null);
|
|
58
57
|
form.resetFields();
|
|
@@ -78,6 +77,6 @@ const AkitableDataTable = (props) => {
|
|
|
78
77
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record, event, rowIndex);
|
|
79
78
|
}
|
|
80
79
|
};
|
|
81
|
-
}, rowClassName: (0, clsx_1.default)({ 'is-selectable': !!onRowClick }), rowSelection: hasActions ? rowSelection : undefined
|
|
80
|
+
}, rowClassName: (0, clsx_1.default)({ 'is-selectable': !!onRowClick }), rowSelection: hasActions ? rowSelection : undefined }))));
|
|
82
81
|
};
|
|
83
82
|
exports.AkitableDataTable = AkitableDataTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,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,2BAA4B,aAAa,sBAqBnE,CAAC"}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fallbackRender = void 0;
|
|
4
4
|
require("./error.css");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const ui_result_1 = require("@akinon/ui-result");
|
|
7
5
|
const ui_button_1 = require("@akinon/ui-button");
|
|
6
|
+
const ui_result_1 = require("@akinon/ui-result");
|
|
7
|
+
const react_1 = require("react");
|
|
8
8
|
const i18n_1 = require("../i18n");
|
|
9
9
|
const fallbackRender = ({ resetErrorBoundary }) => {
|
|
10
10
|
const { t } = i18n_1.i18n;
|
|
11
11
|
return (react_1.default.createElement("div", { className: "akitable-error" },
|
|
12
12
|
react_1.default.createElement(ui_result_1.Result, { status: "error", title: t('errorTitle'), subTitle: t('errorDescription'), extra: [
|
|
13
|
-
react_1.default.createElement(ui_button_1.Button, { type: "primary", onClick: resetErrorBoundary }, t('errorButtonText'))
|
|
13
|
+
react_1.default.createElement(ui_button_1.Button, { type: "primary", onClick: resetErrorBoundary, key: "error-button" }, t('errorButtonText'))
|
|
14
14
|
] })));
|
|
15
15
|
};
|
|
16
16
|
exports.fallbackRender = fallbackRender;
|
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":"AAKA,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;4BAQszB,CAAC;;CADt0B,CAAC"}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableColumnType
|
|
1
|
+
import { TableColumnType } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
type RowClickEvent = (record: AkitableData, event?: React.MouseEvent<HTMLElement>, rowIndex?: number) => void;
|
|
4
4
|
type RowEditCallback = (modifiedRecord: AkitableData, payload: AkitableData) => void;
|
|
@@ -15,7 +15,6 @@ export interface AkitableProps {
|
|
|
15
15
|
onPaginationChanged?: PaginationChangeEvent;
|
|
16
16
|
onRowClick?: RowClickEvent;
|
|
17
17
|
onRowEdit?: RowEditCallback;
|
|
18
|
-
locale?: TableProps['locale'];
|
|
19
18
|
}
|
|
20
19
|
export interface AkitableHeaderProps {
|
|
21
20
|
title?: string;
|
|
@@ -30,7 +29,6 @@ export interface AkitableDataTableProps {
|
|
|
30
29
|
rowKey: string;
|
|
31
30
|
onRowClick?: RowClickEvent;
|
|
32
31
|
onRowEdit?: RowEditCallback;
|
|
33
|
-
locale?: TableProps['locale'];
|
|
34
32
|
}
|
|
35
33
|
export type AkitablePageSizes = 20 | 50 | 100 | 250;
|
|
36
34
|
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,
|
|
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;AAElC,KAAK,aAAa,GAAG,CACnB,MAAM,EAAE,YAAY,EACpB,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,KACd,IAAI,CAAC;AAEV,KAAK,eAAe,GAAG,CACrB,cAAc,EAAE,YAAY,EAC5B,OAAO,EAAE,YAAY,KAClB,IAAI,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,IAAI,EAAE,YAAY,EAAE,GAAG,qBAAqB,CAAC;IAC7C,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;IAC5C,UAAU,CA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"","sources":["../../src/akitable.tsx"],"names":[],"mappings":"AACA,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAuC,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,eAAO,MAAM,QAAQ,UAAW,aAAa,
|
|
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,EAAuC,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,eAAO,MAAM,QAAQ,UAAW,aAAa,sBAgE5C,CAAC"}
|
package/dist/esm/akitable.js
CHANGED
|
@@ -11,12 +11,12 @@ import { fallbackRender } from './components/error';
|
|
|
11
11
|
import { AkitableFooter } from './components/footer';
|
|
12
12
|
import { AkitableHeader } from './components/header';
|
|
13
13
|
export const Akitable = (props) => {
|
|
14
|
-
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit
|
|
14
|
+
const { actions, columns, data, footer, header, isLoading, pagination, rowKey, onPaginationChanged, onRowClick, onRowEdit } = props;
|
|
15
15
|
let parsedData = [];
|
|
16
16
|
let total;
|
|
17
17
|
// If there is a pagination object, table data should be accessed from type AkitablePaginatedData.
|
|
18
18
|
// If not, table data should be accessed from type AkitableData.
|
|
19
|
-
if (
|
|
19
|
+
if (pagination) {
|
|
20
20
|
const result = data;
|
|
21
21
|
total = (result === null || result === void 0 ? void 0 : result.count) || 0;
|
|
22
22
|
parsedData = (result === null || result === void 0 ? void 0 : result.results) || [];
|
|
@@ -32,6 +32,6 @@ export const Akitable = (props) => {
|
|
|
32
32
|
React.createElement(ConfigProvider, { theme: themeOverrides },
|
|
33
33
|
React.createElement(AkitableHeader, Object.assign({}, header)),
|
|
34
34
|
React.createElement(AkitableControls, null),
|
|
35
|
-
React.createElement(AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit
|
|
35
|
+
React.createElement(AkitableDataTable, { columns: columns, data: parsedData, rowKey: rowKey, onRowClick: onRowClick, onRowEdit: onRowEdit }),
|
|
36
36
|
React.createElement(AkitableFooter, Object.assign({}, footer)))))));
|
|
37
37
|
};
|
|
@@ -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;AAExC,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,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,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,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":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAIvB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,eAAe,yBA0D3B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './actions.css';
|
|
2
|
-
import { Icon } from '@akinon/icons';
|
|
3
2
|
import { Button } from '@akinon/ui-button';
|
|
4
3
|
import { Select } from '@akinon/ui-select';
|
|
5
4
|
import React from 'react';
|
|
@@ -24,8 +23,8 @@ export const AkitableActions = () => {
|
|
|
24
23
|
action === null || action === void 0 ? void 0 : action.onSelect(selectedRowKeys);
|
|
25
24
|
};
|
|
26
25
|
return (React.createElement("div", { className: "akitable-actions" },
|
|
27
|
-
React.createElement(Select, { placeholder: t('selectAction'), value: selectedAction, options: options, onChange: handleActionChange, disabled: isLoading || (pagination === null || pagination === void 0 ? void 0 : pagination.total) === 0, allowClear: true }),
|
|
26
|
+
React.createElement(Select, { placeholder: t('selectAction'), value: selectedAction, options: options, onChange: value => handleActionChange(value), disabled: isLoading || (pagination === null || pagination === void 0 ? void 0 : pagination.total) === 0, allowClear: true }),
|
|
28
27
|
selectedAction && (React.createElement(React.Fragment, null,
|
|
29
|
-
React.createElement(Button, { type: "primary", icon:
|
|
28
|
+
React.createElement(Button, { type: "primary", icon: "katalogkontrol", disabled: isLoading || !hasSelections, onClick: handleActionTrigger }, t('apply')),
|
|
30
29
|
hasSelections && (React.createElement("span", { className: "akitable-actions-info" }, t('selectedCount', { count: selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length })))))));
|
|
31
30
|
};
|
|
@@ -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,EAAgC,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIhF,eAAO,MAAM,iBAAiB,UAAW,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,EAAgC,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIhF,eAAO,MAAM,iBAAiB,UAAW,sBAAsB,sBAsH9D,CAAC"}
|
|
@@ -11,7 +11,7 @@ import EditableCell from './EditableCell';
|
|
|
11
11
|
const { t } = i18n;
|
|
12
12
|
export const AkitableDataTable = (props) => {
|
|
13
13
|
const { isLoading, selectedRowKeys, setSelectedRowKeys, actions } = useAkitableContext();
|
|
14
|
-
const { columns, data, rowKey, onRowClick, onRowEdit
|
|
14
|
+
const { columns, data, rowKey, onRowClick, onRowEdit } = props;
|
|
15
15
|
const [form] = Akiform.useForm();
|
|
16
16
|
const [localColumns, setLocalColumns] = React.useState(columns);
|
|
17
17
|
const [editingKey, setEditingKey] = React.useState(null);
|
|
@@ -29,7 +29,6 @@ export const AkitableDataTable = (props) => {
|
|
|
29
29
|
* 2. Look up the existing columns and if editable is set to true, add onCell method to the column
|
|
30
30
|
*/
|
|
31
31
|
React.useEffect(() => {
|
|
32
|
-
setLocalColumns(columns);
|
|
33
32
|
if (!onRowEdit) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
@@ -49,7 +48,7 @@ export const AkitableDataTable = (props) => {
|
|
|
49
48
|
render: (record) => {
|
|
50
49
|
const isRowEditing = record.id === editingKey;
|
|
51
50
|
return isRowEditing ? (React.createElement("span", null,
|
|
52
|
-
React.createElement(Button, {
|
|
51
|
+
React.createElement(Button, { size: "small", onClick: () => {
|
|
53
52
|
onRowEdit(record, form.getFieldsValue());
|
|
54
53
|
setEditingKey(null);
|
|
55
54
|
form.resetFields();
|
|
@@ -75,5 +74,5 @@ export const AkitableDataTable = (props) => {
|
|
|
75
74
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record, event, rowIndex);
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
|
-
}, rowClassName: clsx({ 'is-selectable': !!onRowClick }), rowSelection: hasActions ? rowSelection : undefined
|
|
77
|
+
}, rowClassName: clsx({ 'is-selectable': !!onRowClick }), rowSelection: hasActions ? rowSelection : undefined }))));
|
|
79
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/error.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,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,2BAA4B,aAAa,sBAqBnE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './error.css';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Result } from '@akinon/ui-result';
|
|
4
2
|
import { Button } from '@akinon/ui-button';
|
|
3
|
+
import { Result } from '@akinon/ui-result';
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import { i18n } from '../i18n';
|
|
6
6
|
export const fallbackRender = ({ resetErrorBoundary }) => {
|
|
7
7
|
const { t } = i18n;
|
|
8
8
|
return (React.createElement("div", { className: "akitable-error" },
|
|
9
9
|
React.createElement(Result, { status: "error", title: t('errorTitle'), subTitle: t('errorDescription'), extra: [
|
|
10
|
-
React.createElement(Button, { type: "primary", onClick: resetErrorBoundary }, t('errorButtonText'))
|
|
10
|
+
React.createElement(Button, { type: "primary", onClick: resetErrorBoundary, key: "error-button" }, t('errorButtonText'))
|
|
11
11
|
] })));
|
|
12
12
|
};
|
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":"AAKA,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;4BAQszB,CAAC;;CADt0B,CAAC"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableColumnType
|
|
1
|
+
import { TableColumnType } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
type RowClickEvent = (record: AkitableData, event?: React.MouseEvent<HTMLElement>, rowIndex?: number) => void;
|
|
4
4
|
type RowEditCallback = (modifiedRecord: AkitableData, payload: AkitableData) => void;
|
|
@@ -15,7 +15,6 @@ export interface AkitableProps {
|
|
|
15
15
|
onPaginationChanged?: PaginationChangeEvent;
|
|
16
16
|
onRowClick?: RowClickEvent;
|
|
17
17
|
onRowEdit?: RowEditCallback;
|
|
18
|
-
locale?: TableProps['locale'];
|
|
19
18
|
}
|
|
20
19
|
export interface AkitableHeaderProps {
|
|
21
20
|
title?: string;
|
|
@@ -30,7 +29,6 @@ export interface AkitableDataTableProps {
|
|
|
30
29
|
rowKey: string;
|
|
31
30
|
onRowClick?: RowClickEvent;
|
|
32
31
|
onRowEdit?: RowEditCallback;
|
|
33
|
-
locale?: TableProps['locale'];
|
|
34
32
|
}
|
|
35
33
|
export type AkitablePageSizes = 20 | 50 | 100 | 250;
|
|
36
34
|
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,
|
|
1
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AE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe,CAAC,YAAY,CAAC;IAEnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAE3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,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": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -12,30 +12,30 @@
|
|
|
12
12
|
"antd": "5.17.0",
|
|
13
13
|
"clsx": "^2.0.0",
|
|
14
14
|
"react-error-boundary": "^4.0.13",
|
|
15
|
-
"@akinon/akilocale": "0.
|
|
16
|
-
"@akinon/
|
|
17
|
-
"@akinon/
|
|
18
|
-
"@akinon/ui-card": "0.
|
|
19
|
-
"@akinon/ui-
|
|
20
|
-
"@akinon/ui-
|
|
21
|
-
"@akinon/ui-
|
|
22
|
-
"@akinon/ui-result": "0.
|
|
23
|
-
"@akinon/ui-
|
|
24
|
-
"@akinon/ui-
|
|
25
|
-
"@akinon/ui-
|
|
26
|
-
"@akinon/ui-
|
|
27
|
-
"@akinon/ui-
|
|
28
|
-
"@akinon/ui-
|
|
29
|
-
"@akinon/ui-
|
|
15
|
+
"@akinon/akilocale": "0.13.0",
|
|
16
|
+
"@akinon/akiform": "0.8.0",
|
|
17
|
+
"@akinon/icons": "0.5.0",
|
|
18
|
+
"@akinon/ui-card": "0.4.0",
|
|
19
|
+
"@akinon/ui-input": "0.5.0",
|
|
20
|
+
"@akinon/ui-pagination": "0.4.0",
|
|
21
|
+
"@akinon/ui-progress": "0.4.0",
|
|
22
|
+
"@akinon/ui-result": "0.2.0",
|
|
23
|
+
"@akinon/ui-button": "0.6.0",
|
|
24
|
+
"@akinon/ui-select": "0.4.0",
|
|
25
|
+
"@akinon/ui-skeleton": "0.4.0",
|
|
26
|
+
"@akinon/ui-space": "0.4.0",
|
|
27
|
+
"@akinon/ui-spin": "0.4.0",
|
|
28
|
+
"@akinon/ui-steps": "0.4.0",
|
|
29
|
+
"@akinon/ui-table": "0.4.0",
|
|
30
|
+
"@akinon/ui-theme": "0.6.0",
|
|
31
|
+
"@akinon/ui-typography": "0.4.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"clean-package": "2.2.0",
|
|
33
35
|
"copyfiles": "^2.4.1",
|
|
34
36
|
"rimraf": "^5.0.5",
|
|
35
37
|
"typescript": "^5.2.2",
|
|
36
|
-
"@akinon/
|
|
37
|
-
"@akinon/typescript-config": "0.2.0",
|
|
38
|
-
"@akinon/vite-config": "0.4.0"
|
|
38
|
+
"@akinon/typescript-config": "0.3.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=18",
|
|
@@ -57,11 +57,6 @@
|
|
|
57
57
|
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
58
58
|
"copy:files": "copyfiles -u 1 src/*.css dist/esm && copyfiles -u 1 src/*.css dist/cjs && copyfiles -u 1 src/**/*.css dist/esm && copyfiles -u 1 src/**/*.css dist/cjs",
|
|
59
59
|
"clean": "rimraf dist/",
|
|
60
|
-
"lint": "eslint *.ts*",
|
|
61
|
-
"test": "vitest run",
|
|
62
|
-
"test:ui": "vitest --ui",
|
|
63
|
-
"test:watch": "vitest watch",
|
|
64
|
-
"test:coverage": "vitest run --coverage",
|
|
65
60
|
"typecheck": "tsc --noEmit"
|
|
66
61
|
}
|
|
67
62
|
}
|