@sia.soul/sia-react-ui 0.1.18 → 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-LPRFOSRZ.js → chunk-3TRRBMXY.js} +45 -10
- package/dist/{chunk-JX53ZBIW.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-UCQZZ2YC.js → chunk-VN6PIPP7.js} +2 -2
- package/dist/core-C5OnrCi4.d.cts +2288 -0
- package/dist/core-DeZknKwc.d.ts +2288 -0
- package/dist/core.cjs +85 -15
- 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 +1812 -1571
- package/dist/index.css +18 -1
- package/dist/index.d.cts +1715 -8
- package/dist/index.d.ts +1715 -8
- package/dist/index.js +402 -238
- 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-Bdb-hi9c.d.ts → select-date-range-CGRb3-W8.d.ts} +116 -2
- package/dist/{select-date-range-shDQ5uJA.d.cts → select-date-range-DDmYGDD4.d.cts} +116 -2
- package/dist/select-date-range.cjs +44 -9
- 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-CVvF4mcy.d.cts +0 -57
- package/dist/Select-Ce2Irbpt.d.ts +0 -57
- package/dist/core-AeKYVPDZ.d.cts +0 -1082
- package/dist/core-DcSXqSRs.d.ts +0 -1082
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";
|
|
@@ -4052,9 +4076,135 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
4052
4076
|
] });
|
|
4053
4077
|
});
|
|
4054
4078
|
|
|
4079
|
+
// src/components/SelectModal.tsx
|
|
4080
|
+
import { useState as useState14 } from "react";
|
|
4081
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4082
|
+
function SelectModalBody({ config, values, disabled, onChange }) {
|
|
4083
|
+
const [query, setQuery] = useState14("");
|
|
4084
|
+
const [selectedOnly, setSelectedOnly] = useState14(false);
|
|
4085
|
+
const multiple = config.mode === "multiple";
|
|
4086
|
+
const search = query.trim();
|
|
4087
|
+
const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
|
|
4088
|
+
const enabled = filtered.filter((option) => !option.disabled && (!selectedOnly || values.includes(option.value)));
|
|
4089
|
+
const all = enabled.length > 0 && enabled.every((option) => values.includes(option.value));
|
|
4090
|
+
const batch = (action) => {
|
|
4091
|
+
const next = new Set(values);
|
|
4092
|
+
enabled.forEach((option) => {
|
|
4093
|
+
if (action === "remove" || action === "invert" && next.has(option.value)) next.delete(option.value);
|
|
4094
|
+
else next.add(option.value);
|
|
4095
|
+
});
|
|
4096
|
+
onChange([...next]);
|
|
4097
|
+
};
|
|
4098
|
+
return /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
4099
|
+
/* @__PURE__ */ jsxs18("div", { className: "sia-select-modal__heading", children: [
|
|
4100
|
+
/* @__PURE__ */ jsxs18("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
4101
|
+
/* @__PURE__ */ jsx18(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
4102
|
+
/* @__PURE__ */ jsxs18(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
|
|
4103
|
+
"\u5DF2\u9009\u9879(",
|
|
4104
|
+
values.length,
|
|
4105
|
+
")"
|
|
4106
|
+
] })
|
|
4107
|
+
] }),
|
|
4108
|
+
/* @__PURE__ */ jsx18(
|
|
4109
|
+
Input,
|
|
4110
|
+
{
|
|
4111
|
+
"aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4112
|
+
placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
|
|
4113
|
+
prefix: /* @__PURE__ */ jsx18(Icon, { name: "search", size: 14 }),
|
|
4114
|
+
value: query,
|
|
4115
|
+
allowClear: true,
|
|
4116
|
+
disabled,
|
|
4117
|
+
onChange: (event) => {
|
|
4118
|
+
setQuery(event.target.value);
|
|
4119
|
+
config.onSearch?.(event.target.value);
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
)
|
|
4123
|
+
] }),
|
|
4124
|
+
multiple ? /* @__PURE__ */ jsxs18("div", { className: "sia-select-modal__actions", children: [
|
|
4125
|
+
/* @__PURE__ */ jsx18(
|
|
4126
|
+
Checkbox,
|
|
4127
|
+
{
|
|
4128
|
+
checked: all,
|
|
4129
|
+
indeterminate: !all && enabled.some((option) => values.includes(option.value)),
|
|
4130
|
+
disabled: disabled || !enabled.length,
|
|
4131
|
+
onChange: (checked) => batch(checked ? "all" : "remove"),
|
|
4132
|
+
children: "\u5168\u9009"
|
|
4133
|
+
}
|
|
4134
|
+
),
|
|
4135
|
+
/* @__PURE__ */ jsx18(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
|
|
4136
|
+
/* @__PURE__ */ jsx18(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
|
|
4137
|
+
] }) : null,
|
|
4138
|
+
/* @__PURE__ */ jsx18(
|
|
4139
|
+
SelectionPanel,
|
|
4140
|
+
{
|
|
4141
|
+
options: filtered,
|
|
4142
|
+
value: values,
|
|
4143
|
+
onChange,
|
|
4144
|
+
multiple,
|
|
4145
|
+
disabled,
|
|
4146
|
+
selectedOnly,
|
|
4147
|
+
showValue: config.showValue,
|
|
4148
|
+
showSearch: false,
|
|
4149
|
+
showActions: false,
|
|
4150
|
+
includeUnknownValues: false,
|
|
4151
|
+
columns: config.columns ?? 3,
|
|
4152
|
+
maxHeight: config.maxHeight ?? 360
|
|
4153
|
+
}
|
|
4154
|
+
)
|
|
4155
|
+
] });
|
|
4156
|
+
}
|
|
4157
|
+
function openSelectModal(config) {
|
|
4158
|
+
let current = config;
|
|
4159
|
+
const normalize = (value) => value == null ? [] : Array.isArray(value) ? [...value] : [value];
|
|
4160
|
+
let values = normalize(config.value);
|
|
4161
|
+
if (config.mode !== "multiple") values = values.slice(0, 1);
|
|
4162
|
+
let submitting = false;
|
|
4163
|
+
function body() {
|
|
4164
|
+
return /* @__PURE__ */ jsx18(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
|
|
4165
|
+
values = next;
|
|
4166
|
+
handle.update({ children: body() });
|
|
4167
|
+
} });
|
|
4168
|
+
}
|
|
4169
|
+
function modalConfig() {
|
|
4170
|
+
const { options, value, mode, showValue, columns, maxHeight, searchPlaceholder, filterOption, onSearch, onConfirm, ...modal } = current;
|
|
4171
|
+
return {
|
|
4172
|
+
...modal,
|
|
4173
|
+
title: current.title ?? "\u8BF7\u9009\u62E9",
|
|
4174
|
+
width: current.width ?? 900,
|
|
4175
|
+
className: `sia-select-modal ${current.className ?? ""}`,
|
|
4176
|
+
children: body(),
|
|
4177
|
+
onOk: async () => {
|
|
4178
|
+
const selected = values.map((value2) => current.options.find((option) => option.value === value2) ?? { value: value2, label: String(value2) });
|
|
4179
|
+
submitting = true;
|
|
4180
|
+
handle.update({ children: body() });
|
|
4181
|
+
try {
|
|
4182
|
+
return await current.onConfirm?.(
|
|
4183
|
+
current.mode === "multiple" ? [...values] : values[0] ?? null,
|
|
4184
|
+
current.mode === "multiple" ? selected : selected[0] ?? null
|
|
4185
|
+
);
|
|
4186
|
+
} finally {
|
|
4187
|
+
submitting = false;
|
|
4188
|
+
handle.update({ children: body() });
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
};
|
|
4192
|
+
}
|
|
4193
|
+
const handle = Modal.open(modalConfig());
|
|
4194
|
+
return {
|
|
4195
|
+
destroy: handle.destroy,
|
|
4196
|
+
update(next) {
|
|
4197
|
+
current = { ...current, ...next };
|
|
4198
|
+
if (Object.prototype.hasOwnProperty.call(next, "value")) values = normalize(next.value);
|
|
4199
|
+
if (current.mode !== "multiple") values = values.slice(0, 1);
|
|
4200
|
+
handle.update(modalConfig());
|
|
4201
|
+
}
|
|
4202
|
+
};
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4055
4205
|
// src/components/Treemap.tsx
|
|
4056
|
-
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef12, useState as
|
|
4057
|
-
import { jsx as
|
|
4206
|
+
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef12, useState as useState15 } from "react";
|
|
4207
|
+
import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4058
4208
|
function positiveValue(value) {
|
|
4059
4209
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
4060
4210
|
}
|
|
@@ -4341,9 +4491,9 @@ function Treemap({
|
|
|
4341
4491
|
...props
|
|
4342
4492
|
}) {
|
|
4343
4493
|
const containerRef = useRef12(null);
|
|
4344
|
-
const [size, setSize] =
|
|
4345
|
-
const [internalExpandedKeys, setInternalExpandedKeys] =
|
|
4346
|
-
const [internalFocusedKey, setInternalFocusedKey] =
|
|
4494
|
+
const [size, setSize] = useState15({ width: 0, height: 0 });
|
|
4495
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState15(() => [...defaultExpandedKeys]);
|
|
4496
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState15(defaultFocusedKey);
|
|
4347
4497
|
const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
|
|
4348
4498
|
const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
|
|
4349
4499
|
const expandedSet = useMemo8(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
@@ -4399,7 +4549,7 @@ function Treemap({
|
|
|
4399
4549
|
}
|
|
4400
4550
|
onNodeClick?.({ node, expanded: isExpanded, nativeEvent });
|
|
4401
4551
|
}
|
|
4402
|
-
return /* @__PURE__ */
|
|
4552
|
+
return /* @__PURE__ */ jsxs19(
|
|
4403
4553
|
"div",
|
|
4404
4554
|
{
|
|
4405
4555
|
...props,
|
|
@@ -4408,7 +4558,7 @@ function Treemap({
|
|
|
4408
4558
|
style,
|
|
4409
4559
|
role: "tree",
|
|
4410
4560
|
children: [
|
|
4411
|
-
data.length === 0 ? /* @__PURE__ */
|
|
4561
|
+
data.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "sia-treemap__empty", children: emptyContent }) : null,
|
|
4412
4562
|
positions.map(({ node, rectangle, depth, expanded }) => {
|
|
4413
4563
|
const active = node.key === activeKey || Boolean(node.__active);
|
|
4414
4564
|
const fontSize = tileFontSize(rectangle);
|
|
@@ -4427,7 +4577,7 @@ function Treemap({
|
|
|
4427
4577
|
const hasChildren = Boolean(node.hasChildren || node.children?.length);
|
|
4428
4578
|
const title = `${node.label} \xB7 ${String(valueFormatter(node.value, node))}`;
|
|
4429
4579
|
if (expanded) {
|
|
4430
|
-
return /* @__PURE__ */
|
|
4580
|
+
return /* @__PURE__ */ jsx19(
|
|
4431
4581
|
"div",
|
|
4432
4582
|
{
|
|
4433
4583
|
className: `sia-treemap__tile sia-treemap__tile--directory is-expanded${effectiveFocusedNode?.key === node.key ? " is-focused" : ""}${active ? " is-active" : ""}`,
|
|
@@ -4436,8 +4586,8 @@ function Treemap({
|
|
|
4436
4586
|
"aria-expanded": "true",
|
|
4437
4587
|
title,
|
|
4438
4588
|
"data-treemap-key": node.key,
|
|
4439
|
-
children: /* @__PURE__ */
|
|
4440
|
-
/* @__PURE__ */
|
|
4589
|
+
children: /* @__PURE__ */ jsxs19("div", { className: "sia-treemap__header", children: [
|
|
4590
|
+
/* @__PURE__ */ jsxs19(
|
|
4441
4591
|
"button",
|
|
4442
4592
|
{
|
|
4443
4593
|
type: "button",
|
|
@@ -4445,12 +4595,12 @@ function Treemap({
|
|
|
4445
4595
|
disabled: node.disabled,
|
|
4446
4596
|
onClick: (event) => handleNodeClick(node, event),
|
|
4447
4597
|
children: [
|
|
4448
|
-
/* @__PURE__ */
|
|
4449
|
-
showValue ? /* @__PURE__ */
|
|
4598
|
+
/* @__PURE__ */ jsx19("span", { className: "sia-treemap__label", children: node.label }),
|
|
4599
|
+
showValue ? /* @__PURE__ */ jsx19("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
4450
4600
|
]
|
|
4451
4601
|
}
|
|
4452
4602
|
),
|
|
4453
|
-
/* @__PURE__ */
|
|
4603
|
+
/* @__PURE__ */ jsx19(
|
|
4454
4604
|
"button",
|
|
4455
4605
|
{
|
|
4456
4606
|
type: "button",
|
|
@@ -4458,7 +4608,7 @@ function Treemap({
|
|
|
4458
4608
|
"aria-label": effectiveFocusedNode?.key === node.key ? `\u8FD8\u539F ${node.label}` : `\u805A\u7126\u5C55\u5F00 ${node.label}`,
|
|
4459
4609
|
title: effectiveFocusedNode?.key === node.key ? "\u8FD8\u539F\u539F\u6709\u89C6\u56FE" : "\u5C55\u5F00\u5230\u6574\u4E2A\u533A\u57DF",
|
|
4460
4610
|
onClick: () => updateFocusedKey(effectiveFocusedNode?.key === node.key ? null : node.key),
|
|
4461
|
-
children: /* @__PURE__ */
|
|
4611
|
+
children: /* @__PURE__ */ jsx19(Icon, { name: effectiveFocusedNode?.key === node.key ? "fullscreen-exit" : "fullscreen", size: 14 })
|
|
4462
4612
|
}
|
|
4463
4613
|
)
|
|
4464
4614
|
] })
|
|
@@ -4466,7 +4616,7 @@ function Treemap({
|
|
|
4466
4616
|
node.key
|
|
4467
4617
|
);
|
|
4468
4618
|
}
|
|
4469
|
-
return /* @__PURE__ */
|
|
4619
|
+
return /* @__PURE__ */ jsx19(
|
|
4470
4620
|
"button",
|
|
4471
4621
|
{
|
|
4472
4622
|
type: "button",
|
|
@@ -4478,9 +4628,9 @@ function Treemap({
|
|
|
4478
4628
|
title,
|
|
4479
4629
|
"data-treemap-key": node.key,
|
|
4480
4630
|
onClick: (event) => handleNodeClick(node, event),
|
|
4481
|
-
children: showLabel ? /* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
4483
|
-
showValue ? /* @__PURE__ */
|
|
4631
|
+
children: showLabel ? /* @__PURE__ */ jsxs19("span", { className: "sia-treemap__content", children: [
|
|
4632
|
+
/* @__PURE__ */ jsx19("span", { className: "sia-treemap__label", children: node.label }),
|
|
4633
|
+
showValue ? /* @__PURE__ */ jsx19("span", { className: "sia-treemap__value", children: valueFormatter(node.value, node) }) : null
|
|
4484
4634
|
] }) : null
|
|
4485
4635
|
},
|
|
4486
4636
|
node.key
|
|
@@ -4492,11 +4642,11 @@ function Treemap({
|
|
|
4492
4642
|
}
|
|
4493
4643
|
|
|
4494
4644
|
// src/components/Table/TableCellContent.tsx
|
|
4495
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as useRef13, useState as
|
|
4496
|
-
import { jsx as
|
|
4645
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef13, useState as useState16 } from "react";
|
|
4646
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4497
4647
|
function TableCellContent({ children, ellipsis, title }) {
|
|
4498
4648
|
const ref = useRef13(null);
|
|
4499
|
-
const [overflowing, setOverflowing] =
|
|
4649
|
+
const [overflowing, setOverflowing] = useState16(false);
|
|
4500
4650
|
const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
|
|
4501
4651
|
useLayoutEffect2(() => {
|
|
4502
4652
|
const element = ref.current;
|
|
@@ -4526,14 +4676,14 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
4526
4676
|
layouts.forEach((layout) => layout.removeAttribute("data-table-inline-layout"));
|
|
4527
4677
|
};
|
|
4528
4678
|
}, [children, ellipsis, customContent]);
|
|
4529
|
-
return /* @__PURE__ */
|
|
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 });
|
|
4530
4680
|
}
|
|
4531
4681
|
|
|
4532
4682
|
// src/components/Table/Table.tsx
|
|
4533
|
-
import { Fragment as
|
|
4683
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef15, useState as useState18 } from "react";
|
|
4534
4684
|
|
|
4535
4685
|
// src/components/Table/plugins.tsx
|
|
4536
|
-
import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef14, useState as
|
|
4686
|
+
import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef14, useState as useState17 } from "react";
|
|
4537
4687
|
|
|
4538
4688
|
// src/components/Table/utils.ts
|
|
4539
4689
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -4586,7 +4736,7 @@ function toTablePageParams(current, pageSize) {
|
|
|
4586
4736
|
}
|
|
4587
4737
|
|
|
4588
4738
|
// src/components/Table/plugins.tsx
|
|
4589
|
-
import { Fragment as
|
|
4739
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4590
4740
|
function TableCheckbox({
|
|
4591
4741
|
checked,
|
|
4592
4742
|
indeterminate,
|
|
@@ -4594,7 +4744,7 @@ function TableCheckbox({
|
|
|
4594
4744
|
label,
|
|
4595
4745
|
onChange
|
|
4596
4746
|
}) {
|
|
4597
|
-
return /* @__PURE__ */
|
|
4747
|
+
return /* @__PURE__ */ jsx21(
|
|
4598
4748
|
Checkbox,
|
|
4599
4749
|
{
|
|
4600
4750
|
className: "sia-table__checkbox",
|
|
@@ -5165,20 +5315,20 @@ function TableSelectedItemsPanel({
|
|
|
5165
5315
|
onRemove,
|
|
5166
5316
|
onClear
|
|
5167
5317
|
}) {
|
|
5168
|
-
const [showAll, setShowAll] =
|
|
5318
|
+
const [showAll, setShowAll] = useState17(false);
|
|
5169
5319
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
5170
5320
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
5171
5321
|
const baseColumnMap = new Map(
|
|
5172
5322
|
flattenTableColumns(baseColumns).map((column) => [column.key, column])
|
|
5173
5323
|
);
|
|
5174
|
-
return /* @__PURE__ */
|
|
5175
|
-
/* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5324
|
+
return /* @__PURE__ */ jsxs20("div", { className: "sia-table-selection-panel", children: [
|
|
5325
|
+
/* @__PURE__ */ jsxs20("div", { className: "sia-table-selection-panel__header", children: [
|
|
5326
|
+
/* @__PURE__ */ jsxs20("strong", { children: [
|
|
5177
5327
|
"\u5DF2\u9009 ",
|
|
5178
|
-
/* @__PURE__ */
|
|
5328
|
+
/* @__PURE__ */ jsx21("span", { children: entries.length }),
|
|
5179
5329
|
" \u9879"
|
|
5180
5330
|
] }),
|
|
5181
|
-
/* @__PURE__ */
|
|
5331
|
+
/* @__PURE__ */ jsx21(
|
|
5182
5332
|
Button,
|
|
5183
5333
|
{
|
|
5184
5334
|
size: "small",
|
|
@@ -5189,15 +5339,15 @@ function TableSelectedItemsPanel({
|
|
|
5189
5339
|
}
|
|
5190
5340
|
)
|
|
5191
5341
|
] }),
|
|
5192
|
-
/* @__PURE__ */
|
|
5193
|
-
/* @__PURE__ */
|
|
5194
|
-
columns.map((column) => /* @__PURE__ */
|
|
5195
|
-
/* @__PURE__ */
|
|
5342
|
+
/* @__PURE__ */ jsx21("div", { className: "sia-table-selection-panel__body", children: /* @__PURE__ */ jsxs20("table", { children: [
|
|
5343
|
+
/* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5344
|
+
columns.map((column) => /* @__PURE__ */ jsx21("th", { children: getColumnLabel(column) }, column.key)),
|
|
5345
|
+
/* @__PURE__ */ jsx21("th", { "aria-label": "\u64CD\u4F5C" })
|
|
5196
5346
|
] }) }),
|
|
5197
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ jsx21("tbody", { children: visibleEntries.map((entry, selectedIndex) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5198
5348
|
columns.map((column) => {
|
|
5199
5349
|
if (column.meta?.plugin === "index")
|
|
5200
|
-
return /* @__PURE__ */
|
|
5350
|
+
return /* @__PURE__ */ jsx21("td", { children: entry.sourceIndex + 1 }, column.key);
|
|
5201
5351
|
const baseColumn = baseColumnMap.get(column.key) ?? column;
|
|
5202
5352
|
const value = getTableValue(
|
|
5203
5353
|
entry.record,
|
|
@@ -5217,9 +5367,9 @@ function TableSelectedItemsPanel({
|
|
|
5217
5367
|
entry.sourceIndex,
|
|
5218
5368
|
{ row, rowIndex: entry.sourceIndex, column: baseColumn }
|
|
5219
5369
|
) ?? value;
|
|
5220
|
-
return /* @__PURE__ */
|
|
5370
|
+
return /* @__PURE__ */ jsx21("td", { children: content }, column.key);
|
|
5221
5371
|
}),
|
|
5222
|
-
/* @__PURE__ */
|
|
5372
|
+
/* @__PURE__ */ jsx21("td", { children: /* @__PURE__ */ jsx21(
|
|
5223
5373
|
Button,
|
|
5224
5374
|
{
|
|
5225
5375
|
size: "small",
|
|
@@ -5230,11 +5380,11 @@ function TableSelectedItemsPanel({
|
|
|
5230
5380
|
) })
|
|
5231
5381
|
] }, entry.key)) })
|
|
5232
5382
|
] }) }),
|
|
5233
|
-
hiddenCount > 0 ? /* @__PURE__ */
|
|
5383
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsxs20("div", { className: "sia-table-selection-panel__more", children: [
|
|
5234
5384
|
"\u8FD8\u6709 ",
|
|
5235
5385
|
hiddenCount,
|
|
5236
5386
|
" \u9879\u672A\u5C55\u793A",
|
|
5237
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsx21(Button, { size: "small", variant: "link", onClick: () => setShowAll(true), children: "\u5C55\u793A\u5168\u90E8" })
|
|
5238
5388
|
] }) : null
|
|
5239
5389
|
] });
|
|
5240
5390
|
}
|
|
@@ -5349,7 +5499,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5349
5499
|
const keys = selected(context);
|
|
5350
5500
|
const allChecked = enabledRows.length > 0 && enabledRows.every((row) => keys.includes(row.key));
|
|
5351
5501
|
const someChecked = enabledRows.some((row) => keys.includes(row.key));
|
|
5352
|
-
return /* @__PURE__ */
|
|
5502
|
+
return /* @__PURE__ */ jsx21(
|
|
5353
5503
|
TableCheckbox,
|
|
5354
5504
|
{
|
|
5355
5505
|
label: "\u9009\u62E9\u5F53\u524D\u9875\u5168\u90E8\u884C",
|
|
@@ -5365,7 +5515,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5365
5515
|
}
|
|
5366
5516
|
);
|
|
5367
5517
|
},
|
|
5368
|
-
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */
|
|
5518
|
+
render: (_value, record, _index, info) => mode === "single" ? /* @__PURE__ */ jsx21(
|
|
5369
5519
|
Radio2,
|
|
5370
5520
|
{
|
|
5371
5521
|
className: "sia-table__checkbox",
|
|
@@ -5376,7 +5526,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5376
5526
|
onClick: (event) => event.stopPropagation(),
|
|
5377
5527
|
onChange: () => toggle(info.row.key, record, context)
|
|
5378
5528
|
}
|
|
5379
|
-
) : /* @__PURE__ */
|
|
5529
|
+
) : /* @__PURE__ */ jsx21(
|
|
5380
5530
|
TableCheckbox,
|
|
5381
5531
|
{
|
|
5382
5532
|
label: `\u9009\u62E9\u7B2C ${info.rowIndex + 1} \u884C`,
|
|
@@ -5415,8 +5565,8 @@ function createSelectionPlugin(options = {}) {
|
|
|
5415
5565
|
const columns = flattenTableColumns(context.columns).filter(
|
|
5416
5566
|
(column) => !column.hidden && column.meta?.plugin !== "selection"
|
|
5417
5567
|
).slice(0, Math.max(1, options.selectionPanelColumnCount ?? 4));
|
|
5418
|
-
return /* @__PURE__ */
|
|
5419
|
-
/* @__PURE__ */
|
|
5568
|
+
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__selection-footer", children: [
|
|
5569
|
+
/* @__PURE__ */ jsx21(
|
|
5420
5570
|
Popover,
|
|
5421
5571
|
{
|
|
5422
5572
|
placement: "top-start",
|
|
@@ -5424,7 +5574,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5424
5574
|
open: context.state.panelOpen && entries.length > 0,
|
|
5425
5575
|
onOpenChange: (panelOpen) => context.setState((state) => ({ ...state, panelOpen })),
|
|
5426
5576
|
overlayClassName: "sia-table-selection-popover",
|
|
5427
|
-
content: /* @__PURE__ */
|
|
5577
|
+
content: /* @__PURE__ */ jsx21(
|
|
5428
5578
|
TableSelectedItemsPanel,
|
|
5429
5579
|
{
|
|
5430
5580
|
entries,
|
|
@@ -5440,7 +5590,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5440
5590
|
onClear: () => setKeys([], context)
|
|
5441
5591
|
}
|
|
5442
5592
|
),
|
|
5443
|
-
children: /* @__PURE__ */
|
|
5593
|
+
children: /* @__PURE__ */ jsxs20(
|
|
5444
5594
|
Button,
|
|
5445
5595
|
{
|
|
5446
5596
|
className: "sia-table__selected-trigger",
|
|
@@ -5456,7 +5606,7 @@ function createSelectionPlugin(options = {}) {
|
|
|
5456
5606
|
)
|
|
5457
5607
|
}
|
|
5458
5608
|
),
|
|
5459
|
-
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */
|
|
5609
|
+
mode === "multiple" && options.showPreserveSelectedRowKeys !== false ? /* @__PURE__ */ jsx21(
|
|
5460
5610
|
Checkbox,
|
|
5461
5611
|
{
|
|
5462
5612
|
checked: preserving(context),
|
|
@@ -5511,9 +5661,9 @@ function createSortPlugin(options = {}) {
|
|
|
5511
5661
|
...column,
|
|
5512
5662
|
renderHeader: (currentColumn, coreContext) => {
|
|
5513
5663
|
const info = current(context);
|
|
5514
|
-
return /* @__PURE__ */
|
|
5515
|
-
/* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__sortable-header", children: [
|
|
5665
|
+
/* @__PURE__ */ jsx21("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
5666
|
+
/* @__PURE__ */ jsxs20(
|
|
5517
5667
|
"button",
|
|
5518
5668
|
{
|
|
5519
5669
|
type: "button",
|
|
@@ -5524,7 +5674,7 @@ function createSortPlugin(options = {}) {
|
|
|
5524
5674
|
cycle(field, context);
|
|
5525
5675
|
},
|
|
5526
5676
|
children: [
|
|
5527
|
-
/* @__PURE__ */
|
|
5677
|
+
/* @__PURE__ */ jsx21(
|
|
5528
5678
|
Icon,
|
|
5529
5679
|
{
|
|
5530
5680
|
name: "chevron-up",
|
|
@@ -5532,7 +5682,7 @@ function createSortPlugin(options = {}) {
|
|
|
5532
5682
|
className: info?.field === field && info.order === "ascend" ? "is-active" : ""
|
|
5533
5683
|
}
|
|
5534
5684
|
),
|
|
5535
|
-
/* @__PURE__ */
|
|
5685
|
+
/* @__PURE__ */ jsx21(
|
|
5536
5686
|
Icon,
|
|
5537
5687
|
{
|
|
5538
5688
|
name: "chevron-down",
|
|
@@ -5574,8 +5724,8 @@ function TableFilterControl({
|
|
|
5574
5724
|
placeholder,
|
|
5575
5725
|
onApply
|
|
5576
5726
|
}) {
|
|
5577
|
-
const [open, setOpen] =
|
|
5578
|
-
const [draft, setDraft] =
|
|
5727
|
+
const [open, setOpen] = useState17(false);
|
|
5728
|
+
const [draft, setDraft] = useState17(value);
|
|
5579
5729
|
const label = getColumnLabel(column);
|
|
5580
5730
|
useEffect11(() => {
|
|
5581
5731
|
if (open) setDraft(value);
|
|
@@ -5584,17 +5734,17 @@ function TableFilterControl({
|
|
|
5584
5734
|
onApply(nextValue.trim());
|
|
5585
5735
|
setOpen(false);
|
|
5586
5736
|
};
|
|
5587
|
-
return /* @__PURE__ */
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5737
|
+
return /* @__PURE__ */ jsxs20("span", { className: "sia-table__filter-header", children: [
|
|
5738
|
+
/* @__PURE__ */ jsx21("span", { children: column.title ?? column.name ?? column.key }),
|
|
5739
|
+
/* @__PURE__ */ jsx21(
|
|
5590
5740
|
Popover,
|
|
5591
5741
|
{
|
|
5592
5742
|
open,
|
|
5593
5743
|
onOpenChange: setOpen,
|
|
5594
5744
|
placement: "bottom-end",
|
|
5595
5745
|
overlayClassName: "sia-table-filter-popover",
|
|
5596
|
-
content: /* @__PURE__ */
|
|
5597
|
-
/* @__PURE__ */
|
|
5746
|
+
content: /* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel", children: [
|
|
5747
|
+
/* @__PURE__ */ jsx21(
|
|
5598
5748
|
Input,
|
|
5599
5749
|
{
|
|
5600
5750
|
size: "small",
|
|
@@ -5608,8 +5758,8 @@ function TableFilterControl({
|
|
|
5608
5758
|
}
|
|
5609
5759
|
}
|
|
5610
5760
|
),
|
|
5611
|
-
/* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5761
|
+
/* @__PURE__ */ jsxs20("div", { className: "sia-table-filter-panel__actions", children: [
|
|
5762
|
+
/* @__PURE__ */ jsx21(
|
|
5613
5763
|
Button,
|
|
5614
5764
|
{
|
|
5615
5765
|
size: "small",
|
|
@@ -5621,7 +5771,7 @@ function TableFilterControl({
|
|
|
5621
5771
|
children: "\u6E05\u9664"
|
|
5622
5772
|
}
|
|
5623
5773
|
),
|
|
5624
|
-
/* @__PURE__ */
|
|
5774
|
+
/* @__PURE__ */ jsx21(
|
|
5625
5775
|
Button,
|
|
5626
5776
|
{
|
|
5627
5777
|
size: "small",
|
|
@@ -5632,7 +5782,7 @@ function TableFilterControl({
|
|
|
5632
5782
|
)
|
|
5633
5783
|
] })
|
|
5634
5784
|
] }),
|
|
5635
|
-
children: /* @__PURE__ */
|
|
5785
|
+
children: /* @__PURE__ */ jsx21(
|
|
5636
5786
|
"button",
|
|
5637
5787
|
{
|
|
5638
5788
|
type: "button",
|
|
@@ -5640,7 +5790,7 @@ function TableFilterControl({
|
|
|
5640
5790
|
"aria-label": `\u7B5B\u9009${label}`,
|
|
5641
5791
|
"aria-pressed": Boolean(value),
|
|
5642
5792
|
onClick: (event) => event.stopPropagation(),
|
|
5643
|
-
children: /* @__PURE__ */
|
|
5793
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: "search", size: 13 })
|
|
5644
5794
|
}
|
|
5645
5795
|
)
|
|
5646
5796
|
}
|
|
@@ -5702,7 +5852,7 @@ function createFilterPlugin(options = {}) {
|
|
|
5702
5852
|
title: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title
|
|
5703
5853
|
};
|
|
5704
5854
|
const placeholder = typeof options.placeholder === "function" ? options.placeholder(currentColumn) : options.placeholder ?? `\u8F93\u5165${getColumnLabel(currentColumn)}\u7B5B\u9009`;
|
|
5705
|
-
return /* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ jsx21(
|
|
5706
5856
|
TableFilterControl,
|
|
5707
5857
|
{
|
|
5708
5858
|
column: renderedColumn,
|
|
@@ -5791,10 +5941,11 @@ function createPaginationPlugin(options = {}) {
|
|
|
5791
5941
|
const page = currentPage(context);
|
|
5792
5942
|
const filteredCount = context.getPluginApi("filter")?.getFilteredRows().length;
|
|
5793
5943
|
const totalRecords = options.totalCount ?? filteredCount ?? context.sourceData.length;
|
|
5794
|
-
return /* @__PURE__ */
|
|
5944
|
+
return /* @__PURE__ */ jsx21(
|
|
5795
5945
|
Pagination,
|
|
5796
5946
|
{
|
|
5797
5947
|
className: "sia-table__pagination",
|
|
5948
|
+
currentPageCount: context.rows.length,
|
|
5798
5949
|
current: page.current,
|
|
5799
5950
|
pageSize: page.pageSize,
|
|
5800
5951
|
pageSizeOptions: options.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS,
|
|
@@ -5925,13 +6076,13 @@ function createTreePlugin(options = {}) {
|
|
|
5925
6076
|
const previousRender = column.render;
|
|
5926
6077
|
return {
|
|
5927
6078
|
...column,
|
|
5928
|
-
render: (value, record, index, info) => /* @__PURE__ */
|
|
6079
|
+
render: (value, record, index, info) => /* @__PURE__ */ jsxs20(
|
|
5929
6080
|
"span",
|
|
5930
6081
|
{
|
|
5931
6082
|
className: "sia-table__tree-cell",
|
|
5932
6083
|
style: { paddingLeft: info.row.depth * 18 },
|
|
5933
6084
|
children: [
|
|
5934
|
-
info.row.meta.treeHasChildren ? /* @__PURE__ */
|
|
6085
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx21(
|
|
5935
6086
|
"button",
|
|
5936
6087
|
{
|
|
5937
6088
|
type: "button",
|
|
@@ -5942,7 +6093,7 @@ function createTreePlugin(options = {}) {
|
|
|
5942
6093
|
event.stopPropagation();
|
|
5943
6094
|
toggle(info.row.key, context);
|
|
5944
6095
|
},
|
|
5945
|
-
children: /* @__PURE__ */
|
|
6096
|
+
children: /* @__PURE__ */ jsx21(
|
|
5946
6097
|
Icon,
|
|
5947
6098
|
{
|
|
5948
6099
|
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
@@ -5950,7 +6101,7 @@ function createTreePlugin(options = {}) {
|
|
|
5950
6101
|
}
|
|
5951
6102
|
)
|
|
5952
6103
|
}
|
|
5953
|
-
) : /* @__PURE__ */
|
|
6104
|
+
) : /* @__PURE__ */ jsx21("span", { className: "sia-table__tree-placeholder" }),
|
|
5954
6105
|
previousRender ? previousRender(value, record, index, info) : value
|
|
5955
6106
|
]
|
|
5956
6107
|
}
|
|
@@ -6001,8 +6152,8 @@ function EditableTableCell({
|
|
|
6001
6152
|
trigger
|
|
6002
6153
|
}) {
|
|
6003
6154
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
6004
|
-
const [editValue, setEditValue] =
|
|
6005
|
-
const [saving, setSaving] =
|
|
6155
|
+
const [editValue, setEditValue] = useState17(value);
|
|
6156
|
+
const [saving, setSaving] = useState17(false);
|
|
6006
6157
|
const inputRef = useRef14(null);
|
|
6007
6158
|
const editorRef = useRef14(null);
|
|
6008
6159
|
const editValueRef = useRef14(value);
|
|
@@ -6058,15 +6209,15 @@ function EditableTableCell({
|
|
|
6058
6209
|
);
|
|
6059
6210
|
}, [active, config.type]);
|
|
6060
6211
|
if (!active)
|
|
6061
|
-
return /* @__PURE__ */
|
|
6212
|
+
return /* @__PURE__ */ jsxs20(
|
|
6062
6213
|
"div",
|
|
6063
6214
|
{
|
|
6064
6215
|
className: "sia-table__editable-display",
|
|
6065
6216
|
onClick: trigger === "click" ? onStart : void 0,
|
|
6066
6217
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
6067
6218
|
children: [
|
|
6068
|
-
/* @__PURE__ */
|
|
6069
|
-
/* @__PURE__ */
|
|
6219
|
+
/* @__PURE__ */ jsx21("span", { children: content }),
|
|
6220
|
+
/* @__PURE__ */ jsx21(Icon, { name: "edit", size: 13 })
|
|
6070
6221
|
]
|
|
6071
6222
|
}
|
|
6072
6223
|
);
|
|
@@ -6074,7 +6225,7 @@ function EditableTableCell({
|
|
|
6074
6225
|
if (config.type === "custom" && config.editRender) {
|
|
6075
6226
|
editor = config.editRender(record, (next) => void save(next), onCancel);
|
|
6076
6227
|
} else if (config.type === "inputNumber") {
|
|
6077
|
-
editor = /* @__PURE__ */
|
|
6228
|
+
editor = /* @__PURE__ */ jsx21(
|
|
6078
6229
|
InputNumber,
|
|
6079
6230
|
{
|
|
6080
6231
|
ref: inputRef,
|
|
@@ -6095,7 +6246,7 @@ function EditableTableCell({
|
|
|
6095
6246
|
}
|
|
6096
6247
|
);
|
|
6097
6248
|
} else if (config.type === "select") {
|
|
6098
|
-
editor = /* @__PURE__ */
|
|
6249
|
+
editor = /* @__PURE__ */ jsx21(
|
|
6099
6250
|
Select,
|
|
6100
6251
|
{
|
|
6101
6252
|
size: "small",
|
|
@@ -6109,14 +6260,14 @@ function EditableTableCell({
|
|
|
6109
6260
|
}
|
|
6110
6261
|
);
|
|
6111
6262
|
} else {
|
|
6112
|
-
editor = /* @__PURE__ */
|
|
6263
|
+
editor = /* @__PURE__ */ jsx21(
|
|
6113
6264
|
Input,
|
|
6114
6265
|
{
|
|
6115
6266
|
ref: inputRef,
|
|
6116
6267
|
size: "small",
|
|
6117
6268
|
value: String(editValue ?? ""),
|
|
6118
6269
|
disabled: saving,
|
|
6119
|
-
suffix: saving ? /* @__PURE__ */
|
|
6270
|
+
suffix: saving ? /* @__PURE__ */ jsx21(Icon, { name: "loader", size: 13, spin: true }) : null,
|
|
6120
6271
|
onChange: (event) => updateEditValue(event.target.value),
|
|
6121
6272
|
onBlur: () => void save(),
|
|
6122
6273
|
onKeyDown: (event) => {
|
|
@@ -6126,7 +6277,7 @@ function EditableTableCell({
|
|
|
6126
6277
|
}
|
|
6127
6278
|
);
|
|
6128
6279
|
}
|
|
6129
|
-
return /* @__PURE__ */
|
|
6280
|
+
return /* @__PURE__ */ jsx21("div", { ref: editorRef, className: "sia-table__editor", children: editor });
|
|
6130
6281
|
}
|
|
6131
6282
|
function createEditablePlugin(options = {}) {
|
|
6132
6283
|
const trigger = options.trigger ?? "click";
|
|
@@ -6146,7 +6297,7 @@ function createEditablePlugin(options = {}) {
|
|
|
6146
6297
|
const active = canEdit && context.state.editing?.rowKey === info.row.key && context.state.editing.columnKey === column.key;
|
|
6147
6298
|
const content = previousRender ? previousRender(value, record, index, info) : value;
|
|
6148
6299
|
if (!canEdit) return content;
|
|
6149
|
-
return /* @__PURE__ */
|
|
6300
|
+
return /* @__PURE__ */ jsx21(
|
|
6150
6301
|
EditableTableCell,
|
|
6151
6302
|
{
|
|
6152
6303
|
active,
|
|
@@ -6209,9 +6360,9 @@ function createResizePlugin(options = {}) {
|
|
|
6209
6360
|
...column,
|
|
6210
6361
|
autoWidth,
|
|
6211
6362
|
width,
|
|
6212
|
-
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */
|
|
6213
|
-
/* @__PURE__ */
|
|
6214
|
-
/* @__PURE__ */
|
|
6363
|
+
renderHeader: (currentColumn, coreContext) => /* @__PURE__ */ jsxs20("span", { className: "sia-table__resizable-header", children: [
|
|
6364
|
+
/* @__PURE__ */ jsx21("span", { children: previousHeader ? previousHeader(currentColumn, coreContext) : currentColumn.title ?? currentColumn.name ?? currentColumn.key }),
|
|
6365
|
+
/* @__PURE__ */ jsx21(
|
|
6215
6366
|
"span",
|
|
6216
6367
|
{
|
|
6217
6368
|
className: "sia-table__resize-handle",
|
|
@@ -6343,10 +6494,10 @@ function ColumnSettingPanel({
|
|
|
6343
6494
|
onClose,
|
|
6344
6495
|
onApply
|
|
6345
6496
|
}) {
|
|
6346
|
-
const [draft, setDraft] =
|
|
6497
|
+
const [draft, setDraft] = useState17(items);
|
|
6347
6498
|
const listRef = useRef14(null);
|
|
6348
6499
|
const cancelDrag = useRef14(null);
|
|
6349
|
-
const [preview, setPreview] =
|
|
6500
|
+
const [preview, setPreview] = useState17(null);
|
|
6350
6501
|
useEffect11(() => {
|
|
6351
6502
|
cancelDrag.current?.();
|
|
6352
6503
|
if (open) setDraft(orderColumnSettings(items));
|
|
@@ -6478,7 +6629,7 @@ function ColumnSettingPanel({
|
|
|
6478
6629
|
window.addEventListener("blur", cancel);
|
|
6479
6630
|
frame = requestAnimationFrame(tick);
|
|
6480
6631
|
}
|
|
6481
|
-
return /* @__PURE__ */
|
|
6632
|
+
return /* @__PURE__ */ jsxs20(
|
|
6482
6633
|
Drawer2,
|
|
6483
6634
|
{
|
|
6484
6635
|
open,
|
|
@@ -6487,9 +6638,9 @@ function ColumnSettingPanel({
|
|
|
6487
6638
|
onOpenChange: (next) => {
|
|
6488
6639
|
if (!next) onClose();
|
|
6489
6640
|
},
|
|
6490
|
-
footer: /* @__PURE__ */
|
|
6491
|
-
/* @__PURE__ */
|
|
6492
|
-
/* @__PURE__ */
|
|
6641
|
+
footer: /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
6642
|
+
/* @__PURE__ */ jsx21(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
6643
|
+
/* @__PURE__ */ jsx21(
|
|
6493
6644
|
Button,
|
|
6494
6645
|
{
|
|
6495
6646
|
variant: "primary",
|
|
@@ -6500,19 +6651,19 @@ function ColumnSettingPanel({
|
|
|
6500
6651
|
)
|
|
6501
6652
|
] }),
|
|
6502
6653
|
children: [
|
|
6503
|
-
loadError ? /* @__PURE__ */
|
|
6654
|
+
loadError ? /* @__PURE__ */ jsxs20("p", { role: "alert", children: [
|
|
6504
6655
|
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
6505
|
-
/* @__PURE__ */
|
|
6656
|
+
/* @__PURE__ */ jsx21(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
6506
6657
|
] }) : null,
|
|
6507
|
-
/* @__PURE__ */
|
|
6658
|
+
/* @__PURE__ */ jsx21(Spin, { spinning: Boolean(loading), className: "sia-table-settings__loading", "aria-label": loading ? "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E" : void 0, children: /* @__PURE__ */ jsxs20(
|
|
6508
6659
|
"fieldset",
|
|
6509
6660
|
{
|
|
6510
6661
|
disabled: loading || loadError,
|
|
6511
6662
|
style: { border: 0, padding: 0, margin: 0, minWidth: 0 },
|
|
6512
6663
|
"aria-busy": loading,
|
|
6513
6664
|
children: [
|
|
6514
|
-
/* @__PURE__ */
|
|
6515
|
-
/* @__PURE__ */
|
|
6665
|
+
/* @__PURE__ */ jsxs20("label", { className: "sia-table-settings__all", children: [
|
|
6666
|
+
/* @__PURE__ */ jsx21(
|
|
6516
6667
|
TableCheckbox,
|
|
6517
6668
|
{
|
|
6518
6669
|
label: "\u5168\u9009\u5217",
|
|
@@ -6523,7 +6674,7 @@ function ColumnSettingPanel({
|
|
|
6523
6674
|
)
|
|
6524
6675
|
}
|
|
6525
6676
|
),
|
|
6526
|
-
/* @__PURE__ */
|
|
6677
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
6527
6678
|
"\u5168\u9009\uFF08",
|
|
6528
6679
|
visibleCount,
|
|
6529
6680
|
"/",
|
|
@@ -6531,12 +6682,12 @@ function ColumnSettingPanel({
|
|
|
6531
6682
|
"\uFF09"
|
|
6532
6683
|
] })
|
|
6533
6684
|
] }),
|
|
6534
|
-
/* @__PURE__ */
|
|
6685
|
+
/* @__PURE__ */ jsx21(
|
|
6535
6686
|
"div",
|
|
6536
6687
|
{
|
|
6537
6688
|
ref: listRef,
|
|
6538
6689
|
className: `sia-table-settings__list${preview ? " is-sorting" : ""}`,
|
|
6539
|
-
children: draft.map((item) => /* @__PURE__ */
|
|
6690
|
+
children: draft.map((item) => /* @__PURE__ */ jsxs20(
|
|
6540
6691
|
"div",
|
|
6541
6692
|
{
|
|
6542
6693
|
"data-column-key": item.key,
|
|
@@ -6546,8 +6697,8 @@ function ColumnSettingPanel({
|
|
|
6546
6697
|
} : void 0,
|
|
6547
6698
|
onPointerDown: (event) => startSort(event, item.key),
|
|
6548
6699
|
children: [
|
|
6549
|
-
/* @__PURE__ */
|
|
6550
|
-
/* @__PURE__ */
|
|
6700
|
+
/* @__PURE__ */ jsx21(Icon, { name: "menu", size: 15 }),
|
|
6701
|
+
/* @__PURE__ */ jsx21(
|
|
6551
6702
|
TableCheckbox,
|
|
6552
6703
|
{
|
|
6553
6704
|
label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`,
|
|
@@ -6559,16 +6710,15 @@ function ColumnSettingPanel({
|
|
|
6559
6710
|
)
|
|
6560
6711
|
}
|
|
6561
6712
|
),
|
|
6562
|
-
/* @__PURE__ */
|
|
6713
|
+
/* @__PURE__ */ jsx21(
|
|
6563
6714
|
"span",
|
|
6564
6715
|
{
|
|
6565
6716
|
className: "sia-table-settings__name",
|
|
6566
|
-
title: labels.get(item.key) ?? item.key,
|
|
6567
6717
|
children: labels.get(item.key) ?? item.key
|
|
6568
6718
|
}
|
|
6569
6719
|
),
|
|
6570
|
-
/* @__PURE__ */
|
|
6571
|
-
/* @__PURE__ */
|
|
6720
|
+
/* @__PURE__ */ jsxs20("div", { className: "sia-table-settings__actions", children: [
|
|
6721
|
+
/* @__PURE__ */ jsx21(
|
|
6572
6722
|
Button,
|
|
6573
6723
|
{
|
|
6574
6724
|
size: "small",
|
|
@@ -6581,7 +6731,7 @@ function ColumnSettingPanel({
|
|
|
6581
6731
|
children: "\u5DE6"
|
|
6582
6732
|
}
|
|
6583
6733
|
),
|
|
6584
|
-
/* @__PURE__ */
|
|
6734
|
+
/* @__PURE__ */ jsx21(
|
|
6585
6735
|
Button,
|
|
6586
6736
|
{
|
|
6587
6737
|
size: "small",
|
|
@@ -6725,7 +6875,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6725
6875
|
{
|
|
6726
6876
|
key: "builtin:export",
|
|
6727
6877
|
label: "\u8868\u683C\u5BFC\u51FA",
|
|
6728
|
-
icon: /* @__PURE__ */
|
|
6878
|
+
icon: /* @__PURE__ */ jsx21(Icon, { name: "download", size: 18 }),
|
|
6729
6879
|
disabled: exportApi().getRows().length === 0
|
|
6730
6880
|
},
|
|
6731
6881
|
{ key: "builtin:divider", type: "divider" }
|
|
@@ -6733,7 +6883,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6733
6883
|
{
|
|
6734
6884
|
key: "builtin:columns",
|
|
6735
6885
|
label: "\u5217\u8BBE\u7F6E",
|
|
6736
|
-
icon: /* @__PURE__ */
|
|
6886
|
+
icon: /* @__PURE__ */ jsx21(Icon, { name: "settings", size: 18 })
|
|
6737
6887
|
},
|
|
6738
6888
|
...customItems.map((item) => ({
|
|
6739
6889
|
key: "custom:" + item.key,
|
|
@@ -6743,7 +6893,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6743
6893
|
disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
|
|
6744
6894
|
}))
|
|
6745
6895
|
];
|
|
6746
|
-
return /* @__PURE__ */
|
|
6896
|
+
return /* @__PURE__ */ jsx21(
|
|
6747
6897
|
Dropdown,
|
|
6748
6898
|
{
|
|
6749
6899
|
disabled: options.buttonProps?.disabled || options.buttonProps?.loading,
|
|
@@ -6760,12 +6910,12 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6760
6910
|
void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
6761
6911
|
}
|
|
6762
6912
|
},
|
|
6763
|
-
children: /* @__PURE__ */
|
|
6913
|
+
children: /* @__PURE__ */ jsx21(
|
|
6764
6914
|
Button,
|
|
6765
6915
|
{
|
|
6766
6916
|
size: "small",
|
|
6767
6917
|
variant: "text",
|
|
6768
|
-
icon: /* @__PURE__ */
|
|
6918
|
+
icon: /* @__PURE__ */ jsx21(Icon, { name: "settings", size: 16 }),
|
|
6769
6919
|
"aria-label": "\u8868\u683C\u8BBE\u7F6E",
|
|
6770
6920
|
...options.buttonProps,
|
|
6771
6921
|
className: `sia-table__settings-button${options.buttonProps?.children == null ? " sia-table__toolbar-icon" : ""} ${options.buttonProps?.className ?? ""}`.trim()
|
|
@@ -6774,7 +6924,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
6774
6924
|
}
|
|
6775
6925
|
);
|
|
6776
6926
|
},
|
|
6777
|
-
renderOverlay: (context) => /* @__PURE__ */
|
|
6927
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx21(
|
|
6778
6928
|
ColumnSettingPanel,
|
|
6779
6929
|
{
|
|
6780
6930
|
open: context.state.open,
|
|
@@ -6824,18 +6974,17 @@ function ToolbarItems({
|
|
|
6824
6974
|
items,
|
|
6825
6975
|
context
|
|
6826
6976
|
}) {
|
|
6827
|
-
return /* @__PURE__ */
|
|
6977
|
+
return /* @__PURE__ */ jsx21(Fragment7, { children: items.map((item) => {
|
|
6828
6978
|
if (item.hidden === true || typeof item.hidden === "function" && item.hidden(context))
|
|
6829
6979
|
return null;
|
|
6830
6980
|
const disabled = item.disabled === true || typeof item.disabled === "function" && item.disabled(context);
|
|
6831
|
-
return /* @__PURE__ */
|
|
6981
|
+
return /* @__PURE__ */ jsx21(
|
|
6832
6982
|
Button,
|
|
6833
6983
|
{
|
|
6834
6984
|
size: "small",
|
|
6835
6985
|
danger: item.danger,
|
|
6836
6986
|
icon: item.icon,
|
|
6837
6987
|
disabled,
|
|
6838
|
-
title: typeof item.label === "string" ? item.label : void 0,
|
|
6839
6988
|
onClick: () => void item.onClick?.(context),
|
|
6840
6989
|
children: item.label
|
|
6841
6990
|
},
|
|
@@ -6851,16 +7000,16 @@ function createToolbarPlugin(options) {
|
|
|
6851
7000
|
return {
|
|
6852
7001
|
id: "toolbar",
|
|
6853
7002
|
order: 5,
|
|
6854
|
-
renderToolbarStart: (context) => /* @__PURE__ */
|
|
7003
|
+
renderToolbarStart: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
6855
7004
|
options.start,
|
|
6856
|
-
/* @__PURE__ */
|
|
7005
|
+
/* @__PURE__ */ jsx21(ToolbarItems, { items: items("start"), context })
|
|
6857
7006
|
] }),
|
|
6858
|
-
renderToolbarEnd: (context) => /* @__PURE__ */
|
|
7007
|
+
renderToolbarEnd: (context) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
6859
7008
|
options.end,
|
|
6860
|
-
/* @__PURE__ */
|
|
6861
|
-
items("end", true).length > 0 ? /* @__PURE__ */
|
|
6862
|
-
/* @__PURE__ */
|
|
6863
|
-
/* @__PURE__ */
|
|
7009
|
+
/* @__PURE__ */ jsx21(ToolbarItems, { items: items("end"), context }),
|
|
7010
|
+
items("end", true).length > 0 ? /* @__PURE__ */ jsxs20("details", { className: "sia-table__toolbar-menu", children: [
|
|
7011
|
+
/* @__PURE__ */ jsx21("summary", { "aria-label": "\u66F4\u591A\u8868\u683C\u64CD\u4F5C", children: /* @__PURE__ */ jsx21(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
7012
|
+
/* @__PURE__ */ jsx21("div", { children: /* @__PURE__ */ jsx21(ToolbarItems, { items: items("end", true), context }) })
|
|
6864
7013
|
] }) : null
|
|
6865
7014
|
] })
|
|
6866
7015
|
};
|
|
@@ -6942,11 +7091,11 @@ function createExportPlugin(options = {}) {
|
|
|
6942
7091
|
return {
|
|
6943
7092
|
id: "export",
|
|
6944
7093
|
order: 95,
|
|
6945
|
-
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */
|
|
7094
|
+
renderToolbarEnd: options.showButton === false ? void 0 : (context) => /* @__PURE__ */ jsx21(
|
|
6946
7095
|
Button,
|
|
6947
7096
|
{
|
|
6948
7097
|
size: "small",
|
|
6949
|
-
icon: /* @__PURE__ */
|
|
7098
|
+
icon: /* @__PURE__ */ jsx21(Icon, { name: "download", size: 14 }),
|
|
6950
7099
|
disabled: getRows(context).length === 0,
|
|
6951
7100
|
onClick: () => void download(context),
|
|
6952
7101
|
children: options.buttonLabel ?? "\u5BFC\u51FA"
|
|
@@ -6961,7 +7110,7 @@ function createExportPlugin(options = {}) {
|
|
|
6961
7110
|
}
|
|
6962
7111
|
|
|
6963
7112
|
// src/components/Table/Table.tsx
|
|
6964
|
-
import { jsx as
|
|
7113
|
+
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6965
7114
|
var EMPTY_DATA = [];
|
|
6966
7115
|
var EMPTY_COLUMNS = [];
|
|
6967
7116
|
var EMPTY_PLUGINS = [];
|
|
@@ -7071,7 +7220,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7071
7220
|
onCellPointerDown,
|
|
7072
7221
|
onCellPointerMove
|
|
7073
7222
|
}) {
|
|
7074
|
-
return /* @__PURE__ */
|
|
7223
|
+
return /* @__PURE__ */ jsx22(
|
|
7075
7224
|
"tr",
|
|
7076
7225
|
{
|
|
7077
7226
|
className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
|
|
@@ -7089,7 +7238,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7089
7238
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
7090
7239
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
7091
7240
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7092
|
-
return /* @__PURE__ */
|
|
7241
|
+
return /* @__PURE__ */ jsx22(
|
|
7093
7242
|
"td",
|
|
7094
7243
|
{
|
|
7095
7244
|
"data-column-key": column.key,
|
|
@@ -7103,11 +7252,11 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
7103
7252
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
7104
7253
|
onPointerDown: (event) => onCellPointerDown(column, event),
|
|
7105
7254
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
7106
|
-
children: /* @__PURE__ */
|
|
7255
|
+
children: /* @__PURE__ */ jsx22(
|
|
7107
7256
|
TableCellContent,
|
|
7108
7257
|
{
|
|
7109
7258
|
ellipsis: column.ellipsis !== false,
|
|
7110
|
-
title: column.showTitle
|
|
7259
|
+
title: column.showTitle === true && column.ellipsis !== false && typeof value === "string" ? value : void 0,
|
|
7111
7260
|
children: pluginCellProps.content !== void 0 ? pluginCellProps.content : column.render ? column.render(value, row.record, row.sourceIndex, { row, rowIndex, column }) : value
|
|
7112
7261
|
}
|
|
7113
7262
|
)
|
|
@@ -7154,11 +7303,11 @@ function TableInner(props, ref) {
|
|
|
7154
7303
|
const tableRef = useRef15(null);
|
|
7155
7304
|
useScrollbarProximity();
|
|
7156
7305
|
const scrollbarDragRef = useRef15(null);
|
|
7157
|
-
const [internalLoading, setInternalLoading] =
|
|
7158
|
-
const [scrollTop, setScrollTop] =
|
|
7159
|
-
const [viewportHeight, setViewportHeight] =
|
|
7160
|
-
const [viewportWidth, setViewportWidth] =
|
|
7161
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
7306
|
+
const [internalLoading, setInternalLoading] = useState18(false);
|
|
7307
|
+
const [scrollTop, setScrollTop] = useState18(0);
|
|
7308
|
+
const [viewportHeight, setViewportHeight] = useState18(420);
|
|
7309
|
+
const [viewportWidth, setViewportWidth] = useState18(0);
|
|
7310
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState18({});
|
|
7162
7311
|
const getRowKey = useCallback2((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
|
|
7163
7312
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
7164
7313
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -7171,7 +7320,7 @@ function TableInner(props, ref) {
|
|
|
7171
7320
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
7172
7321
|
const pluginsByIdRef = useRef15(/* @__PURE__ */ new Map());
|
|
7173
7322
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
7174
|
-
const [pluginStates, setPluginStates] =
|
|
7323
|
+
const [pluginStates, setPluginStates] = useState18(() => Object.fromEntries(
|
|
7175
7324
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
7176
7325
|
));
|
|
7177
7326
|
const pluginApisRef = useRef15({});
|
|
@@ -7374,20 +7523,20 @@ function TableInner(props, ref) {
|
|
|
7374
7523
|
const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
|
|
7375
7524
|
const toolbarStart = sortedPlugins.map((plugin) => {
|
|
7376
7525
|
const content = plugin.renderToolbarStart?.(getContext(plugin));
|
|
7377
|
-
return content ? /* @__PURE__ */
|
|
7526
|
+
return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `toolbar-start-${plugin.id}`) : null;
|
|
7378
7527
|
}).filter(Boolean);
|
|
7379
7528
|
const toolbarEnd = sortedPlugins.map((plugin) => {
|
|
7380
7529
|
const content = plugin.renderToolbarEnd?.(getContext(plugin));
|
|
7381
|
-
return content ? /* @__PURE__ */
|
|
7530
|
+
return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `toolbar-end-${plugin.id}`) : null;
|
|
7382
7531
|
}).filter(Boolean);
|
|
7383
7532
|
const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
|
|
7384
7533
|
const footers = sortedPlugins.map((plugin) => {
|
|
7385
7534
|
const content = plugin.renderFooter?.(getContext(plugin));
|
|
7386
|
-
return content ? /* @__PURE__ */
|
|
7535
|
+
return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `footer-${plugin.id}`) : null;
|
|
7387
7536
|
}).filter(Boolean);
|
|
7388
7537
|
const overlays = sortedPlugins.map((plugin) => {
|
|
7389
7538
|
const content = plugin.renderOverlay?.(getContext(plugin));
|
|
7390
|
-
return content ? /* @__PURE__ */
|
|
7539
|
+
return content ? /* @__PURE__ */ jsx22(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
|
|
7391
7540
|
}).filter(Boolean);
|
|
7392
7541
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
7393
7542
|
const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
@@ -7483,9 +7632,9 @@ function TableInner(props, ref) {
|
|
|
7483
7632
|
}
|
|
7484
7633
|
function renderHeaderContent(column, content) {
|
|
7485
7634
|
if (column.description === void 0 || column.description === null) return content;
|
|
7486
|
-
return /* @__PURE__ */
|
|
7487
|
-
/* @__PURE__ */
|
|
7488
|
-
/* @__PURE__ */
|
|
7635
|
+
return /* @__PURE__ */ jsxs21("span", { className: "sia-table__header-label", children: [
|
|
7636
|
+
/* @__PURE__ */ jsx22("span", { className: "sia-table__header-label-content", children: content }),
|
|
7637
|
+
/* @__PURE__ */ jsx22(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx22("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx22(Icon, { name: "info", size: 14 }) }) })
|
|
7489
7638
|
] });
|
|
7490
7639
|
}
|
|
7491
7640
|
function getPluginCellProps(row, column) {
|
|
@@ -7525,17 +7674,17 @@ function TableInner(props, ref) {
|
|
|
7525
7674
|
}
|
|
7526
7675
|
function renderSummaryRow(summary) {
|
|
7527
7676
|
let labelRendered = false;
|
|
7528
|
-
return /* @__PURE__ */
|
|
7677
|
+
return /* @__PURE__ */ jsx22("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
7529
7678
|
const value = summary.values[column.key];
|
|
7530
7679
|
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
7531
7680
|
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
7532
7681
|
const fixed = normalizeFixed(column.fixed);
|
|
7533
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" : "";
|
|
7534
7683
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7535
|
-
return /* @__PURE__ */
|
|
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);
|
|
7536
7685
|
}) }, summary.key);
|
|
7537
7686
|
}
|
|
7538
|
-
return /* @__PURE__ */
|
|
7687
|
+
return /* @__PURE__ */ jsxs21(
|
|
7539
7688
|
"div",
|
|
7540
7689
|
{
|
|
7541
7690
|
ref: rootRef,
|
|
@@ -7585,19 +7734,19 @@ function TableInner(props, ref) {
|
|
|
7585
7734
|
htmlProps.onDoubleClickCapture?.(event);
|
|
7586
7735
|
},
|
|
7587
7736
|
children: [
|
|
7588
|
-
hasToolbar ? /* @__PURE__ */
|
|
7589
|
-
/* @__PURE__ */
|
|
7590
|
-
/* @__PURE__ */
|
|
7737
|
+
hasToolbar ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__toolbar", children: [
|
|
7738
|
+
/* @__PURE__ */ jsx22("div", { children: toolbarStart }),
|
|
7739
|
+
/* @__PURE__ */ jsx22("div", { children: toolbarEnd })
|
|
7591
7740
|
] }) : null,
|
|
7592
|
-
/* @__PURE__ */
|
|
7593
|
-
/* @__PURE__ */
|
|
7594
|
-
/* @__PURE__ */
|
|
7595
|
-
/* @__PURE__ */
|
|
7741
|
+
/* @__PURE__ */ jsxs21("div", { className: "sia-table__viewport-wrap", children: [
|
|
7742
|
+
/* @__PURE__ */ jsx22("div", { className: "sia-table__viewport", ref: scrollRef, onScroll: handleScroll, children: /* @__PURE__ */ jsxs21("table", { ref: tableRef, className: "sia-table__element", style: { width: Math.max(totalWidth, 1), ...manualColumnLayout ? { minWidth: 0 } : {}, ...tableStyle }, children: [
|
|
7743
|
+
/* @__PURE__ */ jsx22("colgroup", { children: leafColumns.map((column) => /* @__PURE__ */ jsx22("col", { "data-column-key": column.key, style: { width: columnWidths.get(column.key) ?? DEFAULT_WIDTH } }, column.key)) }),
|
|
7744
|
+
/* @__PURE__ */ jsx22("thead", { className: stickyHeader ? "sia-table__head sia-table__head--sticky" : "sia-table__head", children: headerRows.map((headerRow, depth) => /* @__PURE__ */ jsx22("tr", { children: headerRow.map((cell) => {
|
|
7596
7745
|
const fixed = cell.fixed;
|
|
7597
7746
|
const pluginHeaderProps = getPluginHeaderCellProps(cell.column);
|
|
7598
7747
|
const fixedEdgeClass = fixed === "left" && cell.column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && cell.column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
7599
7748
|
const autoWidthClass = cell.column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
7600
|
-
return /* @__PURE__ */
|
|
7749
|
+
return /* @__PURE__ */ jsx22(
|
|
7601
7750
|
"th",
|
|
7602
7751
|
{
|
|
7603
7752
|
"data-column-key": cell.column.key,
|
|
@@ -7618,13 +7767,13 @@ function TableInner(props, ref) {
|
|
|
7618
7767
|
`${cell.column.key}-${depth}-${cell.firstLeafKey}`
|
|
7619
7768
|
);
|
|
7620
7769
|
}) }, depth)) }),
|
|
7621
|
-
/* @__PURE__ */
|
|
7622
|
-
topSpacer > 0 ? /* @__PURE__ */
|
|
7770
|
+
/* @__PURE__ */ jsxs21("tbody", { children: [
|
|
7771
|
+
topSpacer > 0 ? /* @__PURE__ */ jsx22("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx22("td", { colSpan: leafColumns.length, style: { height: topSpacer, padding: 0, border: 0 } }) }) : null,
|
|
7623
7772
|
renderedRows.map((row, offset) => {
|
|
7624
7773
|
const rowIndex = startIndex + offset;
|
|
7625
7774
|
const pluginClasses = sortedPlugins.map((plugin) => plugin.getRowClassName?.(row, getContext(plugin))).filter(Boolean).join(" ");
|
|
7626
7775
|
const customClass = typeof rowClassName === "function" ? rowClassName(row.record, row.sourceIndex) : rowClassName ?? "";
|
|
7627
|
-
return /* @__PURE__ */
|
|
7776
|
+
return /* @__PURE__ */ jsx22(
|
|
7628
7777
|
TableBodyRow,
|
|
7629
7778
|
{
|
|
7630
7779
|
row,
|
|
@@ -7671,12 +7820,12 @@ function TableInner(props, ref) {
|
|
|
7671
7820
|
row.key
|
|
7672
7821
|
);
|
|
7673
7822
|
}),
|
|
7674
|
-
bottomSpacer > 0 ? /* @__PURE__ */
|
|
7823
|
+
bottomSpacer > 0 ? /* @__PURE__ */ jsx22("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx22("td", { colSpan: leafColumns.length, style: { height: bottomSpacer, padding: 0, border: 0 } }) }) : null
|
|
7675
7824
|
] }),
|
|
7676
|
-
summaries.length > 0 ? /* @__PURE__ */
|
|
7825
|
+
summaries.length > 0 ? /* @__PURE__ */ jsx22("tfoot", { className: "sia-table__summary", children: summaries.map(renderSummaryRow) }) : null
|
|
7677
7826
|
] }) }),
|
|
7678
|
-
pipeline.rows.length === 0 ? /* @__PURE__ */
|
|
7679
|
-
/* @__PURE__ */
|
|
7827
|
+
pipeline.rows.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "sia-table__empty", role: "status", children: emptyText }) : null,
|
|
7828
|
+
/* @__PURE__ */ jsx22(
|
|
7680
7829
|
"div",
|
|
7681
7830
|
{
|
|
7682
7831
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--horizontal",
|
|
@@ -7687,10 +7836,10 @@ function TableInner(props, ref) {
|
|
|
7687
7836
|
onPointerMove: handleScrollbarPointerMove,
|
|
7688
7837
|
onPointerUp: handleScrollbarPointerEnd,
|
|
7689
7838
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
7690
|
-
children: /* @__PURE__ */
|
|
7839
|
+
children: /* @__PURE__ */ jsx22("div", { className: "sia-table__scrollbar-thumb" })
|
|
7691
7840
|
}
|
|
7692
7841
|
),
|
|
7693
|
-
/* @__PURE__ */
|
|
7842
|
+
/* @__PURE__ */ jsx22(
|
|
7694
7843
|
"div",
|
|
7695
7844
|
{
|
|
7696
7845
|
className: "sia-scrollbar-track sia-table__scrollbar sia-table__scrollbar--vertical",
|
|
@@ -7701,14 +7850,14 @@ function TableInner(props, ref) {
|
|
|
7701
7850
|
onPointerMove: handleScrollbarPointerMove,
|
|
7702
7851
|
onPointerUp: handleScrollbarPointerEnd,
|
|
7703
7852
|
onPointerCancel: handleScrollbarPointerEnd,
|
|
7704
|
-
children: /* @__PURE__ */
|
|
7853
|
+
children: /* @__PURE__ */ jsx22("div", { className: "sia-table__scrollbar-thumb" })
|
|
7705
7854
|
}
|
|
7706
7855
|
)
|
|
7707
7856
|
] }),
|
|
7708
|
-
footers.length > 0 ? /* @__PURE__ */
|
|
7709
|
-
loading || internalLoading ? /* @__PURE__ */
|
|
7710
|
-
/* @__PURE__ */
|
|
7711
|
-
/* @__PURE__ */
|
|
7857
|
+
footers.length > 0 ? /* @__PURE__ */ jsx22("div", { className: "sia-table__footer", children: footers }) : null,
|
|
7858
|
+
loading || internalLoading ? /* @__PURE__ */ jsxs21("div", { className: "sia-table__loading", role: "status", children: [
|
|
7859
|
+
/* @__PURE__ */ jsx22(Icon, { name: "loader", size: 22, spin: true }),
|
|
7860
|
+
/* @__PURE__ */ jsx22("span", { children: "\u52A0\u8F7D\u4E2D" })
|
|
7712
7861
|
] }) : null,
|
|
7713
7862
|
overlays
|
|
7714
7863
|
]
|
|
@@ -7719,7 +7868,7 @@ var Table = forwardRef5(TableInner);
|
|
|
7719
7868
|
|
|
7720
7869
|
// src/components/ThemeSwitch.tsx
|
|
7721
7870
|
import { forwardRef as forwardRef6 } from "react";
|
|
7722
|
-
import { jsx as
|
|
7871
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7723
7872
|
var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
7724
7873
|
checked,
|
|
7725
7874
|
onCheckedChange,
|
|
@@ -7733,7 +7882,7 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
7733
7882
|
onCheckedChange?.(!checked);
|
|
7734
7883
|
onClick?.(event);
|
|
7735
7884
|
}
|
|
7736
|
-
return /* @__PURE__ */
|
|
7885
|
+
return /* @__PURE__ */ jsxs22(
|
|
7737
7886
|
"button",
|
|
7738
7887
|
{
|
|
7739
7888
|
ref,
|
|
@@ -7745,12 +7894,12 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
7745
7894
|
onClick: handleClick,
|
|
7746
7895
|
...props,
|
|
7747
7896
|
children: [
|
|
7748
|
-
/* @__PURE__ */
|
|
7749
|
-
/* @__PURE__ */
|
|
7750
|
-
/* @__PURE__ */
|
|
7751
|
-
/* @__PURE__ */
|
|
7897
|
+
/* @__PURE__ */ jsx23("span", { className: "sia-theme-switch__selection", "aria-hidden": "true" }),
|
|
7898
|
+
/* @__PURE__ */ jsx23("span", { className: `sia-theme-switch__icon${checked ? "" : " is-active"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 24 24", children: [
|
|
7899
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "3.5" }),
|
|
7900
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4" })
|
|
7752
7901
|
] }) }),
|
|
7753
|
-
/* @__PURE__ */
|
|
7902
|
+
/* @__PURE__ */ jsx23("span", { className: `sia-theme-switch__icon${checked ? " is-active" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsx23("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx23("path", { d: "M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z" }) }) })
|
|
7754
7903
|
]
|
|
7755
7904
|
}
|
|
7756
7905
|
);
|
|
@@ -7758,19 +7907,33 @@ var ThemeSwitch = forwardRef6(function ThemeSwitch2({
|
|
|
7758
7907
|
|
|
7759
7908
|
// src/theme.ts
|
|
7760
7909
|
var SIA_THEME = {
|
|
7910
|
+
/** 主色。 */
|
|
7761
7911
|
colorPrimary: "#1677ff",
|
|
7912
|
+
/** 主色的悬停色。 */
|
|
7762
7913
|
colorPrimaryHover: "#4096ff",
|
|
7914
|
+
/** 主色的按下色。 */
|
|
7763
7915
|
colorPrimaryActive: "#0958d9",
|
|
7916
|
+
/** 主要文本颜色。 */
|
|
7764
7917
|
colorText: "#1f1f1f",
|
|
7918
|
+
/** 次要文本颜色。 */
|
|
7765
7919
|
colorTextSecondary: "#666666",
|
|
7920
|
+
/** 页面背景颜色。 */
|
|
7766
7921
|
colorBackground: "#f5f7fa",
|
|
7922
|
+
/** 组件表面颜色。 */
|
|
7767
7923
|
colorSurface: "#ffffff",
|
|
7924
|
+
/** 默认边框颜色。 */
|
|
7768
7925
|
colorBorder: "#d9d9d9",
|
|
7926
|
+
/** 默认圆角半径,单位为像素。 */
|
|
7769
7927
|
borderRadius: 6,
|
|
7928
|
+
/** 默认控件高度,单位为像素。 */
|
|
7770
7929
|
controlHeight: 32,
|
|
7930
|
+
/** 默认布局间距,单位为像素。 */
|
|
7771
7931
|
spacing: 16,
|
|
7932
|
+
/** 默认字号,单位为像素。 */
|
|
7772
7933
|
fontSize: 16,
|
|
7934
|
+
/** 小号文字尺寸,单位为像素。 */
|
|
7773
7935
|
fontSizeSmall: 14,
|
|
7936
|
+
/** 大号文字尺寸,单位为像素。 */
|
|
7774
7937
|
fontSizeLarge: 18
|
|
7775
7938
|
};
|
|
7776
7939
|
function applySiaTheme(mode, target = document.documentElement) {
|
|
@@ -7779,8 +7942,8 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
7779
7942
|
}
|
|
7780
7943
|
|
|
7781
7944
|
// src/components/InputSelect.tsx
|
|
7782
|
-
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef16, useState as
|
|
7783
|
-
import { jsx as
|
|
7945
|
+
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef16, useState as useState19 } from "react";
|
|
7946
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7784
7947
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
7785
7948
|
options,
|
|
7786
7949
|
value,
|
|
@@ -7807,19 +7970,19 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7807
7970
|
...inputProps
|
|
7808
7971
|
}, forwardedRef) {
|
|
7809
7972
|
const size = useControlSize(sizeProp);
|
|
7810
|
-
const [internal, setInternal] =
|
|
7973
|
+
const [internal, setInternal] = useState19(defaultValue);
|
|
7811
7974
|
const current = value !== void 0 ? value : internal;
|
|
7812
7975
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
7813
7976
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
7814
|
-
const [draft, setDraft] =
|
|
7977
|
+
const [draft, setDraft] = useState19(text);
|
|
7815
7978
|
useEffect13(() => {
|
|
7816
7979
|
setDraft(text);
|
|
7817
7980
|
}, [text, current]);
|
|
7818
|
-
const [open, setOpen] =
|
|
7819
|
-
const [search, setSearch] =
|
|
7820
|
-
const [modalOpen, setModalOpen] =
|
|
7821
|
-
const [modalValues, setModalValues] =
|
|
7822
|
-
const [selectedOnly, setSelectedOnly] =
|
|
7981
|
+
const [open, setOpen] = useState19(false);
|
|
7982
|
+
const [search, setSearch] = useState19("");
|
|
7983
|
+
const [modalOpen, setModalOpen] = useState19(false);
|
|
7984
|
+
const [modalValues, setModalValues] = useState19([]);
|
|
7985
|
+
const [selectedOnly, setSelectedOnly] = useState19(false);
|
|
7823
7986
|
const rootRef = useRef16(null);
|
|
7824
7987
|
const popupRef = useRef16(null);
|
|
7825
7988
|
const inputRef = useRef16(null);
|
|
@@ -7863,14 +8026,14 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7863
8026
|
setSelectedOnly(false);
|
|
7864
8027
|
setModalOpen(true);
|
|
7865
8028
|
}
|
|
7866
|
-
return /* @__PURE__ */
|
|
8029
|
+
return /* @__PURE__ */ jsxs23("div", { ref: rootRef, style, className: `sia-input-select${open || modalOpen ? " is-open" : ""} ${className}`, onKeyDown: (event) => {
|
|
7867
8030
|
if (event.key === "Escape" && open) {
|
|
7868
8031
|
event.stopPropagation();
|
|
7869
8032
|
changeOpen(false);
|
|
7870
8033
|
inputRef.current?.focus();
|
|
7871
8034
|
}
|
|
7872
8035
|
}, children: [
|
|
7873
|
-
/* @__PURE__ */
|
|
8036
|
+
/* @__PURE__ */ jsx24(
|
|
7874
8037
|
Input,
|
|
7875
8038
|
{
|
|
7876
8039
|
...inputProps,
|
|
@@ -7907,26 +8070,26 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7907
8070
|
emit(parseInput ? parseInput(next) : multiple ? next.split(",").map((item) => item.trim()).filter(Boolean) : next);
|
|
7908
8071
|
changeOpen(true);
|
|
7909
8072
|
},
|
|
7910
|
-
suffix: /* @__PURE__ */
|
|
7911
|
-
allowClear && draft && !disabled && /* @__PURE__ */
|
|
8073
|
+
suffix: /* @__PURE__ */ jsxs23("span", { className: "sia-input-select__suffix", children: [
|
|
8074
|
+
allowClear && draft && !disabled && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: loading, "aria-label": "\u6E05\u9664\u8F93\u5165\u9009\u62E9", onClick: (event) => {
|
|
7912
8075
|
event.stopPropagation();
|
|
7913
8076
|
setDraft("");
|
|
7914
8077
|
emit(multiple ? [] : void 0);
|
|
7915
8078
|
inputRef.current?.focus();
|
|
7916
8079
|
}, children: "\xD7" }),
|
|
7917
8080
|
suffix,
|
|
7918
|
-
enableModal && /* @__PURE__ */
|
|
8081
|
+
enableModal && /* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u6253\u5F00\u9009\u62E9\u5F39\u7A97", onClick: (event) => {
|
|
7919
8082
|
event.stopPropagation();
|
|
7920
8083
|
openModal();
|
|
7921
8084
|
}, children: "\u2026" }),
|
|
7922
|
-
/* @__PURE__ */
|
|
8085
|
+
/* @__PURE__ */ jsx24(Button, { variant: "text", size: "small", disabled: disabled || loading, "aria-label": "\u5C55\u5F00\u9009\u9879", onClick: (event) => {
|
|
7923
8086
|
event.stopPropagation();
|
|
7924
8087
|
changeOpen(!open);
|
|
7925
|
-
}, children: /* @__PURE__ */
|
|
8088
|
+
}, children: /* @__PURE__ */ jsx24(Icon, { name: loading ? "refresh" : open ? "chevron-up" : "chevron-down", size: 13 }) })
|
|
7926
8089
|
] })
|
|
7927
8090
|
}
|
|
7928
8091
|
),
|
|
7929
|
-
/* @__PURE__ */
|
|
8092
|
+
/* @__PURE__ */ jsx24(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && !disabled && !loading, className: "sia-input-select__popup", children: /* @__PURE__ */ jsx24(
|
|
7930
8093
|
SelectionPanel,
|
|
7931
8094
|
{
|
|
7932
8095
|
options,
|
|
@@ -7941,7 +8104,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7941
8104
|
onSearch: setSearch
|
|
7942
8105
|
}
|
|
7943
8106
|
) }),
|
|
7944
|
-
enableModal && /* @__PURE__ */
|
|
8107
|
+
enableModal && /* @__PURE__ */ jsxs23(
|
|
7945
8108
|
Modal,
|
|
7946
8109
|
{
|
|
7947
8110
|
open: modalOpen,
|
|
@@ -7954,15 +8117,15 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7954
8117
|
setModalOpen(false);
|
|
7955
8118
|
},
|
|
7956
8119
|
children: [
|
|
7957
|
-
/* @__PURE__ */
|
|
7958
|
-
/* @__PURE__ */
|
|
7959
|
-
/* @__PURE__ */
|
|
8120
|
+
/* @__PURE__ */ jsxs23("div", { className: "sia-selection-panel__actions", role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
8121
|
+
/* @__PURE__ */ jsx24(Button, { role: "tab", "aria-selected": !selectedOnly, variant: !selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
8122
|
+
/* @__PURE__ */ jsxs23(Button, { role: "tab", "aria-selected": selectedOnly, variant: selectedOnly ? "primary" : "text", onClick: () => setSelectedOnly(true), children: [
|
|
7960
8123
|
"\u5DF2\u9009\u9879(",
|
|
7961
8124
|
modalValues.length,
|
|
7962
8125
|
")"
|
|
7963
8126
|
] })
|
|
7964
8127
|
] }),
|
|
7965
|
-
modalOpen && /* @__PURE__ */
|
|
8128
|
+
modalOpen && /* @__PURE__ */ jsx24(
|
|
7966
8129
|
SelectionPanel,
|
|
7967
8130
|
{
|
|
7968
8131
|
options,
|
|
@@ -7983,8 +8146,8 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7983
8146
|
});
|
|
7984
8147
|
|
|
7985
8148
|
// src/components/QueryForm.tsx
|
|
7986
|
-
import { Children as Children4, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as
|
|
7987
|
-
import { jsx as
|
|
8149
|
+
import { Children as Children4, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as useState20 } from "react";
|
|
8150
|
+
import { jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7988
8151
|
function QueryForm({
|
|
7989
8152
|
fields,
|
|
7990
8153
|
children,
|
|
@@ -8017,16 +8180,16 @@ function QueryForm({
|
|
|
8017
8180
|
...formProps
|
|
8018
8181
|
}) {
|
|
8019
8182
|
const [form] = useForm(providedForm);
|
|
8020
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
8183
|
+
const [internalCollapsed, setInternalCollapsed] = useState20(defaultCollapsed);
|
|
8021
8184
|
const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
|
|
8022
|
-
const [searching, setSearching] =
|
|
8023
|
-
const [saving, setSaving] =
|
|
8024
|
-
const [removing, setRemoving] =
|
|
8025
|
-
const [saveOpen, setSaveOpen] =
|
|
8026
|
-
const [saveName, setSaveName] =
|
|
8027
|
-
const [saveError, setSaveError] =
|
|
8028
|
-
const [error, setError] =
|
|
8029
|
-
const [activeShortcut, setActiveShortcut] =
|
|
8185
|
+
const [searching, setSearching] = useState20(false);
|
|
8186
|
+
const [saving, setSaving] = useState20(false);
|
|
8187
|
+
const [removing, setRemoving] = useState20(false);
|
|
8188
|
+
const [saveOpen, setSaveOpen] = useState20(false);
|
|
8189
|
+
const [saveName, setSaveName] = useState20("");
|
|
8190
|
+
const [saveError, setSaveError] = useState20("");
|
|
8191
|
+
const [error, setError] = useState20("");
|
|
8192
|
+
const [activeShortcut, setActiveShortcut] = useState20("");
|
|
8030
8193
|
const source = useRef17({ source: "submit" });
|
|
8031
8194
|
const searchLock = useRef17(false);
|
|
8032
8195
|
const saveLock = useRef17(false);
|
|
@@ -8034,11 +8197,11 @@ function QueryForm({
|
|
|
8034
8197
|
const snapshot = useRef17();
|
|
8035
8198
|
const busy = disabled || loading || searching;
|
|
8036
8199
|
const shortcutBusy = busy || shortcutsLoading || saving || removing;
|
|
8037
|
-
const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */
|
|
8200
|
+
const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ jsx25(Form.Item, { noStyle: true, ...item }) })) : Children4.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
|
|
8038
8201
|
const limit = Math.max(1, Math.floor(collapsedCount));
|
|
8039
8202
|
const rowRef = useRef17(null);
|
|
8040
8203
|
const actionsRef = useRef17(null);
|
|
8041
|
-
const [fittingCount, setFittingCount] =
|
|
8204
|
+
const [fittingCount, setFittingCount] = useState20(limit);
|
|
8042
8205
|
useLayoutEffect3(() => {
|
|
8043
8206
|
if (!collapsed) return;
|
|
8044
8207
|
const row = rowRef.current;
|
|
@@ -8138,8 +8301,8 @@ function QueryForm({
|
|
|
8138
8301
|
setRemoving(false);
|
|
8139
8302
|
}
|
|
8140
8303
|
}
|
|
8141
|
-
return /* @__PURE__ */
|
|
8142
|
-
/* @__PURE__ */
|
|
8304
|
+
return /* @__PURE__ */ jsxs24("div", { className: `sia-query-form ${className}`.trim(), children: [
|
|
8305
|
+
/* @__PURE__ */ jsxs24(
|
|
8143
8306
|
Form,
|
|
8144
8307
|
{
|
|
8145
8308
|
...formProps,
|
|
@@ -8158,8 +8321,8 @@ function QueryForm({
|
|
|
8158
8321
|
onValuesChange?.(changed, values);
|
|
8159
8322
|
},
|
|
8160
8323
|
children: [
|
|
8161
|
-
quickQueries.length ? /* @__PURE__ */
|
|
8162
|
-
quickQueries.map((query) => /* @__PURE__ */
|
|
8324
|
+
quickQueries.length ? /* @__PURE__ */ jsxs24("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
8325
|
+
quickQueries.map((query) => /* @__PURE__ */ jsx25(Badge, { className: "sia-query-form__quick-badge", showZero: true, size: "small", title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`, ...query.badgeProps, count: query.count, children: /* @__PURE__ */ jsx25(
|
|
8163
8326
|
Button,
|
|
8164
8327
|
{
|
|
8165
8328
|
size: query.size ?? quickQuerySize,
|
|
@@ -8172,8 +8335,8 @@ function QueryForm({
|
|
|
8172
8335
|
) }, query.key)),
|
|
8173
8336
|
" "
|
|
8174
8337
|
] }) : null,
|
|
8175
|
-
/* @__PURE__ */
|
|
8176
|
-
entries.map((entry, index) => /* @__PURE__ */
|
|
8338
|
+
/* @__PURE__ */ jsxs24("div", { ref: rowRef, className: `sia-query-form__fields${collapsed ? " is-collapsed" : ""}`, style: { "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth }, children: [
|
|
8339
|
+
entries.map((entry, index) => /* @__PURE__ */ jsx25(
|
|
8177
8340
|
"div",
|
|
8178
8341
|
{
|
|
8179
8342
|
className: "sia-query-form__field",
|
|
@@ -8183,23 +8346,23 @@ function QueryForm({
|
|
|
8183
8346
|
},
|
|
8184
8347
|
entry.key
|
|
8185
8348
|
)),
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8188
|
-
/* @__PURE__ */
|
|
8189
|
-
/* @__PURE__ */
|
|
8190
|
-
onSaveQuery ? /* @__PURE__ */
|
|
8349
|
+
/* @__PURE__ */ jsxs24("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
|
|
8350
|
+
/* @__PURE__ */ jsxs24(Space.Compact, { children: [
|
|
8351
|
+
/* @__PURE__ */ jsx25(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
|
|
8352
|
+
/* @__PURE__ */ jsx25(Button, { disabled: busy, onClick: reset, children: resetText }),
|
|
8353
|
+
onSaveQuery ? /* @__PURE__ */ jsx25(Button, { disabled: shortcutBusy, onClick: () => {
|
|
8191
8354
|
snapshot.current = form.getFieldsValue();
|
|
8192
8355
|
setSaveName("");
|
|
8193
8356
|
setSaveError("");
|
|
8194
8357
|
setSaveOpen(true);
|
|
8195
8358
|
}, children: saveText }) : null
|
|
8196
8359
|
] }),
|
|
8197
|
-
collapsible && entries.length > 0 ? /* @__PURE__ */
|
|
8360
|
+
collapsible && entries.length > 0 ? /* @__PURE__ */ jsx25(
|
|
8198
8361
|
Button,
|
|
8199
8362
|
{
|
|
8200
8363
|
variant: "link",
|
|
8201
8364
|
"aria-expanded": !collapsed,
|
|
8202
|
-
icon: /* @__PURE__ */
|
|
8365
|
+
icon: /* @__PURE__ */ jsx25(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
|
|
8203
8366
|
iconPosition: "end",
|
|
8204
8367
|
onClick: () => {
|
|
8205
8368
|
setInternalCollapsed(!collapsed);
|
|
@@ -8211,8 +8374,8 @@ function QueryForm({
|
|
|
8211
8374
|
actionsExtra
|
|
8212
8375
|
] })
|
|
8213
8376
|
] }),
|
|
8214
|
-
savedQueries.length && !collapsed ? /* @__PURE__ */
|
|
8215
|
-
savedQueries.map((query, index) => /* @__PURE__ */
|
|
8377
|
+
savedQueries.length && !collapsed ? /* @__PURE__ */ jsxs24("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
|
|
8378
|
+
savedQueries.map((query, index) => /* @__PURE__ */ jsx25(
|
|
8216
8379
|
Tag,
|
|
8217
8380
|
{
|
|
8218
8381
|
status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
|
|
@@ -8238,14 +8401,14 @@ function QueryForm({
|
|
|
8238
8401
|
)),
|
|
8239
8402
|
" "
|
|
8240
8403
|
] }) : null,
|
|
8241
|
-
error ? /* @__PURE__ */
|
|
8404
|
+
error ? /* @__PURE__ */ jsx25("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
|
|
8242
8405
|
]
|
|
8243
8406
|
}
|
|
8244
8407
|
),
|
|
8245
|
-
/* @__PURE__ */
|
|
8408
|
+
/* @__PURE__ */ jsxs24(Modal, { open: saveOpen, title: "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2", width: 420, confirmLoading: saving, onOk: save, onOpenChange: (next) => {
|
|
8246
8409
|
if (!saveLock.current) setSaveOpen(next);
|
|
8247
8410
|
}, children: [
|
|
8248
|
-
/* @__PURE__ */
|
|
8411
|
+
/* @__PURE__ */ jsx25(
|
|
8249
8412
|
Input,
|
|
8250
8413
|
{
|
|
8251
8414
|
autoFocus: true,
|
|
@@ -8264,7 +8427,7 @@ function QueryForm({
|
|
|
8264
8427
|
}
|
|
8265
8428
|
}
|
|
8266
8429
|
),
|
|
8267
|
-
saveError ? /* @__PURE__ */
|
|
8430
|
+
saveError ? /* @__PURE__ */ jsx25("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
|
|
8268
8431
|
] })
|
|
8269
8432
|
] });
|
|
8270
8433
|
}
|
|
@@ -8414,6 +8577,7 @@ export {
|
|
|
8414
8577
|
message,
|
|
8415
8578
|
niceChartDomain,
|
|
8416
8579
|
notification,
|
|
8580
|
+
openSelectModal,
|
|
8417
8581
|
paddedValueExtent,
|
|
8418
8582
|
registerChartMap,
|
|
8419
8583
|
saveCompositeImage,
|