@hw-component/table 1.9.68 → 1.9.70

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/es/modal.d.ts CHANGED
@@ -126,7 +126,7 @@ export interface DwTableProps extends DrawerProps {
126
126
  request?: HTableProps["request"];
127
127
  contentRender?: (node: React.ReactNode) => React.ReactNode;
128
128
  }
129
- export interface ModalTableProps extends ModalProps {
129
+ export interface ModalTableProps extends Omit<ModalProps, "onOk"> {
130
130
  tableProps?: Omit<HTableProps, "configData" | "request">;
131
131
  dialogTable?: HDiaLogTableInstance;
132
132
  params?: Record<string, any>;
@@ -134,6 +134,7 @@ export interface ModalTableProps extends ModalProps {
134
134
  request?: HTableProps["request"];
135
135
  contentRender?: (node: React.ReactNode) => React.ReactNode;
136
136
  dataSource?: any[];
137
+ onOk?: (e?: React.MouseEvent<HTMLElement>) => void;
137
138
  }
138
139
  export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
139
140
  export type ValueTypeConfigModal = Record<string, ValueTypeConfigRenderFn>;
@@ -16,6 +16,7 @@ interface IProps {
16
16
  tableInstance?: HTableInstance;
17
17
  maxLen?: number | null;
18
18
  popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
19
+ contentItemRender?: (item: any) => React.ReactNode;
19
20
  }
20
21
  declare const TagsComponent: (props: IProps) => JSX.Element;
21
22
  export default TagsComponent;
@@ -17,6 +17,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
17
17
  import { Row, Tooltip, Tag, Popover } from 'antd';
18
18
  import { useMemo } from 'react';
19
19
 
20
+ var _excluded = ["contentItemRender"];
20
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
21
22
  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); }
22
23
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -68,6 +69,8 @@ var TagsComponent = function TagsComponent(props) {
68
69
  tagData = _useMemo.tagData,
69
70
  moreTag = _useMemo.moreTag;
70
71
  var moreLen = moreTag === null || moreTag === void 0 ? void 0 : moreTag.length;
72
+ var contentItemRender = props.contentItemRender,
73
+ childProps = _objectWithoutProperties(props, _excluded);
71
74
  return jsxs(Row, {
72
75
  gutter: [0, 8],
73
76
  children: [tagData === null || tagData === void 0 ? void 0 : _mapInstanceProperty(tagData).call(tagData, function (tagItem, index) {
@@ -87,7 +90,7 @@ var TagsComponent = function TagsComponent(props) {
87
90
  e.preventDefault();
88
91
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
89
92
  },
90
- children: tagItem
93
+ children: contentItemRender ? contentItemRender(tagItem) : tagItem
91
94
  }), indexKey)
92
95
  }));
93
96
  }
@@ -103,13 +106,13 @@ var TagsComponent = function TagsComponent(props) {
103
106
  e.preventDefault();
104
107
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
105
108
  },
106
- children: tagLabel
109
+ children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
107
110
  }), cuKey)
108
111
  }));
109
112
  }), !moreLen ? null : jsx(Popover, {
110
- content: popoverContentRender ? popoverContentRender(jsx(TagsComponent, _objectSpread(_objectSpread({}, props), {}, {
113
+ content: popoverContentRender ? popoverContentRender(jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
111
114
  maxLen: null
112
- }))) : jsx(TagsComponent, _objectSpread(_objectSpread({}, props), {}, {
115
+ }))) : jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
113
116
  maxLen: null
114
117
  })),
115
118
  children: jsxs(Tag, {
package/lib/modal.d.ts CHANGED
@@ -126,7 +126,7 @@ export interface DwTableProps extends DrawerProps {
126
126
  request?: HTableProps["request"];
127
127
  contentRender?: (node: React.ReactNode) => React.ReactNode;
128
128
  }
129
- export interface ModalTableProps extends ModalProps {
129
+ export interface ModalTableProps extends Omit<ModalProps, "onOk"> {
130
130
  tableProps?: Omit<HTableProps, "configData" | "request">;
131
131
  dialogTable?: HDiaLogTableInstance;
132
132
  params?: Record<string, any>;
@@ -134,6 +134,7 @@ export interface ModalTableProps extends ModalProps {
134
134
  request?: HTableProps["request"];
135
135
  contentRender?: (node: React.ReactNode) => React.ReactNode;
136
136
  dataSource?: any[];
137
+ onOk?: (e?: React.MouseEvent<HTMLElement>) => void;
137
138
  }
138
139
  export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
139
140
  export type ValueTypeConfigModal = Record<string, ValueTypeConfigRenderFn>;
@@ -16,6 +16,7 @@ interface IProps {
16
16
  tableInstance?: HTableInstance;
17
17
  maxLen?: number | null;
18
18
  popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
19
+ contentItemRender?: (item: any) => React.ReactNode;
19
20
  }
20
21
  declare const TagsComponent: (props: IProps) => JSX.Element;
21
22
  export default TagsComponent;
@@ -20,6 +20,7 @@ var jsxRuntime = require('react/jsx-runtime');
20
20
  var antd = require('antd');
21
21
  var React = require('react');
22
22
 
23
+ var _excluded = ["contentItemRender"];
23
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
24
25
  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); }
25
26
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -71,6 +72,8 @@ var TagsComponent = function TagsComponent(props) {
71
72
  tagData = _useMemo.tagData,
72
73
  moreTag = _useMemo.moreTag;
73
74
  var moreLen = moreTag === null || moreTag === void 0 ? void 0 : moreTag.length;
75
+ var contentItemRender = props.contentItemRender,
76
+ childProps = _objectWithoutProperties(props, _excluded);
74
77
  return jsxRuntime.jsxs(antd.Row, {
75
78
  gutter: [0, 8],
76
79
  children: [tagData === null || tagData === void 0 ? void 0 : _mapInstanceProperty(tagData).call(tagData, function (tagItem, index) {
@@ -90,7 +93,7 @@ var TagsComponent = function TagsComponent(props) {
90
93
  e.preventDefault();
91
94
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
92
95
  },
93
- children: tagItem
96
+ children: contentItemRender ? contentItemRender(tagItem) : tagItem
94
97
  }), indexKey)
95
98
  }));
96
99
  }
@@ -106,13 +109,13 @@ var TagsComponent = function TagsComponent(props) {
106
109
  e.preventDefault();
107
110
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
108
111
  },
109
- children: tagLabel
112
+ children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
110
113
  }), cuKey)
111
114
  }));
112
115
  }), !moreLen ? null : jsxRuntime.jsx(antd.Popover, {
113
- content: popoverContentRender ? popoverContentRender(jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, props), {}, {
116
+ content: popoverContentRender ? popoverContentRender(jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
114
117
  maxLen: null
115
- }))) : jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, props), {}, {
118
+ }))) : jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
116
119
  maxLen: null
117
120
  })),
118
121
  children: jsxRuntime.jsxs(antd.Tag, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.9.68",
3
+ "version": "1.9.70",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -159,7 +159,7 @@ export interface DwTableProps extends DrawerProps {
159
159
  contentRender?: (node: React.ReactNode) => React.ReactNode;
160
160
  }
161
161
 
162
- export interface ModalTableProps extends ModalProps {
162
+ export interface ModalTableProps extends Omit<ModalProps,"onOk"> {
163
163
  tableProps?: Omit<HTableProps, "configData" | "request">;
164
164
  dialogTable?: HDiaLogTableInstance;
165
165
  params?: Record<string, any>;
@@ -167,6 +167,7 @@ export interface ModalTableProps extends ModalProps {
167
167
  request?: HTableProps["request"];
168
168
  contentRender?: (node: React.ReactNode) => React.ReactNode;
169
169
  dataSource?: any[];
170
+ onOk?:(e?: React.MouseEvent<HTMLElement>)=>void;
170
171
  }
171
172
 
172
173
  export type ValueTypeConfigRenderFn = (
@@ -14,6 +14,7 @@ interface IProps {
14
14
  tableInstance?: HTableInstance;
15
15
  maxLen?: number | null;
16
16
  popoverContentRender?:(node:React.ReactNode)=>React.ReactNode;
17
+ contentItemRender?:(item:any)=>React.ReactNode;
17
18
  }
18
19
  const getTooltipProps = (
19
20
  title: string,
@@ -62,7 +63,7 @@ const TagsComponent = (props: IProps) => {
62
63
  };
63
64
  }, [data, maxLen]);
64
65
  const moreLen = moreTag?.length;
65
-
66
+ const {contentItemRender,...childProps}=props;
66
67
  return (
67
68
  <Row gutter={[0, 8]}>
68
69
  {tagData?.map((tagItem, index) => {
@@ -85,7 +86,7 @@ const TagsComponent = (props: IProps) => {
85
86
  onClose?.(indexKey, tableInstance);
86
87
  }}
87
88
  >
88
- {tagItem}
89
+ {contentItemRender?contentItemRender(tagItem):tagItem}
89
90
  </Tag>
90
91
  </Tooltip>
91
92
  );
@@ -107,13 +108,13 @@ const TagsComponent = (props: IProps) => {
107
108
  cuTagProps?.onClose(cuKey, tableInstance);
108
109
  }}
109
110
  >
110
- {tagLabel}
111
+ {contentItemRender?contentItemRender(tagLabel):tagLabel}
111
112
  </Tag>
112
113
  </Tooltip>
113
114
  );
114
115
  })}
115
116
  {!moreLen ? null : (
116
- <Popover content={popoverContentRender?popoverContentRender(<TagsComponent {...props} maxLen={null} />):<TagsComponent {...props} maxLen={null} />}>
117
+ <Popover content={popoverContentRender?popoverContentRender(<TagsComponent {...childProps} maxLen={null} />):<TagsComponent {...childProps} maxLen={null} />}>
117
118
  <Tag>...等{data.length}个</Tag>
118
119
  </Popover>
119
120
  )}