@teamias/rex-pro 0.1.0 → 0.1.2
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.
|
@@ -31,6 +31,10 @@ export default (function () {
|
|
|
31
31
|
var tableData = {
|
|
32
32
|
items: [{
|
|
33
33
|
key: 'parent_1075',
|
|
34
|
+
qweqwe: [{
|
|
35
|
+
type: 'group',
|
|
36
|
+
props: []
|
|
37
|
+
}],
|
|
34
38
|
id: [{
|
|
35
39
|
type: 'text',
|
|
36
40
|
props: {
|
|
@@ -681,6 +685,9 @@ export default (function () {
|
|
|
681
685
|
// tableHeaderUrl: '/tableProps',
|
|
682
686
|
// tableHeaderParams?: Record<string, unknown>;
|
|
683
687
|
tableHeaderConfig: [{
|
|
688
|
+
title: 'qweqwe',
|
|
689
|
+
dataIndex: 'qweqwe'
|
|
690
|
+
}, {
|
|
684
691
|
title: '编号/状态',
|
|
685
692
|
dataIndex: 'status_name',
|
|
686
693
|
key: 'status_name'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IRexProTableProps, IRexProTableRef } from './types';
|
|
2
|
-
export declare const RexProTable: <TF extends Record<string, unknown>, TT extends Record<string, unknown>>({ toolbar, filterFormProps, tableProps, listTableProps, request, defaultPageSize, autoInitRequest, hidePagination, actionConfig, proTableRef, reload, }: IRexProTableProps<TF, TT> & {
|
|
2
|
+
export declare const RexProTable: <TF extends Record<string, unknown>, TT extends Record<string, unknown>>({ toolbar, filterFormProps, tableProps, listTableProps, request, defaultPageSize, autoInitRequest, hidePagination, pageSizeOptions, cardProps, actionConfig, proTableRef, reload, }: IRexProTableProps<TF, TT> & {
|
|
3
3
|
reload?: ((wait?: number | undefined) => Promise<void>) | undefined;
|
|
4
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,14 +19,13 @@ import { BaseListTable, BaseTable, useRequestFieldsConfig, useRexProConfigProvid
|
|
|
19
19
|
import { Card, Pagination, Skeleton, Space } from 'antd';
|
|
20
20
|
import { cloneDeep } from 'lodash';
|
|
21
21
|
import React, { useImperativeHandle, useRef } from 'react';
|
|
22
|
-
import { Navigate } from 'react-router';
|
|
23
22
|
import { ActionButtons } from "./components/ActionButtons";
|
|
24
23
|
import { TableActionButtonGroup, ToolbarBox, Wrapper } from "./style";
|
|
25
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
25
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
27
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
27
|
var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
29
|
-
var _state$dataSource;
|
|
28
|
+
var _cardProps$form, _cardProps$form2, _cardProps$form3, _cardProps$table, _cardProps$table2, _state$dataSource;
|
|
30
29
|
var toolbar = _ref.toolbar,
|
|
31
30
|
filterFormProps = _ref.filterFormProps,
|
|
32
31
|
tableProps = _ref.tableProps,
|
|
@@ -38,6 +37,9 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
38
37
|
autoInitRequest = _ref$autoInitRequest === void 0 ? false : _ref$autoInitRequest,
|
|
39
38
|
_ref$hidePagination = _ref.hidePagination,
|
|
40
39
|
hidePagination = _ref$hidePagination === void 0 ? false : _ref$hidePagination,
|
|
40
|
+
_ref$pageSizeOptions = _ref.pageSizeOptions,
|
|
41
|
+
pageSizeOptions = _ref$pageSizeOptions === void 0 ? [10, 20, 50, 100] : _ref$pageSizeOptions,
|
|
42
|
+
cardProps = _ref.cardProps,
|
|
41
43
|
actionConfig = _ref.actionConfig,
|
|
42
44
|
proTableRef = _ref.proTableRef,
|
|
43
45
|
_reload = _ref.reload;
|
|
@@ -239,16 +241,17 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
239
241
|
});
|
|
240
242
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
241
243
|
className: "pro-rex-table-box",
|
|
242
|
-
children: [/*#__PURE__*/_jsx(Card, {
|
|
243
|
-
size: "small"
|
|
244
|
-
|
|
244
|
+
children: [/*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({
|
|
245
|
+
size: "small"
|
|
246
|
+
}, cardProps === null || cardProps === void 0 ? void 0 : cardProps.form), {}, {
|
|
247
|
+
style: _objectSpread({
|
|
245
248
|
display: filterFormProps !== null && filterFormProps !== void 0 && filterFormProps.hidden ? 'none' : undefined
|
|
246
|
-
},
|
|
247
|
-
styles: {
|
|
248
|
-
body: {
|
|
249
|
+
}, cardProps === null || cardProps === void 0 || (_cardProps$form = cardProps.form) === null || _cardProps$form === void 0 ? void 0 : _cardProps$form.style),
|
|
250
|
+
styles: _objectSpread(_objectSpread({}, cardProps === null || cardProps === void 0 || (_cardProps$form2 = cardProps.form) === null || _cardProps$form2 === void 0 ? void 0 : _cardProps$form2.styles), {}, {
|
|
251
|
+
body: _objectSpread({
|
|
249
252
|
padding: 10
|
|
250
|
-
}
|
|
251
|
-
},
|
|
253
|
+
}, cardProps === null || cardProps === void 0 || (_cardProps$form3 = cardProps.form) === null || _cardProps$form3 === void 0 || (_cardProps$form3 = _cardProps$form3.styles) === null || _cardProps$form3 === void 0 ? void 0 : _cardProps$form3.body)
|
|
254
|
+
}),
|
|
252
255
|
children: /*#__PURE__*/_jsx(FilterForm, _objectSpread(_objectSpread({}, filterFormProps), {}, {
|
|
253
256
|
loading: state.loading,
|
|
254
257
|
form: form,
|
|
@@ -272,22 +275,23 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
}))
|
|
275
|
-
}), listTableProps ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(ToolbarBox, {
|
|
278
|
+
})), listTableProps ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(ToolbarBox, {
|
|
276
279
|
className: "pro-rex-toolbar-box",
|
|
277
280
|
style: {
|
|
278
281
|
marginBottom: 0
|
|
279
282
|
},
|
|
280
283
|
children: batchActionNodeFn()
|
|
281
|
-
}), /*#__PURE__*/_jsxs(Card, {
|
|
284
|
+
}), /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({
|
|
282
285
|
size: "small",
|
|
283
|
-
rootClassName: "pro-rex-table-card"
|
|
284
|
-
|
|
285
|
-
|
|
286
|
+
rootClassName: "pro-rex-table-card"
|
|
287
|
+
}, cardProps === null || cardProps === void 0 ? void 0 : cardProps.table), {}, {
|
|
288
|
+
styles: _objectSpread(_objectSpread({}, cardProps === null || cardProps === void 0 || (_cardProps$table = cardProps.table) === null || _cardProps$table === void 0 ? void 0 : _cardProps$table.styles), {}, {
|
|
289
|
+
body: _objectSpread({
|
|
286
290
|
display: 'flex',
|
|
287
291
|
flexDirection: 'column',
|
|
288
292
|
padding: 10
|
|
289
|
-
}
|
|
290
|
-
},
|
|
293
|
+
}, cardProps === null || cardProps === void 0 || (_cardProps$table2 = cardProps.table) === null || _cardProps$table2 === void 0 || (_cardProps$table2 = _cardProps$table2.styles) === null || _cardProps$table2 === void 0 ? void 0 : _cardProps$table2.body)
|
|
294
|
+
}),
|
|
291
295
|
children: [listTableProps ? /*#__PURE__*/_jsx(BaseListTable, _objectSpread(_objectSpread({
|
|
292
296
|
dataSource: state.dataSource
|
|
293
297
|
}, listTableProps), {}, {
|
|
@@ -329,6 +333,7 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
329
333
|
action.getList(1);
|
|
330
334
|
}
|
|
331
335
|
})), (_state$dataSource = state.dataSource) !== null && _state$dataSource !== void 0 && _state$dataSource.length && !hidePagination ? /*#__PURE__*/_jsx(Pagination, {
|
|
336
|
+
pageSizeOptions: pageSizeOptions,
|
|
332
337
|
style: {
|
|
333
338
|
marginTop: 10
|
|
334
339
|
},
|
|
@@ -355,10 +360,12 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
355
360
|
change();
|
|
356
361
|
}
|
|
357
362
|
}) : /*#__PURE__*/_jsx(_Fragment, {})]
|
|
358
|
-
})]
|
|
363
|
+
}))]
|
|
359
364
|
});
|
|
360
365
|
};
|
|
361
366
|
export var RexProTable = function RexProTable(props) {
|
|
367
|
+
var _useRexProConfigProvi2 = useRexProConfigProvider(),
|
|
368
|
+
systemHistory = _useRexProConfigProvi2.systemHistory;
|
|
362
369
|
var _useStateData2 = useStateData(function () {
|
|
363
370
|
return {
|
|
364
371
|
/** 用于 reload */
|
|
@@ -426,15 +433,10 @@ export var RexProTable = function RexProTable(props) {
|
|
|
426
433
|
var handleLink = function handleLink(target, url) {
|
|
427
434
|
if (target === '_blank') {
|
|
428
435
|
window.open(url, target);
|
|
436
|
+
} else if (systemHistory) {
|
|
437
|
+
systemHistory.push(url);
|
|
429
438
|
} else {
|
|
430
|
-
|
|
431
|
-
Navigate({
|
|
432
|
-
to: url,
|
|
433
|
-
replace: false
|
|
434
|
-
});
|
|
435
|
-
} catch (error) {
|
|
436
|
-
window.location.href = url;
|
|
437
|
-
}
|
|
439
|
+
window.location.href = url;
|
|
438
440
|
}
|
|
439
441
|
};
|
|
440
442
|
if (item.type === 'link' || item.type === 'icon') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FilterForm, IFilterFormProps } from "../../filter-form";
|
|
2
2
|
import { BaseListTable, BaseTable, RequestFieldsContainer, TButtonFilterItem } from '@teamias/rex-design';
|
|
3
|
-
import { Button, DrawerProps, DropDownProps, FormInstance, GetProps, ModalProps } from 'antd';
|
|
3
|
+
import { Button, Card, DrawerProps, DropDownProps, FormInstance, GetProps, ModalProps } from 'antd';
|
|
4
4
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
5
5
|
import { MutableRefObject, ReactNode } from 'react';
|
|
6
6
|
/** 组件props */
|
|
@@ -24,6 +24,16 @@ export interface IRexProTableProps<TF extends Record<string, unknown> = Record<s
|
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
autoInitRequest?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 每页条数配置
|
|
29
|
+
* @default [10, 20, 50, 100]
|
|
30
|
+
*/
|
|
31
|
+
pageSizeOptions?: number[];
|
|
32
|
+
/** card props */
|
|
33
|
+
cardProps?: {
|
|
34
|
+
form?: GetProps<typeof Card>;
|
|
35
|
+
table?: GetProps<typeof Card>;
|
|
36
|
+
};
|
|
27
37
|
/** 隐藏分页 */
|
|
28
38
|
hidePagination?: boolean;
|
|
29
39
|
/** proTable 操作对象 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-pro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@ant-design/icons": "^6.1.0",
|
|
53
53
|
"@ant-design/pro-components": "^2.8.10",
|
|
54
|
-
"@teamias/rex-design": "^0.1.
|
|
54
|
+
"@teamias/rex-design": "^0.1.12",
|
|
55
55
|
"ahooks": "^3.9.6",
|
|
56
56
|
"antd": "^5.26.7",
|
|
57
57
|
"classnames": "^2.5.1",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"react": "^18.3.1",
|
|
62
62
|
"react-dom": "^18.3.1",
|
|
63
63
|
"react-intl": "^7.1.11",
|
|
64
|
-
"react-router": "6",
|
|
65
64
|
"styled-components": "^6.1.19"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
@@ -91,8 +90,7 @@
|
|
|
91
90
|
"antd": ">=5.0.0",
|
|
92
91
|
"react": ">=16.9.0",
|
|
93
92
|
"react-dom": ">=16.9.0",
|
|
94
|
-
"react-intl": ">=3.0.0"
|
|
95
|
-
"react-router": ">=6"
|
|
93
|
+
"react-intl": ">=3.0.0"
|
|
96
94
|
},
|
|
97
95
|
"packageManager": "pnpm@9.15.9",
|
|
98
96
|
"publishConfig": {
|