@teamias/rex-design 0.0.19 → 0.0.20

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.
@@ -0,0 +1,28 @@
1
+ import { Descriptions, GetProps } from 'antd';
2
+ import { FC } from 'react';
3
+ import { DataCell } from '../data-cell';
4
+ export declare const BaseDescriptions: FC<IBaseDescriptionsProps>;
5
+ type TDataCellItem = GetProps<typeof DataCell>['items'][number];
6
+ /** 允许自定义参数 */
7
+ type TDataCellItemExtend = TDataCellItem & Record<string, any>;
8
+ export interface IBaseDescriptionsProps extends Omit<GetProps<typeof Descriptions>, 'items'> {
9
+ /** 主要渲染数据 */
10
+ items?: Array<{
11
+ label: React.ReactNode;
12
+ span?: number;
13
+ children?: React.ReactNode | Array<TDataCellItemExtend[]>;
14
+ }>;
15
+ /**
16
+ * - 使用 DataCell 组件渲染单元格, 需要注意数据结构
17
+ * - 默认 true
18
+ */
19
+ useDataCellRender?: boolean;
20
+ /** dataCell 的点击事件 */
21
+ onDataCellClick?: (data: {
22
+ item: TDataCellItemExtend[];
23
+ cellItem: TDataCellItemExtend;
24
+ subItem: TDataCellItemExtend[number];
25
+ index: number;
26
+ }) => void;
27
+ }
28
+ export {};
@@ -0,0 +1,58 @@
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 = ["items", "useDataCellRender", "onDataCellClick"];
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
+ 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
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ 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
+ 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 { Descriptions } from 'antd';
11
+ import { DataCell } from "../data-cell";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export var BaseDescriptions = function BaseDescriptions(_ref) {
14
+ var items = _ref.items,
15
+ _ref$useDataCellRende = _ref.useDataCellRender,
16
+ useDataCellRender = _ref$useDataCellRende === void 0 ? true : _ref$useDataCellRende,
17
+ onDataCellClick = _ref.onDataCellClick,
18
+ otherProps = _objectWithoutProperties(_ref, _excluded);
19
+ return /*#__PURE__*/_jsx(Descriptions, _objectSpread(_objectSpread({
20
+ size: "small"
21
+ }, otherProps), {}, {
22
+ items: items === null || items === void 0 ? void 0 : items.map(function (item, index) {
23
+ try {
24
+ var children = useDataCellRender ? item.children.map(function (topItem, topIndex) {
25
+ return /*#__PURE__*/_jsx(DataCell, {
26
+ items: topItem,
27
+ onClick: function onClick(cellItem, subItem) {
28
+ // console.log(cellItem, subItem);
29
+ onDataCellClick === null || onDataCellClick === void 0 || onDataCellClick({
30
+ item: topItem,
31
+ cellItem: cellItem,
32
+ subItem: subItem,
33
+ index: index
34
+ });
35
+ }
36
+ }, topIndex);
37
+ }) : item.children || '';
38
+ return _objectSpread(_objectSpread({}, item), {}, {
39
+ key: "".concat(index),
40
+ children: children
41
+ });
42
+ } catch (error) {
43
+ console.error('BaseDescriptions Error:', error, item, index);
44
+ return _objectSpread(_objectSpread({}, item), {}, {
45
+ key: "".concat(index),
46
+ children: /*#__PURE__*/_jsx("div", {
47
+ style: {
48
+ color: 'red'
49
+ },
50
+ children: "\u6570\u636E\u51FA\u73B0\u95EE\u9898,\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA"
51
+ })
52
+ });
53
+ }
54
+ })
55
+ }));
56
+ };
57
+
58
+ /** 允许自定义参数 */
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { BaseDescriptions } from "../base-descriptions";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default (function () {
4
+ return /*#__PURE__*/_jsx(BaseDescriptions, {
5
+ bordered: true,
6
+ useDataCellRender: false,
7
+ items: [{
8
+ label: 'UserName',
9
+ children: 'Zhou Maomao'
10
+ }, {
11
+ label: 'Telephone',
12
+ children: '1810000000'
13
+ }, {
14
+ label: 'Live',
15
+ children: 'Hangzhou, Zhejiang'
16
+ }, {
17
+ label: 'Address',
18
+ span: 2,
19
+ children: 'No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China'
20
+ }, {
21
+ label: 'Remark',
22
+ children: 'empty'
23
+ }]
24
+ });
25
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,121 @@
1
+ import { BaseDescriptions } from "../base-descriptions";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default (function () {
4
+ return /*#__PURE__*/_jsx(BaseDescriptions, {
5
+ bordered: true,
6
+ items: [{
7
+ label: 'Address',
8
+ span: 2,
9
+ children: [[{
10
+ type: 'group-v2',
11
+ props: {
12
+ label: 'label',
13
+ // labelStyle: {},
14
+ // itemsGap: 2,
15
+ // itemsStyle: {},
16
+ // itemsSeparator: '/',
17
+ // itemsDirection: 'row',
18
+ items: [{
19
+ type: 'text',
20
+ value: 'qweqweqweqwe',
21
+ action: 'url',
22
+ url: 'http://baidu.com'
23
+ }, {
24
+ type: 'icon',
25
+ iconsType: 'iconify',
26
+ name: 'svg-spinners:ring-resize',
27
+ size: 12,
28
+ action: 'url',
29
+ url: 'http://baidu.com'
30
+ }, {
31
+ type: 'text',
32
+ value: 'qweqweqweqwe',
33
+ copyable: true,
34
+ tooltip: true,
35
+ style: {
36
+ color: 'red'
37
+ }
38
+ }, {
39
+ type: 'tag',
40
+ value: '33123',
41
+ color: 'red'
42
+ }, {
43
+ type: 'img',
44
+ src: 'http://qweqe'
45
+ }]
46
+ }
47
+ }, {
48
+ type: 'group-v2',
49
+ props: {
50
+ items: [{
51
+ type: 'img',
52
+ src: 'http://qweqe'
53
+ }, {
54
+ type: 'group-v2',
55
+ props: {
56
+ itemsDirection: 'column',
57
+ items: [{
58
+ type: 'text',
59
+ value: 'qweqweqweqwe',
60
+ action: 'url',
61
+ url: 'http://baidu.com',
62
+ ellipsis: 1,
63
+ copyable: true
64
+ }, {
65
+ type: 'text',
66
+ value: 'qweqweqweqwe2',
67
+ ellipsis: 1,
68
+ copyable: '自定义复制'
69
+ }, {
70
+ type: 'text',
71
+ value: 'qweqweqweqwe3',
72
+ tooltip: '自定义提示'
73
+ }]
74
+ }
75
+ }]
76
+ }
77
+ }, {
78
+ type: 'group-v2',
79
+ props: {
80
+ items: [{
81
+ type: 'img',
82
+ src: 'http://qweqe'
83
+ }, {
84
+ type: 'group-v2',
85
+ props: {
86
+ itemsDirection: 'column',
87
+ items: [{
88
+ type: 'group-v2',
89
+ props: {
90
+ itemsDirection: 'column',
91
+ label: 'label',
92
+ items: [{
93
+ type: 'text',
94
+ value: 'qweqweqweqwe'
95
+ }]
96
+ }
97
+ }, {
98
+ type: 'group-v2',
99
+ props: {
100
+ itemsDirection: 'column',
101
+ label: 'label',
102
+ items: [{
103
+ type: 'text',
104
+ value: 'qweqweqweqwe2',
105
+ action: 'custom'
106
+ }]
107
+ }
108
+ }]
109
+ }
110
+ }]
111
+ }
112
+ }]]
113
+ }, {
114
+ label: 'Remark',
115
+ children: 'empty'
116
+ }],
117
+ onDataCellClick: function onDataCellClick(data) {
118
+ console.log(data);
119
+ }
120
+ });
121
+ });
@@ -0,0 +1 @@
1
+ export * from './base-descriptions';
@@ -0,0 +1 @@
1
+ export * from "./base-descriptions";
@@ -1,4 +1,5 @@
1
1
  export * from './action-buttons';
2
+ export * from './base-descriptions';
2
3
  export * from './base-form';
3
4
  export * from './base-list-table';
4
5
  export * from './base-table';
@@ -1,4 +1,5 @@
1
1
  export * from "./action-buttons";
2
+ export * from "./base-descriptions";
2
3
  export * from "./base-form";
3
4
  export * from "./base-list-table";
4
5
  export * from "./base-table";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/rex-design",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",