@teamias/rex-pro 0.1.1 → 0.1.3
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: {
|
|
@@ -68,9 +72,11 @@ export default (function () {
|
|
|
68
72
|
id: 1075,
|
|
69
73
|
detail_id: 1102,
|
|
70
74
|
status_name: [{
|
|
71
|
-
type: '
|
|
75
|
+
type: 'link',
|
|
72
76
|
props: {
|
|
73
|
-
value: 1075
|
|
77
|
+
value: 1075,
|
|
78
|
+
label: '1075',
|
|
79
|
+
action: 'custom'
|
|
74
80
|
},
|
|
75
81
|
extra: {
|
|
76
82
|
rowSpan: 2
|
|
@@ -681,6 +687,9 @@ export default (function () {
|
|
|
681
687
|
// tableHeaderUrl: '/tableProps',
|
|
682
688
|
// tableHeaderParams?: Record<string, unknown>;
|
|
683
689
|
tableHeaderConfig: [{
|
|
690
|
+
title: 'qweqwe',
|
|
691
|
+
dataIndex: 'qweqwe'
|
|
692
|
+
}, {
|
|
684
693
|
title: '编号/状态',
|
|
685
694
|
dataIndex: 'status_name',
|
|
686
695
|
key: 'status_name'
|
|
@@ -1159,6 +1168,12 @@ export default (function () {
|
|
|
1159
1168
|
x: 1000,
|
|
1160
1169
|
y: h
|
|
1161
1170
|
};
|
|
1171
|
+
},
|
|
1172
|
+
// onDataCellClick: (...data) => {
|
|
1173
|
+
// console.log('onDataCellClick', data);
|
|
1174
|
+
// },
|
|
1175
|
+
onDataCellClickV2: function onDataCellClickV2(data) {
|
|
1176
|
+
console.log('onDataCellClickV2', data);
|
|
1162
1177
|
}
|
|
1163
1178
|
}
|
|
1164
1179
|
// listTableProps={{
|
|
@@ -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;
|
|
@@ -25,7 +25,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
25
25
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
28
|
-
var _state$dataSource;
|
|
28
|
+
var _cardProps$form, _cardProps$form2, _cardProps$form3, _cardProps$table, _cardProps$table2, _state$dataSource;
|
|
29
29
|
var toolbar = _ref.toolbar,
|
|
30
30
|
filterFormProps = _ref.filterFormProps,
|
|
31
31
|
tableProps = _ref.tableProps,
|
|
@@ -37,6 +37,9 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
37
37
|
autoInitRequest = _ref$autoInitRequest === void 0 ? false : _ref$autoInitRequest,
|
|
38
38
|
_ref$hidePagination = _ref.hidePagination,
|
|
39
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,
|
|
40
43
|
actionConfig = _ref.actionConfig,
|
|
41
44
|
proTableRef = _ref.proTableRef,
|
|
42
45
|
_reload = _ref.reload;
|
|
@@ -238,16 +241,17 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
238
241
|
});
|
|
239
242
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
240
243
|
className: "pro-rex-table-box",
|
|
241
|
-
children: [/*#__PURE__*/_jsx(Card, {
|
|
242
|
-
size: "small"
|
|
243
|
-
|
|
244
|
+
children: [/*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({
|
|
245
|
+
size: "small"
|
|
246
|
+
}, cardProps === null || cardProps === void 0 ? void 0 : cardProps.form), {}, {
|
|
247
|
+
style: _objectSpread({
|
|
244
248
|
display: filterFormProps !== null && filterFormProps !== void 0 && filterFormProps.hidden ? 'none' : undefined
|
|
245
|
-
},
|
|
246
|
-
styles: {
|
|
247
|
-
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({
|
|
248
252
|
padding: 10
|
|
249
|
-
}
|
|
250
|
-
},
|
|
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
|
+
}),
|
|
251
255
|
children: /*#__PURE__*/_jsx(FilterForm, _objectSpread(_objectSpread({}, filterFormProps), {}, {
|
|
252
256
|
loading: state.loading,
|
|
253
257
|
form: form,
|
|
@@ -271,22 +275,23 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
}))
|
|
274
|
-
}), listTableProps ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(ToolbarBox, {
|
|
278
|
+
})), listTableProps ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(ToolbarBox, {
|
|
275
279
|
className: "pro-rex-toolbar-box",
|
|
276
280
|
style: {
|
|
277
281
|
marginBottom: 0
|
|
278
282
|
},
|
|
279
283
|
children: batchActionNodeFn()
|
|
280
|
-
}), /*#__PURE__*/_jsxs(Card, {
|
|
284
|
+
}), /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({
|
|
281
285
|
size: "small",
|
|
282
|
-
rootClassName: "pro-rex-table-card"
|
|
283
|
-
|
|
284
|
-
|
|
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({
|
|
285
290
|
display: 'flex',
|
|
286
291
|
flexDirection: 'column',
|
|
287
292
|
padding: 10
|
|
288
|
-
}
|
|
289
|
-
},
|
|
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
|
+
}),
|
|
290
295
|
children: [listTableProps ? /*#__PURE__*/_jsx(BaseListTable, _objectSpread(_objectSpread({
|
|
291
296
|
dataSource: state.dataSource
|
|
292
297
|
}, listTableProps), {}, {
|
|
@@ -328,6 +333,7 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
328
333
|
action.getList(1);
|
|
329
334
|
}
|
|
330
335
|
})), (_state$dataSource = state.dataSource) !== null && _state$dataSource !== void 0 && _state$dataSource.length && !hidePagination ? /*#__PURE__*/_jsx(Pagination, {
|
|
336
|
+
pageSizeOptions: pageSizeOptions,
|
|
331
337
|
style: {
|
|
332
338
|
marginTop: 10
|
|
333
339
|
},
|
|
@@ -354,7 +360,7 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
354
360
|
change();
|
|
355
361
|
}
|
|
356
362
|
}) : /*#__PURE__*/_jsx(_Fragment, {})]
|
|
357
|
-
})]
|
|
363
|
+
}))]
|
|
358
364
|
});
|
|
359
365
|
};
|
|
360
366
|
export var RexProTable = function RexProTable(props) {
|
|
@@ -418,8 +424,8 @@ export var RexProTable = function RexProTable(props) {
|
|
|
418
424
|
});
|
|
419
425
|
}
|
|
420
426
|
return /*#__PURE__*/_jsx(InlineRexProTable, _objectSpread(_objectSpread({}, props), {}, {
|
|
421
|
-
tableProps: _objectSpread(_objectSpread({}, props.tableProps),
|
|
422
|
-
onDataCellClickV2
|
|
427
|
+
tableProps: _objectSpread(_objectSpread({}, props.tableProps), function (_props$tableProps2, _props$tableProps3, _props$tableProps4) {
|
|
428
|
+
var onDataCellClickV2 = function onDataCellClickV2(topConfig) {
|
|
423
429
|
var _props$tableProps, _props$tableProps$onD;
|
|
424
430
|
// 主要兼容 来自低代码的数据源
|
|
425
431
|
var item = topConfig.item,
|
|
@@ -453,8 +459,21 @@ export var RexProTable = function RexProTable(props) {
|
|
|
453
459
|
}
|
|
454
460
|
}
|
|
455
461
|
(_props$tableProps = props.tableProps) === null || _props$tableProps === void 0 || (_props$tableProps$onD = _props$tableProps.onDataCellClickV2) === null || _props$tableProps$onD === void 0 || _props$tableProps$onD.call(_props$tableProps, topConfig);
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// 优先级处理,如果没有任何点击事件才使用新的 onDataCellClickV2, 作为兼容处理低代码的情况
|
|
465
|
+
if (!((_props$tableProps2 = props.tableProps) !== null && _props$tableProps2 !== void 0 && _props$tableProps2.onDataCellClickV2) && !((_props$tableProps3 = props.tableProps) !== null && _props$tableProps3 !== void 0 && _props$tableProps3.onDataCellClick)) {
|
|
466
|
+
return {
|
|
467
|
+
onDataCellClickV2: onDataCellClickV2
|
|
468
|
+
};
|
|
456
469
|
}
|
|
457
|
-
|
|
470
|
+
if ((_props$tableProps4 = props.tableProps) !== null && _props$tableProps4 !== void 0 && _props$tableProps4.onDataCellClickV2) {
|
|
471
|
+
return {
|
|
472
|
+
onDataCellClickV2: onDataCellClickV2
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
return {};
|
|
476
|
+
}()),
|
|
458
477
|
reload: reload
|
|
459
478
|
}));
|
|
460
479
|
};
|
|
@@ -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.3",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"deploy": "changeset && changeset version && npm publish && npm run docs:deploy",
|
|
16
16
|
"dev": "dumi dev",
|
|
17
17
|
"docs:build": "dumi build",
|
|
18
|
-
"docs:deploy": "vercel
|
|
18
|
+
"docs:deploy": "npm run docs:deploy:wrangler && npm run docs:deploy:vercel",
|
|
19
|
+
"docs:deploy:vercel": "vercel --prod",
|
|
20
|
+
"docs:deploy:wrangler": "cross-env DOCS_DEPLOY=wrangler CLOUDFLARE_ACCOUNT_ID=0ea1eadbf2a2483b37c6044cc0dcb010 dumi build && wrangler pages deploy docs-dist --project-name=rex-pro",
|
|
19
21
|
"docs:preview": "dumi preview",
|
|
20
22
|
"doctor": "father doctor",
|
|
21
23
|
"lint": "npm run lint:es",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"dependencies": {
|
|
52
54
|
"@ant-design/icons": "^6.1.0",
|
|
53
55
|
"@ant-design/pro-components": "^2.8.10",
|
|
54
|
-
"@teamias/rex-design": "^0.1.
|
|
56
|
+
"@teamias/rex-design": "^0.1.12",
|
|
55
57
|
"ahooks": "^3.9.6",
|
|
56
58
|
"antd": "^5.26.7",
|
|
57
59
|
"classnames": "^2.5.1",
|
|
@@ -73,6 +75,7 @@
|
|
|
73
75
|
"@types/react": "^18.3.27",
|
|
74
76
|
"@types/react-dom": "^18.3.7",
|
|
75
77
|
"@umijs/lint": "^4.0.0",
|
|
78
|
+
"cross-env": "^10.1.0",
|
|
76
79
|
"dumi": "^2.4.13",
|
|
77
80
|
"eslint": "^8.57.1",
|
|
78
81
|
"father": "^4.1.0",
|
|
@@ -81,7 +84,8 @@
|
|
|
81
84
|
"prettier": "^3.7.4",
|
|
82
85
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
83
86
|
"prettier-plugin-packagejson": "^2.5.20",
|
|
84
|
-
"stylelint": "^14.9.1"
|
|
87
|
+
"stylelint": "^14.9.1",
|
|
88
|
+
"wrangler": "^4.58.0"
|
|
85
89
|
},
|
|
86
90
|
"peerDependencies": {
|
|
87
91
|
"@ant-design/icons": ">=5.0.0",
|