@hw-component/table 1.10.27 → 1.10.29

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { DwTableProps } from "../modal";
3
3
  import { ProColumns } from "@ant-design/pro-table/lib/typing";
4
- declare const _default: ({ configData: configDataProps, request: requestProps, editTableProps, editDialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, ...props }: DwTableProps<ProColumns[]>) => JSX.Element;
4
+ declare const _default: ({ configData: configDataProps, request: requestProps, editTableProps, editDialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, afterClose, ...props }: DwTableProps<ProColumns[]>) => JSX.Element;
5
5
  export default _default;
@@ -16,7 +16,7 @@ import { EditTableContent } from './Content.js';
16
16
  import { CloseOutlined } from '@ant-design/icons';
17
17
  import { useClassName } from '../hooks/index.js';
18
18
 
19
- var _excluded = ["configData", "request", "editTableProps", "editDialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width", "footer"];
19
+ var _excluded = ["configData", "request", "editTableProps", "editDialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width", "footer", "afterClose"];
20
20
  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; }
21
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
22
22
  var DwEditTable = (function (_ref) {
@@ -29,13 +29,14 @@ var DwEditTable = (function (_ref) {
29
29
  visible = _ref$visible === void 0 ? false : _ref$visible,
30
30
  _ref$bodyStyle = _ref.bodyStyle,
31
31
  bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
32
- _onClose = _ref.onClose,
33
- afterVisibleChange = _ref.afterVisibleChange,
34
- contentRender = _ref.contentRender,
32
+ _onClose = _ref.onClose;
33
+ _ref.afterVisibleChange;
34
+ var contentRender = _ref.contentRender,
35
35
  _ref$width = _ref.width,
36
36
  width = _ref$width === void 0 ? 888 : _ref$width,
37
37
  _ref$footer = _ref.footer,
38
38
  footer = _ref$footer === void 0 ? null : _ref$footer,
39
+ afterClose = _ref.afterClose,
39
40
  props = _objectWithoutProperties(_ref, _excluded);
40
41
  var _useVisible = useVisible(visible),
41
42
  modalVisible = _useVisible.modalVisible,
@@ -113,7 +114,11 @@ var DwEditTable = (function (_ref) {
113
114
  padding: 0,
114
115
  paddingBottom: 12
115
116
  }, bodyStyle),
116
- afterVisibleChange: afterVisibleChange,
117
+ afterVisibleChange: function afterVisibleChange(visible) {
118
+ if (!visible) {
119
+ afterClose === null || afterClose === void 0 || afterClose();
120
+ }
121
+ },
117
122
  children: jsx(EditTableContent, {
118
123
  contentRender: contentRender,
119
124
  editTableProps: editTableProps,
package/es/modal.d.ts CHANGED
@@ -139,6 +139,7 @@ export interface DwTableProps<T = HTableProps["configData"]> extends DrawerProps
139
139
  contentRender?: (node: React.ReactNode) => React.ReactNode;
140
140
  editTableProps?: Omit<HEditTableProps, "configData" | "request">;
141
141
  dataSource?: any[];
142
+ afterClose?: () => void;
142
143
  }
143
144
  export interface ModalTableProps<T = HTableProps["configData"]> extends Omit<ModalProps, "onOk"> {
144
145
  tableProps?: Omit<HTableProps, "configData" | "request">;
@@ -20,5 +20,6 @@ interface IProps {
20
20
  contentItemRender?: (item: any) => React.ReactNode;
21
21
  extra?: React.ReactNode;
22
22
  }
23
+ export declare const Text: React.FC;
23
24
  declare const TagsComponent: (props: IProps) => JSX.Element;
24
25
  export default TagsComponent;
@@ -14,7 +14,7 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
14
14
  import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
15
15
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
16
16
  import { jsxs, jsx } from 'react/jsx-runtime';
17
- import { Row, Tooltip, Tag, Popover } from 'antd';
17
+ import { Row, Tooltip, Tag, Popover, Typography } from 'antd';
18
18
  import { useMemo } from 'react';
19
19
 
20
20
  var _excluded = ["contentItemRender"];
@@ -41,6 +41,15 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
41
41
  title: title
42
42
  });
43
43
  };
44
+ var Text = function Text(_ref) {
45
+ var children = _ref.children;
46
+ return jsx(Typography.Text, {
47
+ ellipsis: {
48
+ tooltip: children
49
+ },
50
+ children: children
51
+ });
52
+ };
44
53
  var TagsComponent = function TagsComponent(props) {
45
54
  var data = props.data,
46
55
  closable = props.closable,
@@ -91,13 +100,20 @@ var TagsComponent = function TagsComponent(props) {
91
100
  var _tooltipProps = getTooltipProps({
92
101
  title: tagItem
93
102
  }, tooltip);
103
+ var _tagNode = jsx(Text, {
104
+ children: tagItem
105
+ });
94
106
  return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
95
- children: jsx(Tag, _objectSpread(_objectSpread({}, tagProps), {}, {
107
+ children: jsx(Tag, _objectSpread(_objectSpread({
108
+ style: {
109
+ maxWidth: "100%"
110
+ }
111
+ }, tagProps), {}, {
96
112
  onClose: function onClose(e) {
97
113
  e.preventDefault();
98
114
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
99
115
  },
100
- children: contentItemRender ? contentItemRender(tagItem) : tagItem
116
+ children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
101
117
  }), indexKey)
102
118
  }));
103
119
  }
@@ -110,13 +126,20 @@ var TagsComponent = function TagsComponent(props) {
110
126
  }, itemProps), tooltip);
111
127
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
112
128
  var cuKey = tagValue || indexKey;
129
+ var tagNode = jsx(Text, {
130
+ children: tagLabel
131
+ });
113
132
  return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
114
- children: jsx(Tag, _objectSpread(_objectSpread({}, cuTagProps), {}, {
133
+ children: jsx(Tag, _objectSpread(_objectSpread({
134
+ style: {
135
+ maxWidth: "100%"
136
+ }
137
+ }, cuTagProps), {}, {
115
138
  onClose: function onClose(e) {
116
139
  e.preventDefault();
117
140
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
118
141
  },
119
- children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
142
+ children: contentItemRender ? tagNode : tagNode
120
143
  }), cuKey)
121
144
  }));
122
145
  }), !moreLen ? null : jsx(Popover, {
@@ -134,5 +157,5 @@ var TagsComponent = function TagsComponent(props) {
134
157
  });
135
158
  };
136
159
 
137
- export { TagsComponent as default };
160
+ export { Text, TagsComponent as default };
138
161
  // powered by hdj
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { DwTableProps } from "../modal";
3
3
  import { ProColumns } from "@ant-design/pro-table/lib/typing";
4
- declare const _default: ({ configData: configDataProps, request: requestProps, editTableProps, editDialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, ...props }: DwTableProps<ProColumns[]>) => JSX.Element;
4
+ declare const _default: ({ configData: configDataProps, request: requestProps, editTableProps, editDialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, afterClose, ...props }: DwTableProps<ProColumns[]>) => JSX.Element;
5
5
  export default _default;
@@ -19,7 +19,7 @@ var Content = require('./Content.js');
19
19
  var icons = require('@ant-design/icons');
20
20
  var index = require('../hooks/index.js');
21
21
 
22
- var _excluded = ["configData", "request", "editTableProps", "editDialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width", "footer"];
22
+ var _excluded = ["configData", "request", "editTableProps", "editDialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width", "footer", "afterClose"];
23
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; }
24
24
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
25
25
  var DwEditTable = (function (_ref) {
@@ -32,13 +32,14 @@ var DwEditTable = (function (_ref) {
32
32
  visible = _ref$visible === void 0 ? false : _ref$visible,
33
33
  _ref$bodyStyle = _ref.bodyStyle,
34
34
  bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
35
- _onClose = _ref.onClose,
36
- afterVisibleChange = _ref.afterVisibleChange,
37
- contentRender = _ref.contentRender,
35
+ _onClose = _ref.onClose;
36
+ _ref.afterVisibleChange;
37
+ var contentRender = _ref.contentRender,
38
38
  _ref$width = _ref.width,
39
39
  width = _ref$width === void 0 ? 888 : _ref$width,
40
40
  _ref$footer = _ref.footer,
41
41
  footer = _ref$footer === void 0 ? null : _ref$footer,
42
+ afterClose = _ref.afterClose,
42
43
  props = _objectWithoutProperties(_ref, _excluded);
43
44
  var _useVisible = hooks.useVisible(visible),
44
45
  modalVisible = _useVisible.modalVisible,
@@ -116,7 +117,11 @@ var DwEditTable = (function (_ref) {
116
117
  padding: 0,
117
118
  paddingBottom: 12
118
119
  }, bodyStyle),
119
- afterVisibleChange: afterVisibleChange,
120
+ afterVisibleChange: function afterVisibleChange(visible) {
121
+ if (!visible) {
122
+ afterClose === null || afterClose === void 0 || afterClose();
123
+ }
124
+ },
120
125
  children: jsxRuntime.jsx(Content.EditTableContent, {
121
126
  contentRender: contentRender,
122
127
  editTableProps: editTableProps,
package/lib/modal.d.ts CHANGED
@@ -139,6 +139,7 @@ export interface DwTableProps<T = HTableProps["configData"]> extends DrawerProps
139
139
  contentRender?: (node: React.ReactNode) => React.ReactNode;
140
140
  editTableProps?: Omit<HEditTableProps, "configData" | "request">;
141
141
  dataSource?: any[];
142
+ afterClose?: () => void;
142
143
  }
143
144
  export interface ModalTableProps<T = HTableProps["configData"]> extends Omit<ModalProps, "onOk"> {
144
145
  tableProps?: Omit<HTableProps, "configData" | "request">;
@@ -20,5 +20,6 @@ interface IProps {
20
20
  contentItemRender?: (item: any) => React.ReactNode;
21
21
  extra?: React.ReactNode;
22
22
  }
23
+ export declare const Text: React.FC;
23
24
  declare const TagsComponent: (props: IProps) => JSX.Element;
24
25
  export default TagsComponent;
@@ -44,6 +44,15 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
44
44
  title: title
45
45
  });
46
46
  };
47
+ var Text = function Text(_ref) {
48
+ var children = _ref.children;
49
+ return jsxRuntime.jsx(antd.Typography.Text, {
50
+ ellipsis: {
51
+ tooltip: children
52
+ },
53
+ children: children
54
+ });
55
+ };
47
56
  var TagsComponent = function TagsComponent(props) {
48
57
  var data = props.data,
49
58
  closable = props.closable,
@@ -94,13 +103,20 @@ var TagsComponent = function TagsComponent(props) {
94
103
  var _tooltipProps = getTooltipProps({
95
104
  title: tagItem
96
105
  }, tooltip);
106
+ var _tagNode = jsxRuntime.jsx(Text, {
107
+ children: tagItem
108
+ });
97
109
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
98
- children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({}, tagProps), {}, {
110
+ children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
111
+ style: {
112
+ maxWidth: "100%"
113
+ }
114
+ }, tagProps), {}, {
99
115
  onClose: function onClose(e) {
100
116
  e.preventDefault();
101
117
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
102
118
  },
103
- children: contentItemRender ? contentItemRender(tagItem) : tagItem
119
+ children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
104
120
  }), indexKey)
105
121
  }));
106
122
  }
@@ -113,13 +129,20 @@ var TagsComponent = function TagsComponent(props) {
113
129
  }, itemProps), tooltip);
114
130
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
115
131
  var cuKey = tagValue || indexKey;
132
+ var tagNode = jsxRuntime.jsx(Text, {
133
+ children: tagLabel
134
+ });
116
135
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
117
- children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({}, cuTagProps), {}, {
136
+ children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
137
+ style: {
138
+ maxWidth: "100%"
139
+ }
140
+ }, cuTagProps), {}, {
118
141
  onClose: function onClose(e) {
119
142
  e.preventDefault();
120
143
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
121
144
  },
122
- children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
145
+ children: contentItemRender ? tagNode : tagNode
123
146
  }), cuKey)
124
147
  }));
125
148
  }), !moreLen ? null : jsxRuntime.jsx(antd.Popover, {
@@ -137,5 +160,6 @@ var TagsComponent = function TagsComponent(props) {
137
160
  });
138
161
  };
139
162
 
163
+ exports.Text = Text;
140
164
  exports.default = TagsComponent;
141
165
  // powered by h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.10.27",
3
+ "version": "1.10.29",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -23,6 +23,7 @@ export default ({
23
23
  contentRender,
24
24
  width = 888,
25
25
  footer = null,
26
+ afterClose,
26
27
  ...props
27
28
  }: DwTableProps<ProColumns[]>) => {
28
29
  const { modalVisible, setModalVisible } = useVisible(visible);
@@ -96,7 +97,11 @@ export default ({
96
97
  }
97
98
  width={width}
98
99
  bodyStyle={{ padding: 0, paddingBottom: 12, ...bodyStyle }}
99
- afterVisibleChange={afterVisibleChange}
100
+ afterVisibleChange={(visible) =>{
101
+ if (!visible){
102
+ afterClose?.()
103
+ }
104
+ }}
100
105
  >
101
106
  <EditTableContent
102
107
  contentRender={contentRender}
@@ -177,6 +177,7 @@ export interface DwTableProps<T = HTableProps["configData"]>
177
177
  contentRender?: (node: React.ReactNode) => React.ReactNode;
178
178
  editTableProps?: Omit<HEditTableProps, "configData" | "request">;
179
179
  dataSource?: any[];
180
+ afterClose?: () => void;
180
181
  }
181
182
 
182
183
  export interface ModalTableProps<T = HTableProps["configData"]>
@@ -1,4 +1,4 @@
1
- import { Row, Tag, Tooltip, Popover } from "antd";
1
+ import {Row, Tag, Tooltip, Popover, Typography} from "antd";
2
2
  import React, { useMemo } from "react";
3
3
  import type { TooltipProps } from "antd/lib/tooltip";
4
4
  import type { HTableInstance } from "../modal";
@@ -43,6 +43,9 @@ const getTooltipProps = (
43
43
  title,
44
44
  };
45
45
  };
46
+ export const Text:React.FC=({children})=>{
47
+ return <Typography.Text ellipsis={{tooltip:children}}>{children}</Typography.Text>
48
+ }
46
49
  const TagsComponent = (props: IProps) => {
47
50
  const {
48
51
  data,
@@ -85,17 +88,21 @@ const TagsComponent = (props: IProps) => {
85
88
  const indexKey = index.toString();
86
89
  if (typeof tagItem === "string") {
87
90
  const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
91
+ const tagNode=<Text>{tagItem}</Text>
88
92
  return (
89
93
  <Tooltip {...tooltipProps}>
90
94
  <Tag
91
95
  key={indexKey}
96
+ style={{
97
+ maxWidth: "100%",
98
+ }}
92
99
  {...tagProps}
93
100
  onClose={(e) => {
94
101
  e.preventDefault();
95
102
  onClose?.(indexKey, tableInstance);
96
103
  }}
97
104
  >
98
- {contentItemRender ? contentItemRender(tagItem) : tagItem}
105
+ {contentItemRender ? contentItemRender(tagNode) : tagNode}
99
106
  </Tag>
100
107
  </Tooltip>
101
108
  );
@@ -110,17 +117,21 @@ const TagsComponent = (props: IProps) => {
110
117
  ...itemProps,
111
118
  };
112
119
  const cuKey = tagValue || indexKey;
120
+ const tagNode=<Text>{tagLabel}</Text>
113
121
  return (
114
122
  <Tooltip {...tooltipProps}>
115
123
  <Tag
116
124
  key={cuKey}
125
+ style={{
126
+ maxWidth: "100%",
127
+ }}
117
128
  {...cuTagProps}
118
129
  onClose={(e) => {
119
130
  e.preventDefault();
120
131
  cuTagProps?.onClose(cuKey, tableInstance);
121
132
  }}
122
133
  >
123
- {contentItemRender ? contentItemRender(tagLabel) : tagLabel}
134
+ {contentItemRender ? tagNode : tagNode}
124
135
  </Tag>
125
136
  </Tooltip>
126
137
  );
@@ -41,6 +41,9 @@ export default () => {
41
41
  </div>
42
42
  <HDwEditTable
43
43
  title="编辑"
44
+ afterClose={()=>{
45
+ console.log("afterClose")
46
+ }}
44
47
  contentRender={(node) => {
45
48
  return (
46
49
  <>