@teamias/rex-design 0.1.8 → 0.1.9
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/components/base-table/base-table.js +9 -8
- package/dist/components/base-table/components/BaseTableRow.js +20 -13
- package/dist/components/base-table/demo/BaseTableBasic.js +3 -0
- package/dist/components/base-table/demo/tableData.d.ts +8 -0
- package/dist/components/base-table/demo/tableData.js +8 -0
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
10
|
import { useRequestFields, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from "../..";
|
|
11
11
|
import { useDebounceEffect } from 'ahooks';
|
|
12
|
-
import { ConfigProvider, Empty, Skeleton, Table } from 'antd';
|
|
12
|
+
import { Alert, ConfigProvider, Empty, Skeleton, Table } from 'antd';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useMemo } from 'react';
|
|
15
15
|
import { dataToDataCellData } from "../data-cell";
|
|
@@ -145,8 +145,12 @@ export var BaseTable = function BaseTable(_ref) {
|
|
|
145
145
|
render: function render(value, record, index) {
|
|
146
146
|
if (item.render) return item.render(value, record, index);
|
|
147
147
|
if (!state.useDataCellRender) return _typeof(value) === 'object' && value !== null ? JSON.stringify(value) : value;
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
return Array.isArray(value) ? /*#__PURE__*/_jsx(Alert.ErrorBoundary, {
|
|
149
|
+
message: /*#__PURE__*/_jsxs(_Fragment, {
|
|
150
|
+
children: ["field: ", item.dataIndex]
|
|
151
|
+
}),
|
|
152
|
+
description: "DataCell render error",
|
|
153
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
150
154
|
items: value,
|
|
151
155
|
onClick: function onClick(cellItem, subItem) {
|
|
152
156
|
cellClick({
|
|
@@ -157,11 +161,8 @@ export var BaseTable = function BaseTable(_ref) {
|
|
|
157
161
|
subItem: subItem
|
|
158
162
|
});
|
|
159
163
|
}
|
|
160
|
-
})
|
|
161
|
-
}
|
|
162
|
-
console.error("DataCell render error key:".concat(item.dataIndex, "-value:").concat(value, "-index:").concat(index, "-error:").concat(error));
|
|
163
|
-
return JSON.stringify(value);
|
|
164
|
-
}
|
|
164
|
+
})
|
|
165
|
+
}) : JSON.stringify(value);
|
|
165
166
|
},
|
|
166
167
|
onCell: function onCell(rawRecord) {
|
|
167
168
|
var record = rawRecord;
|
|
@@ -8,6 +8,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
10
|
/* eslint-disable react/destructuring-assignment */
|
|
11
|
+
import { Alert } from 'antd';
|
|
11
12
|
import classNames from 'classnames';
|
|
12
13
|
import React from 'react';
|
|
13
14
|
import { DataCell } from "../../data-cell/data-cell";
|
|
@@ -17,9 +18,9 @@ import { TableParentRow, TableParentRowCell } from "../style";
|
|
|
17
18
|
* 判断是否为左侧固定列
|
|
18
19
|
* 兼容 antd 5.x (fixLeft) 和 antd 6.x (fixStart)
|
|
19
20
|
*/
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
var isFixedLeft = function isFixedLeft(props) {
|
|
24
25
|
return typeof (props === null || props === void 0 ? void 0 : props.fixLeft) === 'number' || typeof (props === null || props === void 0 ? void 0 : props.fixStart) === 'number';
|
|
25
26
|
};
|
|
@@ -88,18 +89,24 @@ export var BaseTableRow = function BaseTableRow(outProps) {
|
|
|
88
89
|
width: width
|
|
89
90
|
},
|
|
90
91
|
children: Object.keys(record).map(function (key) {
|
|
91
|
-
return Array.isArray(record[key]) ? /*#__PURE__*/_jsx(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
return Array.isArray(record[key]) ? /*#__PURE__*/_jsx(Alert.ErrorBoundary, {
|
|
93
|
+
message: /*#__PURE__*/_jsxs(_Fragment, {
|
|
94
|
+
children: ["field: ", key]
|
|
95
|
+
}),
|
|
96
|
+
description: "DataCell render error",
|
|
97
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
98
|
+
items: record[key],
|
|
99
|
+
onClick: function onClick(cellItem, subItem) {
|
|
100
|
+
// cellClick({dataIndex: 'parent'}, record, 0, cellItem, subItem);
|
|
101
|
+
cellClick({
|
|
102
|
+
dataIndex: 'parent',
|
|
103
|
+
record: record,
|
|
104
|
+
index: index,
|
|
105
|
+
cellItem: cellItem,
|
|
106
|
+
subItem: subItem
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, key)
|
|
103
110
|
}, key) : /*#__PURE__*/_jsx("span", {
|
|
104
111
|
style: {
|
|
105
112
|
display: 'none'
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export declare const tableData: {
|
|
2
2
|
items: ({
|
|
3
3
|
key: string;
|
|
4
|
+
qweqwe: {
|
|
5
|
+
type: string;
|
|
6
|
+
props: never[];
|
|
7
|
+
}[];
|
|
4
8
|
id: {
|
|
5
9
|
type: string;
|
|
6
10
|
props: {
|
|
@@ -79,6 +83,10 @@ export declare const tableData: {
|
|
|
79
83
|
key: string;
|
|
80
84
|
id: number;
|
|
81
85
|
detail_id: number;
|
|
86
|
+
qweqwe: {
|
|
87
|
+
type: string;
|
|
88
|
+
props: never[];
|
|
89
|
+
}[];
|
|
82
90
|
is_checkbox: number;
|
|
83
91
|
status_name: ({
|
|
84
92
|
type: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export var tableData = {
|
|
2
2
|
items: [{
|
|
3
3
|
key: 'parent_1075',
|
|
4
|
+
qweqwe: [{
|
|
5
|
+
type: 'group',
|
|
6
|
+
props: []
|
|
7
|
+
}],
|
|
4
8
|
id: [{
|
|
5
9
|
type: 'text',
|
|
6
10
|
props: {
|
|
@@ -51,6 +55,10 @@ export var tableData = {
|
|
|
51
55
|
key: '1075_1102',
|
|
52
56
|
id: 1075,
|
|
53
57
|
detail_id: 1102,
|
|
58
|
+
qweqwe: [{
|
|
59
|
+
type: 'group',
|
|
60
|
+
props: []
|
|
61
|
+
}],
|
|
54
62
|
is_checkbox: 2,
|
|
55
63
|
status_name: [{
|
|
56
64
|
type: 'text',
|