@qsxy/element-plus-react 1.0.0-next.13 → 1.0.0-next.16

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 (104) hide show
  1. package/dist/Button/Button.js +5 -3
  2. package/dist/Button/typings.d.ts +3 -1
  3. package/dist/ColorPicker/AlphaSlider.d.ts +0 -7
  4. package/dist/ColorPicker/AlphaSlider.js +0 -7
  5. package/dist/ColorPicker/HueSlider.d.ts +0 -7
  6. package/dist/ColorPicker/HueSlider.js +0 -7
  7. package/dist/ColorPicker/Predefine.d.ts +0 -7
  8. package/dist/ColorPicker/Predefine.js +0 -7
  9. package/dist/ColorPicker/SvPanel.d.ts +0 -7
  10. package/dist/ColorPicker/SvPanel.js +0 -7
  11. package/dist/DateTimePicker/DateTimePicker.d.ts +1 -1
  12. package/dist/Descriptions/Descriptions.d.ts +2 -2
  13. package/dist/Descriptions/Descriptions.js +7 -6
  14. package/dist/Descriptions/DescriptionsCell.d.ts +11 -12
  15. package/dist/Descriptions/DescriptionsCell.js +13 -6
  16. package/dist/Descriptions/DescriptionsItem.js +1 -1
  17. package/dist/Descriptions/DescriptionsRow.d.ts +2 -5
  18. package/dist/Descriptions/DescriptionsRow.js +11 -4
  19. package/dist/Dialog/Dialog.js +5 -6
  20. package/dist/Dialog/DialogContext.d.ts +1 -1
  21. package/dist/Dialog/DialogContext.js +1 -1
  22. package/dist/Drawer/Drawer.d.ts +2 -5
  23. package/dist/Drawer/Drawer.js +98 -35
  24. package/dist/Drawer/DrawerBody.js +6 -12
  25. package/dist/Drawer/DrawerContext.d.ts +1 -13
  26. package/dist/Drawer/DrawerContext.js +1 -11
  27. package/dist/Drawer/DrawerHeader.js +5 -18
  28. package/dist/Drawer/typings.d.ts +31 -10
  29. package/dist/Dropdown/Dropdown.js +7 -7
  30. package/dist/Dropdown/DropdownItem.js +1 -1
  31. package/dist/Dropdown/DropdownMenu.d.ts +5 -2
  32. package/dist/Dropdown/DropdownMenu.js +5 -3
  33. package/dist/Dropdown/typings.d.ts +3 -1
  34. package/dist/MessageBox/MessageBox.js +6 -1
  35. package/dist/MessageBox/index.d.ts +3 -3
  36. package/dist/Notification/Notification.js +6 -3
  37. package/dist/Notification/index.d.ts +0 -8
  38. package/dist/Notification/index.js +0 -9
  39. package/dist/Notification/typings.d.ts +0 -2
  40. package/dist/Pagination/Options.js +2 -1
  41. package/dist/Popconfirm/Popconfirm.d.ts +3 -2
  42. package/dist/Popconfirm/Popconfirm.js +15 -8
  43. package/dist/Popconfirm/typings.d.ts +2 -1
  44. package/dist/Popover/Popover.js +7 -5
  45. package/dist/Popover/typings.d.ts +1 -1
  46. package/dist/Select/Option.js +1 -1
  47. package/dist/Select/OptionGroup.js +1 -1
  48. package/dist/Select/Select.d.ts +3 -15
  49. package/dist/Select/Select.js +3 -9
  50. package/dist/Select/SelectCore.js +52 -27
  51. package/dist/Select/index.d.ts +1 -0
  52. package/dist/Select/index.js +1 -0
  53. package/dist/Select/typings.d.ts +13 -1
  54. package/dist/Skeleton/PlaceholderGraph.d.ts +1 -1
  55. package/dist/Skeleton/PlaceholderGraph.js +3 -3
  56. package/dist/Skeleton/PlaceholderGrid.d.ts +1 -1
  57. package/dist/Skeleton/PlaceholderGrid.js +3 -3
  58. package/dist/Skeleton/PlaceholderParagraph.d.ts +2 -2
  59. package/dist/Skeleton/PlaceholderParagraph.js +13 -8
  60. package/dist/Skeleton/Skeleton.d.ts +2 -9
  61. package/dist/Skeleton/Skeleton.js +94 -7
  62. package/dist/Skeleton/SkeletonContext.d.ts +17 -0
  63. package/dist/Skeleton/SkeletonContext.js +5 -0
  64. package/dist/Skeleton/SkeletonItem.d.ts +4 -0
  65. package/dist/Skeleton/SkeletonItem.js +47 -0
  66. package/dist/Skeleton/index.d.ts +2 -3
  67. package/dist/Skeleton/index.js +2 -1
  68. package/dist/Skeleton/typings.d.ts +29 -0
  69. package/dist/Skeleton/typings.js +1 -0
  70. package/dist/Table/TableColumn.js +2 -2
  71. package/dist/Table/TableHeaderCell.js +16 -16
  72. package/dist/Table/hooks/useTable.d.ts +0 -7
  73. package/dist/Table/hooks/useTable.js +1 -9
  74. package/dist/Table/typings.d.ts +1 -1
  75. package/dist/Tabs/TabPane.js +1 -1
  76. package/dist/Tabs/Tabs.d.ts +2 -2
  77. package/dist/Tabs/Tabs.js +8 -4
  78. package/dist/Tabs/typings.d.ts +2 -0
  79. package/dist/Tag/Tag.d.ts +1 -1
  80. package/dist/Tag/Tag.js +5 -5
  81. package/dist/Tag/typings.d.ts +1 -1
  82. package/dist/TimeLine/TimeLine.js +1 -0
  83. package/dist/TimeLine/TimeLineItem.js +1 -0
  84. package/dist/TimeLine/typings.d.ts +2 -2
  85. package/dist/TimePicker/useTimePicker.d.ts +0 -7
  86. package/dist/TimePicker/useTimePicker.js +1 -8
  87. package/dist/Upload/use-handlers.d.ts +1 -1
  88. package/dist/hooks/animationPropsUtils.d.ts +0 -4
  89. package/dist/hooks/animationPropsUtils.js +0 -4
  90. package/dist/hooks/popperPropsUtils.d.ts +0 -4
  91. package/dist/hooks/popperPropsUtils.js +0 -4
  92. package/dist/hooks/useChildrenInstance.d.ts +0 -4
  93. package/dist/hooks/useChildrenInstance.js +0 -4
  94. package/dist/index.css +1 -1
  95. package/dist/index.d.ts +3 -3
  96. package/dist/index.js +2 -2
  97. package/package.json +1 -1
  98. package/theme-chalk/drawer/index.scss +61 -65
  99. package/theme-chalk/index.scss +1 -1
  100. package/theme-chalk/placeholder/index.scss +22 -37
  101. package/theme-chalk/skeleton/index.scss +120 -0
  102. package/theme-chalk/tabs/index.scss +3 -3
  103. package/theme-chalk/tag/index.scss +5 -162
  104. package/theme-chalk/time-line/_timeline-item.scss +1 -1
@@ -1,8 +1,95 @@
1
- import SkeletonGraph from "./PlaceholderGraph";
2
- import PlaceholderGrid from "./PlaceholderGrid";
3
- import PlaceholderParagraph from "./PlaceholderParagraph";
4
- var Skeleton = PlaceholderParagraph;
5
- Skeleton.Paragraph = PlaceholderParagraph;
6
- Skeleton.Grid = PlaceholderGrid;
7
- Skeleton.Graph = SkeletonGraph;
1
+ var _templateObject, _templateObject2;
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
9
+ import classNames from 'classnames';
10
+ import debounce from 'lodash/debounce';
11
+ import React, { Children, useEffect, useRef } from 'react';
12
+ import { mergeDefaultProps } from "../Util";
13
+ import { useClassNames, useControlled } from "../hooks";
14
+ import { SkeletonContext } from "./SkeletonContext";
15
+ import SkeletonItem from "./SkeletonItem";
16
+ var SkeletonCore = function SkeletonCore(props) {
17
+ var animated = props.animated,
18
+ _props$rows = props.rows,
19
+ rows = _props$rows === void 0 ? 4 : _props$rows,
20
+ variant = props.variant,
21
+ _props$rowHeight = props.rowHeight,
22
+ rowHeight = _props$rowHeight === void 0 ? 16 : _props$rowHeight,
23
+ _props$rowMargin = props.rowMargin,
24
+ rowMargin = _props$rowMargin === void 0 ? 16 : _props$rowMargin,
25
+ _props$classPrefix = props.classPrefix,
26
+ classPrefix = _props$classPrefix === void 0 ? 'skeleton' : _props$classPrefix,
27
+ formatter = props.formatter,
28
+ className = props.className,
29
+ style = props.style;
30
+ var _useClassNames = useClassNames(classPrefix),
31
+ b = _useClassNames.b,
32
+ wb = _useClassNames.wb;
33
+ return /*#__PURE__*/React.createElement(SkeletonContext.Provider, {
34
+ value: {
35
+ rowHeight: rowHeight,
36
+ rowMargin: rowMargin,
37
+ rows: rows
38
+ }
39
+ }, /*#__PURE__*/React.createElement("div", {
40
+ className: classNames(className, wb('paragraph', {
41
+ active: animated
42
+ })),
43
+ style: style
44
+ }, variant && /*#__PURE__*/React.createElement("div", {
45
+ className: b('paragraph-graph', "paragraph-graph-".concat(variant))
46
+ }, variant === 'image' ? /*#__PURE__*/React.createElement("svg", {
47
+ xmlns: "http://www.w3.org/2000/svg",
48
+ viewBox: "0 0 1024 1024"
49
+ }, /*#__PURE__*/React.createElement("path", {
50
+ fill: "currentColor",
51
+ d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
52
+ })) : null, /*#__PURE__*/React.createElement("span", {
53
+ className: b(_templateObject || (_templateObject = _taggedTemplateLiteral(["paragraph-graph-inner"])))
54
+ })), /*#__PURE__*/React.createElement("div", {
55
+ className: b(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["paragraph-rows"])))
56
+ }, Children.count(formatter) === 0 ? new Array(rows).fill(0).map(function (_, index) {
57
+ return /*#__PURE__*/React.createElement(SkeletonItem, {
58
+ key: index,
59
+ isFirst: index === 0
60
+ });
61
+ }) : formatter)));
62
+ };
63
+ var Skeleton = function Skeleton(props) {
64
+ var _throttle$leading, _throttle$trailing;
65
+ props = mergeDefaultProps({
66
+ visible: true
67
+ }, props);
68
+ var _props = props,
69
+ defaultVisible = _props.defaultVisible,
70
+ throttle = _props.throttle,
71
+ children = _props.children;
72
+ var initLoad = useRef(false);
73
+ var _useControlled = useControlled(undefined, defaultVisible !== null && defaultVisible !== void 0 ? defaultVisible : props.visible),
74
+ _useControlled2 = _slicedToArray(_useControlled, 2),
75
+ visible = _useControlled2[0],
76
+ setVisible = _useControlled2[1];
77
+ var display = debounce(function () {
78
+ return setVisible(true);
79
+ }, typeof throttle === 'number' ? throttle : (_throttle$leading = throttle === null || throttle === void 0 ? void 0 : throttle.leading) !== null && _throttle$leading !== void 0 ? _throttle$leading : 0);
80
+ var hide = debounce(function () {
81
+ return setVisible(false);
82
+ }, typeof throttle !== 'number' ? (_throttle$trailing = throttle === null || throttle === void 0 ? void 0 : throttle.trailing) !== null && _throttle$trailing !== void 0 ? _throttle$trailing : 0 : 0);
83
+ useEffect(function () {
84
+ if (defaultVisible === true && !initLoad.current) {
85
+ setVisible(true);
86
+ } else {
87
+ props.visible ? display() : hide();
88
+ }
89
+ initLoad.current = true;
90
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
+ }, [props.visible]);
92
+ return visible ? /*#__PURE__*/React.createElement(SkeletonCore, props) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
93
+ };
94
+ Skeleton.displayName = 'ElSkeleton';
8
95
  export default Skeleton;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ export declare const SkeletonContext: import("react").Context<{
3
+ /** 骨架屏段落数量 */
4
+ rows?: number;
5
+ /** 是否使用动画 */
6
+ animated?: boolean;
7
+ rowHeight?: number;
8
+ rowMargin?: number;
9
+ }>;
10
+ export declare const useSkeletonContext: () => {
11
+ /** 骨架屏段落数量 */
12
+ rows?: number;
13
+ /** 是否使用动画 */
14
+ animated?: boolean;
15
+ rowHeight?: number;
16
+ rowMargin?: number;
17
+ };
@@ -0,0 +1,5 @@
1
+ import { createContext, useContext } from 'react';
2
+ export var SkeletonContext = /*#__PURE__*/createContext({});
3
+ export var useSkeletonContext = function useSkeletonContext() {
4
+ return useContext(SkeletonContext);
5
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SkeletonItemProps } from './typings';
3
+ declare const SkeletonItem: (props: SkeletonItemProps) => React.JSX.Element;
4
+ export default SkeletonItem;
@@ -0,0 +1,47 @@
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 _templateObject, _templateObject2;
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 _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
9
+ import classNames from 'classnames';
10
+ import React from 'react';
11
+ import { useClassNames } from "../hooks";
12
+ import { useSkeletonContext } from "./SkeletonContext";
13
+ var SkeletonItem = function SkeletonItem(props) {
14
+ var _props$rowHeight, _props$rowMargin, _props$rowMargin2;
15
+ var isFirst = props.isFirst,
16
+ variant = props.variant,
17
+ className = props.className,
18
+ style = props.style,
19
+ _props$classPrefix = props.classPrefix,
20
+ classPrefix = _props$classPrefix === void 0 ? 'skeleton' : _props$classPrefix;
21
+ var _useClassNames = useClassNames(classPrefix),
22
+ b = _useClassNames.b,
23
+ e = _useClassNames.e;
24
+ var _useSkeletonContext = useSkeletonContext(),
25
+ rowHeight = _useSkeletonContext.rowHeight,
26
+ rowMargin = _useSkeletonContext.rowMargin;
27
+ return variant ? /*#__PURE__*/React.createElement("div", {
28
+ className: classNames(b('paragraph-graph', "paragraph-graph-".concat(variant)), className),
29
+ style: style
30
+ }, variant === 'image' ? /*#__PURE__*/React.createElement("svg", {
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ viewBox: "0 0 1024 1024"
33
+ }, /*#__PURE__*/React.createElement("path", {
34
+ fill: "currentColor",
35
+ d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
36
+ })) : null, /*#__PURE__*/React.createElement("span", {
37
+ className: b(_templateObject || (_templateObject = _taggedTemplateLiteral(["paragraph-graph-inner"])))
38
+ })) : /*#__PURE__*/React.createElement("div", {
39
+ className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["item"]))), className),
40
+ style: _objectSpread({
41
+ width: "".concat(Math.random() * 75 + 25, "%"),
42
+ height: (_props$rowHeight = props.rowHeight) !== null && _props$rowHeight !== void 0 ? _props$rowHeight : rowHeight,
43
+ marginTop: isFirst ? Number((_props$rowMargin = props.rowMargin) !== null && _props$rowMargin !== void 0 ? _props$rowMargin : rowMargin) / 2 : (_props$rowMargin2 = props.rowMargin) !== null && _props$rowMargin2 !== void 0 ? _props$rowMargin2 : rowMargin
44
+ }, style)
45
+ });
46
+ };
47
+ export default SkeletonItem;
@@ -1,4 +1,3 @@
1
- export type { SkeletonGraphProps } from './PlaceholderGraph';
2
- export type { PlaceholderGridProps } from './PlaceholderGrid';
3
- export type { PlaceholderParagraphProps } from './PlaceholderParagraph';
4
1
  export { default as Skeleton } from './Skeleton';
2
+ export { default as SkeletonItem } from './SkeletonItem';
3
+ export type { SkeletonItemProps, SkeletonProps } from './typings';
@@ -1 +1,2 @@
1
- export { default as Skeleton } from "./Skeleton";
1
+ export { default as Skeleton } from "./Skeleton";
2
+ export { default as SkeletonItem } from "./SkeletonItem";
@@ -0,0 +1,29 @@
1
+ import { ReactElement } from 'react';
2
+ import { BaseProps, NativeProps } from '../types/common';
3
+ export interface SkeletonProps extends BaseProps, NativeProps {
4
+ /** 是否显示骨架屏(可控) */
5
+ visible?: boolean;
6
+ /** 默认是否显示骨架屏 */
7
+ defaultVisible?: boolean;
8
+ /** 骨架屏段落数量 */
9
+ rows?: number;
10
+ /** 是否使用动画 */
11
+ animated?: boolean;
12
+ rowHeight?: number;
13
+ rowMargin?: number;
14
+ /** 当前渲染 skeleton 类型 */
15
+ variant?: 'image' | 'circle' | 'rect';
16
+ /** 渲染延迟(以毫秒为单位) 数字代表延迟显示, 也可以设置为延迟隐藏, 例如 { leading: 500, trailing: 500 } 当需要控制初始加载值时,您可以设置 { initVal: true } */
17
+ throttle?: number | {
18
+ leading?: number;
19
+ trailing?: number;
20
+ };
21
+ formatter?: ReactElement;
22
+ }
23
+ export interface SkeletonItemProps extends BaseProps, NativeProps {
24
+ /** 当前渲染 skeleton 类型 */
25
+ variant?: 'image' | 'circle' | 'rect';
26
+ isFirst?: boolean;
27
+ rowHeight?: number;
28
+ rowMargin?: number;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useChildrenInstance } from "../hooks";
3
3
  var TableColumn = function TableColumn(props) {
4
- var getChildren = useChildrenInstance('TableColumn');
4
+ var getChildren = useChildrenInstance('ElTableColumn');
5
5
  if (props.children instanceof Function) {
6
6
  return /*#__PURE__*/React.createElement("div", null);
7
7
  } else {
@@ -9,5 +9,5 @@ var TableColumn = function TableColumn(props) {
9
9
  return /*#__PURE__*/React.createElement("div", null, columns);
10
10
  }
11
11
  };
12
- TableColumn.displayName = 'TableColumn';
12
+ TableColumn.displayName = 'ElTableColumn';
13
13
  export default TableColumn;
@@ -123,33 +123,33 @@ var TableHeaderCell = function TableHeaderCell(p) {
123
123
  /** 排序 */
124
124
  var handleSort = useCallback(function (_sort) {
125
125
  if (column.sortable === 'custom' && sortProp && _sort) {
126
- var _data = onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange({
126
+ onSortChange === null || onSortChange === void 0 || onSortChange({
127
127
  column: column,
128
128
  prop: sortProp,
129
129
  order: _sort
130
130
  });
131
- if (_data && _data instanceof Array) {
132
- try {
133
- setData(mergeTreeData(initialData.current, treeNodes.current, treeProps, rowKey));
134
- } catch (error) {
135
- // eslint-disable-next-line no-console
136
- console.warn('warning: 返回的数据似乎有问题');
137
- }
138
- } else {
139
- // eslint-disable-next-line no-console
140
- console.warn('warning: 返回的数据格式有问题');
141
- }
131
+ // if (_data && _data instanceof Array) {
132
+ // try {
133
+ // setData(mergeTreeData(initialData.current, treeNodes.current, treeProps, rowKey));
134
+ // } catch (error) {
135
+ // // eslint-disable-next-line no-console
136
+ // console.warn('warning: 返回的数据似乎有问题');
137
+ // }
138
+ // } else {
139
+ // // eslint-disable-next-line no-console
140
+ // console.warn('warning: 返回的数据格式有问题');
141
+ // }
142
142
  } else if (column.sortMethod) {
143
- var _data2 = initialData.current.sort(function (a, b) {
143
+ var _data = initialData.current.sort(function (a, b) {
144
144
  return column.sortMethod(a, b);
145
145
  });
146
- setData(mergeTreeData(_data2, treeNodes.current, treeProps, rowKey));
146
+ setData(mergeTreeData(_data, treeNodes.current, treeProps, rowKey));
147
147
  } else if (isEmpty(_sort)) {
148
148
  // 没有排序,恢复到原始顺序
149
149
  setData(mergeTreeData(initialData.current, treeNodes.current, treeProps, rowKey));
150
150
  } else {
151
- var _data3 = sortBy(initialData.current, column.sortBy ? column.sortBy : column.prop || column.name);
152
- sortedData.current = _sort === 'descending' ? _data3.reverse() : _data3;
151
+ var _data2 = sortBy(initialData.current, column.sortBy ? column.sortBy : column.prop || column.name);
152
+ sortedData.current = _sort === 'descending' ? _data2.reverse() : _data2;
153
153
  setData(mergeTreeData(sortedData.current, treeNodes.current, treeProps, rowKey));
154
154
  }
155
155
  }, [column, sortProp, onSortChange, initialData, setData, treeNodes, treeProps, rowKey, sortedData]);
@@ -1,12 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TableColumnCtx, TableColumnProps, TableProps, TableRefs, TreeNode } from '../typings';
3
- /**
4
- * @author Parker
5
- * @CreateTime 2022/9/11 12:24:23
6
- * @LastEditor Parker
7
- * @LastEditor Parker
8
- * @ModifyTime 2022/11/19 23:23:42
9
- */
10
3
  export declare const useTable: <T extends object>(props: TableProps<T>, refs: TableRefs, tableId: string) => {
11
4
  data: T[];
12
5
  setData: React.Dispatch<React.SetStateAction<T[]>>;
@@ -18,16 +18,8 @@ import { isNotEmpty } from "../../Util";
18
18
  import { useChildrenInstance } from "../../hooks";
19
19
  import { flatTreeData } from "../treeUtil";
20
20
  import { TableIdManager, getRowIdentity } from "../util";
21
-
22
- /**
23
- * @author Parker
24
- * @CreateTime 2022/9/11 12:24:23
25
- * @LastEditor Parker
26
- * @LastEditor Parker
27
- * @ModifyTime 2022/11/19 23:23:42
28
- */
29
21
  export var useTable = function useTable(props, refs, tableId) {
30
- var getChildren = useChildrenInstance('TableColumn');
22
+ var getChildren = useChildrenInstance('ElTableColumn');
31
23
  var _children = getChildren(props.children);
32
24
  var maxLevel = useRef(0);
33
25
  var flatColumns = useRef([]);
@@ -160,7 +160,7 @@ export interface TableEvents<T> {
160
160
  column: TableColumnCtx<T>;
161
161
  prop: string;
162
162
  order: 'ascending' | 'descending';
163
- }) => T[];
163
+ }) => void;
164
164
  /** column 的 key, 如果需要使用 filterChange 事件,则需要此属性标识是哪个 column 的筛选条件 */
165
165
  onFilterChange?: (filters: any) => void;
166
166
  /** 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlightCurrentRow 属性 */
@@ -66,5 +66,5 @@ var TabPane = /*#__PURE__*/forwardRef(function (props, ref) {
66
66
  return main;
67
67
  }
68
68
  });
69
- TabPane.displayName = 'TabPane';
69
+ TabPane.displayName = 'ElTabPane';
70
70
  export default TabPane;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import { TabsProps } from './typings';
3
- declare const Tabs: FC<TabsProps>;
3
+ declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
4
4
  export default Tabs;
package/dist/Tabs/Tabs.js CHANGED
@@ -28,6 +28,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
28
28
  classPrefix = _props$classPrefix === void 0 ? 'tabs' : _props$classPrefix,
29
29
  children = props.children,
30
30
  onTabClick = props.onTabClick,
31
+ onTabChange = props.onTabChange,
31
32
  beforeLeave = props.beforeLeave,
32
33
  center = props.center,
33
34
  editable = props.editable,
@@ -82,7 +83,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
82
83
  // const [barStyle, setBarStyle] = useState<JSX.CSSProperties>({});
83
84
 
84
85
  /** 获取子组件 */
85
- var getTabPaneInstance = useChildrenInstance('TabPane');
86
+ var getTabPaneInstance = useChildrenInstance('ElTabPane');
86
87
 
87
88
  /** 获取TabPane组件中的配置数据 */
88
89
  var navs = useMemo(function () {
@@ -229,12 +230,15 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
229
230
  // [sizeName === 'offsetWidth' ? 'width' : 'height']: `${tabSize}px`,
230
231
  // transform: `translate${sizeDir}(${offset}px)`,
231
232
  // });
232
- }, [sizeName, children]);
233
+ }, [sizeName, e, children]);
233
234
 
234
235
  /** 激活标签页 */
235
236
  var changeCurrentName = useCallback(function (item) {
236
237
  var _item$closable;
237
238
  setActiveName(item === null || item === void 0 ? void 0 : item.name);
239
+ if (item !== null && item !== void 0 && item.name && activeName !== item.name) {
240
+ onTabChange === null || onTabChange === void 0 || onTabChange(item.name);
241
+ }
238
242
  onTabClick === null || onTabClick === void 0 || onTabClick({
239
243
  paneName: item === null || item === void 0 ? void 0 : item.name,
240
244
  active: item === null || item === void 0 ? void 0 : item.active,
@@ -242,7 +246,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
242
246
  isClosable: (_item$closable = item === null || item === void 0 ? void 0 : item.closable) !== null && _item$closable !== void 0 ? _item$closable : false,
243
247
  props: item.props
244
248
  });
245
- }, [onTabClick, setActiveName]);
249
+ }, [activeName, onTabChange, onTabClick, setActiveName]);
246
250
 
247
251
  /**
248
252
  * 点击标签页方法
@@ -371,5 +375,5 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
371
375
  ref: ref
372
376
  }, tabPosition === 'bottom' ? content : header, tabPosition === 'bottom' ? header : content));
373
377
  });
374
- Tabs.displayName = 'Tabs';
378
+ Tabs.displayName = 'ElTabs';
375
379
  export default Tabs;
@@ -35,6 +35,8 @@ export interface TabsProps extends BaseProps, NativeProps<'--el-tabs-header-heig
35
35
  onTabAdd?: () => void;
36
36
  /** 点击 tab 移除按钮时触发 */
37
37
  onTabRemove?: (name: TabPaneName | undefined) => void;
38
+ /** `activeName` 改变时触发 */
39
+ onTabChange?: (name: TabPaneName | undefined) => void;
38
40
  /** 鼠标右键点击 tab 时触发 */
39
41
  formatter?: (name: TabPaneName | undefined) => void;
40
42
  }
package/dist/Tag/Tag.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { TagProps } from './typings';
3
- declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLElement>>;
3
+ declare const Tag: React.MemoExoticComponent<React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLElement>>>;
4
4
  export default Tag;
package/dist/Tag/Tag.js CHANGED
@@ -15,18 +15,18 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import classNames from 'classnames';
17
17
  import { useComposeRef } from 'rc-util/lib/ref';
18
- import React, { forwardRef, useCallback, useRef } from 'react';
18
+ import React, { forwardRef, memo, useCallback, useRef } from 'react';
19
19
  import Icon from "../Icon/Icon";
20
20
  import Transition from "../Transition/Transition";
21
21
  import { partitionHTMLProps, useClassNames } from "../hooks";
22
- var Tag = /*#__PURE__*/forwardRef(function (props, ref) {
22
+ var Tag = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  var _props$type = props.type,
24
24
  type = _props$type === void 0 ? 'primary' : _props$type,
25
25
  closable = props.closable,
26
26
  size = props.size,
27
27
  color = props.color,
28
- _props$theme = props.theme,
29
- theme = _props$theme === void 0 ? 'light' : _props$theme,
28
+ _props$effect = props.effect,
29
+ theme = _props$effect === void 0 ? 'light' : _props$effect,
30
30
  round = props.round,
31
31
  hit = props.hit,
32
32
  _props$classPrefix = props.classPrefix,
@@ -82,6 +82,6 @@ var Tag = /*#__PURE__*/forwardRef(function (props, ref) {
82
82
  className: e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["close"]))),
83
83
  onClick: onCloseTag
84
84
  })));
85
- });
85
+ }));
86
86
  Tag.displayName = 'ElTag';
87
87
  export default Tag;
@@ -16,7 +16,7 @@ export interface TagProps extends Omit<TooltipBaseProps<HTMLSpanElement>, 'onCli
16
16
  /** 尺寸 */
17
17
  size?: TypeAttributes.Size;
18
18
  /** 主题 */
19
- theme?: 'dark' | 'light' | 'plain';
19
+ effect?: 'dark' | 'light' | 'plain';
20
20
  /** 点击 Tag 时触发的事件 */
21
21
  onClick?: (e?: React.MouseEvent<HTMLSpanElement>) => void;
22
22
  /** 关闭 Tag 时触发的事件 */
@@ -11,4 +11,5 @@ var TimeLine = function TimeLine(props) {
11
11
  style: props.style
12
12
  }, props.children);
13
13
  };
14
+ TimeLine.displayName = 'ElTimeLine';
14
15
  export default TimeLine;
@@ -67,4 +67,5 @@ var TimeLineItem = function TimeLineItem(props) {
67
67
  className: classNames(e(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["timestamp"]))), is(placement))
68
68
  }, timestamp)));
69
69
  };
70
+ TimeLineItem.displayName = 'ElTimeLineItem';
70
71
  export default TimeLineItem;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IconName } from '../Icon';
3
- import { BaseProps, NativeProps } from '../types/common';
3
+ import { BaseProps, NativeProps, TypeAttributes } from '../types/common';
4
4
  export type TimeLineProps = BaseProps & NativeProps<'--el-timeline-node-size-normal' | '--el-timeline-node-size-large' | '--el-timeline-timestamp-color' | '--el-timeline-content-color' | '--el-timeline-content-font-size-small' | '--el-timeline-content-font-size-large' | '--el-timeline-node-color'>;
5
5
  export type TimeLineItemProps = BaseProps & NativeProps & {
6
6
  /** 时间戳 */
@@ -12,7 +12,7 @@ export type TimeLineItemProps = BaseProps & NativeProps & {
12
12
  /** 时间戳位置 */
13
13
  placement?: 'top' | 'bottom';
14
14
  /** 节点类型 */
15
- type?: 'primary' | 'success' | 'warning' | 'error' | 'info';
15
+ type?: TypeAttributes.Appearance;
16
16
  /** 节点颜色 */
17
17
  color?: string;
18
18
  /** 节点尺寸 */
@@ -1,10 +1,3 @@
1
- /**
2
- * @author Element Plus
3
- * @CreateTime 2022/4/1 09:09:12
4
- * @LastEditor Parker
5
- * @ModifyTime 2022/4/6 14:44:01
6
- * @Description Element Plus 时间选择面板工具类,见https://github.com/element-plus/element-plus
7
- */
8
1
  import { Compare, DisabledHours, DisabledMinutes, DisabledSeconds, RoleType } from './typings';
9
2
  export declare const getTimeLists: (disabledHours: DisabledHours, disabledMinutes: DisabledMinutes, disabledSeconds: DisabledSeconds) => {
10
3
  getHoursList: (role: RoleType, compare?: Compare) => boolean[];
@@ -1,11 +1,4 @@
1
- /**
2
- * @author Element Plus
3
- * @CreateTime 2022/4/1 09:09:12
4
- * @LastEditor Parker
5
- * @ModifyTime 2022/4/6 14:44:01
6
- * @Description Element Plus 时间选择面板工具类,见https://github.com/element-plus/element-plus
7
- */
8
-
1
+ // Element Plus 时间选择面板工具类
9
2
  import filter from 'lodash/filter';
10
3
  var makeList = function makeList(total, method, methodFunc) {
11
4
  var arr = [];
@@ -12,6 +12,6 @@ export declare const useHandlers: (props: Omit<UploadProps, 'fileList'> & {
12
12
  handleProgress: (evt: import("./typings").UploadProgressEvent, rawFile: UploadRawFile) => void;
13
13
  handleStart: (rawFile: UploadRawFile) => void;
14
14
  handleSuccess: (response: any, rawFile: UploadRawFile) => unknown;
15
- handleRemove: (file: UploadRawFile | UploadFile) => void;
15
+ handleRemove: (file: UploadFile | UploadRawFile) => void;
16
16
  submit: () => void;
17
17
  };
@@ -2,10 +2,6 @@ import { TransitionProps } from '../Transition';
2
2
  export declare const animationAllProps: string[];
3
3
  /**
4
4
  * Returns an array of objects consisting of: props of html input element and rest.
5
- * @author Parker
6
- * @CreateTime 2022/4/8 17:46:40
7
- * @LastEditor Parker
8
- * @ModifyTime 2022/4/22 15:38:45
9
5
  * @param {object} props A ReactElement props object
10
6
  * @param {Object} [options={}]
11
7
  * @param {Array} [options.htmlProps] An array of html input props
@@ -5,10 +5,6 @@ export var animationAllProps = ['transitionAppear', 'unmountOnExit', 'beforeEnte
5
5
 
6
6
  /**
7
7
  * Returns an array of objects consisting of: props of html input element and rest.
8
- * @author Parker
9
- * @CreateTime 2022/4/8 17:46:40
10
- * @LastEditor Parker
11
- * @ModifyTime 2022/4/22 15:38:45
12
8
  * @param {object} props A ReactElement props object
13
9
  * @param {Object} [options={}]
14
10
  * @param {Array} [options.htmlProps] An array of html input props
@@ -2,10 +2,6 @@ import { PopperProps } from '../Popper';
2
2
  export declare const popperAllProps: string[];
3
3
  /**
4
4
  * Returns an array of objects consisting of: props of html input element and rest.
5
- * @author Parker
6
- * @CreateTime 2022/4/8 17:46:40
7
- * @LastEditor Parker
8
- * @ModifyTime 2025/2/22 11:48:08
9
5
  * @param {object} props A ReactElement props object
10
6
  * @param {Object} [options={}]
11
7
  * @param {Array} [options.htmlProps] An array of html input props
@@ -5,10 +5,6 @@ export var popperAllProps = ['popperInstRef', 'offset', 'placement', 'arrowOffse
5
5
 
6
6
  /**
7
7
  * Returns an array of objects consisting of: props of html input element and rest.
8
- * @author Parker
9
- * @CreateTime 2022/4/8 17:46:40
10
- * @LastEditor Parker
11
- * @ModifyTime 2025/2/22 11:48:08
12
8
  * @param {object} props A ReactElement props object
13
9
  * @param {Object} [options={}]
14
10
  * @param {Array} [options.htmlProps] An array of html input props
@@ -2,10 +2,6 @@ import React from 'react';
2
2
  import { ComponentChildren } from '../types/common';
3
3
  /**
4
4
  * 获取特定名称的子组件
5
- * @author Parker
6
- * @CreateTime 2022/3/30下午2:08:36
7
- * @LastEditor Parker
8
- * @ModifyTime 2022/9/23 14:44:20
9
5
  * @param componentChildren 子组件
10
6
  * @param compName 目标组件名称 (`displayName`属性)
11
7
  * @param virtualCompName 子组件中的需要继续乡下递归查找的组件名称(`displayName`属性)
@@ -7,10 +7,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7
7
  import { Children, Fragment, useCallback, useRef } from 'react';
8
8
  /**
9
9
  * 获取特定名称的子组件
10
- * @author Parker
11
- * @CreateTime 2022/3/30下午2:08:36
12
- * @LastEditor Parker
13
- * @ModifyTime 2022/9/23 14:44:20
14
10
  * @param componentChildren 子组件
15
11
  * @param compName 目标组件名称 (`displayName`属性)
16
12
  * @param virtualCompName 子组件中的需要继续乡下递归查找的组件名称(`displayName`属性)