@sia.soul/sia-react-ui 0.1.20 → 0.1.21
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/Select-4hGJt3RJ.d.cts +142 -0
- package/dist/Select-BNSE67xn.d.ts +142 -0
- package/dist/chart.d.cts +2498 -0
- package/dist/chart.d.ts +2498 -0
- package/dist/{chunk-4HB6GC24.js → chunk-3TRRBMXY.js} +37 -8
- package/dist/{chunk-3RWL67CK.js → chunk-7RNS52YG.js} +38 -5
- package/dist/{chunk-SUMXP2SF.js → chunk-KLI65JVD.js} +12 -4
- package/dist/{chunk-I3EF5SF2.js → chunk-RWGSZW32.js} +1 -1
- package/dist/{chunk-LO3BUBWU.js → chunk-VN6PIPP7.js} +2 -2
- package/dist/{core-CdoVqv0o.d.ts → core-C5OnrCi4.d.cts} +1207 -3
- package/dist/{core-CM79w-7A.d.cts → core-DeZknKwc.d.ts} +1207 -3
- package/dist/core.cjs +77 -13
- package/dist/core.css +18 -1
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +3 -3
- package/dist/index.cjs +128 -21
- package/dist/index.css +18 -1
- package/dist/index.d.cts +1696 -7
- package/dist/index.d.ts +1696 -7
- package/dist/index.js +50 -13
- package/dist/markdown-editor.d.cts +41 -1
- package/dist/markdown-editor.d.ts +41 -1
- package/dist/rich-text-editor.cjs +11 -3
- package/dist/rich-text-editor.d.cts +46 -1
- package/dist/rich-text-editor.d.ts +46 -1
- package/dist/rich-text-editor.js +2 -2
- package/dist/{select-date-range-4tEYkA5O.d.cts → select-date-range-CGRb3-W8.d.ts} +116 -2
- package/dist/{select-date-range-D-ynrB5k.d.ts → select-date-range-DDmYGDD4.d.cts} +116 -2
- package/dist/select-date-range.cjs +36 -7
- package/dist/select-date-range.d.cts +3 -3
- package/dist/select-date-range.d.ts +3 -3
- package/dist/select-date-range.js +3 -3
- package/dist/{shared-DAYZvZVu.d.cts → shared-Bx4B28Wh.d.cts} +3 -0
- package/dist/{shared-DAYZvZVu.d.ts → shared-Bx4B28Wh.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/Select-Cz3hzQl_.d.ts +0 -57
- package/dist/Select-Da9CLN0X.d.cts +0 -57
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
Watermark,
|
|
80
80
|
message,
|
|
81
81
|
notification
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-7RNS52YG.js";
|
|
83
83
|
import {
|
|
84
84
|
TextArea
|
|
85
85
|
} from "./chunk-YT6E3X2K.js";
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
RichTextContent,
|
|
91
91
|
RichTextEditor
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-RWGSZW32.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-VN6PIPP7.js";
|
|
98
98
|
import {
|
|
99
99
|
Checkbox,
|
|
100
100
|
FloatingScrollbarProvider,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
Tree,
|
|
110
110
|
useOverlayLifecycle,
|
|
111
111
|
useScrollbarProximity
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-3TRRBMXY.js";
|
|
113
113
|
import {
|
|
114
114
|
Dropdown,
|
|
115
115
|
FILLED_ICON_NAMES,
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
PopupPortal,
|
|
121
121
|
Segmented,
|
|
122
122
|
Steps
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-KLI65JVD.js";
|
|
124
124
|
import {
|
|
125
125
|
Button
|
|
126
126
|
} from "./chunk-TZGUBGA4.js";
|
|
@@ -183,6 +183,7 @@ var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
|
183
183
|
function Pagination({
|
|
184
184
|
size: sizeProp,
|
|
185
185
|
total = 0,
|
|
186
|
+
currentPageCount,
|
|
186
187
|
current,
|
|
187
188
|
defaultCurrent = 1,
|
|
188
189
|
pageSize,
|
|
@@ -209,6 +210,7 @@ function Pagination({
|
|
|
209
210
|
const loading = refreshing ?? internalRefreshing;
|
|
210
211
|
const sizes = [...new Set([...pageSizeOptions, size].filter((value) => value > 0))].sort((a, b) => a - b);
|
|
211
212
|
const range = safeTotal ? [(safePage - 1) * size + 1, Math.min(safeTotal, safePage * size)] : [0, 0];
|
|
213
|
+
const pageCount = Math.max(0, currentPageCount ?? (safeTotal ? range[1] - range[0] + 1 : 0));
|
|
212
214
|
if (hideOnSinglePage && totalPages <= 1) return null;
|
|
213
215
|
function change(nextPage, nextSize = size) {
|
|
214
216
|
const nextTotalPages = Math.max(1, Math.ceil(safeTotal / nextSize));
|
|
@@ -232,6 +234,11 @@ function Pagination({
|
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
return /* @__PURE__ */ jsxs2("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...props, children: [
|
|
237
|
+
/* @__PURE__ */ jsxs2("span", { className: "sia-pagination__current-count", "aria-live": "polite", children: [
|
|
238
|
+
"\u5F53\u524D\u9875 ",
|
|
239
|
+
pageCount,
|
|
240
|
+
" \u6761"
|
|
241
|
+
] }),
|
|
235
242
|
showSizeChanger ? /* @__PURE__ */ jsxs2("div", { className: "sia-pagination__size", children: [
|
|
236
243
|
/* @__PURE__ */ jsx2("span", { children: "\u6BCF\u9875\u663E\u793A" }),
|
|
237
244
|
/* @__PURE__ */ jsx2(
|
|
@@ -561,7 +568,10 @@ function SpaceRoot({
|
|
|
561
568
|
split !== void 0 && index < items.length - 1 ? /* @__PURE__ */ jsx4("span", { className: "sia-space__split", children: split }) : null
|
|
562
569
|
] }, index)) });
|
|
563
570
|
}
|
|
564
|
-
var Space = Object.assign(SpaceRoot, {
|
|
571
|
+
var Space = Object.assign(SpaceRoot, {
|
|
572
|
+
/** 紧凑布局容器,将相邻控件组合为连续的按钮或输入组。 */
|
|
573
|
+
Compact: SpaceCompact
|
|
574
|
+
});
|
|
565
575
|
function Divider({
|
|
566
576
|
orientation = "horizontal",
|
|
567
577
|
variant = "solid",
|
|
@@ -834,7 +844,10 @@ function SplitterRoot({
|
|
|
834
844
|
)];
|
|
835
845
|
}) });
|
|
836
846
|
}
|
|
837
|
-
var Splitter = Object.assign(SplitterRoot, {
|
|
847
|
+
var Splitter = Object.assign(SplitterRoot, {
|
|
848
|
+
/** Splitter 中的可调整大小面板。 */
|
|
849
|
+
Panel: SplitterPanel
|
|
850
|
+
});
|
|
838
851
|
|
|
839
852
|
// src/components/ToolPanel.tsx
|
|
840
853
|
import { useId, useLayoutEffect, useRef as useRef3, useState as useState5 } from "react";
|
|
@@ -1384,7 +1397,9 @@ function openDrawer(config) {
|
|
|
1384
1397
|
return handle;
|
|
1385
1398
|
}
|
|
1386
1399
|
var Drawer2 = Object.assign(DrawerRoot, {
|
|
1400
|
+
/** 直接打开实例,返回可用于更新或关闭的操作句柄。 */
|
|
1387
1401
|
open: openDrawer,
|
|
1402
|
+
/** 关闭由此 API 打开的所有弹层。 */
|
|
1388
1403
|
destroyAll() {
|
|
1389
1404
|
[...drawerHandles].forEach((handle) => handle.destroy());
|
|
1390
1405
|
}
|
|
@@ -1788,9 +1803,13 @@ function FormErrorList({ errors = [] }) {
|
|
|
1788
1803
|
return errors.length ? /* @__PURE__ */ jsx9("div", { className: "sia-form-error-list", children: errors.map((error, index) => /* @__PURE__ */ jsx9("div", { children: error }, index)) }) : null;
|
|
1789
1804
|
}
|
|
1790
1805
|
var Form = Object.assign(FormRoot, {
|
|
1806
|
+
/** 表单字段,负责字段值绑定、校验和标签布局。 */
|
|
1791
1807
|
Item: FormItem,
|
|
1808
|
+
/** 动态表单列表,提供字段索引以及新增、删除、移动操作。 */
|
|
1792
1809
|
List: FormList,
|
|
1810
|
+
/** 显示表单错误文本集合。 */
|
|
1793
1811
|
ErrorList: FormErrorList,
|
|
1812
|
+
/** 创建或复用表单实例,返回单元素元组 [form]。 */
|
|
1794
1813
|
useForm
|
|
1795
1814
|
});
|
|
1796
1815
|
|
|
@@ -1869,7 +1888,12 @@ function RadioGroup({
|
|
|
1869
1888
|
children
|
|
1870
1889
|
] }) }) });
|
|
1871
1890
|
}
|
|
1872
|
-
var Radio2 = Object.assign(RadioRoot, {
|
|
1891
|
+
var Radio2 = Object.assign(RadioRoot, {
|
|
1892
|
+
/** 组合主操作按钮与下拉菜单的按钮组件。 */
|
|
1893
|
+
Button: RadioButton,
|
|
1894
|
+
/** 组合多个子项并统一管理布局或选择状态。 */
|
|
1895
|
+
Group: RadioGroup
|
|
1896
|
+
});
|
|
1873
1897
|
|
|
1874
1898
|
// src/components/Slider.tsx
|
|
1875
1899
|
import { useState as useState7 } from "react";
|
|
@@ -4652,7 +4676,7 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
4652
4676
|
layouts.forEach((layout) => layout.removeAttribute("data-table-inline-layout"));
|
|
4653
4677
|
};
|
|
4654
4678
|
}, [children, ellipsis, customContent]);
|
|
4655
|
-
return /* @__PURE__ */ jsx20("div", { ref, className: "sia-table__cell-content",
|
|
4679
|
+
return /* @__PURE__ */ jsx20("div", { ref, className: "sia-table__cell-content", "data-custom-content": customContent || void 0, "data-content-overflow": ellipsis && customContent && overflowing || void 0, children: title ? /* @__PURE__ */ jsx20(Tooltip, { title, className: "sia-table__cell-tooltip", children: /* @__PURE__ */ jsx20("span", { children }) }) : children });
|
|
4656
4680
|
}
|
|
4657
4681
|
|
|
4658
4682
|
// src/components/Table/Table.tsx
|
|
@@ -5921,6 +5945,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
5921
5945
|
Pagination,
|
|
5922
5946
|
{
|
|
5923
5947
|
className: "sia-table__pagination",
|
|
5948
|
+
currentPageCount: context.rows.length,
|
|
5924
5949
|
current: page.current,
|
|
5925
5950
|
pageSize: page.pageSize,
|
|
5926
5951
|
pageSizeOptions: options.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS,
|
|
@@ -6689,7 +6714,6 @@ function ColumnSettingPanel({
|
|
|
6689
6714
|
"span",
|
|
6690
6715
|
{
|
|
6691
6716
|
className: "sia-table-settings__name",
|
|
6692
|
-
title: labels.get(item.key) ?? item.key,
|
|
6693
6717
|
children: labels.get(item.key) ?? item.key
|
|
6694
6718
|
}
|
|
6695
6719
|
),
|
|
@@ -6961,7 +6985,6 @@ function ToolbarItems({
|
|
|
6961
6985
|
danger: item.danger,
|
|
6962
6986
|
icon: item.icon,
|
|
6963
6987
|
disabled,
|
|
6964
|
-
title: typeof item.label === "string" ? item.label : void 0,
|
|
6965
6988
|
onClick: () => void item.onClick?.(context),
|
|
6966
6989
|
children: item.label
|
|
6967
6990
|
},
|
|
@@ -7233,7 +7256,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7233
7256
|
TableCellContent,
|
|
7234
7257
|
{
|
|
7235
7258
|
ellipsis: column.ellipsis !== false,
|
|
7236
|
-
title: column.showTitle
|
|
7259
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
7237
7260
|
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
7238
7261
|
}
|
|
7239
7262
|
)
|
|
@@ -7658,7 +7681,7 @@ function TableInner(props, ref) {
|
|
|
7658
7681
|
const fixed = normalizeFixed(column.fixed);
|
|
7659
7682
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
7660
7683
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7661
|
-
return /* @__PURE__ */ jsx22("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx22("span", { className: "sia-table__summary-label",
|
|
7684
|
+
return /* @__PURE__ */ jsx22("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${isLabel ? " sia-table__summary-cell--label" : ""}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: isLabel ? /* @__PURE__ */ jsx22("span", { className: "sia-table__summary-label", children: content }) : content }, column.key);
|
|
7662
7685
|
}) }, summary.key);
|
|
7663
7686
|
}
|
|
7664
7687
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -7884,19 +7907,33 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
7884
7907
|
|
|
7885
7908
|
// src/theme.ts
|
|
7886
7909
|
var SIA_THEME = {
|
|
7910
|
+
/** 主色。 */
|
|
7887
7911
|
colorPrimary: "#1677ff",
|
|
7912
|
+
/** 主色的悬停色。 */
|
|
7888
7913
|
colorPrimaryHover: "#4096ff",
|
|
7914
|
+
/** 主色的按下色。 */
|
|
7889
7915
|
colorPrimaryActive: "#0958d9",
|
|
7916
|
+
/** 主要文本颜色。 */
|
|
7890
7917
|
colorText: "#1f1f1f",
|
|
7918
|
+
/** 次要文本颜色。 */
|
|
7891
7919
|
colorTextSecondary: "#666666",
|
|
7920
|
+
/** 页面背景颜色。 */
|
|
7892
7921
|
colorBackground: "#f5f7fa",
|
|
7922
|
+
/** 组件表面颜色。 */
|
|
7893
7923
|
colorSurface: "#ffffff",
|
|
7924
|
+
/** 默认边框颜色。 */
|
|
7894
7925
|
colorBorder: "#d9d9d9",
|
|
7926
|
+
/** 默认圆角半径,单位为像素。 */
|
|
7895
7927
|
borderRadius: 6,
|
|
7928
|
+
/** 默认控件高度,单位为像素。 */
|
|
7896
7929
|
controlHeight: 32,
|
|
7930
|
+
/** 默认布局间距,单位为像素。 */
|
|
7897
7931
|
spacing: 16,
|
|
7932
|
+
/** 默认字号,单位为像素。 */
|
|
7898
7933
|
fontSize: 16,
|
|
7934
|
+
/** 小号文字尺寸,单位为像素。 */
|
|
7899
7935
|
fontSizeSmall: 14,
|
|
7936
|
+
/** 大号文字尺寸,单位为像素。 */
|
|
7900
7937
|
fontSizeLarge: 18
|
|
7901
7938
|
};
|
|
7902
7939
|
function applySiaTheme(mode, target = document.documentElement) {
|
|
@@ -1,30 +1,70 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
3
|
import * as vditor from 'vditor';
|
|
4
|
-
import { I as InputPlaceholderMode } from './shared-
|
|
4
|
+
import { I as InputPlaceholderMode } from './shared-Bx4B28Wh.cjs';
|
|
5
5
|
|
|
6
|
+
/** 用于创建 Markdown 编辑器的 Vditor 构造函数类型。 */
|
|
6
7
|
type VditorConstructor = typeof vditor["default"];
|
|
7
8
|
declare global {
|
|
9
|
+
/** 供 Markdown 编辑器加载器使用的浏览器全局声明补充。 */
|
|
8
10
|
interface Window {
|
|
11
|
+
/** Vditor 编辑器的构造入口。 */
|
|
9
12
|
Vditor?: VditorConstructor;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
15
|
+
/** Markdown编辑器的模式类型。 */
|
|
12
16
|
type MarkdownEditorMode = "wysiwyg" | "ir" | "sv";
|
|
17
|
+
/** Markdown编辑器的属性配置。 */
|
|
13
18
|
interface MarkdownEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
|
|
19
|
+
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
14
20
|
value?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 非受控模式的初始值,仅在初始化时使用。
|
|
23
|
+
* @defaultValue ""
|
|
24
|
+
*/
|
|
15
25
|
defaultValue?: string;
|
|
26
|
+
/** Markdown 内容变化回调 */
|
|
16
27
|
onChange?: (markdown: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* 所见即所得、即时渲染或源码模式
|
|
30
|
+
* @defaultValue "wysiwyg"
|
|
31
|
+
*/
|
|
17
32
|
mode?: MarkdownEditorMode;
|
|
33
|
+
/**
|
|
34
|
+
* 空内容提示
|
|
35
|
+
* @defaultValue "请输入 Markdown 正文"
|
|
36
|
+
*/
|
|
18
37
|
placeholder?: string;
|
|
38
|
+
/** 占位提示的显示模式;floating 为浮动标签。 */
|
|
19
39
|
placeholderMode?: InputPlaceholderMode;
|
|
40
|
+
/**
|
|
41
|
+
* 编辑器最小高度
|
|
42
|
+
* @defaultValue 320
|
|
43
|
+
*/
|
|
20
44
|
minHeight?: number | string;
|
|
45
|
+
/**
|
|
46
|
+
* 禁用编辑器
|
|
47
|
+
* @defaultValue false
|
|
48
|
+
*/
|
|
21
49
|
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
控件的无障碍名称,供屏幕阅读器识别。
|
|
52
|
+
* @defaultValue "Markdown 编辑器"
|
|
53
|
+
*/
|
|
22
54
|
ariaLabel?: string;
|
|
55
|
+
/** Vditor 静态资源地址;不传时使用组件库已安装的版本 */
|
|
23
56
|
assetBaseUrl?: string;
|
|
57
|
+
/** 按 Ctrl / Command + S 时执行 */
|
|
24
58
|
saveShortcut?: () => void;
|
|
59
|
+
/** 上传图片并返回图片地址;配置后显示上传按钮 */
|
|
25
60
|
onUploadImage?: (file: File) => Promise<string> | string;
|
|
61
|
+
/**
|
|
62
|
+
* 识别剪贴板 Markdown 并保留语法结构
|
|
63
|
+
* @defaultValue true
|
|
64
|
+
*/
|
|
26
65
|
smartMarkdownPaste?: boolean;
|
|
27
66
|
}
|
|
67
|
+
/** Markdown编辑器组件。 */
|
|
28
68
|
declare function MarkdownEditor({ value, defaultValue, onChange, mode, placeholder, placeholderMode, minHeight, disabled, ariaLabel, assetBaseUrl, saveShortcut, onUploadImage, smartMarkdownPaste, className, style, ...props }: MarkdownEditorProps): react.JSX.Element;
|
|
29
69
|
|
|
30
70
|
export { MarkdownEditor, type MarkdownEditorMode, type MarkdownEditorProps };
|
|
@@ -1,30 +1,70 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
3
|
import * as vditor from 'vditor';
|
|
4
|
-
import { I as InputPlaceholderMode } from './shared-
|
|
4
|
+
import { I as InputPlaceholderMode } from './shared-Bx4B28Wh.js';
|
|
5
5
|
|
|
6
|
+
/** 用于创建 Markdown 编辑器的 Vditor 构造函数类型。 */
|
|
6
7
|
type VditorConstructor = typeof vditor["default"];
|
|
7
8
|
declare global {
|
|
9
|
+
/** 供 Markdown 编辑器加载器使用的浏览器全局声明补充。 */
|
|
8
10
|
interface Window {
|
|
11
|
+
/** Vditor 编辑器的构造入口。 */
|
|
9
12
|
Vditor?: VditorConstructor;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
15
|
+
/** Markdown编辑器的模式类型。 */
|
|
12
16
|
type MarkdownEditorMode = "wysiwyg" | "ir" | "sv";
|
|
17
|
+
/** Markdown编辑器的属性配置。 */
|
|
13
18
|
interface MarkdownEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
|
|
19
|
+
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
14
20
|
value?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 非受控模式的初始值,仅在初始化时使用。
|
|
23
|
+
* @defaultValue ""
|
|
24
|
+
*/
|
|
15
25
|
defaultValue?: string;
|
|
26
|
+
/** Markdown 内容变化回调 */
|
|
16
27
|
onChange?: (markdown: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* 所见即所得、即时渲染或源码模式
|
|
30
|
+
* @defaultValue "wysiwyg"
|
|
31
|
+
*/
|
|
17
32
|
mode?: MarkdownEditorMode;
|
|
33
|
+
/**
|
|
34
|
+
* 空内容提示
|
|
35
|
+
* @defaultValue "请输入 Markdown 正文"
|
|
36
|
+
*/
|
|
18
37
|
placeholder?: string;
|
|
38
|
+
/** 占位提示的显示模式;floating 为浮动标签。 */
|
|
19
39
|
placeholderMode?: InputPlaceholderMode;
|
|
40
|
+
/**
|
|
41
|
+
* 编辑器最小高度
|
|
42
|
+
* @defaultValue 320
|
|
43
|
+
*/
|
|
20
44
|
minHeight?: number | string;
|
|
45
|
+
/**
|
|
46
|
+
* 禁用编辑器
|
|
47
|
+
* @defaultValue false
|
|
48
|
+
*/
|
|
21
49
|
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
控件的无障碍名称,供屏幕阅读器识别。
|
|
52
|
+
* @defaultValue "Markdown 编辑器"
|
|
53
|
+
*/
|
|
22
54
|
ariaLabel?: string;
|
|
55
|
+
/** Vditor 静态资源地址;不传时使用组件库已安装的版本 */
|
|
23
56
|
assetBaseUrl?: string;
|
|
57
|
+
/** 按 Ctrl / Command + S 时执行 */
|
|
24
58
|
saveShortcut?: () => void;
|
|
59
|
+
/** 上传图片并返回图片地址;配置后显示上传按钮 */
|
|
25
60
|
onUploadImage?: (file: File) => Promise<string> | string;
|
|
61
|
+
/**
|
|
62
|
+
* 识别剪贴板 Markdown 并保留语法结构
|
|
63
|
+
* @defaultValue true
|
|
64
|
+
*/
|
|
26
65
|
smartMarkdownPaste?: boolean;
|
|
27
66
|
}
|
|
67
|
+
/** Markdown编辑器组件。 */
|
|
28
68
|
declare function MarkdownEditor({ value, defaultValue, onChange, mode, placeholder, placeholderMode, minHeight, disabled, ariaLabel, assetBaseUrl, saveShortcut, onUploadImage, smartMarkdownPaste, className, style, ...props }: MarkdownEditorProps): react.JSX.Element;
|
|
29
69
|
|
|
30
70
|
export { MarkdownEditor, type MarkdownEditorMode, type MarkdownEditorProps };
|
|
@@ -1274,6 +1274,7 @@ function DropdownRoot({
|
|
|
1274
1274
|
open,
|
|
1275
1275
|
defaultOpen = false,
|
|
1276
1276
|
disabled = false,
|
|
1277
|
+
showTriggerIcon = true,
|
|
1277
1278
|
arrow = false,
|
|
1278
1279
|
autoFocus = false,
|
|
1279
1280
|
openDelay = 80,
|
|
@@ -1434,6 +1435,10 @@ function DropdownRoot({
|
|
|
1434
1435
|
className: "sia-dropdown__menu"
|
|
1435
1436
|
}
|
|
1436
1437
|
);
|
|
1438
|
+
const triggerNode = showTriggerIcon && (0, import_react6.isValidElement)(children) && children.type === Button && children.props.children !== void 0 && children.props.children !== null ? (0, import_react6.cloneElement)(children, {}, /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "sia-dropdown__trigger-content", children: [
|
|
1439
|
+
children.props.children,
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron-down", size: 14, className: "sia-dropdown__trigger-icon" })
|
|
1441
|
+
] })) : children;
|
|
1437
1442
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1438
1443
|
"span",
|
|
1439
1444
|
{
|
|
@@ -1449,7 +1454,7 @@ function DropdownRoot({
|
|
|
1449
1454
|
onKeyDown: handleKeyDown,
|
|
1450
1455
|
...props,
|
|
1451
1456
|
children: [
|
|
1452
|
-
|
|
1457
|
+
triggerNode,
|
|
1453
1458
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1454
1459
|
"span",
|
|
1455
1460
|
{
|
|
@@ -1496,7 +1501,7 @@ function DropdownButton({
|
|
|
1496
1501
|
}) {
|
|
1497
1502
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: `sia-dropdown-button ${className}`.trim(), children: [
|
|
1498
1503
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { ...buttonProps, disabled, onClick, children }),
|
|
1499
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownRoot, { ...dropdownProps, disabled, trigger, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownRoot, { ...dropdownProps, disabled, trigger, showTriggerIcon: false, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1500
1505
|
Button,
|
|
1501
1506
|
{
|
|
1502
1507
|
...buttonProps,
|
|
@@ -1508,7 +1513,10 @@ function DropdownButton({
|
|
|
1508
1513
|
) })
|
|
1509
1514
|
] });
|
|
1510
1515
|
}
|
|
1511
|
-
var Dropdown = Object.assign(DropdownRoot, {
|
|
1516
|
+
var Dropdown = Object.assign(DropdownRoot, {
|
|
1517
|
+
/** 组合主操作按钮与下拉菜单的按钮组件。 */
|
|
1518
|
+
Button: DropdownButton
|
|
1519
|
+
});
|
|
1512
1520
|
|
|
1513
1521
|
// src/components/Input.tsx
|
|
1514
1522
|
var import_react7 = require("react");
|
|
@@ -1,29 +1,74 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { I as InputPlaceholderMode } from './shared-
|
|
3
|
+
import { I as InputPlaceholderMode } from './shared-Bx4B28Wh.cjs';
|
|
4
4
|
|
|
5
|
+
/** 处理富文本粘贴图片的函数,返回可插入编辑器的图片地址。 */
|
|
5
6
|
type RichTextImagePasteHandler = (file: File) => string | Promise<string>;
|
|
7
|
+
/** 富文本内容采用的存储格式。 */
|
|
6
8
|
type RichTextContentFormat = "html" | "markdown";
|
|
9
|
+
/** 富文本编辑工具栏的按钮配置。 */
|
|
7
10
|
type RichTextToolbar = "basic" | "full";
|
|
11
|
+
/** 富文本编辑器的属性配置。 */
|
|
8
12
|
interface RichTextEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "contentEditable" | "onChange"> {
|
|
13
|
+
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
9
14
|
value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* 非受控模式的初始值,仅在初始化时使用。
|
|
17
|
+
* @defaultValue ""
|
|
18
|
+
*/
|
|
10
19
|
defaultValue?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 输入和输出的内容格式
|
|
22
|
+
* @defaultValue "html"
|
|
23
|
+
*/
|
|
11
24
|
contentFormat?: RichTextContentFormat;
|
|
25
|
+
/**
|
|
26
|
+
工具栏配置。
|
|
27
|
+
* @defaultValue "basic"
|
|
28
|
+
*/
|
|
12
29
|
toolbar?: RichTextToolbar;
|
|
30
|
+
/**
|
|
31
|
+
* 空内容提示
|
|
32
|
+
* @defaultValue "请输入内容"
|
|
33
|
+
*/
|
|
13
34
|
placeholder?: string;
|
|
35
|
+
/** 占位提示的显示模式;floating 为浮动标签。 */
|
|
14
36
|
placeholderMode?: InputPlaceholderMode;
|
|
37
|
+
/**
|
|
38
|
+
* 禁用编辑和工具栏
|
|
39
|
+
* @defaultValue false
|
|
40
|
+
*/
|
|
15
41
|
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 编辑区域最小高度
|
|
44
|
+
* @defaultValue 150
|
|
45
|
+
*/
|
|
16
46
|
minHeight?: number | string;
|
|
47
|
+
/**
|
|
48
|
+
* 图片粘贴能力的工具栏提示
|
|
49
|
+
* @defaultValue "可直接粘贴图片"
|
|
50
|
+
*/
|
|
17
51
|
pasteImageHint?: ReactNode;
|
|
52
|
+
/** 内容变化回调,格式由 contentFormat 决定 */
|
|
18
53
|
onChange?: (content: string) => void;
|
|
54
|
+
/** 处理剪贴板图片并返回可访问地址 */
|
|
19
55
|
onPasteImage?: RichTextImagePasteHandler;
|
|
56
|
+
/** 按 Ctrl / Command + S 时执行 */
|
|
20
57
|
saveShortcut?: () => void;
|
|
21
58
|
}
|
|
59
|
+
/** 富文本内容的属性配置。 */
|
|
22
60
|
interface RichTextContentProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
61
|
+
/** 需要显示的内容,支持文本或 React 节点。 */
|
|
23
62
|
content: string;
|
|
63
|
+
/**
|
|
64
|
+
* 内容为空时显示的占位内容
|
|
65
|
+
* @defaultValue "暂无内容"
|
|
66
|
+
*/
|
|
24
67
|
emptyText?: ReactNode;
|
|
25
68
|
}
|
|
69
|
+
/** 富文本内容组件。 */
|
|
26
70
|
declare function RichTextContent({ content, emptyText, className, ...props }: RichTextContentProps): react.JSX.Element;
|
|
71
|
+
/** 富文本编辑器组件。 */
|
|
27
72
|
declare function RichTextEditor({ value, defaultValue, contentFormat, toolbar, placeholder, placeholderMode, disabled, minHeight, pasteImageHint, onChange, onPasteImage, saveShortcut, className, id, style, "aria-label": ariaLabel, ...props }: RichTextEditorProps): react.JSX.Element;
|
|
28
73
|
|
|
29
74
|
export { RichTextContent, type RichTextContentFormat, type RichTextContentProps, RichTextEditor, type RichTextEditorProps, type RichTextImagePasteHandler, type RichTextToolbar };
|
|
@@ -1,29 +1,74 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { I as InputPlaceholderMode } from './shared-
|
|
3
|
+
import { I as InputPlaceholderMode } from './shared-Bx4B28Wh.js';
|
|
4
4
|
|
|
5
|
+
/** 处理富文本粘贴图片的函数,返回可插入编辑器的图片地址。 */
|
|
5
6
|
type RichTextImagePasteHandler = (file: File) => string | Promise<string>;
|
|
7
|
+
/** 富文本内容采用的存储格式。 */
|
|
6
8
|
type RichTextContentFormat = "html" | "markdown";
|
|
9
|
+
/** 富文本编辑工具栏的按钮配置。 */
|
|
7
10
|
type RichTextToolbar = "basic" | "full";
|
|
11
|
+
/** 富文本编辑器的属性配置。 */
|
|
8
12
|
interface RichTextEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "contentEditable" | "onChange"> {
|
|
13
|
+
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
9
14
|
value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* 非受控模式的初始值,仅在初始化时使用。
|
|
17
|
+
* @defaultValue ""
|
|
18
|
+
*/
|
|
10
19
|
defaultValue?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 输入和输出的内容格式
|
|
22
|
+
* @defaultValue "html"
|
|
23
|
+
*/
|
|
11
24
|
contentFormat?: RichTextContentFormat;
|
|
25
|
+
/**
|
|
26
|
+
工具栏配置。
|
|
27
|
+
* @defaultValue "basic"
|
|
28
|
+
*/
|
|
12
29
|
toolbar?: RichTextToolbar;
|
|
30
|
+
/**
|
|
31
|
+
* 空内容提示
|
|
32
|
+
* @defaultValue "请输入内容"
|
|
33
|
+
*/
|
|
13
34
|
placeholder?: string;
|
|
35
|
+
/** 占位提示的显示模式;floating 为浮动标签。 */
|
|
14
36
|
placeholderMode?: InputPlaceholderMode;
|
|
37
|
+
/**
|
|
38
|
+
* 禁用编辑和工具栏
|
|
39
|
+
* @defaultValue false
|
|
40
|
+
*/
|
|
15
41
|
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 编辑区域最小高度
|
|
44
|
+
* @defaultValue 150
|
|
45
|
+
*/
|
|
16
46
|
minHeight?: number | string;
|
|
47
|
+
/**
|
|
48
|
+
* 图片粘贴能力的工具栏提示
|
|
49
|
+
* @defaultValue "可直接粘贴图片"
|
|
50
|
+
*/
|
|
17
51
|
pasteImageHint?: ReactNode;
|
|
52
|
+
/** 内容变化回调,格式由 contentFormat 决定 */
|
|
18
53
|
onChange?: (content: string) => void;
|
|
54
|
+
/** 处理剪贴板图片并返回可访问地址 */
|
|
19
55
|
onPasteImage?: RichTextImagePasteHandler;
|
|
56
|
+
/** 按 Ctrl / Command + S 时执行 */
|
|
20
57
|
saveShortcut?: () => void;
|
|
21
58
|
}
|
|
59
|
+
/** 富文本内容的属性配置。 */
|
|
22
60
|
interface RichTextContentProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
61
|
+
/** 需要显示的内容,支持文本或 React 节点。 */
|
|
23
62
|
content: string;
|
|
63
|
+
/**
|
|
64
|
+
* 内容为空时显示的占位内容
|
|
65
|
+
* @defaultValue "暂无内容"
|
|
66
|
+
*/
|
|
24
67
|
emptyText?: ReactNode;
|
|
25
68
|
}
|
|
69
|
+
/** 富文本内容组件。 */
|
|
26
70
|
declare function RichTextContent({ content, emptyText, className, ...props }: RichTextContentProps): react.JSX.Element;
|
|
71
|
+
/** 富文本编辑器组件。 */
|
|
27
72
|
declare function RichTextEditor({ value, defaultValue, contentFormat, toolbar, placeholder, placeholderMode, disabled, minHeight, pasteImageHint, onChange, onPasteImage, saveShortcut, className, id, style, "aria-label": ariaLabel, ...props }: RichTextEditorProps): react.JSX.Element;
|
|
28
73
|
|
|
29
74
|
export { RichTextContent, type RichTextContentFormat, type RichTextContentProps, RichTextEditor, type RichTextEditorProps, type RichTextImagePasteHandler, type RichTextToolbar };
|
package/dist/rich-text-editor.js
CHANGED