@teamias/rex-pro 0.0.11 → 0.0.12
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/components/card-basic-info/v1/card-basic-info.d.ts +7 -3
- package/dist/components/card-basic-info/v1/card-basic-info.js +42 -21
- package/dist/components/card-basic-info/v1/demo/BaseDescriptions.d.ts +2 -0
- package/dist/components/card-basic-info/v1/demo/BaseDescriptions.js +126 -0
- package/dist/components/filter-form/v1/filter-form.js +49 -49
- package/dist/locales/en-US.json +0 -0
- package/dist/locales/zh-CN.json +0 -0
- package/dist/types/svg.d.ts +0 -0
- package/package.json +4 -3
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DataCell, type IBaseTableProps } from '@teamias/rex-design';
|
|
1
|
+
import { BaseDescriptions, DataCell, type IBaseTableProps } from '@teamias/rex-design';
|
|
2
2
|
import { CardProps, GetProps } from 'antd';
|
|
3
3
|
export interface CardBasicInfoProps<T extends object = object> extends Omit<CardProps, 'type'> {
|
|
4
4
|
/**
|
|
5
5
|
* 卡片类型
|
|
6
6
|
* @default info
|
|
7
7
|
*/
|
|
8
|
-
type?: 'info' | 'table';
|
|
8
|
+
type?: 'info' | 'table' | 'descriptions';
|
|
9
9
|
/**
|
|
10
10
|
* 数据源
|
|
11
11
|
*/
|
|
@@ -19,6 +19,10 @@ export interface CardBasicInfoProps<T extends object = object> extends Omit<Card
|
|
|
19
19
|
* type=table时生效
|
|
20
20
|
*/
|
|
21
21
|
tableProps?: IBaseTableProps<T>;
|
|
22
|
+
/** type=descriptions时生效 */
|
|
23
|
+
descriptionsProps?: GetProps<typeof BaseDescriptions>;
|
|
24
|
+
/** 隐藏卡片样式 */
|
|
25
|
+
hideCardStyle?: boolean;
|
|
22
26
|
onDataCellClick?: GetProps<typeof DataCell>['onClick'];
|
|
23
27
|
}
|
|
24
|
-
export declare function CardBasicInfo<T extends object = object>({ dataSource, col, type, tableProps, rootClassName, onDataCellClick, ...cardProps }: CardBasicInfoProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function CardBasicInfo<T extends object = object>({ dataSource, col, type, tableProps, rootClassName, hideCardStyle, descriptionsProps, onDataCellClick, ...cardProps }: CardBasicInfoProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["dataSource", "col", "type", "tableProps", "rootClassName", "onDataCellClick"];
|
|
2
|
+
var _excluded = ["dataSource", "col", "type", "tableProps", "rootClassName", "hideCardStyle", "descriptionsProps", "onDataCellClick"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -7,11 +7,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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
|
-
import { BaseTable, DataCell } from '@teamias/rex-design';
|
|
10
|
+
import { BaseDescriptions, BaseTable, DataCell } from '@teamias/rex-design';
|
|
11
11
|
import { Col, Row } from 'antd';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import { useMemo } from 'react';
|
|
14
14
|
import { Card } from "./style";
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
/**
|
|
17
18
|
* 平分列数
|
|
@@ -35,28 +36,48 @@ export function CardBasicInfo(_ref) {
|
|
|
35
36
|
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
36
37
|
tableProps = _ref.tableProps,
|
|
37
38
|
rootClassName = _ref.rootClassName,
|
|
39
|
+
hideCardStyle = _ref.hideCardStyle,
|
|
40
|
+
descriptionsProps = _ref.descriptionsProps,
|
|
38
41
|
onDataCellClick = _ref.onDataCellClick,
|
|
39
42
|
cardProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
43
|
var span = useSpan(dataSource.length, col);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
var renderNode = function renderNode(node) {
|
|
45
|
+
if (hideCardStyle) return /*#__PURE__*/_jsx(_Fragment, {
|
|
46
|
+
children: node
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, cardProps), {}, {
|
|
49
|
+
rootClassName: classNames('card-basic-info', rootClassName),
|
|
50
|
+
children: node
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
return renderNode( /*#__PURE__*/_jsx(_Fragment, {
|
|
54
|
+
children: function () {
|
|
55
|
+
if (type === 'table') {
|
|
56
|
+
return /*#__PURE__*/_jsx(BaseTable, _objectSpread({}, tableProps));
|
|
57
|
+
}
|
|
58
|
+
if (type === 'descriptions') {
|
|
59
|
+
return /*#__PURE__*/_jsx(BaseDescriptions, _objectSpread({
|
|
60
|
+
column: col
|
|
61
|
+
}, descriptionsProps));
|
|
62
|
+
}
|
|
63
|
+
return /*#__PURE__*/_jsx(Row, {
|
|
64
|
+
gutter: [20, 20],
|
|
65
|
+
children: dataSource.map(function (item, index) {
|
|
66
|
+
return /*#__PURE__*/_jsx(Col, {
|
|
67
|
+
span: span,
|
|
68
|
+
children: /*#__PURE__*/_jsx(Row, {
|
|
69
|
+
align: "middle",
|
|
70
|
+
style: {
|
|
71
|
+
gap: 10
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
74
|
+
items: item,
|
|
75
|
+
onClick: onDataCellClick
|
|
76
|
+
})
|
|
56
77
|
})
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
}
|
|
78
|
+
}, index);
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}()
|
|
61
82
|
}));
|
|
62
83
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { CardBasicInfo } from "../card-basic-info";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/_jsx(CardBasicInfo, {
|
|
5
|
+
type: "descriptions",
|
|
6
|
+
title: "\u6D4B\u8BD5\u63CF\u8FF0\u7C7B\u578B",
|
|
7
|
+
hideCardStyle: false,
|
|
8
|
+
descriptionsProps: {
|
|
9
|
+
items: [{
|
|
10
|
+
label: 'Address',
|
|
11
|
+
span: 2,
|
|
12
|
+
children: [[{
|
|
13
|
+
type: 'group-v2',
|
|
14
|
+
props: {
|
|
15
|
+
label: 'label',
|
|
16
|
+
// labelStyle: {},
|
|
17
|
+
// itemsGap: 2,
|
|
18
|
+
// itemsStyle: {},
|
|
19
|
+
// itemsSeparator: '/',
|
|
20
|
+
// itemsDirection: 'row',
|
|
21
|
+
items: [{
|
|
22
|
+
type: 'text',
|
|
23
|
+
value: 'qweqweqweqwe',
|
|
24
|
+
action: 'url',
|
|
25
|
+
url: 'http://baidu.com'
|
|
26
|
+
}, {
|
|
27
|
+
type: 'icon',
|
|
28
|
+
iconsType: 'iconify',
|
|
29
|
+
name: 'svg-spinners:ring-resize',
|
|
30
|
+
size: 12,
|
|
31
|
+
action: 'url',
|
|
32
|
+
url: 'http://baidu.com'
|
|
33
|
+
}, {
|
|
34
|
+
type: 'text',
|
|
35
|
+
value: 'qweqweqweqwe',
|
|
36
|
+
copyable: true,
|
|
37
|
+
tooltip: true,
|
|
38
|
+
style: {
|
|
39
|
+
color: 'red'
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
type: 'tag',
|
|
43
|
+
value: '33123',
|
|
44
|
+
color: 'red'
|
|
45
|
+
}, {
|
|
46
|
+
type: 'img',
|
|
47
|
+
src: 'http://qweqe'
|
|
48
|
+
}]
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
type: 'group-v2',
|
|
52
|
+
props: {
|
|
53
|
+
items: [{
|
|
54
|
+
type: 'img',
|
|
55
|
+
src: 'http://qweqe'
|
|
56
|
+
}, {
|
|
57
|
+
type: 'group-v2',
|
|
58
|
+
props: {
|
|
59
|
+
itemsDirection: 'column',
|
|
60
|
+
items: [{
|
|
61
|
+
type: 'text',
|
|
62
|
+
value: 'qweqweqweqwe',
|
|
63
|
+
action: 'url',
|
|
64
|
+
url: 'http://baidu.com',
|
|
65
|
+
ellipsis: 1,
|
|
66
|
+
copyable: true
|
|
67
|
+
}, {
|
|
68
|
+
type: 'text',
|
|
69
|
+
value: 'qweqweqweqwe2',
|
|
70
|
+
ellipsis: 1,
|
|
71
|
+
copyable: '自定义复制'
|
|
72
|
+
}, {
|
|
73
|
+
type: 'text',
|
|
74
|
+
value: 'qweqweqweqwe3',
|
|
75
|
+
tooltip: '自定义提示'
|
|
76
|
+
}]
|
|
77
|
+
}
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
type: 'group-v2',
|
|
82
|
+
props: {
|
|
83
|
+
items: [{
|
|
84
|
+
type: 'img',
|
|
85
|
+
src: 'http://qweqe'
|
|
86
|
+
}, {
|
|
87
|
+
type: 'group-v2',
|
|
88
|
+
props: {
|
|
89
|
+
itemsDirection: 'column',
|
|
90
|
+
items: [{
|
|
91
|
+
type: 'group-v2',
|
|
92
|
+
props: {
|
|
93
|
+
itemsDirection: 'column',
|
|
94
|
+
label: 'label',
|
|
95
|
+
items: [{
|
|
96
|
+
type: 'text',
|
|
97
|
+
value: 'qweqweqweqwe'
|
|
98
|
+
}]
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
type: 'group-v2',
|
|
102
|
+
props: {
|
|
103
|
+
itemsDirection: 'column',
|
|
104
|
+
label: 'label',
|
|
105
|
+
items: [{
|
|
106
|
+
type: 'text',
|
|
107
|
+
value: 'qweqweqweqwe2',
|
|
108
|
+
action: 'custom'
|
|
109
|
+
}]
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
}
|
|
113
|
+
}]
|
|
114
|
+
}
|
|
115
|
+
}]]
|
|
116
|
+
}, {
|
|
117
|
+
label: 'Remark',
|
|
118
|
+
children: 'empty'
|
|
119
|
+
}],
|
|
120
|
+
bordered: true,
|
|
121
|
+
onDataCellClick: function onDataCellClick(data) {
|
|
122
|
+
console.log(data);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -20,7 +20,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
20
|
/* eslint-disable no-param-reassign */
|
|
21
21
|
import { ProForm } from '@ant-design/pro-components';
|
|
22
22
|
import { BaseForm, getFieldsDefaultValues, useRequestFields, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
|
|
23
|
-
import { Button, Dropdown, Skeleton, Space
|
|
23
|
+
import { Button, Checkbox, Dropdown, Skeleton, Space } from 'antd';
|
|
24
24
|
import { cloneDeep } from 'lodash';
|
|
25
25
|
import { useEffect, useImperativeHandle, useRef } from 'react';
|
|
26
26
|
import { FilterFormAutoWidthStyle, FilterFormStyle } from "./style";
|
|
@@ -132,6 +132,54 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
132
132
|
});
|
|
133
133
|
return arr;
|
|
134
134
|
};
|
|
135
|
+
|
|
136
|
+
// 切换自定义字段的显示状态
|
|
137
|
+
var handleToggleCustomField = function handleToggleCustomField(fieldKey) {
|
|
138
|
+
var isSelected = state.selectedCustomFieldKeys.has(fieldKey);
|
|
139
|
+
if (isSelected) {
|
|
140
|
+
// 移除字段
|
|
141
|
+
state.selectedCustomFieldKeys.delete(fieldKey);
|
|
142
|
+
} else {
|
|
143
|
+
// 添加字段
|
|
144
|
+
state.selectedCustomFieldKeys.add(fieldKey);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 创建新的 Set 以触发状态更新
|
|
148
|
+
state.selectedCustomFieldKeys = new Set(state.selectedCustomFieldKeys);
|
|
149
|
+
update();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// 创建下拉菜单内容
|
|
153
|
+
var getDropdownMenu = function getDropdownMenu() {
|
|
154
|
+
// 筛选出所有自定义字段
|
|
155
|
+
var customFields = state.allFields.filter(function (field) {
|
|
156
|
+
return field.isCustom;
|
|
157
|
+
});
|
|
158
|
+
var items = customFields.map(function (field) {
|
|
159
|
+
var isSelected = state.selectedCustomFieldKeys.has(field.field);
|
|
160
|
+
return {
|
|
161
|
+
key: field.field,
|
|
162
|
+
label: /*#__PURE__*/_jsx("div", {
|
|
163
|
+
style: {
|
|
164
|
+
display: 'flex',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
minWidth: 200
|
|
167
|
+
},
|
|
168
|
+
onClick: function onClick(e) {
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
handleToggleCustomField(field.field);
|
|
171
|
+
},
|
|
172
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
173
|
+
checked: isSelected,
|
|
174
|
+
children: field.label
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
items: items
|
|
181
|
+
};
|
|
182
|
+
};
|
|
135
183
|
useEffect(function () {
|
|
136
184
|
if (loading) return;
|
|
137
185
|
var allFields = cloneDeep(fields);
|
|
@@ -177,54 +225,6 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
177
225
|
update();
|
|
178
226
|
}
|
|
179
227
|
}, [fields, state.selectedCustomFieldKeys]);
|
|
180
|
-
|
|
181
|
-
// 创建下拉菜单内容
|
|
182
|
-
var getDropdownMenu = function getDropdownMenu() {
|
|
183
|
-
// 筛选出所有自定义字段
|
|
184
|
-
var customFields = state.allFields.filter(function (field) {
|
|
185
|
-
return field.isCustom;
|
|
186
|
-
});
|
|
187
|
-
var items = customFields.map(function (field) {
|
|
188
|
-
var isSelected = state.selectedCustomFieldKeys.has(field.field);
|
|
189
|
-
return {
|
|
190
|
-
key: field.field,
|
|
191
|
-
label: /*#__PURE__*/_jsx("div", {
|
|
192
|
-
style: {
|
|
193
|
-
display: 'flex',
|
|
194
|
-
alignItems: 'center',
|
|
195
|
-
minWidth: 200
|
|
196
|
-
},
|
|
197
|
-
onClick: function onClick(e) {
|
|
198
|
-
e.stopPropagation();
|
|
199
|
-
handleToggleCustomField(field.field);
|
|
200
|
-
},
|
|
201
|
-
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
202
|
-
checked: isSelected,
|
|
203
|
-
children: field.label
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
};
|
|
207
|
-
});
|
|
208
|
-
return {
|
|
209
|
-
items: items
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// 切换自定义字段的显示状态
|
|
214
|
-
var handleToggleCustomField = function handleToggleCustomField(fieldKey) {
|
|
215
|
-
var isSelected = state.selectedCustomFieldKeys.has(fieldKey);
|
|
216
|
-
if (isSelected) {
|
|
217
|
-
// 移除字段
|
|
218
|
-
state.selectedCustomFieldKeys.delete(fieldKey);
|
|
219
|
-
} else {
|
|
220
|
-
// 添加字段
|
|
221
|
-
state.selectedCustomFieldKeys.add(fieldKey);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// 创建新的 Set 以触发状态更新
|
|
225
|
-
state.selectedCustomFieldKeys = new Set(state.selectedCustomFieldKeys);
|
|
226
|
-
update();
|
|
227
|
-
};
|
|
228
228
|
useImperativeHandle(actionRef, function () {
|
|
229
229
|
return {
|
|
230
230
|
getAllValues: function getAllValues() {
|
package/dist/locales/en-US.json
CHANGED
|
File without changes
|
package/dist/locales/zh-CN.json
CHANGED
|
File without changes
|
package/dist/types/svg.d.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-pro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
24
24
|
"prepare": "husky install && dumi setup",
|
|
25
25
|
"prepublishOnly": "father doctor && npm run build",
|
|
26
|
-
"start": "npm run dev"
|
|
26
|
+
"start": "npm run dev",
|
|
27
|
+
"update:lib": "pnpm add @teamias/rex-design@latest"
|
|
27
28
|
},
|
|
28
29
|
"commitlint": {
|
|
29
30
|
"extends": [
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@ant-design/icons": "^6.0.0",
|
|
52
53
|
"@ant-design/pro-components": "^2.8.10",
|
|
53
|
-
"@teamias/rex-design": "^0.0.
|
|
54
|
+
"@teamias/rex-design": "^0.0.20",
|
|
54
55
|
"ahooks": "^3.9.0",
|
|
55
56
|
"antd": "^5.26.7",
|
|
56
57
|
"classnames": "^2.5.1",
|