@zykj2024/much-library 1.1.6 → 1.1.7-beta.1

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.
Files changed (49) hide show
  1. package/dist/McContainer/demo/generic.d.ts +8 -0
  2. package/dist/McContainer/demo/generic.js +91 -0
  3. package/dist/McContainer/index.d.ts +147 -108
  4. package/dist/McContainer/index.js +16 -7
  5. package/dist/McEllipsis/demo/base.d.ts +6 -0
  6. package/dist/McEllipsis/demo/base.js +22 -0
  7. package/dist/McEllipsis/demo/middle.d.ts +6 -0
  8. package/dist/McEllipsis/demo/middle.js +24 -0
  9. package/dist/McEllipsis/demo/table.d.ts +5 -0
  10. package/dist/McEllipsis/demo/table.js +93 -0
  11. package/dist/McEllipsis/demo/tooltip-size.d.ts +6 -0
  12. package/dist/McEllipsis/demo/tooltip-size.js +20 -0
  13. package/dist/McEllipsis/demo/tooltip.d.ts +6 -0
  14. package/dist/McEllipsis/demo/tooltip.js +53 -0
  15. package/dist/McEllipsis/index.css +4 -0
  16. package/dist/McEllipsis/index.d.ts +40 -0
  17. package/dist/McEllipsis/index.js +115 -0
  18. package/dist/McGroupPanel/index.css +8 -3
  19. package/dist/McGroupPanel/index.d.ts +1 -0
  20. package/dist/McGroupPanel/index.js +156 -141
  21. package/dist/McInputNumber/index.d.ts +3 -0
  22. package/dist/McInputNumber/index.js +16 -9
  23. package/dist/McListSelect/comps/ListSelect.d.ts +67 -0
  24. package/dist/McListSelect/comps/ListSelect.js +289 -0
  25. package/dist/McListSelect/comps/ListSelectPanel.d.ts +138 -0
  26. package/dist/McListSelect/comps/ListSelectPanel.js +451 -0
  27. package/dist/McListSelect/comps/SelectedItem.d.ts +17 -0
  28. package/dist/McListSelect/comps/SelectedItem.js +76 -0
  29. package/dist/McListSelect/demo/base.d.ts +6 -0
  30. package/dist/McListSelect/demo/base.js +125 -0
  31. package/dist/McListSelect/demo/inexistent.d.ts +6 -0
  32. package/dist/McListSelect/demo/inexistent.js +111 -0
  33. package/dist/McListSelect/demo/layout.d.ts +6 -0
  34. package/dist/McListSelect/demo/layout.js +70 -0
  35. package/dist/McListSelect/demo/other.d.ts +6 -0
  36. package/dist/McListSelect/demo/other.js +68 -0
  37. package/dist/McListSelect/demo/panel-inexistent.d.ts +6 -0
  38. package/dist/McListSelect/demo/panel-inexistent.js +86 -0
  39. package/dist/McListSelect/index.css +273 -0
  40. package/dist/McListSelect/index.d.ts +10 -0
  41. package/dist/McListSelect/index.js +5 -0
  42. package/dist/McListSelect/mock/index.d.ts +1 -0
  43. package/dist/McListSelect/mock/index.js +27 -0
  44. package/dist/McModalProvider/index.d.ts +2 -2
  45. package/dist/McThemeConfig/layoutStyle.d.ts +1 -1
  46. package/dist/McThemeConfig/layoutStyle.js +1 -1
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.js +3 -0
  49. package/package.json +3 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 泛型
3
+ * description: 更好的代码提示及类型推断
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1,91 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 泛型
4
+ * description: 更好的代码提示及类型推断
5
+ * transform: true
6
+ * compact: true
7
+ */
8
+
9
+ import { McContainer, McInput } from "../..";
10
+ import { useRef, useState } from 'react';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ var tableData = Array.from({
14
+ length: 5
15
+ }, function (_, index) {
16
+ return {
17
+ id: index + 1,
18
+ name: "\u59D3\u540D".concat(index + 1),
19
+ age: 18 + index
20
+ };
21
+ });
22
+ export default (function () {
23
+ var _useState = useState(tableData),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ dataSource = _useState2[0],
26
+ setDataSource = _useState2[1];
27
+ var _useState3 = useState(false),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ loading = _useState4[0],
30
+ setLoading = _useState4[1];
31
+ var mcContainerRef = useRef(null);
32
+ var columns = [{
33
+ title: 'ID',
34
+ dataIndex: 'id'
35
+ }, {
36
+ title: '姓名',
37
+ dataIndex: 'name'
38
+ }, {
39
+ title: '年龄',
40
+ dataIndex: 'age'
41
+ }, {
42
+ title: '操作',
43
+ dataIndex: 'id',
44
+ width: 100,
45
+ render: function render() {
46
+ return /*#__PURE__*/_jsx("a", {
47
+ children: "\u7F16\u8F91"
48
+ });
49
+ }
50
+ }];
51
+ var queryItems = /*#__PURE__*/_jsx(_Fragment, {
52
+ children: /*#__PURE__*/_jsx(McInput, {
53
+ label: "\u59D3\u540D",
54
+ name: "name",
55
+ style: {
56
+ width: 270
57
+ }
58
+ })
59
+ });
60
+ var onQuery = function onQuery(data) {
61
+ var _mcContainerRef$curre;
62
+ var queryData = (_mcContainerRef$curre = mcContainerRef.current) === null || _mcContainerRef$curre === void 0 ? void 0 : _mcContainerRef$curre.getQueryParams();
63
+ // 加了泛型后,data. queryData.就会有类型推断
64
+ console.log(data.a, queryData === null || queryData === void 0 ? void 0 : queryData.a);
65
+ return new Promise(function (resolve) {
66
+ setLoading(true);
67
+ setTimeout(function () {
68
+ setDataSource(tableData);
69
+ setLoading(false);
70
+ resolve();
71
+ }, 1000);
72
+ });
73
+ };
74
+ return (
75
+ /*#__PURE__*/
76
+ // 添加泛型后,组件下写的第一个属性会没有代码提示。
77
+ _jsx(McContainer, {
78
+ ref: mcContainerRef,
79
+ height: "100%",
80
+ immediateQuery: false,
81
+ loading: loading,
82
+ onQuery: onQuery,
83
+ queryItems: queryItems,
84
+ tableProps: {
85
+ columns: columns,
86
+ dataSource: dataSource,
87
+ rowKey: 'id'
88
+ }
89
+ })
90
+ );
91
+ });
@@ -1,153 +1,192 @@
1
1
  import { ButtonProps, TableProps } from 'antd';
2
- import { CSSProperties, FC, ReactElement, ReactNode } from 'react';
2
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
3
3
  import './index.less';
4
- export type McContainerPropsType = {
4
+ /** 请求参数 */
5
+ type QueryParamsType<T = any> = {
6
+ /** 当前页码 */
7
+ current: number;
8
+ /** 每页显示的记录数 */
9
+ pageSize: number;
10
+ } & T;
11
+ /** 批量操作配置接口 */
12
+ interface BatchConfig {
13
+ /** 是否显示批量操作按钮 */
14
+ show?: boolean;
15
+ /** 批量操作按钮的文本 */
16
+ buttonText?: string;
17
+ /** 批量操作按钮的属性 */
18
+ buttonProps?: ButtonProps;
19
+ /** 批量操作按钮在操作栏中的位置 */
20
+ order?: number;
21
+ }
22
+ /** McContainer 组件 Props 类型定义 */
23
+ export interface McContainerProps<T> {
24
+ /** 组件的自定义样式 */
5
25
  style?: CSSProperties;
26
+ /** 组件的自定义类名 */
6
27
  className?: string;
7
- /** 页面容器的高度(默认'calc(100vh - 88px)',即视口高度-菜单header高度56px-页面上下内边距16px*2) */
28
+ /**
29
+ * 页面容器的高度
30
+ * @default 'calc(100vh - 88px)' 即视口高度-菜单header高度56px-页面上下内边距16px*2
31
+ */
8
32
  height?: string;
9
- /** 页面容器的背景色(默认'#ffffff') */
33
+ /**
34
+ * 页面容器的背景色
35
+ * @default '#ffffff'
36
+ */
10
37
  backgroundColor?: string;
11
38
  /**
12
- * 是否展示头部遮罩,默认显示
39
+ * 是否展示头部遮罩
40
+ * @default true
13
41
  */
14
42
  showCell?: boolean;
15
43
  /**
16
- * 是否触发首次查询(默认true)
17
- 若使用场景为需自定义默认查询参数,可将该属性设置为false,并手动调用setDefaultQueryParams方法重新设置默认查询参数,而后调用query方法触发查询
18
- */
44
+ * 是否触发首次查询
45
+ * @description 若使用场景为需自定义默认查询参数,可将该属性设置为false
46
+ * 并手动调用setDefaultQueryParams方法重新设置默认查询参数,而后调用query方法触发查询
47
+ * @default true
48
+ */
19
49
  immediateQuery?: boolean;
20
- /** 加载中(已覆盖table组件的loading) */
50
+ /**
51
+ * 加载中状态(已覆盖table组件的loading)
52
+ * @default false
53
+ */
21
54
  loading?: boolean;
22
55
  /** 加载loading下方的文案,默认为测试中 */
23
56
  loadingText?: string;
24
57
  /**
25
58
  * 查询项(不受展开、收起按钮控制显示隐藏的查询项)
26
- 结合以下组件使用为最佳实现方式:McSelect、McCascader、McDateRange、McInput、McInput.Search、McInput.TextArea
27
- 已设置默认样式,可直接如下使用:
28
- <>
29
- <McSelect
30
- label="下拉选择器"
31
- name="name1"
32
- />
33
- <McCascader
34
- label="级联选择器"
35
- name="name2"
36
- />
37
- <McDateRange
38
- label="日期范围选择器"
39
- name="name3"
40
- />
41
- <McInput.Search
42
- name="name4"
43
- onSearch={() => mcContainerRef.current?.query({ current: 1 })}
44
- />
45
- </>
46
- */
59
+ * @description 建议结合 McSelect、McCascader、McDateRange、McInput 等组件使用
60
+ */
47
61
  queryItems?: ReactElement;
48
- /** 是否显示查询按钮(默认显示 true) */
62
+ /**
63
+ * 是否显示查询按钮
64
+ * @default true
65
+ */
49
66
  showQuery?: boolean;
50
- /** 是否显示重置按钮(默认显示 true) */
67
+ /**
68
+ * 是否显示重置按钮
69
+ * @default true
70
+ */
51
71
  showReset?: boolean;
52
- /** 是否显示展开、收起按钮(默认不显示 false) */
72
+ /**
73
+ * 是否显示展开、收起按钮
74
+ * @default false
75
+ */
53
76
  showCollapse?: boolean;
54
- /** 可折叠的查询项(可通过展开、收起按钮控制显示隐藏的查询项,使用建议同queryItems) */
77
+ /** 可折叠的查询项(可通过展开、收起按钮控制显示隐藏的查询项) */
55
78
  collapsibleQueryItems?: ReactElement;
56
- /** 查询(点击查询按钮、点击重置按钮、表格分页、排序、筛选变化)回调事件 */
57
- onQuery?: (params: {
58
- current?: number;
59
- pageSize?: number;
60
- [key: string]: any;
61
- }, filters?: any, sorter?: any, extra?: any) => void;
62
- /** 重置按钮回调事件(若设置该属性,则在点击重置按钮时不再触发onQuery事件) */
63
- onReset?: (params?: {
64
- current?: number;
65
- pageSize?: number;
66
- [key: string]: any;
79
+ /**
80
+ * 查询回调事件
81
+ * @param params - 分页参数
82
+ * @param filters - 过滤条件
83
+ * @param sorter - 排序条件
84
+ * @param extra - 额外信息,包含当前数据源和触发的操作类型
85
+ */
86
+ onQuery?: (params: QueryParamsType<T>, filters?: Record<string, any>, sorter?: Record<string, any>, extra?: {
87
+ currentDataSource: any[];
88
+ action: 'paginate' | 'sort' | 'filter';
67
89
  }) => void;
68
- /** 查询区自定义渲染(若设置为null,则不显示查询区) */
90
+ /**
91
+ * 重置按钮回调事件
92
+ * @description 若设置该属性,则在点击重置按钮时不再触发onQuery事件
93
+ */
94
+ onReset?: (params?: QueryParamsType<T>) => void;
95
+ /**
96
+ * 查询区自定义渲染
97
+ * @description 若设置为null,则不显示查询区
98
+ */
69
99
  queryRender?: ReactNode;
70
100
  /**
71
- * 操作栏(若未设置该项,则不显示)
72
- 已设置默认样式,可直接如下使用:
73
- <>
74
- <Button type="primary">操作1</Button>
75
- <Button>操作2</Button>
76
- </>
77
- */
101
+ * 操作栏
102
+ * @description 若未设置该项,则不显示
103
+ */
78
104
  actionBar?: ReactElement;
79
105
  /**
80
- * @description 操作栏自定义渲染
106
+ * 操作栏自定义渲染
81
107
  * @param batchEl - 批量操作按钮实例
82
- * @returns 操作栏元素
83
108
  */
84
109
  actionBarRender?: (batchEl: ReactNode) => ReactNode;
85
- /** 批量操作已选项数量(当数量大于0时,显示批量操作栏) */
110
+ /**
111
+ * 批量操作已选项数量
112
+ * @description 当数量大于0时,显示批量操作栏
113
+ */
86
114
  batchNum?: number;
87
115
  /**
88
- * 批量操作按钮区(若未设置该项,则不显示)
89
- 已设置默认样式,可直接如下使用:
90
- <>
91
- <Button>批量操作1</Button>
92
- <Button>批量操作2</Button>
93
- </>
94
- */
116
+ * 批量操作按钮区
117
+ * @description 若未设置该项,则不显示
118
+ */
95
119
  batchBtns?: ReactNode;
96
- /**
97
- * @description 批量操作按钮配置
98
- * @param show - 是否显示批量操作按钮(默认不显示 false)
99
- * @param buttonText - 批量操作按钮文字
100
- * @param buttonProps - 批量操作按钮属性
101
- * @param order - 批量操作按钮在操作栏中的位置(默认为最后一个)
102
- */
103
- batch?: {
104
- show?: boolean;
105
- buttonText?: string;
106
- buttonProps?: ButtonProps;
107
- order?: number;
108
- };
120
+ /** 批量操作按钮配置 */
121
+ batch?: BatchConfig;
109
122
  /** 批量操作取消按钮回调事件 */
110
123
  onCancel?: () => void;
111
124
  /** 表格组件属性 */
112
125
  tableProps?: TableProps<any>;
113
- /** 数据表格区自定义渲染(若设置为null,则不显示数据表格区 */
126
+ /**
127
+ * 数据表格区自定义渲染
128
+ * @description 若设置为null,则不显示数据表格区
129
+ */
114
130
  tableRender?: ReactNode;
115
- /** 当前分页数据为空且非第一页时,是否自动会退到上一个分页(默认false) */
131
+ /**
132
+ * 当前分页数据为空且非第一页时,是否自动会退到上一个分页
133
+ * @default false
134
+ */
116
135
  autoBackPagination?: boolean;
117
- /** 折叠事件的回调 */
118
- onCollapse?: (v: boolean) => void;
119
- [key: string]: any;
120
- };
121
- export type McContainerRef = {
136
+ /**
137
+ * 折叠事件的回调
138
+ * @param collapsed - 是否折叠
139
+ */
140
+ onCollapse?: (collapsed: boolean) => void;
141
+ }
142
+ /** McContainer 组件 Ref 类型定义 */
143
+ export interface McContainerRef<T = any> {
122
144
  /**
123
145
  * 调用查询的方法
124
- 可通过传参(params)更新查询参数的状态后触发查询,所设置的属性仅会覆盖原查询参数对应的属性,如:query({current: 1}),仅会覆盖原查询参数的current属性;
125
- 仅对设置过name属性的查询项(和current、pageSize)有效,查询项自身已绑定value属性的除外,需自行编写相关业务逻辑代码进行状态管理;
126
- 若不传参则按当前查询参数触发查询
127
- */
128
- query: (params?: {
129
- [key: string]: any;
130
- }) => void;
131
- /** 调用重置的方法 */
146
+ * @description 可通过传参更新查询参数的状态后触发查询,所设置的属性仅会覆盖原查询参数对应的属性
147
+ * @param params - 查询参数,仅支持设置过name属性的查询项
148
+ */
149
+ query: (params?: QueryParamsType<T>) => void;
150
+ /**
151
+ * 调用重置的方法
152
+ * @description 重置查询参数为默认值
153
+ */
132
154
  reset: () => void;
133
155
  /**
134
156
  * 设置默认查询参数
135
- 默认查询参数,用于重置使用,仅对设置过name属性的查询项(和current、pageSize)有效,查询项自身已绑定value属性的除外,需自行编写相关业务逻辑代码进行状态管理;
136
- 可通过该方法配置默认查询的分页参数;
137
- 设置的查询参数将覆盖原有默认值,如:setDefaultQueryParams({pageSize: 10, status: 1}),设置后的默认查询参数为{current: 1, pageSize: 10, status: 1}
138
- 原有默认值 {current: 1, pageSize: 20}(若未开启分页功能,默认值为{})
139
- */
140
- setDefaultQueryParams: (params: {
141
- [key: string]: any;
142
- }) => void;
143
- /** 设置单个查询项的参数(仅支持设置过name属性的查询项和current、pageSize) */
144
- setQueryParam: (name: string, value: any) => void;
145
- /** 获取单个查询项的参数(仅支持设置过name属性的查询项和current、pageSize) */
146
- getQueryParam: (name: string) => any;
147
- /** 获取所有查询项的参数 */
148
- getQueryParams: () => any;
149
- /** 重置查询参数(重置为默认查询参数) */
157
+ * @description 用于重置使用,仅对设置过name属性的查询项有效
158
+ * 仅对设置过name属性的查询项(和current、pageSize)有效,查询项自身已绑定value属性的除外,需自行编写相关业务逻辑代码进行状态管理;
159
+ * 可通过该方法配置默认查询的分页参数;
160
+ * 设置的查询参数将覆盖原有默认值,如:setDefaultQueryParams({pageSize: 10, status: 1}),设置后的默认查询参数为{current: 1, pageSize: 10, status: 1}
161
+ * 原有默认值 {current: 1, pageSize: 20}(若未开启分页功能,默认值为{}
162
+ * @param params - 默认查询参数
163
+ */
164
+ setDefaultQueryParams: (params: QueryParamsType<T>) => void;
165
+ /**
166
+ * 设置单个查询项的参数
167
+ * @description 仅支持设置过name属性的查询项
168
+ * @param name - 查询项名称
169
+ * @param value - 查询项值
170
+ */
171
+ setQueryParam: (name: keyof QueryParamsType<T>, value: any) => void;
172
+ /**
173
+ * 获取单个查询项的参数
174
+ * @description 仅支持设置过name属性的查询项
175
+ * @param name - 查询项名称
176
+ */
177
+ getQueryParam: (name: keyof QueryParamsType<T>) => any;
178
+ /**
179
+ * 获取所有查询项的参数
180
+ * @returns 当前可见的查询项的参数集
181
+ */
182
+ getQueryParams: () => QueryParamsType<T>;
183
+ /**
184
+ * 重置查询参数
185
+ * @description 重置为默认查询参数
186
+ */
150
187
  resetQueryParams: () => void;
151
- };
152
- declare const McContainer: FC<McContainerPropsType>;
188
+ }
189
+ declare const McContainer: <T>(props: McContainerProps<T> & {
190
+ ref?: React.ForwardedRef<McContainerRef<T>>;
191
+ }) => JSX.Element;
153
192
  export default McContainer;
@@ -7,10 +7,22 @@ import { isNumber } from 'lodash';
7
7
  import { CaretDownFilled, DoubleLeftOutlined } from 'much-icons';
8
8
  import { Children, cloneElement, forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, useState } from 'react';
9
9
  import "./index.css";
10
+
11
+ /** 请求参数 */
12
+
13
+ /** 批量操作配置接口 */
14
+
15
+ /** McContainer 组件 Props 类型定义 */
16
+
17
+ /** McContainer 组件 Ref 类型定义 */
10
18
  import { jsx as _jsx } from "react/jsx-runtime";
11
19
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
- var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
21
+ /**
22
+ * McContainer 组件
23
+ * @description 一个通用的容器组件,支持查询、表格、批量操作等功能
24
+ */
25
+ var ContainerPanel = function ContainerPanel(props, ref) {
14
26
  var _tableProps$dataSourc;
15
27
  var style = props.style,
16
28
  className = props.className,
@@ -171,15 +183,13 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
171
183
  };
172
184
 
173
185
  // 格式化查询参数(返回当前可见的查询项的参数集)
174
- var formatQueryParams = function formatQueryParams() {
186
+ var formatQueryParams = function formatQueryParams(params) {
175
187
  var _tableProps$paginatio;
176
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
177
188
  var _params = tableRender || tableRender === null || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination) === false || tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio = tableProps.pagination) !== null && _tableProps$paginatio !== void 0 && _tableProps$paginatio.hasOwnProperty('onChange') || tableProps !== null && tableProps !== void 0 && tableProps.hasOwnProperty('onChange') ? {} : {
178
189
  current: params.current,
179
190
  pageSize: params.pageSize
180
191
  };
181
192
  var fn = function fn(items) {
182
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
183
193
  items && Children.map(items.props.children ? items.props.children : items, function (item) {
184
194
  if (item !== null && item !== void 0 && item.props) {
185
195
  var _item$props2;
@@ -199,7 +209,6 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
199
209
  var query = function query(params) {
200
210
  if (params) {
201
211
  var _params = _objectSpread({}, queryParamsRef.current);
202
- // 仅支持设置过name属性的查询项(和current、pageSize)
203
212
  Object.entries(params).forEach(function (_ref2) {
204
213
  var _ref3 = _slicedToArray(_ref2, 2),
205
214
  key = _ref3[0],
@@ -255,7 +264,6 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
255
264
  Object.keys(_params).forEach(function (k) {
256
265
  return !allNamesRef.current.includes(k) && allNamesRef.current.push(k);
257
266
  });
258
- // 仅支持设置过name属性的查询项(和current、pageSize)
259
267
  Object.entries(params).forEach(function (_ref4) {
260
268
  var _ref5 = _slicedToArray(_ref4, 2),
261
269
  key = _ref5[0],
@@ -509,5 +517,6 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
509
517
  })]
510
518
  })
511
519
  });
512
- });
520
+ };
521
+ var McContainer = /*#__PURE__*/forwardRef(ContainerPanel);
513
522
  export default McContainer;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * title: 基本使用
3
+ * description: 单行末尾省略<br>设置 `rows` 多行末尾省略
4
+ */
5
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * title: 基本使用
3
+ * description: 单行末尾省略<br>设置 `rows` 多行末尾省略
4
+ */
5
+
6
+ import { McEllipsis } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ export default (function () {
10
+ var longText = '一-二-三-四-五-六-七-八-九-十=壹-贰-叁-肆-伍-陆-柒-捌-玖-拾=yī-èr-sān-sì-wǔ-liù-qī-bā-jiǔ-shí=one-two-three-four-five-six-seven-eight-nine-ten';
11
+ return /*#__PURE__*/_jsxs("div", {
12
+ style: {
13
+ width: 240
14
+ },
15
+ children: [/*#__PURE__*/_jsx(McEllipsis, {
16
+ text: '单行末尾省略:' + longText
17
+ }), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx(McEllipsis, {
18
+ text: '3行末尾省略:' + longText,
19
+ rows: 3
20
+ })]
21
+ });
22
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * title: 中间省略
3
+ * description: 设置 `middle` 使用中间省略<br>设置 `suffixCount` 结尾显示的字个数
4
+ */
5
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * title: 中间省略
3
+ * description: 设置 `middle` 使用中间省略<br>设置 `suffixCount` 结尾显示的字个数
4
+ */
5
+
6
+ import { McEllipsis } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ export default (function () {
10
+ var longText = '一-二-三-四-五-六-七-八-九-十=壹-贰-叁-肆-伍-陆-柒-捌-玖-拾=yī-èr-sān-sì-wǔ-liù-qī-bā-jiǔ-shí=one-two-three-four-five-six-seven-eight-nine-ten';
11
+ return /*#__PURE__*/_jsxs("div", {
12
+ style: {
13
+ width: 240
14
+ },
15
+ children: [/*#__PURE__*/_jsx(McEllipsis, {
16
+ text: '中间省略:' + longText,
17
+ middle: true
18
+ }), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx(McEllipsis, {
19
+ text: '结尾显示10个字:' + longText,
20
+ middle: true,
21
+ suffixCount: 10
22
+ })]
23
+ });
24
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * title: 表格内使用
3
+ */
4
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * title: 表格内使用
3
+ */
4
+
5
+ import { Table } from 'antd';
6
+ import { McEllipsis } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export default (function () {
9
+ var longText = '一-二-三-四-五-六-七-八-九-十=壹-贰-叁-肆-伍-陆-柒-捌-玖-拾=yī-èr-sān-sì-wǔ-liù-qī-bā-jiǔ-shí=one-two-three-four-five-six-seven-eight-nine-ten';
10
+ var dataSource = [];
11
+ for (var i = 0; i < 100; i++) {
12
+ dataSource.push({
13
+ id: i,
14
+ column1: '单行末尾省略 ' + longText + i,
15
+ column2: '单行中间省略 ' + longText + i,
16
+ column3: '3行末尾省略 ' + longText + i,
17
+ column4: '3行末尾省略可复制 ' + longText + i,
18
+ column5: '自定义提示内容 ' + longText + i,
19
+ column6: '2行末尾省略不提示 ' + longText + i
20
+ });
21
+ }
22
+ var columns = [{
23
+ title: '单行末尾省略',
24
+ dataIndex: 'column1',
25
+ width: 120,
26
+ render: function render(_) {
27
+ return /*#__PURE__*/_jsx(McEllipsis, {
28
+ text: _
29
+ });
30
+ }
31
+ }, {
32
+ title: '单行中间省略',
33
+ dataIndex: 'column2',
34
+ width: 120,
35
+ render: function render(_) {
36
+ return /*#__PURE__*/_jsx(McEllipsis, {
37
+ text: _,
38
+ middle: true
39
+ });
40
+ }
41
+ }, {
42
+ title: '3行末尾省略',
43
+ dataIndex: 'column3',
44
+ width: 120,
45
+ render: function render(_) {
46
+ return /*#__PURE__*/_jsx(McEllipsis, {
47
+ text: _,
48
+ rows: 3
49
+ });
50
+ }
51
+ }, {
52
+ title: '3行末尾省略可复制',
53
+ dataIndex: 'column4',
54
+ width: 140,
55
+ render: function render(_) {
56
+ return /*#__PURE__*/_jsx(McEllipsis, {
57
+ text: _,
58
+ rows: 3,
59
+ copyable: true
60
+ });
61
+ }
62
+ }, {
63
+ title: '自定义提示内容',
64
+ dataIndex: 'column5',
65
+ width: 120,
66
+ render: function render(_) {
67
+ return /*#__PURE__*/_jsx(McEllipsis, {
68
+ text: _,
69
+ tooltip: "\u6211\u662F\u81EA\u5B9A\u4E49\u63D0\u793A\u5185\u5BB9"
70
+ });
71
+ }
72
+ }, {
73
+ title: '2行末尾省略不提示',
74
+ dataIndex: 'column6',
75
+ width: 140,
76
+ render: function render(_) {
77
+ return /*#__PURE__*/_jsx(McEllipsis, {
78
+ text: _,
79
+ rows: 2,
80
+ tooltip: false
81
+ });
82
+ }
83
+ }];
84
+ return /*#__PURE__*/_jsx(Table, {
85
+ size: "small",
86
+ columns: columns,
87
+ dataSource: dataSource,
88
+ rowKey: "id",
89
+ scroll: {
90
+ y: 300
91
+ }
92
+ });
93
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * title: 提示框宽高
3
+ * description: 设置 `tooltipMaxWidth` 和 `tooltipMaxHeight` 可控制提示框最大宽高,避免内容过多时显示异常
4
+ */
5
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * title: 提示框宽高
3
+ * description: 设置 `tooltipMaxWidth` 和 `tooltipMaxHeight` 可控制提示框最大宽高,避免内容过多时显示异常
4
+ */
5
+
6
+ import { McEllipsis } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export default (function () {
9
+ var longText = '一-二-三-四-五-六-七-八-九-十=壹-贰-叁-肆-伍-陆-柒-捌-玖-拾=yī-èr-sān-sì-wǔ-liù-qī-bā-jiǔ-shí=one-two-three-four-five-six-seven-eight-nine-ten';
10
+ return /*#__PURE__*/_jsx("div", {
11
+ style: {
12
+ width: 240
13
+ },
14
+ children: /*#__PURE__*/_jsx(McEllipsis, {
15
+ text: '提示框宽高:' + longText,
16
+ tooltipMaxWidth: 200,
17
+ tooltipMaxHeight: 100
18
+ })
19
+ });
20
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * title: 自定义提示内容
3
+ * description: 设置 `tooltip` 或使用 `TooltipProps` 属性自定义提示内容<br>设置 `tooltip` 为 false 则不展示<br>设置 `alwaysTooltip` 为 true 则不省略也展示
4
+ */
5
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;