@baishuyun/ui-base 6.7.3 → 6.8.2
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/dist/Amap/AmapCircle/index.js +1 -1
- package/dist/Amap/AmapMarker/index.js +1 -1
- package/dist/Amap/AmapMarkerCluster/index.js +1 -1
- package/dist/Amap/AmapProvider/index.js +4 -4
- package/dist/Amap/{AmapProvider-DSjQj2oA.js → AmapProvider-Cwi6WOe0.js} +1 -1
- package/dist/Amap/hooks/index.js +1 -1
- package/dist/Amap/index.js +4 -4
- package/dist/Calendar/{Calendar-C2iO_3cX.js → Calendar-DnQrN8KB.js} +2 -2
- package/dist/Calendar/context/index.js +1 -1
- package/dist/Calendar/index.js +5 -5
- package/dist/Calendar/subcomponents/AllDaySection/index.js +1 -1
- package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
- package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
- package/dist/Calendar/subcomponents/TimeGrid/index.js +1 -1
- package/dist/Calendar/utils/index.js +1 -1
- package/dist/Calendar/utils/layout/index.js +1 -1
- package/dist/Calendar/utils/theme/index.js +1 -1
- package/dist/Card/index.js +1 -1
- package/dist/CheckBox/index.js +1 -1
- package/dist/ColorPicker/{ColorPicker-BtTIb9tX.js → ColorPicker-CL57cSDG.js} +2 -1
- package/dist/ColorPicker/index.js +4 -4
- package/dist/ConfigProvider/index.js +3 -3
- package/dist/DatePicker/{DatePicker-BMTK0Phw.js → DatePicker-C0XbZmrZ.js} +2 -2
- package/dist/DatePicker/{DatePickerPanel-BH_Z4e88.js → DatePickerPanel-BEn16cat.js} +3 -3
- package/dist/DatePicker/index.js +4 -4
- package/dist/DatePicker/style/index.js +1 -1
- package/dist/DropDown/{DropDown-CdTjlySd.js → DropDown-yDH9V_9Y.js} +2 -2
- package/dist/DropDown/index.js +5 -5
- package/dist/DropDown/style/index.js +1 -1
- package/dist/Editor/{Buttons-BcP66z6E.js → Buttons-BivKInBV.js} +144 -124
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +7 -7
- package/dist/Editor/constants/index.js +1 -1
- package/dist/Editor/index.js +274 -164
- package/dist/Gantt/GanttChart/index.js +7 -7
- package/dist/Gantt/{GanttChart-BYzMKcZ2.js → GanttChart-CDw1IQ4F.js} +2 -2
- package/dist/Gantt/GanttTable/index.js +5 -5
- package/dist/Gantt/{GanttTable-DqJziqML.js → GanttTable-xbXD_PWI.js} +1 -1
- package/dist/Gantt/GanttToolBar/index.js +6 -6
- package/dist/Gantt/{GanttToolBar-C50n7PD9.js → GanttToolBar-BTeTsR6Z.js} +2 -2
- package/dist/Gantt/index.js +9 -9
- package/dist/Gantt/utils/index.js +1 -1
- package/dist/Gantt/utils/theme/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/InputTag-hzCCJQ1z.js +144 -0
- package/dist/InputTag/index.js +4 -2
- package/dist/Loading/Loading-DiywS7ex.js +19 -0
- package/dist/Loading/index.js +4 -2
- package/dist/Modal/index.js +1 -1
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Radio/{Radio-DSoZotcs.js → Radio-CX9cUqb7.js} +12 -12
- package/dist/Radio/index.js +2 -2
- package/dist/ScrollBar/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/Select/{Select-DujgkkUp.js → Select-D6EK7whJ.js} +195 -194
- package/dist/Select/{SelectInputSearch-Bikrj3FI.js → SelectInputSearch-COUzreau.js} +1 -1
- package/dist/Select/index.js +7 -7
- package/dist/Table/{Table-k9wdWm6V.js → Table-yQXQEk6d.js} +1 -1
- package/dist/Table/hooks/index.js +1 -1
- package/dist/Table/index.js +4 -4
- package/dist/Table/style/index.js +1 -1
- package/dist/Table/utils/index.js +1 -1
- package/dist/Tabs/Tabs-BiKW70CL.js +398 -0
- package/dist/Tabs/index.js +4 -2
- package/dist/Tooltip/index.js +1 -1
- package/dist/Tree/index.js +3 -3
- package/dist/Tree/utils/index.js +1 -1
- package/dist/components/DropDown/interface.d.ts +167 -169
- package/dist/components/Editor/LengthBadge.d.ts +6 -0
- package/dist/components/Editor/ToolbarPlugin/BaseButton/BaseButton.d.ts +1 -1
- package/dist/components/Editor/ToolbarPlugin/ToolbarPlugin.d.ts +5 -1
- package/dist/components/Editor/ToolbarPlugin/context/EditorToolbarThemeContext.d.ts +6 -0
- package/dist/components/Editor/ToolbarPlugin/interface.d.ts +30 -32
- package/dist/components/Editor/index.d.ts +1 -1
- package/dist/components/Editor/interface.d.ts +118 -60
- package/dist/components/Editor/plugins/MaxLengthPlugin.d.ts +7 -0
- package/dist/components/Editor/utils/resolveEditorToolbarThemeVars.d.ts +5 -0
- package/dist/components/Editor/utils/textLength.d.ts +4 -0
- package/dist/components/InputTag/interface.d.ts +32 -32
- package/dist/components/Radio/interface.d.ts +95 -97
- package/dist/components/Tabs/TabSelect/interface.d.ts +23 -25
- package/dist/components/Tabs/interface.d.ts +58 -60
- package/dist/components/Tree/types/node.d.ts +19 -19
- package/dist/components/Tree/types/tree.d.ts +81 -83
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +18 -18
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/lang/en-US.json.d.ts +177 -166
- package/dist/locale/lang/zh-CN.json.d.ts +177 -166
- package/dist/locale/lang/zh-TW.json.d.ts +177 -166
- package/dist/style.css +1 -1
- package/dist/vendors/{ConfigProvider-C3Uwzinj.js → ConfigProvider-DxrZpdIb.js} +23 -1
- package/dist/vendors/{LocaleContext-B1HuhJc-.js → LocaleContext-Dcw6C1LX.js} +11 -0
- package/dist/vendors/{Tree-DQkpLl6f.js → Tree-DXmVRDn0.js} +8 -7
- package/dist/vendors/{useLocale-BYtF5pxt.js → useLocale-BKZX2_zw.js} +1 -1
- package/dist/vendors/{version-Dkos5Cha.js → version-4HBYLKDL.js} +1 -1
- package/dist/vite-env.d.ts +13 -13
- package/dist/vitest-matchers.d.ts +0 -1
- package/package.json +8 -8
- package/dist/InputTag/InputTag-LnUqz0Hz.js +0 -143
- package/dist/Loading/Loading-CcTZogVx.js +0 -15
- package/dist/Tabs/Tabs-Ctgg45Ox.js +0 -410
|
@@ -1,170 +1,168 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
theme?: DropDownTheme;
|
|
170
|
-
}
|
|
2
|
+
/**
|
|
3
|
+
* 浮层偏移量接口
|
|
4
|
+
*/
|
|
5
|
+
export interface OffsetType {
|
|
6
|
+
/**
|
|
7
|
+
* x 轴偏移量
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
x: number;
|
|
11
|
+
/**
|
|
12
|
+
* y 轴偏移量
|
|
13
|
+
* @default 0
|
|
14
|
+
*/
|
|
15
|
+
y: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 下拉菜单项接口
|
|
20
|
+
*/
|
|
21
|
+
export interface MenuItemType {
|
|
22
|
+
/**
|
|
23
|
+
* 菜单项的唯一标识
|
|
24
|
+
*/
|
|
25
|
+
key: string;
|
|
26
|
+
/**
|
|
27
|
+
* 菜单项的显示内容,可以是字符串或 React 节点
|
|
28
|
+
*/
|
|
29
|
+
label: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* 菜单项的图标
|
|
32
|
+
*/
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* 是否禁用该菜单项
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 是否是系统字段
|
|
42
|
+
* @description 系统字段的颜色会比较突出,和其他字段仅文字样式的不同
|
|
43
|
+
*/
|
|
44
|
+
systemField?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 允许任意额外字段,用于自定义搜索或其他用途
|
|
47
|
+
*/
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 下拉组件级颜色 token
|
|
53
|
+
*/
|
|
54
|
+
export interface DropDownTheme {
|
|
55
|
+
/**
|
|
56
|
+
* 浮层背景色
|
|
57
|
+
* @default #fff
|
|
58
|
+
*/
|
|
59
|
+
colorBgContainer?: string;
|
|
60
|
+
/**
|
|
61
|
+
* 菜单项默认文字颜色
|
|
62
|
+
* @default #121211
|
|
63
|
+
*/
|
|
64
|
+
colorText?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 菜单项图标颜色
|
|
67
|
+
* @default #6f829e
|
|
68
|
+
*/
|
|
69
|
+
colorIcon?: string;
|
|
70
|
+
/**
|
|
71
|
+
* 禁用态文字/图标颜色
|
|
72
|
+
* @default #999
|
|
73
|
+
*/
|
|
74
|
+
colorTextDisabled?: string;
|
|
75
|
+
/**
|
|
76
|
+
* 菜单项悬停背景色
|
|
77
|
+
* @default #eff0f6
|
|
78
|
+
*/
|
|
79
|
+
itemHoverBg?: string;
|
|
80
|
+
/**
|
|
81
|
+
* 高亮项背景色
|
|
82
|
+
* @default #f0f6ff
|
|
83
|
+
*/
|
|
84
|
+
itemActiveBg?: string;
|
|
85
|
+
/**
|
|
86
|
+
* 高亮项文字/图标颜色
|
|
87
|
+
* @default #0265ff
|
|
88
|
+
*/
|
|
89
|
+
itemActiveColor?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 下拉组件的属性接口
|
|
94
|
+
*/
|
|
95
|
+
export interface DropDownProps {
|
|
96
|
+
/**
|
|
97
|
+
* 触发器子元素
|
|
98
|
+
*/
|
|
99
|
+
children: ReactNode;
|
|
100
|
+
/**
|
|
101
|
+
* 下拉菜单的菜单项列表
|
|
102
|
+
*/
|
|
103
|
+
menus: MenuItemType[];
|
|
104
|
+
/**
|
|
105
|
+
* 菜单项点击时的回调函数
|
|
106
|
+
*/
|
|
107
|
+
onClick?: (menuItem: MenuItemType) => void;
|
|
108
|
+
/**
|
|
109
|
+
* 下拉菜单打开/关闭状态变化时的回调函数
|
|
110
|
+
*/
|
|
111
|
+
onOpenChange?: (open: boolean) => void;
|
|
112
|
+
/**
|
|
113
|
+
* 控制下拉菜单的显示隐藏状态(受控模式)
|
|
114
|
+
* @description 当传入此属性时,组件将变为受控模式
|
|
115
|
+
*/
|
|
116
|
+
visible?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* 搜索框的占位符文本
|
|
119
|
+
* @default '搜索'
|
|
120
|
+
*/
|
|
121
|
+
searchPlaceholder?: string;
|
|
122
|
+
/**
|
|
123
|
+
* 搜索值变化时的回调函数
|
|
124
|
+
*/
|
|
125
|
+
onSearch?: (searchValue: string) => void;
|
|
126
|
+
/**
|
|
127
|
+
* 用于搜索的字段名
|
|
128
|
+
* @default 'label'
|
|
129
|
+
*/
|
|
130
|
+
searchKey?: string;
|
|
131
|
+
/**
|
|
132
|
+
* 是否显示搜索框
|
|
133
|
+
* @default true
|
|
134
|
+
*/
|
|
135
|
+
showSearch?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* 选择菜单项后是否关闭面板
|
|
138
|
+
* @default true
|
|
139
|
+
*/
|
|
140
|
+
closeOnSelect?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* 浮层偏移量
|
|
143
|
+
* @default { x: 0, y: 0 }
|
|
144
|
+
*/
|
|
145
|
+
offset?: OffsetType;
|
|
146
|
+
/**
|
|
147
|
+
* 自定义下拉菜单的样式
|
|
148
|
+
*/
|
|
149
|
+
style?: React.CSSProperties;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 下拉面板浮层的 z-index
|
|
153
|
+
*/
|
|
154
|
+
zIndex?: number;
|
|
155
|
+
/**
|
|
156
|
+
* 指定下拉浮层渲染的父级 DOM 节点
|
|
157
|
+
*/
|
|
158
|
+
getPopupContainer?: () => HTMLElement;
|
|
159
|
+
/**
|
|
160
|
+
* 高亮的菜单项 key 数组
|
|
161
|
+
* @description 指定哪些菜单项应该被高亮显示
|
|
162
|
+
*/
|
|
163
|
+
activeKey?: string[];
|
|
164
|
+
/**
|
|
165
|
+
* 组件级颜色 token
|
|
166
|
+
*/
|
|
167
|
+
theme?: DropDownTheme;
|
|
168
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { EditorToolbarTheme } from '../interface';
|
|
1
2
|
import { ToolbarButtonProps } from './interface.d';
|
|
2
|
-
|
|
3
|
+
type ToolbarProps = ToolbarButtonProps & {
|
|
4
|
+
theme?: EditorToolbarTheme;
|
|
5
|
+
};
|
|
6
|
+
declare const Toolbar: React.FC<ToolbarProps>;
|
|
3
7
|
export default Toolbar;
|
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import { ToolbarButtonName } from './Buttons';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
style?: React.CSSProperties;
|
|
33
|
-
}
|
|
2
|
+
export interface ToolbarButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description 根据外部配置传入你想要渲染的 toolbar 按钮
|
|
5
|
+
* @description 如果数组为空,则会渲染默认的 toolbar 按钮
|
|
6
|
+
*/
|
|
7
|
+
config?: Array<{
|
|
8
|
+
/**
|
|
9
|
+
* @description 分组的唯一标识
|
|
10
|
+
*/
|
|
11
|
+
key: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description 按钮组名称
|
|
14
|
+
* @description 自定义按钮名称需要通过 registerToolbarButton 先注册
|
|
15
|
+
*/
|
|
16
|
+
buttons: Array<
|
|
17
|
+
| ToolbarButtonName
|
|
18
|
+
| {
|
|
19
|
+
name: ToolbarButtonName;
|
|
20
|
+
/**
|
|
21
|
+
* @description 各个 button 组件的 props
|
|
22
|
+
*/
|
|
23
|
+
props?: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
>;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* @description 自定义样式
|
|
29
|
+
*/
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Editor as default } from './Editor';
|
|
2
|
-
export type { EditorProps } from './interface';
|
|
2
|
+
export type { EditorProps, EditorTheme, EditorToolbarTheme } from './interface';
|
|
3
3
|
export { registerToolbarButton, unregisterToolbarButton, listRegisteredToolbarButtons, } from './ToolbarPlugin/Buttons';
|
|
4
4
|
export type { ToolbarButtonName } from './ToolbarPlugin/Buttons';
|
|
5
5
|
export { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
@@ -1,62 +1,120 @@
|
|
|
1
1
|
import { EditorState } from 'lexical';
|
|
2
2
|
import { ToolbarButtonProps } from './ToolbarPlugin/interface.d';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
3
|
+
/** Editor 工具栏 Design Token(挂在 theme.toolbar,避免与后续 content 等命名空间冲突) */
|
|
4
|
+
export interface EditorToolbarTheme {
|
|
5
|
+
/** 工具栏背景 @default #fafafa */
|
|
6
|
+
bg?: string;
|
|
7
|
+
/** 工具栏底部分割线 @default #e0e0e0 */
|
|
8
|
+
borderColor?: string;
|
|
9
|
+
/** 工具栏内边距 @default 5px 6px */
|
|
10
|
+
padding?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 工具栏容器 flex gap。
|
|
13
|
+
* 现状无 gap;未传时不写变量,保持与现状一致。
|
|
14
|
+
*/
|
|
15
|
+
gap?: string | number;
|
|
16
|
+
/** 组内按钮间距 @default 6px */
|
|
17
|
+
groupGap?: string | number;
|
|
18
|
+
/** 组分隔线颜色 @default #e0e0e0 */
|
|
19
|
+
dividerColor?: string;
|
|
20
|
+
/** 组分隔线高度 @default 20px */
|
|
21
|
+
dividerSize?: string | number;
|
|
22
|
+
/** 组分隔线水平外边距 @default 5px */
|
|
23
|
+
dividerMargin?: string | number;
|
|
24
|
+
/** 按钮默认图标/文字色 @default #666 */
|
|
25
|
+
colorIcon?: string;
|
|
26
|
+
/** hover 背景 @default #e0e0e0 */
|
|
27
|
+
itemHoverBg?: string;
|
|
28
|
+
/** hover 前景 @default #121211 */
|
|
29
|
+
itemHoverColor?: string;
|
|
30
|
+
/** active 背景 @default #e0e0e0 */
|
|
31
|
+
itemActiveBg?: string;
|
|
32
|
+
/** active 前景 @default #121211 */
|
|
33
|
+
itemActiveColor?: string;
|
|
34
|
+
/** 按钮内边距 @default 3px */
|
|
35
|
+
itemPadding?: string | number;
|
|
36
|
+
/** 按钮圆角 @default 2px */
|
|
37
|
+
itemBorderRadius?: string | number;
|
|
38
|
+
/** 图标尺寸 @default 14 */
|
|
39
|
+
iconSize?: string | number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface EditorTheme {
|
|
43
|
+
toolbar?: EditorToolbarTheme;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type EditorProps = {
|
|
47
|
+
/**
|
|
48
|
+
* 编辑器容器高度
|
|
49
|
+
*/
|
|
50
|
+
height?: number;
|
|
51
|
+
/**
|
|
52
|
+
* 编辑器内容变化回调
|
|
53
|
+
*/
|
|
54
|
+
onChange: (
|
|
55
|
+
{ text, html }: { text: string; html: string | null },
|
|
56
|
+
editorState: EditorState
|
|
57
|
+
) => void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 组件主题(与 Lexical 内部 content theme 无关)
|
|
61
|
+
*/
|
|
62
|
+
theme?: EditorTheme;
|
|
63
|
+
|
|
64
|
+
toolbar?: {
|
|
65
|
+
/**
|
|
66
|
+
* toolbar 配置
|
|
67
|
+
*/
|
|
68
|
+
config?: ToolbarButtonProps['config'];
|
|
69
|
+
|
|
70
|
+
style?: React.CSSProperties;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 编辑器受控内容
|
|
75
|
+
*/
|
|
76
|
+
value?: string | null;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 最大字符数(与 onChange.text.length / getTextContent().length 一致)。
|
|
80
|
+
* 仅 `number && > 0` 时生效;未传或无效值不限制。
|
|
81
|
+
* 图片不计字数,链接只计可见文字。
|
|
82
|
+
*/
|
|
83
|
+
maxLength?: number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 发生超限(键入拦截 / 粘贴截断 / 回填截断)时触发
|
|
87
|
+
*/
|
|
88
|
+
onMaxLengthExceed?: () => void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @description 占位符文本
|
|
92
|
+
* @todo 待实现
|
|
93
|
+
*/
|
|
94
|
+
placeholder?: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description 是否自动聚焦,默认为 false
|
|
98
|
+
*/
|
|
99
|
+
autoFocus?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* @description 是否禁用
|
|
102
|
+
* @todo 待实现
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @description 错误处理回调
|
|
107
|
+
* @todo 待实现
|
|
108
|
+
*/
|
|
109
|
+
onError?: (error: Error) => void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description 图片上传配置
|
|
113
|
+
* @todo 待实现
|
|
114
|
+
*/
|
|
115
|
+
imageUpload?: {
|
|
116
|
+
maxSize?: number; // 最大文件大小
|
|
117
|
+
accept?: string[]; // 支持的文件类型
|
|
118
|
+
customUpload?: (file: File) => Promise<string>; // 自定义上传函数
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type MaxLengthPluginProps = {
|
|
2
|
+
maxLength: number;
|
|
3
|
+
onMaxLengthExceed?: () => void;
|
|
4
|
+
};
|
|
5
|
+
/** Lexical Playground–style hard limit; restore when already at cap, else trim. */
|
|
6
|
+
export default function MaxLengthPlugin({ maxLength, onMaxLengthExceed, }: MaxLengthPluginProps): null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EditorToolbarTheme } from '../interface';
|
|
2
|
+
/** 将 EditorToolbarTheme 映射为 CSS 变量(未传 token 不写入)。 */
|
|
3
|
+
export declare const resolveEditorToolbarThemeVars: (theme?: EditorToolbarTheme) => Record<string, string>;
|
|
4
|
+
/** 解析 iconSize 为数值,供 Icon size prop;默认 14(与 BaseButton 现状一致)。 */
|
|
5
|
+
export declare const resolveEditorToolbarIconSize: (iconSize?: string | number) => number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LexicalEditor } from 'lexical';
|
|
2
|
+
export declare function isValidMaxLength(maxLength: unknown): maxLength is number;
|
|
3
|
+
/** Trim from document end to `maxLength` (metric = getTextContentSize / onChange.text). */
|
|
4
|
+
export declare function $truncateRootToMaxLength(editor: LexicalEditor, maxLength: number): boolean;
|