@sia.soul/sia-react-ui 0.1.20 → 0.1.22
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 +29 -5
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +3 -3
- package/dist/index.cjs +167 -25
- package/dist/index.css +29 -5
- package/dist/index.d.cts +1697 -8
- package/dist/index.d.ts +1697 -8
- package/dist/index.js +89 -17
- 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
|
|
@@ -4814,6 +4838,7 @@ function isInteractiveTableTarget(target) {
|
|
|
4814
4838
|
function createCellSelectionPlugin(options = {}) {
|
|
4815
4839
|
let dragMode = null;
|
|
4816
4840
|
let dragAnchor = null;
|
|
4841
|
+
let textCell = null;
|
|
4817
4842
|
let headerDragAnchorKey = null;
|
|
4818
4843
|
let snapshotCache = null;
|
|
4819
4844
|
let latestContext = null;
|
|
@@ -5115,12 +5140,17 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5115
5140
|
return;
|
|
5116
5141
|
}
|
|
5117
5142
|
if (!isSelectable(row, column, context)) return;
|
|
5118
|
-
event.preventDefault();
|
|
5119
5143
|
window.getSelection()?.removeAllRanges();
|
|
5120
5144
|
focusTable(event.currentTarget);
|
|
5121
5145
|
const address = { rowKey: row.key, columnKey: column.key };
|
|
5122
|
-
|
|
5123
|
-
|
|
5146
|
+
const extendRange = event.shiftKey && context.state.range;
|
|
5147
|
+
dragAnchor = extendRange ? extendRange.anchor : address;
|
|
5148
|
+
dragMode = extendRange ? "cells" : "text";
|
|
5149
|
+
textCell = extendRange ? null : event.currentTarget;
|
|
5150
|
+
if (extendRange) {
|
|
5151
|
+
event.preventDefault();
|
|
5152
|
+
window.getSelection()?.removeAllRanges();
|
|
5153
|
+
}
|
|
5124
5154
|
setSelection(context, { anchor: dragAnchor, focus: address });
|
|
5125
5155
|
},
|
|
5126
5156
|
onCellPointerMove(row, column, event, context) {
|
|
@@ -5128,6 +5158,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5128
5158
|
if ((event.buttons & 1) === 0) {
|
|
5129
5159
|
dragMode = null;
|
|
5130
5160
|
dragAnchor = null;
|
|
5161
|
+
textCell = null;
|
|
5131
5162
|
return;
|
|
5132
5163
|
}
|
|
5133
5164
|
if (dragMode === "rows") {
|
|
@@ -5137,6 +5168,12 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5137
5168
|
return;
|
|
5138
5169
|
}
|
|
5139
5170
|
if (!isSelectable(row, column, context)) return;
|
|
5171
|
+
if (dragMode === "text") {
|
|
5172
|
+
if (sameCellAddress(dragAnchor, { rowKey: row.key, columnKey: column.key })) return;
|
|
5173
|
+
dragMode = "cells";
|
|
5174
|
+
textCell = null;
|
|
5175
|
+
focusTable(event.currentTarget);
|
|
5176
|
+
}
|
|
5140
5177
|
event.preventDefault();
|
|
5141
5178
|
window.getSelection()?.removeAllRanges();
|
|
5142
5179
|
setSelection(context, {
|
|
@@ -5170,14 +5207,29 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5170
5207
|
},
|
|
5171
5208
|
onMount() {
|
|
5172
5209
|
const stopDragging = () => {
|
|
5210
|
+
constrainTextSelection();
|
|
5173
5211
|
dragMode = null;
|
|
5174
5212
|
dragAnchor = null;
|
|
5213
|
+
textCell = null;
|
|
5175
5214
|
headerDragAnchorKey = null;
|
|
5176
5215
|
};
|
|
5216
|
+
const constrainTextSelection = () => {
|
|
5217
|
+
if (!dragMode) return;
|
|
5218
|
+
const selection = window.getSelection();
|
|
5219
|
+
if (!selection || selection.isCollapsed) return;
|
|
5220
|
+
if (dragMode !== "text" || !textCell?.contains(selection.anchorNode) || !textCell.contains(selection.focusNode)) {
|
|
5221
|
+
selection.removeAllRanges();
|
|
5222
|
+
}
|
|
5223
|
+
};
|
|
5224
|
+
const handleSelectStart = (event) => {
|
|
5225
|
+
if (dragMode && dragMode !== "text") event.preventDefault();
|
|
5226
|
+
};
|
|
5177
5227
|
const handleCopy = (event) => {
|
|
5178
5228
|
const context = latestContext;
|
|
5179
5229
|
if (options.copyable === false || !context || !activeRoot || !activeRoot.contains(document.activeElement) || isInteractiveTableTarget(document.activeElement))
|
|
5180
5230
|
return;
|
|
5231
|
+
const selection = window.getSelection();
|
|
5232
|
+
if (selection && !selection.isCollapsed && selection.toString()) return;
|
|
5181
5233
|
const text = copyText(context);
|
|
5182
5234
|
if (!text) return;
|
|
5183
5235
|
event.preventDefault();
|
|
@@ -5185,11 +5237,18 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5185
5237
|
options.onCopy?.(text, selectedCells(context));
|
|
5186
5238
|
};
|
|
5187
5239
|
window.addEventListener("pointerup", stopDragging);
|
|
5240
|
+
window.addEventListener("pointercancel", stopDragging);
|
|
5188
5241
|
window.addEventListener("blur", stopDragging);
|
|
5242
|
+
document.addEventListener("selectionchange", constrainTextSelection);
|
|
5243
|
+
document.addEventListener("selectstart", handleSelectStart);
|
|
5189
5244
|
document.addEventListener("copy", handleCopy);
|
|
5190
5245
|
return () => {
|
|
5246
|
+
stopDragging();
|
|
5191
5247
|
window.removeEventListener("pointerup", stopDragging);
|
|
5248
|
+
window.removeEventListener("pointercancel", stopDragging);
|
|
5192
5249
|
window.removeEventListener("blur", stopDragging);
|
|
5250
|
+
document.removeEventListener("selectionchange", constrainTextSelection);
|
|
5251
|
+
document.removeEventListener("selectstart", handleSelectStart);
|
|
5193
5252
|
document.removeEventListener("copy", handleCopy);
|
|
5194
5253
|
};
|
|
5195
5254
|
},
|
|
@@ -5921,6 +5980,7 @@ function createPaginationPlugin(options = {}) {
|
|
|
5921
5980
|
Pagination,
|
|
5922
5981
|
{
|
|
5923
5982
|
className: "sia-table__pagination",
|
|
5983
|
+
currentPageCount: context.rows.length,
|
|
5924
5984
|
current: page.current,
|
|
5925
5985
|
pageSize: page.pageSize,
|
|
5926
5986
|
pageSizeOptions: options.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS,
|
|
@@ -6689,7 +6749,6 @@ function ColumnSettingPanel({
|
|
|
6689
6749
|
"span",
|
|
6690
6750
|
{
|
|
6691
6751
|
className: "sia-table-settings__name",
|
|
6692
|
-
title: labels.get(item.key) ?? item.key,
|
|
6693
6752
|
children: labels.get(item.key) ?? item.key
|
|
6694
6753
|
}
|
|
6695
6754
|
),
|
|
@@ -6961,7 +7020,6 @@ function ToolbarItems({
|
|
|
6961
7020
|
danger: item.danger,
|
|
6962
7021
|
icon: item.icon,
|
|
6963
7022
|
disabled,
|
|
6964
|
-
title: typeof item.label === "string" ? item.label : void 0,
|
|
6965
7023
|
onClick: () => void item.onClick?.(context),
|
|
6966
7024
|
children: item.label
|
|
6967
7025
|
},
|
|
@@ -7233,7 +7291,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7233
7291
|
TableCellContent,
|
|
7234
7292
|
{
|
|
7235
7293
|
ellipsis: column.ellipsis !== false,
|
|
7236
|
-
title: column.showTitle
|
|
7294
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
7237
7295
|
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
7238
7296
|
}
|
|
7239
7297
|
)
|
|
@@ -7658,7 +7716,7 @@ function TableInner(props, ref) {
|
|
|
7658
7716
|
const fixed = normalizeFixed(column.fixed);
|
|
7659
7717
|
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
7718
|
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",
|
|
7719
|
+
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
7720
|
}) }, summary.key);
|
|
7663
7721
|
}
|
|
7664
7722
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -7884,19 +7942,33 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
7884
7942
|
|
|
7885
7943
|
// src/theme.ts
|
|
7886
7944
|
var SIA_THEME = {
|
|
7945
|
+
/** 主色。 */
|
|
7887
7946
|
colorPrimary: "#1677ff",
|
|
7947
|
+
/** 主色的悬停色。 */
|
|
7888
7948
|
colorPrimaryHover: "#4096ff",
|
|
7949
|
+
/** 主色的按下色。 */
|
|
7889
7950
|
colorPrimaryActive: "#0958d9",
|
|
7951
|
+
/** 主要文本颜色。 */
|
|
7890
7952
|
colorText: "#1f1f1f",
|
|
7953
|
+
/** 次要文本颜色。 */
|
|
7891
7954
|
colorTextSecondary: "#666666",
|
|
7955
|
+
/** 页面背景颜色。 */
|
|
7892
7956
|
colorBackground: "#f5f7fa",
|
|
7957
|
+
/** 组件表面颜色。 */
|
|
7893
7958
|
colorSurface: "#ffffff",
|
|
7959
|
+
/** 默认边框颜色。 */
|
|
7894
7960
|
colorBorder: "#d9d9d9",
|
|
7961
|
+
/** 默认圆角半径,单位为像素。 */
|
|
7895
7962
|
borderRadius: 6,
|
|
7963
|
+
/** 默认控件高度,单位为像素。 */
|
|
7896
7964
|
controlHeight: 32,
|
|
7965
|
+
/** 默认布局间距,单位为像素。 */
|
|
7897
7966
|
spacing: 16,
|
|
7967
|
+
/** 默认字号,单位为像素。 */
|
|
7898
7968
|
fontSize: 16,
|
|
7969
|
+
/** 小号文字尺寸,单位为像素。 */
|
|
7899
7970
|
fontSizeSmall: 14,
|
|
7971
|
+
/** 大号文字尺寸,单位为像素。 */
|
|
7900
7972
|
fontSizeLarge: 18
|
|
7901
7973
|
};
|
|
7902
7974
|
function applySiaTheme(mode, target = document.documentElement) {
|
|
@@ -8304,7 +8376,7 @@ function QueryForm({
|
|
|
8304
8376
|
{
|
|
8305
8377
|
className: "sia-query-form__field",
|
|
8306
8378
|
hidden: collapsed && index >= Math.min(limit, fittingCount),
|
|
8307
|
-
style: entry.width !== void 0 ? {
|
|
8379
|
+
style: entry.width !== void 0 ? { "--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width } : void 0,
|
|
8308
8380
|
children: entry.content
|
|
8309
8381
|
},
|
|
8310
8382
|
entry.key
|
|
@@ -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