@hi-ui/tabs 4.2.0 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/lib/cjs/TabInk.js +10 -1
- package/lib/cjs/TabItem.js +131 -18
- package/lib/cjs/TabList.js +184 -12
- package/lib/cjs/Tabs.js +17 -2
- package/lib/cjs/hooks/index.js +8 -3
- package/lib/cjs/hooks/use-id/lib/esm/index.js +34 -0
- package/lib/cjs/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +16 -0
- package/lib/cjs/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +33 -0
- package/lib/cjs/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +41 -0
- package/lib/cjs/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +33 -0
- package/lib/cjs/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +19 -0
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/utils/index.js +7 -2
- package/lib/esm/TabInk.js +10 -1
- package/lib/esm/TabItem.js +131 -19
- package/lib/esm/TabList.js +184 -13
- package/lib/esm/Tabs.js +17 -2
- package/lib/esm/hooks/index.js +8 -3
- package/lib/esm/hooks/use-id/lib/esm/index.js +29 -0
- package/lib/esm/hooks/use-id/node_modules/uuid/dist/esm-browser/regex.js +11 -0
- package/lib/esm/hooks/use-id/node_modules/uuid/dist/esm-browser/rng.js +27 -0
- package/lib/esm/hooks/use-id/node_modules/uuid/dist/esm-browser/stringify.js +36 -0
- package/lib/esm/hooks/use-id/node_modules/uuid/dist/esm-browser/v4.js +28 -0
- package/lib/esm/hooks/use-id/node_modules/uuid/dist/esm-browser/validate.js +14 -0
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/utils/index.js +7 -2
- package/lib/types/TabInk.d.ts +1 -0
- package/lib/types/TabItem.d.ts +12 -2
- package/lib/types/TabList.d.ts +31 -2
- package/lib/types/Tabs.d.ts +31 -2
- package/package.json +16 -13
package/lib/types/TabList.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabPaneProps } from './TabPane';
|
|
3
|
+
import { EditActions } from './TabItem';
|
|
3
4
|
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
4
5
|
export declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
5
|
-
export interface TabListProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'onDragOver' | 'onDragStart' | 'onDrop'> {
|
|
6
|
+
export interface TabListProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'onDragOver' | 'onDragStart' | 'onDrop' | 'onCopy'> {
|
|
6
7
|
/**
|
|
7
8
|
* tabs 面板数据
|
|
8
9
|
*/
|
|
@@ -39,18 +40,46 @@ export interface TabListProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' |
|
|
|
39
40
|
* 布局类型
|
|
40
41
|
*/
|
|
41
42
|
type?: 'desc' | 'card' | 'button' | 'line';
|
|
43
|
+
/**
|
|
44
|
+
* 大小
|
|
45
|
+
*/
|
|
46
|
+
size?: 'sm' | 'md' | 'lg';
|
|
47
|
+
/**
|
|
48
|
+
* 是否显示下划线
|
|
49
|
+
*/
|
|
50
|
+
showDivider?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 标签最大宽度
|
|
53
|
+
*/
|
|
54
|
+
maxTabTitleWidth?: number;
|
|
42
55
|
/**
|
|
43
56
|
* 右侧的拓展区域
|
|
44
57
|
*/
|
|
45
58
|
extra?: React.ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* 标签编辑渲染
|
|
61
|
+
*/
|
|
62
|
+
editRender?: (item: TabPaneProps, index: number, actions: EditActions) => React.ReactNode;
|
|
46
63
|
/**
|
|
47
64
|
* 节点增加时触发
|
|
48
65
|
*/
|
|
49
66
|
onAdd?: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* 节点增加完成时触发
|
|
69
|
+
*/
|
|
70
|
+
onAdded?: (newTab: TabPaneProps) => void | boolean | Promise<boolean>;
|
|
50
71
|
/**
|
|
51
72
|
* 节点删除时时触发
|
|
52
73
|
*/
|
|
53
|
-
onDelete?: (deletedNode: TabPaneProps,
|
|
74
|
+
onDelete?: (deletedNode: TabPaneProps, evt: React.MouseEvent) => void | boolean | Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* 节点编辑时触发
|
|
77
|
+
*/
|
|
78
|
+
onEdit?: (value: string, item: TabPaneProps) => void | boolean | Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* 节点复制时触发
|
|
81
|
+
*/
|
|
82
|
+
onCopy?: (sourceItem: TabPaneProps, copiedItem: TabPaneProps, newItems: TabPaneProps[]) => void;
|
|
54
83
|
/**
|
|
55
84
|
* 节点开始拖拽时触发
|
|
56
85
|
*/
|
package/lib/types/Tabs.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabPaneProps } from './TabPane';
|
|
3
3
|
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
4
|
+
import { EditActions } from './TabItem';
|
|
4
5
|
/**
|
|
5
6
|
* Tabs 标签页
|
|
6
7
|
*/
|
|
7
8
|
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
8
|
-
export interface TabsProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'onDragOver' | 'onDragStart' | 'onDrop'> {
|
|
9
|
+
export interface TabsProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'onDragOver' | 'onDragStart' | 'onDrop' | 'onCopy'> {
|
|
9
10
|
/**
|
|
10
11
|
* 是否可拖拽
|
|
11
12
|
*/
|
|
@@ -34,6 +35,18 @@ export interface TabsProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'o
|
|
|
34
35
|
* 布局类型
|
|
35
36
|
*/
|
|
36
37
|
type?: 'desc' | 'card' | 'button' | 'line';
|
|
38
|
+
/**
|
|
39
|
+
* 大小
|
|
40
|
+
*/
|
|
41
|
+
size?: 'sm' | 'md' | 'lg';
|
|
42
|
+
/**
|
|
43
|
+
* 是否显示下划线
|
|
44
|
+
*/
|
|
45
|
+
showDivider?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 标签最大宽度
|
|
48
|
+
*/
|
|
49
|
+
maxTabTitleWidth?: number;
|
|
37
50
|
/**
|
|
38
51
|
* `activeId` 改变的回调
|
|
39
52
|
*/
|
|
@@ -46,14 +59,30 @@ export interface TabsProps extends Omit<HiBaseHTMLProps<'div'>, 'onDragEnd' | 'o
|
|
|
46
59
|
* 右侧的拓展区域
|
|
47
60
|
*/
|
|
48
61
|
extra?: React.ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* 标签编辑渲染
|
|
64
|
+
*/
|
|
65
|
+
editRender?: (item: TabPaneProps, index: number, actions: EditActions) => React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* 节点编辑时触发
|
|
68
|
+
*/
|
|
69
|
+
onEdit?: (value: string, item: TabPaneProps) => void | boolean | Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* 节点复制时触发
|
|
72
|
+
*/
|
|
73
|
+
onCopy?: (sourceItem: TabPaneProps, copiedItem: TabPaneProps, newItems: TabPaneProps[]) => void;
|
|
49
74
|
/**
|
|
50
75
|
* 节点增加时触发
|
|
51
76
|
*/
|
|
52
77
|
onAdd?: () => void;
|
|
78
|
+
/**
|
|
79
|
+
* 节点增加完成时触发
|
|
80
|
+
*/
|
|
81
|
+
onAdded?: (newTab: TabPaneProps) => void | boolean | Promise<boolean>;
|
|
53
82
|
/**
|
|
54
83
|
* 节点删除时时触发
|
|
55
84
|
*/
|
|
56
|
-
onDelete?: (deletedNode: TabPaneProps,
|
|
85
|
+
onDelete?: (deletedNode: TabPaneProps, evt: React.MouseEvent) => void | boolean | Promise<boolean>;
|
|
57
86
|
/**
|
|
58
87
|
* 节点开始拖拽时触发
|
|
59
88
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/tabs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.0",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"typings": "lib/types/index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
+
"types": "./lib/types/index.d.ts",
|
|
22
23
|
"require": "./lib/cjs/index.js",
|
|
23
24
|
"default": "./lib/esm/index.js"
|
|
24
25
|
}
|
|
@@ -43,24 +44,26 @@
|
|
|
43
44
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@hi-ui/classname": "^
|
|
47
|
-
"@hi-ui/env": "^
|
|
48
|
-
"@hi-ui/icon-button": "^
|
|
49
|
-
"@hi-ui/icons": "^
|
|
50
|
-
"@hi-ui/
|
|
51
|
-
"@hi-ui/
|
|
52
|
-
"@hi-ui/
|
|
53
|
-
"@hi-ui/
|
|
54
|
-
"@hi-ui/use-
|
|
47
|
+
"@hi-ui/classname": "^5.0.0-alpha.0",
|
|
48
|
+
"@hi-ui/env": "^5.0.0-alpha.0",
|
|
49
|
+
"@hi-ui/icon-button": "^5.0.0-alpha.0",
|
|
50
|
+
"@hi-ui/icons": "^5.0.0-alpha.0",
|
|
51
|
+
"@hi-ui/input": "^5.0.0-alpha.0",
|
|
52
|
+
"@hi-ui/react-utils": "^5.0.0-alpha.0",
|
|
53
|
+
"@hi-ui/tooltip": "^5.0.0-alpha.0",
|
|
54
|
+
"@hi-ui/type-assertion": "^5.0.0-alpha.0",
|
|
55
|
+
"@hi-ui/use-latest": "^5.0.0-alpha.0",
|
|
56
|
+
"@hi-ui/use-uncontrolled-state": "^5.0.0-alpha.0",
|
|
57
|
+
"@hi-ui/use-unmount-effect": "^5.0.0-alpha.0"
|
|
55
58
|
},
|
|
56
59
|
"peerDependencies": {
|
|
57
|
-
"@hi-ui/core": ">=
|
|
60
|
+
"@hi-ui/core": ">=5.0.0-alpha.0",
|
|
58
61
|
"react": ">=16.8.6",
|
|
59
62
|
"react-dom": ">=16.8.6"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"@hi-ui/core": "^
|
|
63
|
-
"@hi-ui/core-css": "^
|
|
65
|
+
"@hi-ui/core": "^5.0.0-alpha.0",
|
|
66
|
+
"@hi-ui/core-css": "^5.0.0-alpha.0",
|
|
64
67
|
"react": "^17.0.1",
|
|
65
68
|
"react-dom": "^17.0.1"
|
|
66
69
|
}
|