linkmore-design 1.0.88 → 1.0.90

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 (65) hide show
  1. package/dist/LmEditTable/EditTable.d.ts +1 -0
  2. package/dist/Modal/index.d.ts +1 -0
  3. package/dist/Select/index.d.ts +2 -9
  4. package/dist/Tabs/TabPane.d.ts +5 -0
  5. package/dist/Tabs/hooks/useAnimateConfig.d.ts +3 -0
  6. package/dist/Tabs/hooks/useLegacyItems.d.ts +4 -0
  7. package/dist/Tabs/index.d.ts +21 -10
  8. package/dist/Tabs/index.old.d.ts +12 -0
  9. package/dist/index.d.ts +0 -2
  10. package/dist/index.umd.js +32861 -30078
  11. package/dist/index.umd.min.js +21 -21
  12. package/es/LmEditTable/EditTable.d.ts +1 -0
  13. package/es/LmEditTable/EditTable.js +26 -10
  14. package/es/LmTable/Table.js +1 -1
  15. package/es/LmTable/util.js +70 -21
  16. package/es/Modal/index.d.ts +1 -0
  17. package/es/Modal/index.js +8 -3
  18. package/es/Select/index.d.ts +2 -9
  19. package/es/Tabs/TabPane.d.ts +5 -0
  20. package/es/Tabs/TabPane.js +9 -0
  21. package/es/Tabs/hooks/useAnimateConfig.d.ts +3 -0
  22. package/es/Tabs/hooks/useAnimateConfig.js +38 -0
  23. package/es/Tabs/hooks/useLegacyItems.d.ts +4 -0
  24. package/es/Tabs/hooks/useLegacyItems.js +50 -0
  25. package/es/Tabs/index.d.ts +21 -10
  26. package/es/Tabs/index.js +73 -19
  27. package/es/Tabs/index.old.d.ts +12 -0
  28. package/es/Tabs/index.old.js +38 -0
  29. package/es/Tabs/style/index.css +40 -0
  30. package/es/index.d.ts +0 -2
  31. package/es/index.js +0 -1
  32. package/lib/LmEditTable/EditTable.d.ts +1 -0
  33. package/lib/LmEditTable/EditTable.js +25 -10
  34. package/lib/LmTable/Table.js +1 -1
  35. package/lib/LmTable/util.js +70 -21
  36. package/lib/Modal/index.d.ts +1 -0
  37. package/lib/Modal/index.js +9 -3
  38. package/lib/Select/index.d.ts +2 -9
  39. package/lib/Tabs/TabPane.d.ts +5 -0
  40. package/lib/Tabs/TabPane.js +17 -0
  41. package/lib/Tabs/hooks/useAnimateConfig.d.ts +3 -0
  42. package/lib/Tabs/hooks/useAnimateConfig.js +50 -0
  43. package/lib/Tabs/hooks/useLegacyItems.d.ts +4 -0
  44. package/lib/Tabs/hooks/useLegacyItems.js +63 -0
  45. package/lib/Tabs/index.d.ts +21 -10
  46. package/lib/Tabs/index.js +84 -19
  47. package/lib/Tabs/index.old.d.ts +12 -0
  48. package/lib/Tabs/index.old.js +52 -0
  49. package/lib/Tabs/style/index.css +40 -0
  50. package/lib/index.d.ts +0 -2
  51. package/lib/index.js +0 -8
  52. package/package.json +2 -2
  53. package/dist/InputRange/demos/basic.d.ts +0 -2
  54. package/dist/InputRange/index.d.ts +0 -8
  55. package/dist/InputRange/style/index.d.ts +0 -1
  56. package/es/InputRange/index.d.ts +0 -8
  57. package/es/InputRange/index.js +0 -67
  58. package/es/InputRange/style/index.css +0 -511
  59. package/es/InputRange/style/index.d.ts +0 -1
  60. package/es/InputRange/style/index.js +0 -1
  61. package/lib/InputRange/index.d.ts +0 -8
  62. package/lib/InputRange/index.js +0 -79
  63. package/lib/InputRange/style/index.css +0 -511
  64. package/lib/InputRange/style/index.d.ts +0 -1
  65. package/lib/InputRange/style/index.js +0 -3
@@ -18,6 +18,7 @@ interface ILmEditTable extends TableProps<any> {
18
18
  creatorButtonText?: string;
19
19
  style?: Record<string, any>;
20
20
  initData?: Record<string, any> | (() => Record<string, any>);
21
+ customAddClick?: () => void;
21
22
  };
22
23
  /** 是否为强制更新 */
23
24
  shouldUpdate?: boolean;
@@ -139,14 +139,18 @@ var InputRange = function InputRange(_a) {
139
139
  var _a$value = _a.value,
140
140
  value = _a$value === void 0 ? ['', ''] : _a$value,
141
141
  onChange = _a.onChange,
142
- editEnum = __rest(_a, ["value", "onChange"]); // 输入值改变
142
+ record = _a.record,
143
+ rowIndex = _a.rowIndex,
144
+ colIndex = _a.colIndex,
145
+ validator = _a.validator,
146
+ editEnum = __rest(_a, ["value", "onChange", "record", "rowIndex", "colIndex", "validator"]); // 输入值改变
143
147
 
144
148
 
145
- var nValue = _toConsumableArray(value);
146
-
147
149
  var handleInput = function handleInput(e, type) {
148
150
  var v = e.target.value;
149
151
 
152
+ var nValue = _toConsumableArray(value);
153
+
150
154
  if (type === 'prev') {
151
155
  nValue[0] = v;
152
156
  }
@@ -154,10 +158,14 @@ var InputRange = function InputRange(_a) {
154
158
  if (type === 'next') {
155
159
  nValue[1] = v;
156
160
  }
157
- };
158
161
 
159
- var handleBlur = function handleBlur() {
160
- onChange(nValue);
162
+ if (isFunction(validator)) {
163
+ if (validator(record, nValue, rowIndex, colIndex)) {
164
+ onChange(nValue);
165
+ }
166
+ } else {
167
+ onChange(nValue);
168
+ }
161
169
  };
162
170
 
163
171
  return /*#__PURE__*/React.createElement("div", {
@@ -167,14 +175,12 @@ var InputRange = function InputRange(_a) {
167
175
  }, /*#__PURE__*/React.createElement(Input, Object.assign({
168
176
  value: value === null || value === void 0 ? void 0 : value[0],
169
177
  placeholder: "\u8BF7\u8F93\u5165",
170
- onBlur: handleBlur,
171
178
  onChange: function onChange(e) {
172
179
  return handleInput(e, 'prev');
173
180
  }
174
181
  }, editEnum)), "~", /*#__PURE__*/React.createElement(Input, Object.assign({
175
182
  value: value === null || value === void 0 ? void 0 : value[1],
176
183
  placeholder: "\u8BF7\u8F93\u5165",
177
- onBlur: handleBlur,
178
184
  onChange: function onChange(e) {
179
185
  return handleInput(e, 'next');
180
186
  }
@@ -422,7 +428,11 @@ var EditableCell = function EditableCell(props) {
422
428
  return /*#__PURE__*/React.createElement(InputRange, Object.assign({
423
429
  onChange: handleFormItemChange,
424
430
  ref: inputRef
425
- }, resultComponentProps));
431
+ }, resultComponentProps, {
432
+ record: record,
433
+ rowIndex: rowIndex,
434
+ colIndex: colIndex
435
+ }));
426
436
 
427
437
  case 'number':
428
438
  return /*#__PURE__*/React.createElement(InputNumber, Object.assign({
@@ -480,6 +490,12 @@ var EditableCell = function EditableCell(props) {
480
490
  }, resultComponentProps));
481
491
 
482
492
  case 'radio':
493
+ return /*#__PURE__*/React.createElement(Radio, Object.assign({
494
+ onChange: handleFormItemChange,
495
+ ref: inputRef
496
+ }, resultComponentProps));
497
+
498
+ case 'radioGroup':
483
499
  return /*#__PURE__*/React.createElement(Radio.Group, Object.assign({
484
500
  onChange: handleFormItemChange,
485
501
  ref: inputRef
@@ -1145,7 +1161,7 @@ var EditTable = /*#__PURE__*/forwardRef(function (props, ref) {
1145
1161
  })), isShowAddAction && /*#__PURE__*/React.createElement(Button, {
1146
1162
  className: "lm_editTable_add_bar",
1147
1163
  type: "dashed",
1148
- onClick: handleAdd,
1164
+ onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
1149
1165
  style: Object.assign({
1150
1166
  marginTop: 8
1151
1167
  }, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
@@ -926,7 +926,7 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
926
926
  var config = (0, _react.useMemo)(function () {
927
927
  return (0, _objectSpread2.default)({
928
928
  defaultSize: 'small',
929
- tableLayout: 'fixed',
929
+ tableLayout: columnKeys ? 'auto' : 'fixed',
930
930
  rowKey: rowKey,
931
931
  debounceTime: 300,
932
932
  revalidateOnFocus: false,
@@ -61,20 +61,35 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
61
61
 
62
62
 
63
63
  var columnKeysCopy = (0, _toConsumableArray2.default)(new Set(columnKeys));
64
- debugger;
64
+ /**
65
+ * @param {Array} source source数据源,树状结构,行分组会有children子级结构
66
+ * @param {Array} columns 列数据,用于表头,当列分组时会有children子级结构
67
+ * @param {Array<string>} oGroup 数组,列分组的keys值
68
+ * @param {string} markStr
69
+ * @returns
70
+ */
65
71
 
66
72
  var groupBy = function groupBy(source, columns, oGroup, markStr) {
67
73
  if (!(oGroup === null || oGroup === void 0 ? void 0 : oGroup.length)) {
68
- return columns.filter(function (c) {
69
- return columnKeysCopy.indexOf(c.dataIndex) === -1;
70
- }).map(function (item) {
71
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
72
- dataIndex: "".concat(markStr, "_").concat(item.dataIndex)
73
- });
74
+ // 表头数据的生成,生成新的 dataIndex
75
+ // dataIndex最后的i:筛选的值相同需要加索引
76
+ var handledColumns = [];
77
+ source.forEach(function (souItem, i) {
78
+ handledColumns = handledColumns.concat(columns.filter(function (c) {
79
+ // 过滤掉(表头操作) 使用列分组作为key的项
80
+ return columnKeysCopy.indexOf(c.dataIndex) === -1;
81
+ }).map(function (item) {
82
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
83
+ dataIndex: "".concat(markStr, "_").concat(item.dataIndex, "_").concat(i)
84
+ });
85
+ }));
74
86
  });
75
- }
87
+ return handledColumns;
88
+ } // 拷贝
89
+
90
+
91
+ var group = oGroup.slice(); // 获取列表的第一个值
76
92
 
77
- var group = oGroup.slice();
78
93
  var filterKey = group.shift();
79
94
  var map = dataGroup(source, filterKey);
80
95
  return Object.keys(map).map(function (item) {
@@ -88,20 +103,54 @@ function transformWithColGroup(columns, dataSource, columnKeys) {
88
103
  };
89
104
 
90
105
  var tempColumns = groupBy(dataSourceCopy, columnsCopy, columnKeysCopy, null);
91
- var tempDataSource = [dataSourceCopy.reduce(function (prev, cur) {
92
- var str = '';
93
- columnKeysCopy.forEach(function (dataIndex, i) {
94
- if (i !== 0) {
95
- str += '_';
106
+
107
+ var dataSourceBy = function dataSourceBy(source) {
108
+ var keyMap = new Map();
109
+ return [source.reduce(function (prev, sItem) {
110
+ if (sItem.children && sItem.children.length) {
111
+ sItem.children = dataSourceBy(sItem.children);
112
+
113
+ if (!prev) {
114
+ prev = [];
115
+ }
116
+
117
+ return [].concat((0, _toConsumableArray2.default)(prev), [sItem]);
118
+ } else {
119
+ var str = ''; // 根据筛选条件生成对应的前缀key值,比如[name, age] => 'name_xiaoming_age_18'
120
+
121
+ columnKeysCopy.forEach(function (dataIndex, i) {
122
+ if (i !== 0) {
123
+ str += '_';
124
+ }
125
+
126
+ str += "".concat(dataIndex, "_").concat(sItem[dataIndex]);
127
+ }); // 对dataSource的key值进行更改:例如:'name' => 'name_xiaoming_age_18_address'
128
+
129
+ Object.keys(sItem).forEach(function (key) {
130
+ var newKey = "".concat(str, "_").concat(key);
131
+
132
+ if (keyMap.has(newKey)) {
133
+ var value = keyMap.get(newKey) + 1;
134
+ keyMap.set(newKey, value);
135
+ newKey = "".concat(newKey, "_").concat(value);
136
+ } else {
137
+ keyMap.set(newKey, 0);
138
+ newKey = "".concat(newKey, "_", 0);
139
+ }
140
+
141
+ sItem[newKey] = sItem[key];
142
+ });
96
143
  }
97
144
 
98
- str += "".concat(dataIndex, "_").concat(cur[dataIndex]);
99
- });
100
- Object.keys(cur).forEach(function (key) {
101
- cur["".concat(str, "_").concat(key)] = cur[key];
102
- });
103
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), cur);
104
- }, {})];
145
+ if (!prev) {
146
+ prev = {};
147
+ }
148
+
149
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), sItem);
150
+ }, null)];
151
+ };
152
+
153
+ var tempDataSource = dataSourceBy(dataSourceCopy).flat();
105
154
  return {
106
155
  columns: tempColumns,
107
156
  dataSource: tempDataSource
@@ -3,6 +3,7 @@ import { ModalProps } from 'antd';
3
3
  export interface ILMModalProps extends ModalProps {
4
4
  wrapClassName?: string;
5
5
  size?: 'default' | 'small';
6
+ open?: boolean;
6
7
  }
7
8
  declare const LMModal: React.FC<ILMModalProps> & React.FC<ModalProps> & import("antd/lib/modal/confirm").ModalStaticFunctions & {
8
9
  useModal: typeof import("antd/lib/modal/useModal").default;
package/es/Modal/index.js CHANGED
@@ -17,6 +17,7 @@ var __rest = this && this.__rest || function (s, e) {
17
17
  import React from 'react';
18
18
  import Button from '../Button';
19
19
  import classNames from 'classnames';
20
+ import SizeContext from '../ConfigProvider/SizeContext';
20
21
  var prefixCls = 'lm_modal';
21
22
 
22
23
  var CLMModal = function CLMModal(props) {
@@ -29,25 +30,29 @@ var CLMModal = function CLMModal(props) {
29
30
  okText = _props$okText === void 0 ? '确定' : _props$okText,
30
31
  _props$cancelText = props.cancelText,
31
32
  cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
32
- other = __rest(props, ["wrapClassName", "size", "onOk", "onCancel", "okText", "cancelText"]);
33
+ visible = props.visible,
34
+ open = props.open,
35
+ other = __rest(props, ["wrapClassName", "size", "onOk", "onCancel", "okText", "cancelText", "visible", "open"]);
33
36
 
37
+ var defaultFooterSize = React.useContext(SizeContext) || 'middle';
34
38
  return /*#__PURE__*/React.createElement(_Modal, Object.assign({
35
39
  wrapClassName: classNames(wrapClassName, prefixCls),
36
40
  width: size === 'default' ? 552 : 416,
37
41
  footer: [/*#__PURE__*/React.createElement(Button, {
38
42
  onClick: onCancel,
39
43
  key: 'canncel_button',
40
- size: 'middle'
44
+ size: defaultFooterSize
41
45
  }, cancelText), /*#__PURE__*/React.createElement(Button, {
42
46
  type: "primary",
43
47
  onClick: onOk,
44
48
  key: 'ok_button',
45
- size: 'middle'
49
+ size: defaultFooterSize
46
50
  }, okText)]
47
51
  }, other, {
48
52
  onOk: onOk,
49
53
  onCancel: onCancel,
50
54
  okText: okText,
55
+ visible: visible || open,
51
56
  cancelText: cancelText
52
57
  }));
53
58
  };
@@ -6,13 +6,6 @@ export interface ISelectProps extends SelectProps {
6
6
  Option?: typeof Select.Option;
7
7
  OptGroup?: typeof Select.OptGroup;
8
8
  }
9
- declare const LMSelect: (<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
10
- children?: React.ReactNode;
11
- } & {
12
- ref?: React.Ref<import("antd").RefSelectProps>;
13
- }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
14
- SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
15
- Option: import("rc-select/lib/Option").OptionFC;
16
- OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
17
- };
9
+ declare type SelectType = typeof Select & typeof Select.Option & typeof Select.OptGroup;
10
+ declare const LMSelect: SelectType;
18
11
  export default LMSelect;
@@ -0,0 +1,5 @@
1
+ import type * as React from 'react';
2
+ import type { TabPaneProps } from 'rc-tabs/lib/TabPanelList/TabPane';
3
+ declare const TabPane: React.FC<TabPaneProps>;
4
+ export { TabPaneProps };
5
+ export default TabPane;
@@ -0,0 +1,9 @@
1
+ var TabPane = function TabPane() {
2
+ return null;
3
+ };
4
+
5
+ if (process.env.NODE_ENV !== 'production') {
6
+ TabPane.displayName = 'DeprecatedTabPane';
7
+ }
8
+
9
+ export default TabPane;
@@ -0,0 +1,3 @@
1
+ import type { AnimatedConfig } from 'rc-tabs/lib/interface';
2
+ import type { TabsProps } from '..';
3
+ export default function useAnimateConfig(prefixCls: string, animated?: TabsProps['animated']): AnimatedConfig;
@@ -0,0 +1,38 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import { getTransitionName } from '../../_util/motion';
3
+ var motion = {
4
+ motionAppear: false,
5
+ motionEnter: true,
6
+ motionLeave: true
7
+ };
8
+ export default function useAnimateConfig(prefixCls) {
9
+ var animated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
10
+ inkBar: true,
11
+ tabPane: false
12
+ };
13
+ var mergedAnimated;
14
+
15
+ if (animated === false) {
16
+ mergedAnimated = {
17
+ inkBar: false,
18
+ tabPane: false
19
+ };
20
+ } else if (animated === true) {
21
+ mergedAnimated = {
22
+ inkBar: true,
23
+ tabPane: true
24
+ };
25
+ } else {
26
+ mergedAnimated = Object.assign({
27
+ inkBar: true
28
+ }, _typeof(animated) === 'object' ? animated : {});
29
+ }
30
+
31
+ if (mergedAnimated.tabPane) {
32
+ mergedAnimated.tabPaneMotion = Object.assign(Object.assign({}, motion), {
33
+ motionName: getTransitionName(prefixCls, 'switch')
34
+ });
35
+ }
36
+
37
+ return mergedAnimated;
38
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import type { Tab } from 'rc-tabs/lib/interface';
3
+ import type { TabsProps } from '..';
4
+ export default function useLegacyItems(items?: TabsProps['items'], children?: React.ReactNode): Tab[];
@@ -0,0 +1,50 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+
4
+ for (var p in s) {
5
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ }
7
+
8
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+
14
+ import * as React from 'react';
15
+ import toArray from 'rc-util/lib/Children/toArray';
16
+ import warning from '../../_util/warning';
17
+
18
+ function filter(items) {
19
+ return items.filter(function (item) {
20
+ return item;
21
+ });
22
+ }
23
+
24
+ export default function useLegacyItems(items, children) {
25
+ if (items) {
26
+ return items;
27
+ }
28
+
29
+ warning(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.');
30
+ var childrenItems = toArray(children).map(function (node) {
31
+ if ( /*#__PURE__*/React.isValidElement(node)) {
32
+ var key = node.key,
33
+ props = node.props;
34
+
35
+ var _a = props || {},
36
+ tab = _a.tab,
37
+ restProps = __rest(_a, ["tab"]);
38
+
39
+ var item = Object.assign(Object.assign({
40
+ key: String(key)
41
+ }, restProps), {
42
+ label: tab
43
+ });
44
+ return item;
45
+ }
46
+
47
+ return null;
48
+ });
49
+ return filter(childrenItems);
50
+ }
@@ -1,12 +1,23 @@
1
- import React from 'react';
2
- import { Tabs, TabsProps } from 'antd';
3
- export interface ITabsProps extends TabsProps {
4
- className?: string;
5
- style?: React.CSSProperties;
6
- noBorder?: Boolean;
1
+ import type { TabsProps as RcTabsProps } from 'rc-tabs';
2
+ import * as React from 'react';
3
+ import type { SizeType } from '../ConfigProvider/SizeContext';
4
+ import { TabPaneProps } from './TabPane';
5
+ export declare type TabsType = 'line' | 'card' | 'editable-card';
6
+ export declare type TabsPosition = 'top' | 'right' | 'bottom' | 'left';
7
+ export type { TabPaneProps };
8
+ export interface TabsProps extends Omit<RcTabsProps, 'editable'> {
9
+ type?: TabsType;
10
+ size?: SizeType;
11
+ hideAdd?: boolean;
12
+ centered?: boolean;
13
+ addIcon?: React.ReactNode;
14
+ onEdit?: (e: React.MouseEvent | React.KeyboardEvent | string, action: 'add' | 'remove') => void;
15
+ children?: React.ReactNode;
16
+ noBorder?: boolean;
7
17
  }
8
- interface LmTabsInterface extends React.FC<ITabsProps> {
9
- TabPane?: typeof Tabs.TabPane;
18
+ declare function Tabs({ type, className, size: propSize, onEdit, hideAdd, centered, addIcon, children, items, animated, ...props }: TabsProps): JSX.Element;
19
+ declare namespace Tabs {
20
+ var TabPane: React.FC<TabPaneProps>;
21
+ var AntdTabs: typeof import("antd/lib/tabs").default;
10
22
  }
11
- declare const LMTabs: LmTabsInterface;
12
- export default LMTabs;
23
+ export default Tabs;
package/es/Tabs/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import "antd/es/tabs/style";
2
2
  import _Tabs from "antd/es/tabs";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
4
 
4
5
  var __rest = this && this.__rest || function (s, e) {
5
6
  var t = {};
@@ -14,25 +15,78 @@ var __rest = this && this.__rest || function (s, e) {
14
15
  return t;
15
16
  };
16
17
 
17
- import React from 'react';
18
+ import CloseOutlined from '@ant-design/icons/CloseOutlined';
19
+ import EllipsisOutlined from '@ant-design/icons/EllipsisOutlined';
20
+ import PlusOutlined from '@ant-design/icons/PlusOutlined';
18
21
  import classNames from 'classnames';
22
+ import RcTabs from 'rc-tabs';
23
+ import * as React from 'react';
24
+ import { ConfigContext } from '../ConfigProvider';
19
25
  import SizeContext from '../ConfigProvider/SizeContext';
20
- var prefixCls = 'lm_tabs';
21
-
22
- var LMTabs = function LMTabs(props) {
23
- var className = props.className,
24
- customizeSize = props.size,
25
- _props$noBorder = props.noBorder,
26
- noBorder = _props$noBorder === void 0 ? false : _props$noBorder,
27
- others = __rest(props, ["className", "size", "noBorder"]);
28
-
29
- var size = customizeSize || React.useContext(SizeContext) || 'middle';
30
- return /*#__PURE__*/React.createElement(_Tabs, Object.assign({
31
- size: size
32
- }, others, {
33
- className: classNames(className, prefixCls, noBorder && 'lm_tabs_noborder')
34
- }));
35
- };
26
+ import warning from '../_util/warning';
27
+ import useAnimateConfig from './hooks/useAnimateConfig';
28
+ import useLegacyItems from './hooks/useLegacyItems';
29
+ import TabPane from './TabPane';
30
+
31
+ function Tabs(_a) {
32
+ var type = _a.type,
33
+ className = _a.className,
34
+ propSize = _a.size,
35
+ _onEdit = _a.onEdit,
36
+ hideAdd = _a.hideAdd,
37
+ centered = _a.centered,
38
+ addIcon = _a.addIcon,
39
+ children = _a.children,
40
+ items = _a.items,
41
+ animated = _a.animated,
42
+ props = __rest(_a, ["type", "className", "size", "onEdit", "hideAdd", "centered", "addIcon", "children", "items", "animated"]);
43
+
44
+ var customizePrefixCls = props.prefixCls,
45
+ _props$moreIcon = props.moreIcon,
46
+ moreIcon = _props$moreIcon === void 0 ? /*#__PURE__*/React.createElement(EllipsisOutlined, null) : _props$moreIcon;
47
+
48
+ var _React$useContext = React.useContext(ConfigContext),
49
+ getPrefixCls = _React$useContext.getPrefixCls,
50
+ direction = _React$useContext.direction;
51
+
52
+ var prefixCls = getPrefixCls('tabs', customizePrefixCls);
53
+ var editable;
54
+
55
+ if (type === 'editable-card') {
56
+ editable = {
57
+ onEdit: function onEdit(editType, _ref) {
58
+ var key = _ref.key,
59
+ event = _ref.event;
60
+ _onEdit === null || _onEdit === void 0 ? void 0 : _onEdit(editType === 'add' ? event : key, editType);
61
+ },
62
+ removeIcon: /*#__PURE__*/React.createElement(CloseOutlined, null),
63
+ addIcon: addIcon || /*#__PURE__*/React.createElement(PlusOutlined, null),
64
+ showAdd: hideAdd !== true
65
+ };
66
+ }
67
+
68
+ var rootPrefixCls = getPrefixCls();
69
+ warning(!('onPrevClick' in props) && !('onNextClick' in props), 'Tabs', '`onPrevClick` and `onNextClick` has been removed. Please use `onTabScroll` instead.');
70
+ var mergedItems = useLegacyItems(items, children);
71
+ var mergedAnimated = useAnimateConfig(prefixCls, animated);
72
+ return /*#__PURE__*/React.createElement(SizeContext.Consumer, null, function (contextSize) {
73
+ var _classNames;
74
+
75
+ var size = propSize !== undefined ? propSize : contextSize;
76
+ return /*#__PURE__*/React.createElement(RcTabs, Object.assign({
77
+ direction: direction,
78
+ moreTransitionName: "".concat(rootPrefixCls, "-slide-up")
79
+ }, props, {
80
+ items: mergedItems,
81
+ className: classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(size), size), _defineProperty(_classNames, "".concat(prefixCls, "-card"), ['card', 'editable-card'].includes(type)), _defineProperty(_classNames, "".concat(prefixCls, "-editable-card"), type === 'editable-card'), _defineProperty(_classNames, "".concat(prefixCls, "-centered"), centered), _classNames), 'lm_tabs', props.noBorder && 'lm_tabs_noborder', className),
82
+ editable: editable,
83
+ moreIcon: moreIcon,
84
+ prefixCls: prefixCls,
85
+ animated: mergedAnimated
86
+ }));
87
+ });
88
+ }
36
89
 
37
- LMTabs.TabPane = _Tabs.TabPane;
38
- export default LMTabs;
90
+ Tabs.TabPane = TabPane;
91
+ Tabs.AntdTabs = _Tabs;
92
+ export default Tabs;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Tabs, TabsProps } from 'antd';
3
+ export interface ITabsProps extends TabsProps {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ noBorder?: Boolean;
7
+ }
8
+ interface LmTabsInterface extends React.FC<ITabsProps> {
9
+ TabPane?: typeof Tabs.TabPane;
10
+ }
11
+ declare const LMTabs: LmTabsInterface;
12
+ export default LMTabs;
@@ -0,0 +1,38 @@
1
+ import "antd/es/tabs/style";
2
+ import _Tabs from "antd/es/tabs";
3
+
4
+ var __rest = this && this.__rest || function (s, e) {
5
+ var t = {};
6
+
7
+ for (var p in s) {
8
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
9
+ }
10
+
11
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
16
+
17
+ import React from 'react';
18
+ import classNames from 'classnames';
19
+ import SizeContext from '../ConfigProvider/SizeContext';
20
+ var prefixCls = 'lm_tabs';
21
+
22
+ var LMTabs = function LMTabs(props) {
23
+ var className = props.className,
24
+ customizeSize = props.size,
25
+ _props$noBorder = props.noBorder,
26
+ noBorder = _props$noBorder === void 0 ? false : _props$noBorder,
27
+ others = __rest(props, ["className", "size", "noBorder"]);
28
+
29
+ var size = customizeSize || React.useContext(SizeContext) || 'middle';
30
+ return /*#__PURE__*/React.createElement(_Tabs, Object.assign({
31
+ size: size
32
+ }, others, {
33
+ className: classNames(className, prefixCls, noBorder && 'lm_tabs_noborder')
34
+ }));
35
+ };
36
+
37
+ LMTabs.TabPane = _Tabs.TabPane;
38
+ export default LMTabs;
@@ -515,3 +515,43 @@ p {
515
515
  .lm_tabs.lm_tabs_noborder .ant-tabs-nav:before {
516
516
  border-bottom: 0px;
517
517
  }
518
+ .lm_tabs.ant-tabs .ant-tabs-content {
519
+ position: relative;
520
+ width: 100%;
521
+ }
522
+ .lm_tabs.ant-tabs .ant-tabs-content .ant-tabs-holder {
523
+ flex: auto;
524
+ min-width: 0;
525
+ min-height: 0;
526
+ }
527
+ .lm_tabs.ant-tabs .ant-tabs-tabpane {
528
+ outline: none;
529
+ }
530
+ .lm_tabs.ant-tabs .ant-tabs-tabpane-hidden {
531
+ display: none;
532
+ }
533
+ .lm_tabs.ant-tabs .ant-tabs-switch-appear,
534
+ .lm_tabs.ant-tabs .ant-tabs-switch-enter {
535
+ transition: none;
536
+ }
537
+ .lm_tabs.ant-tabs .ant-tabs-switch-appear-start,
538
+ .lm_tabs.ant-tabs .ant-tabs-switch-enter-start {
539
+ opacity: 0;
540
+ }
541
+ .lm_tabs.ant-tabs .ant-tabs-switch-appear-active,
542
+ .lm_tabs.ant-tabs .ant-tabs-switch-enter-active {
543
+ opacity: 1;
544
+ transition: opacity 0.3s;
545
+ }
546
+ .lm_tabs.ant-tabs .ant-tabs-switch-leave {
547
+ position: absolute;
548
+ transition: none;
549
+ inset: 0;
550
+ }
551
+ .lm_tabs.ant-tabs .ant-tabs-switch-leave-start {
552
+ opacity: 1;
553
+ }
554
+ .lm_tabs.ant-tabs .ant-tabs-switch-leave-active {
555
+ opacity: 0;
556
+ transition: opacity 0.3s;
557
+ }
package/es/index.d.ts CHANGED
@@ -117,7 +117,5 @@ export { default as Skeleton } from './Skeleton';
117
117
  export type { ISkeletonProps } from './Skeleton';
118
118
  export { default as Descriptions } from './Descriptions';
119
119
  export type { DescriptionsProps } from './Descriptions';
120
- export { default as InputRange } from './InputRange';
121
- export type { InputRangeProps } from './InputRange';
122
120
  export { default as FullScreen } from './FullScreen';
123
121
  export type { IFullScreenProps } from './FullScreen';
package/es/index.js CHANGED
@@ -78,5 +78,4 @@ export { default as Avatar } from './Avatar';
78
78
  export { default as Divider } from './Divider';
79
79
  export { default as Skeleton } from './Skeleton';
80
80
  export { default as Descriptions } from './Descriptions';
81
- export { default as InputRange } from './InputRange';
82
81
  export { default as FullScreen } from './FullScreen';