@sia.soul/sia-react-ui 0.1.12 → 0.1.14
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/chart.cjs +21 -13
- package/dist/chart.js +4 -4
- package/dist/{chunk-RLTG3IK7.js → chunk-25BU7YTB.js} +21 -11
- package/dist/{chunk-EJDPRAU2.js → chunk-3VJ4CZDQ.js} +7 -0
- package/dist/{chunk-JJVD2ITI.js → chunk-ALWHRV4L.js} +7 -4
- package/dist/{chunk-MOOMDRAN.js → chunk-K3XRTEIO.js} +9 -7
- package/dist/{chunk-F3VH6LJH.js → chunk-MUTJVDM6.js} +3 -3
- package/dist/{chunk-Z3T6RDQP.js → chunk-OKP4DIQH.js} +2 -2
- package/dist/{chunk-5ZTWY3PG.js → chunk-QJ4OQNQ4.js} +3 -3
- package/dist/{chunk-BUMS62NO.js → chunk-R3TYVU53.js} +14 -8
- package/dist/{chunk-MBS2HXLZ.js → chunk-TZGUBGA4.js} +6 -1
- package/dist/{chunk-WHARTF2I.js → chunk-YT6E3X2K.js} +5 -2
- package/dist/{core-y0w5PBO2.d.cts → core-BK8AXc12.d.cts} +3 -2
- package/dist/{core-VmiEI1Jp.d.ts → core-CJK3_KTQ.d.ts} +3 -2
- package/dist/core.cjs +54 -40
- package/dist/core.css +344 -40
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +6 -6
- package/dist/index.cjs +312 -123
- package/dist/index.css +344 -40
- package/dist/index.d.cts +27 -14
- package/dist/index.d.ts +27 -14
- package/dist/index.js +255 -88
- package/dist/markdown-editor.cjs +3 -2
- package/dist/markdown-editor.js +2 -2
- package/dist/rich-text-editor.cjs +9 -2
- package/dist/rich-text-editor.js +4 -4
- package/dist/{select-date-range-D-JMfpwD.d.ts → select-date-range-Bdb-hi9c.d.ts} +3 -3
- package/dist/{select-date-range-l-xgB959.d.cts → select-date-range-shDQ5uJA.d.cts} +3 -3
- package/dist/select-date-range.cjs +35 -15
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
smoothSvgPath,
|
|
57
57
|
svgArcPath,
|
|
58
58
|
transferCompositeValue
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-OKP4DIQH.js";
|
|
60
60
|
import {
|
|
61
61
|
Badge,
|
|
62
62
|
Breadcrumb,
|
|
@@ -79,22 +79,22 @@ import {
|
|
|
79
79
|
Watermark,
|
|
80
80
|
message,
|
|
81
81
|
notification
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-K3XRTEIO.js";
|
|
83
83
|
import {
|
|
84
84
|
TextArea
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-YT6E3X2K.js";
|
|
86
86
|
import {
|
|
87
87
|
MarkdownEditor
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-QJ4OQNQ4.js";
|
|
89
89
|
import {
|
|
90
90
|
RichTextContent,
|
|
91
91
|
RichTextEditor
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-MUTJVDM6.js";
|
|
93
93
|
import {
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-25BU7YTB.js";
|
|
98
98
|
import {
|
|
99
99
|
Checkbox,
|
|
100
100
|
Modal,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
Tooltip,
|
|
108
108
|
Tree,
|
|
109
109
|
useOverlayLifecycle
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-R3TYVU53.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
FILLED_ICON_NAMES,
|
|
@@ -118,16 +118,18 @@ import {
|
|
|
118
118
|
PopupPortal,
|
|
119
119
|
Segmented,
|
|
120
120
|
Steps
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-ALWHRV4L.js";
|
|
122
122
|
import {
|
|
123
123
|
Button
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-TZGUBGA4.js";
|
|
125
125
|
import {
|
|
126
|
+
ControlSizeContext,
|
|
126
127
|
PlaceholderModeContext,
|
|
128
|
+
useControlSize,
|
|
127
129
|
useControllableState,
|
|
128
130
|
useFloatingPlaceholder,
|
|
129
131
|
usePlaceholderMode
|
|
130
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-3VJ4CZDQ.js";
|
|
131
133
|
|
|
132
134
|
// src/components/Alert.tsx
|
|
133
135
|
import { useState } from "react";
|
|
@@ -177,6 +179,7 @@ import { useState as useState2 } from "react";
|
|
|
177
179
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
178
180
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
179
181
|
function Pagination({
|
|
182
|
+
size: sizeProp,
|
|
180
183
|
total = 0,
|
|
181
184
|
current,
|
|
182
185
|
defaultCurrent = 1,
|
|
@@ -194,6 +197,7 @@ function Pagination({
|
|
|
194
197
|
className = "",
|
|
195
198
|
...props
|
|
196
199
|
}) {
|
|
200
|
+
const controlSize = useControlSize(sizeProp);
|
|
197
201
|
const [size, setSize] = useControllableState({ value: pageSize, defaultValue: Math.max(1, defaultPageSize) });
|
|
198
202
|
const [page, setPage] = useControllableState({ value: current, defaultValue: Math.max(1, defaultCurrent) });
|
|
199
203
|
const [internalRefreshing, setInternalRefreshing] = useState2(false);
|
|
@@ -225,14 +229,14 @@ function Pagination({
|
|
|
225
229
|
if (refreshing === void 0) setInternalRefreshing(false);
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
|
-
return /* @__PURE__ */ jsxs2("nav", { className: `sia-pagination ${className}`.trim(), "aria-label": "\u5206\u9875", ...props, children: [
|
|
232
|
+
return /* @__PURE__ */ jsxs2("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...props, children: [
|
|
229
233
|
showSizeChanger ? /* @__PURE__ */ jsxs2("div", { className: "sia-pagination__size", children: [
|
|
230
234
|
/* @__PURE__ */ jsx2("span", { children: "\u6BCF\u9875\u663E\u793A" }),
|
|
231
235
|
/* @__PURE__ */ jsx2(
|
|
232
236
|
Select,
|
|
233
237
|
{
|
|
234
238
|
className: "sia-pagination__size-select",
|
|
235
|
-
size:
|
|
239
|
+
size: controlSize,
|
|
236
240
|
"aria-label": "\u6BCF\u9875\u6761\u6570",
|
|
237
241
|
value: size,
|
|
238
242
|
options: sizes.map((value) => ({ label: `${value} \u6761`, value })),
|
|
@@ -247,7 +251,7 @@ function Pagination({
|
|
|
247
251
|
Button,
|
|
248
252
|
{
|
|
249
253
|
variant: "text",
|
|
250
|
-
size:
|
|
254
|
+
size: controlSize,
|
|
251
255
|
className: "sia-pagination__total",
|
|
252
256
|
disabled: disabled || !onRefreshTotal || loading,
|
|
253
257
|
title: onRefreshTotal ? "\u70B9\u51FB\u5237\u65B0\u603B\u8BB0\u5F55\u6570" : void 0,
|
|
@@ -262,15 +266,15 @@ function Pagination({
|
|
|
262
266
|
}
|
|
263
267
|
) : null,
|
|
264
268
|
/* @__PURE__ */ jsxs2("div", { className: "sia-pagination__buttons", children: [
|
|
265
|
-
/* @__PURE__ */ jsx2(Button, { size:
|
|
266
|
-
/* @__PURE__ */ jsx2(Button, { size:
|
|
269
|
+
/* @__PURE__ */ jsx2(Button, { size: controlSize, variant: "text", "aria-label": "\u7B2C\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(1), children: /* @__PURE__ */ jsx2(Icon, { name: "double-left", size: 15 }) }),
|
|
270
|
+
/* @__PURE__ */ jsx2(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0A\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(safePage - 1), children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-left", size: 15 }) }),
|
|
267
271
|
/* @__PURE__ */ jsxs2("span", { "aria-live": "polite", children: [
|
|
268
272
|
safePage,
|
|
269
273
|
" / ",
|
|
270
274
|
totalPages
|
|
271
275
|
] }),
|
|
272
|
-
/* @__PURE__ */ jsx2(Button, { size:
|
|
273
|
-
/* @__PURE__ */ jsx2(Button, { size:
|
|
276
|
+
/* @__PURE__ */ jsx2(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0B\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(safePage + 1), children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-right", size: 15 }) }),
|
|
277
|
+
/* @__PURE__ */ jsx2(Button, { size: controlSize, variant: "text", "aria-label": "\u6700\u540E\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(totalPages), children: /* @__PURE__ */ jsx2(Icon, { name: "double-right", size: 15 }) })
|
|
274
278
|
] })
|
|
275
279
|
] });
|
|
276
280
|
}
|
|
@@ -315,6 +319,7 @@ function Cascader({
|
|
|
315
319
|
options,
|
|
316
320
|
value,
|
|
317
321
|
defaultValue,
|
|
322
|
+
size: sizeProp,
|
|
318
323
|
multiple = false,
|
|
319
324
|
showSearch = false,
|
|
320
325
|
allowClear = false,
|
|
@@ -330,6 +335,7 @@ function Cascader({
|
|
|
330
335
|
className = "",
|
|
331
336
|
...props
|
|
332
337
|
}) {
|
|
338
|
+
const size = useControlSize(sizeProp);
|
|
333
339
|
const fields = useMemo(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
334
340
|
const rootRef = useRef(null);
|
|
335
341
|
const popupRef = useRef(null);
|
|
@@ -418,7 +424,7 @@ function Cascader({
|
|
|
418
424
|
if (children?.length) columns.push(children);
|
|
419
425
|
});
|
|
420
426
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
|
|
421
|
-
return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: `sia-cascader${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
427
|
+
return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: `sia-cascader sia-cascader--${size}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
422
428
|
/* @__PURE__ */ jsxs3("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
|
|
423
429
|
/* @__PURE__ */ jsx3("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ jsx3("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ jsx3("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
|
|
424
430
|
allowClear && selectedPaths.length ? /* @__PURE__ */ jsx3("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
|
|
@@ -1388,6 +1394,7 @@ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-run
|
|
|
1388
1394
|
var Switch = forwardRef2(function Switch2({
|
|
1389
1395
|
label,
|
|
1390
1396
|
variant = "standard",
|
|
1397
|
+
size: sizeProp,
|
|
1391
1398
|
checkedContent,
|
|
1392
1399
|
uncheckedContent,
|
|
1393
1400
|
onChange,
|
|
@@ -1395,6 +1402,7 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1395
1402
|
className = "",
|
|
1396
1403
|
...props
|
|
1397
1404
|
}, ref) {
|
|
1405
|
+
const size = useControlSize(sizeProp);
|
|
1398
1406
|
const hasContent = checkedContent !== void 0 || uncheckedContent !== void 0;
|
|
1399
1407
|
const checkedVisual = checkedContent ?? (variant === "segmented" ? "\u5F00" : null);
|
|
1400
1408
|
const uncheckedVisual = uncheckedContent ?? (variant === "segmented" ? "\u5173" : null);
|
|
@@ -1402,7 +1410,7 @@ var Switch = forwardRef2(function Switch2({
|
|
|
1402
1410
|
onCheckedChange?.(event.currentTarget.checked);
|
|
1403
1411
|
onChange?.(event);
|
|
1404
1412
|
};
|
|
1405
|
-
return /* @__PURE__ */ jsxs9("label", { className: `sia-switch-wrap ${className}`.trim(), children: [
|
|
1413
|
+
return /* @__PURE__ */ jsxs9("label", { className: `sia-switch-wrap sia-switch-wrap--${size} ${className}`.trim(), children: [
|
|
1406
1414
|
/* @__PURE__ */ jsx9("input", { ref, type: "checkbox", role: "switch", className: "sia-switch-input", onChange: handleChange, ...props }),
|
|
1407
1415
|
/* @__PURE__ */ jsxs9(
|
|
1408
1416
|
"span",
|
|
@@ -1611,6 +1619,7 @@ function FormRoot({
|
|
|
1611
1619
|
form,
|
|
1612
1620
|
initialValues,
|
|
1613
1621
|
layout = "horizontal",
|
|
1622
|
+
size: sizeProp,
|
|
1614
1623
|
placeholderMode,
|
|
1615
1624
|
disabled = false,
|
|
1616
1625
|
requiredMark = true,
|
|
@@ -1621,16 +1630,17 @@ function FormRoot({
|
|
|
1621
1630
|
children,
|
|
1622
1631
|
...props
|
|
1623
1632
|
}) {
|
|
1633
|
+
const size = useControlSize(sizeProp);
|
|
1624
1634
|
const resolvedPlaceholderMode = usePlaceholderMode(placeholderMode);
|
|
1625
1635
|
const [internalForm] = useForm(form);
|
|
1626
1636
|
const instance = internalForm;
|
|
1627
1637
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
1628
1638
|
const context = useMemo4(() => instance, [instance]);
|
|
1629
|
-
return /* @__PURE__ */ jsx9(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx9(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx9(
|
|
1639
|
+
return /* @__PURE__ */ jsx9(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx9(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ jsx9(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx9(
|
|
1630
1640
|
"form",
|
|
1631
1641
|
{
|
|
1632
1642
|
...props,
|
|
1633
|
-
className: `sia-form sia-form--${layout}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
1643
|
+
className: `sia-form sia-form--${layout} sia-form--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
1634
1644
|
"data-required-mark": requiredMark,
|
|
1635
1645
|
onSubmit: (event) => {
|
|
1636
1646
|
event.preventDefault();
|
|
@@ -1638,7 +1648,7 @@ function FormRoot({
|
|
|
1638
1648
|
},
|
|
1639
1649
|
children: /* @__PURE__ */ jsx9("fieldset", { disabled, children })
|
|
1640
1650
|
}
|
|
1641
|
-
) }) });
|
|
1651
|
+
) }) }) });
|
|
1642
1652
|
}
|
|
1643
1653
|
function defaultEventValue(valuePropName, args) {
|
|
1644
1654
|
const first = args[0];
|
|
@@ -1786,12 +1796,13 @@ var Form = Object.assign(FormRoot, {
|
|
|
1786
1796
|
import { createContext as createContext3, forwardRef as forwardRef3, useContext as useContext3, useId as useId4, useMemo as useMemo5 } from "react";
|
|
1787
1797
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1788
1798
|
var RadioContext = createContext3(null);
|
|
1789
|
-
var RadioRoot = forwardRef3(function Radio({ value, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
1799
|
+
var RadioRoot = forwardRef3(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
1800
|
+
const size = useControlSize(sizeProp);
|
|
1790
1801
|
const group = useContext3(RadioContext);
|
|
1791
1802
|
const fallbackId = useId4();
|
|
1792
1803
|
const grouped = group !== null;
|
|
1793
1804
|
const currentChecked = grouped ? group.value === value : checked;
|
|
1794
|
-
return /* @__PURE__ */ jsxs10("label", { className: `sia-radio${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1805
|
+
return /* @__PURE__ */ jsxs10("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1795
1806
|
/* @__PURE__ */ jsx10(
|
|
1796
1807
|
"input",
|
|
1797
1808
|
{
|
|
@@ -1819,6 +1830,7 @@ function RadioButton(props) {
|
|
|
1819
1830
|
return /* @__PURE__ */ jsx10(RadioRoot, { ...props, button: true });
|
|
1820
1831
|
}
|
|
1821
1832
|
function RadioGroup({
|
|
1833
|
+
size: sizeProp,
|
|
1822
1834
|
value,
|
|
1823
1835
|
defaultValue,
|
|
1824
1836
|
options,
|
|
@@ -1830,6 +1842,7 @@ function RadioGroup({
|
|
|
1830
1842
|
children,
|
|
1831
1843
|
onChange
|
|
1832
1844
|
}) {
|
|
1845
|
+
const size = useControlSize(sizeProp);
|
|
1833
1846
|
const fallbackName = useId4();
|
|
1834
1847
|
const [currentValue, setValue2] = useControllableState({
|
|
1835
1848
|
value,
|
|
@@ -1846,13 +1859,13 @@ function RadioGroup({
|
|
|
1846
1859
|
setValue: setValue2
|
|
1847
1860
|
}), [buttonStyle, currentValue, disabled, fallbackName, name, setValue2]);
|
|
1848
1861
|
const Component = optionType === "button" ? RadioButton : RadioRoot;
|
|
1849
|
-
return /* @__PURE__ */ jsx10(RadioContext.Provider, { value: context, children: /* @__PURE__ */ jsxs10("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
1862
|
+
return /* @__PURE__ */ jsx10(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx10(RadioContext.Provider, { value: context, children: /* @__PURE__ */ jsxs10("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
1850
1863
|
options?.map((option) => {
|
|
1851
1864
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
1852
1865
|
return /* @__PURE__ */ jsx10(Component, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
1853
1866
|
}),
|
|
1854
1867
|
children
|
|
1855
|
-
] }) });
|
|
1868
|
+
] }) }) });
|
|
1856
1869
|
}
|
|
1857
1870
|
var Radio2 = Object.assign(RadioRoot, { Button: RadioButton, Group: RadioGroup });
|
|
1858
1871
|
|
|
@@ -2047,6 +2060,7 @@ function createDefaultStops(color) {
|
|
|
2047
2060
|
return [createStop(color, 0), createStop("#FFFFFF", 100)];
|
|
2048
2061
|
}
|
|
2049
2062
|
function ColorPicker({
|
|
2063
|
+
size: sizeProp,
|
|
2050
2064
|
value,
|
|
2051
2065
|
defaultValue = "#1677FF",
|
|
2052
2066
|
mode,
|
|
@@ -2064,6 +2078,7 @@ function ColorPicker({
|
|
|
2064
2078
|
onClear,
|
|
2065
2079
|
...props
|
|
2066
2080
|
}) {
|
|
2081
|
+
const size = useControlSize(sizeProp);
|
|
2067
2082
|
const rootRef = useRef6(null);
|
|
2068
2083
|
const popupRef = useRef6(null);
|
|
2069
2084
|
const lastEmittedValue = useRef6();
|
|
@@ -2164,7 +2179,7 @@ function ColorPicker({
|
|
|
2164
2179
|
const triggerBackground = color || "transparent";
|
|
2165
2180
|
const triggerText = color || "\u65E0\u8272";
|
|
2166
2181
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
2167
|
-
return /* @__PURE__ */ jsxs12("div", { ref: rootRef, className: `sia-color-picker${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
2182
|
+
return /* @__PURE__ */ jsxs12("div", { ref: rootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
2168
2183
|
/* @__PURE__ */ jsxs12(
|
|
2169
2184
|
"button",
|
|
2170
2185
|
{
|
|
@@ -2298,7 +2313,7 @@ function seconds(value) {
|
|
|
2298
2313
|
function TimePicker({
|
|
2299
2314
|
value,
|
|
2300
2315
|
defaultValue = "",
|
|
2301
|
-
size
|
|
2316
|
+
size: sizeProp,
|
|
2302
2317
|
status = "default",
|
|
2303
2318
|
allowClear = true,
|
|
2304
2319
|
use12Hours = false,
|
|
@@ -2318,6 +2333,7 @@ function TimePicker({
|
|
|
2318
2333
|
step,
|
|
2319
2334
|
...props
|
|
2320
2335
|
}) {
|
|
2336
|
+
const size = useControlSize(sizeProp);
|
|
2321
2337
|
const id = useId5();
|
|
2322
2338
|
const rootRef = useRef7(null);
|
|
2323
2339
|
const inputRef = useRef7(null);
|
|
@@ -2444,13 +2460,14 @@ function TimePicker({
|
|
|
2444
2460
|
] });
|
|
2445
2461
|
}
|
|
2446
2462
|
function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F00\u59CB\u65F6\u95F4", "\u7ED3\u675F\u65F6\u95F4"], separator = "\u2192", onChange, className = "", style, ...props }) {
|
|
2463
|
+
const size = useControlSize(props.size);
|
|
2447
2464
|
const [currentValue, setValue2] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
|
|
2448
2465
|
function update(index, next) {
|
|
2449
2466
|
const pair = [currentValue[0], currentValue[1]];
|
|
2450
2467
|
pair[index] = next;
|
|
2451
2468
|
setValue2(pair);
|
|
2452
2469
|
}
|
|
2453
|
-
return /* @__PURE__ */ jsxs13("span", { style, className: `sia-time-range sia-picker--${
|
|
2470
|
+
return /* @__PURE__ */ jsxs13("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2454
2471
|
/* @__PURE__ */ jsx13(TimePicker, { ...props, "aria-label": props["aria-label"] ? props["aria-label"] + "\u5F00\u59CB\u65F6\u95F4" : "\u5F00\u59CB\u65F6\u95F4", value: currentValue[0], placeholder: placeholder[0], max: currentValue[1] && (!props.max || seconds(currentValue[1]) < seconds(String(props.max))) ? currentValue[1] : props.max, onChange: (next) => update(0, next) }),
|
|
2455
2472
|
/* @__PURE__ */ jsx13("span", { className: "sia-time-range__separator", children: separator }),
|
|
2456
2473
|
/* @__PURE__ */ jsx13(TimePicker, { ...props, id: props.id ? props.id + "-end" : void 0, "aria-label": props["aria-label"] ? props["aria-label"] + "\u7ED3\u675F\u65F6\u95F4" : "\u7ED3\u675F\u65F6\u95F4", value: currentValue[1], placeholder: placeholder[1], min: currentValue[0] && (!props.min || seconds(currentValue[0]) > seconds(String(props.min))) ? currentValue[0] : props.min, onChange: (next) => update(1, next) })
|
|
@@ -2496,7 +2513,7 @@ function TreeSelect({
|
|
|
2496
2513
|
searchPlaceholder = "\u641C\u7D22\u8282\u70B9",
|
|
2497
2514
|
maxTagCount = 3,
|
|
2498
2515
|
disabled = false,
|
|
2499
|
-
size
|
|
2516
|
+
size: sizeProp,
|
|
2500
2517
|
status = "default",
|
|
2501
2518
|
className = "",
|
|
2502
2519
|
onChange,
|
|
@@ -2523,6 +2540,7 @@ function TreeSelect({
|
|
|
2523
2540
|
onDeselect,
|
|
2524
2541
|
...props
|
|
2525
2542
|
}) {
|
|
2543
|
+
const size = useControlSize(sizeProp);
|
|
2526
2544
|
const rootRef = useRef8(null);
|
|
2527
2545
|
const popupRef = useRef8(null);
|
|
2528
2546
|
const nodeIndex = useMemo6(() => {
|
|
@@ -3920,7 +3938,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
3920
3938
|
max,
|
|
3921
3939
|
step = 1,
|
|
3922
3940
|
precision,
|
|
3923
|
-
size
|
|
3941
|
+
size: sizeProp,
|
|
3924
3942
|
status = "default",
|
|
3925
3943
|
prefix,
|
|
3926
3944
|
suffix,
|
|
@@ -3935,6 +3953,7 @@ var InputNumber = forwardRef4(function InputNumber2({
|
|
|
3935
3953
|
onKeyDown,
|
|
3936
3954
|
...props
|
|
3937
3955
|
}, forwardedRef) {
|
|
3956
|
+
const size = useControlSize(sizeProp);
|
|
3938
3957
|
const fallbackId = useId7();
|
|
3939
3958
|
const inputId = id ?? fallbackId;
|
|
3940
3959
|
const localRef = useRef11(null);
|
|
@@ -5786,87 +5805,231 @@ function applyColumnSettingsToTree(columns, items) {
|
|
|
5786
5805
|
}).sort((left, right) => left.order - right.order);
|
|
5787
5806
|
return walk(columns).map((entry) => entry.column);
|
|
5788
5807
|
}
|
|
5789
|
-
function
|
|
5808
|
+
function orderColumnSettings(items) {
|
|
5809
|
+
const rank = (item) => item.fixed === "left" ? 0 : item.fixed === "right" ? 2 : 1;
|
|
5810
|
+
return [...items].sort((a, b) => rank(a) - rank(b)).map((item, order) => ({ ...item, order }));
|
|
5811
|
+
}
|
|
5812
|
+
function ColumnSettingPanel({ open, items, columns, loading, loadError, onRetry, onClose, onApply }) {
|
|
5790
5813
|
const [draft, setDraft] = useState16(items);
|
|
5791
|
-
const
|
|
5814
|
+
const listRef = useRef14(null);
|
|
5815
|
+
const cancelDrag = useRef14(null);
|
|
5816
|
+
const [preview, setPreview] = useState16(null);
|
|
5792
5817
|
useEffect12(() => {
|
|
5793
|
-
|
|
5818
|
+
cancelDrag.current?.();
|
|
5819
|
+
if (open) setDraft(orderColumnSettings(items));
|
|
5794
5820
|
}, [items, open]);
|
|
5821
|
+
useEffect12(() => () => cancelDrag.current?.(), []);
|
|
5795
5822
|
const labels = new Map(flattenTableColumns(columns).map((column) => [column.key, getColumnLabel(column)]));
|
|
5796
5823
|
const visibleCount = draft.filter((item) => item.visible).length;
|
|
5797
|
-
function move(index, offset) {
|
|
5798
|
-
const target = index + offset;
|
|
5799
|
-
if (target < 0 || target >= draft.length) return;
|
|
5800
|
-
const next = [...draft];
|
|
5801
|
-
const [item] = next.splice(index, 1);
|
|
5802
|
-
next.splice(target, 0, item);
|
|
5803
|
-
setDraft(next.map((entry, order) => ({ ...entry, order })));
|
|
5804
|
-
}
|
|
5805
5824
|
function setFixed(key, fixed) {
|
|
5806
|
-
setDraft((previous) =>
|
|
5825
|
+
setDraft((previous) => {
|
|
5826
|
+
const item = previous.find((entry) => entry.key === key);
|
|
5827
|
+
if (!item) return previous;
|
|
5828
|
+
const next = previous.filter((entry) => entry.key !== key);
|
|
5829
|
+
const updated = { ...item, fixed };
|
|
5830
|
+
const target = fixed === "left" ? next.filter((entry) => entry.fixed === "left").length : fixed === "right" ? next.findIndex((entry) => entry.fixed === "right") : item.fixed === "left" ? next.filter((entry) => entry.fixed === "left").length : next.findIndex((entry) => entry.fixed === "right");
|
|
5831
|
+
next.splice(target < 0 ? next.length : target, 0, updated);
|
|
5832
|
+
return orderColumnSettings(next);
|
|
5833
|
+
});
|
|
5834
|
+
}
|
|
5835
|
+
function startSort(event, key) {
|
|
5836
|
+
if (loading || loadError || event.button !== 0 || event.target.closest("button, input, label")) return;
|
|
5837
|
+
const list = listRef.current;
|
|
5838
|
+
if (!list) return;
|
|
5839
|
+
cancelDrag.current?.();
|
|
5840
|
+
const original = [...draft];
|
|
5841
|
+
const from = original.findIndex((item) => item.key === key);
|
|
5842
|
+
const elements = Array.from(list.querySelectorAll(".sia-table-settings__item"));
|
|
5843
|
+
const rects = elements.map((element) => element.getBoundingClientRect());
|
|
5844
|
+
const gap = parseFloat(getComputedStyle(list).rowGap) || 0;
|
|
5845
|
+
const positions = original.map((_, index) => index);
|
|
5846
|
+
const startY = event.clientY;
|
|
5847
|
+
let lastY = startY;
|
|
5848
|
+
let moved = false;
|
|
5849
|
+
let next = original;
|
|
5850
|
+
let frame = 0;
|
|
5851
|
+
let scrollParent = list.parentElement;
|
|
5852
|
+
while (scrollParent && !(scrollParent.scrollHeight > scrollParent.clientHeight && /auto|scroll/.test(getComputedStyle(scrollParent).overflowY))) scrollParent = scrollParent.parentElement;
|
|
5853
|
+
const initialScroll = scrollParent?.scrollTop ?? 0;
|
|
5854
|
+
const target = event.currentTarget;
|
|
5855
|
+
target.setPointerCapture(event.pointerId);
|
|
5856
|
+
const previousUserSelect = document.body.style.userSelect;
|
|
5857
|
+
function update() {
|
|
5858
|
+
const dy = lastY - startY + (scrollParent?.scrollTop ?? 0) - initialScroll;
|
|
5859
|
+
if (!moved && Math.abs(dy) < 4) return;
|
|
5860
|
+
moved = true;
|
|
5861
|
+
document.body.style.userSelect = "none";
|
|
5862
|
+
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
5863
|
+
let to = from;
|
|
5864
|
+
for (const index of positions) {
|
|
5865
|
+
if (index > from && center > rects[index].top + rects[index].height / 2) to = index;
|
|
5866
|
+
if (index < from && center < rects[index].top + rects[index].height / 2) {
|
|
5867
|
+
to = index;
|
|
5868
|
+
break;
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
next = [...original];
|
|
5872
|
+
const [item] = next.splice(from, 1);
|
|
5873
|
+
next.splice(to, 0, { ...item, fixed: original[to].fixed });
|
|
5874
|
+
const offsets = {};
|
|
5875
|
+
let top = rects[0].top;
|
|
5876
|
+
for (const entry of next) {
|
|
5877
|
+
const index = original.findIndex((item2) => item2.key === entry.key);
|
|
5878
|
+
offsets[entry.key] = entry.key === key ? dy : top - rects[index].top;
|
|
5879
|
+
top += rects[index].height + gap;
|
|
5880
|
+
}
|
|
5881
|
+
setPreview({ key, fixed: original[to].fixed, offsets });
|
|
5882
|
+
}
|
|
5883
|
+
function tick() {
|
|
5884
|
+
if (moved && scrollParent) {
|
|
5885
|
+
const bounds = scrollParent.getBoundingClientRect();
|
|
5886
|
+
const delta = lastY < bounds.top + 40 ? -10 : lastY > bounds.bottom - 40 ? 10 : 0;
|
|
5887
|
+
if (delta) {
|
|
5888
|
+
scrollParent.scrollTop += delta;
|
|
5889
|
+
update();
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5892
|
+
frame = requestAnimationFrame(tick);
|
|
5893
|
+
}
|
|
5894
|
+
function move(moveEvent) {
|
|
5895
|
+
if (moveEvent.pointerId !== event.pointerId) return;
|
|
5896
|
+
lastY = moveEvent.clientY;
|
|
5897
|
+
update();
|
|
5898
|
+
}
|
|
5899
|
+
function finish(commit) {
|
|
5900
|
+
document.removeEventListener("pointermove", move);
|
|
5901
|
+
document.removeEventListener("pointerup", up);
|
|
5902
|
+
document.removeEventListener("pointercancel", cancel);
|
|
5903
|
+
document.removeEventListener("keydown", escape, true);
|
|
5904
|
+
window.removeEventListener("blur", cancel);
|
|
5905
|
+
cancelAnimationFrame(frame);
|
|
5906
|
+
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
5907
|
+
document.body.style.userSelect = previousUserSelect;
|
|
5908
|
+
cancelDrag.current = null;
|
|
5909
|
+
setPreview(null);
|
|
5910
|
+
if (commit && moved) setDraft(orderColumnSettings(next));
|
|
5911
|
+
}
|
|
5912
|
+
function up(upEvent) {
|
|
5913
|
+
if (upEvent.pointerId === event.pointerId) {
|
|
5914
|
+
lastY = upEvent.clientY;
|
|
5915
|
+
update();
|
|
5916
|
+
finish(true);
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
function cancel() {
|
|
5920
|
+
finish(false);
|
|
5921
|
+
}
|
|
5922
|
+
function escape(event2) {
|
|
5923
|
+
if (event2.key === "Escape") {
|
|
5924
|
+
event2.preventDefault();
|
|
5925
|
+
event2.stopPropagation();
|
|
5926
|
+
cancel();
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
cancelDrag.current = cancel;
|
|
5930
|
+
document.addEventListener("pointermove", move);
|
|
5931
|
+
document.addEventListener("pointerup", up);
|
|
5932
|
+
document.addEventListener("pointercancel", cancel);
|
|
5933
|
+
document.addEventListener("keydown", escape, true);
|
|
5934
|
+
window.addEventListener("blur", cancel);
|
|
5935
|
+
frame = requestAnimationFrame(tick);
|
|
5807
5936
|
}
|
|
5808
5937
|
return /* @__PURE__ */ jsxs19(Drawer2, { open, title: "\u5217\u8BBE\u7F6E", size: 440, onOpenChange: (next) => {
|
|
5809
5938
|
if (!next) onClose();
|
|
5810
5939
|
}, footer: /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
5811
5940
|
/* @__PURE__ */ jsx20(Button, { onClick: onClose, children: "\u53D6\u6D88" }),
|
|
5812
|
-
/* @__PURE__ */ jsx20(Button, { variant: "primary", onClick: () => onApply(draft), children: "\u5E94\u7528" })
|
|
5941
|
+
/* @__PURE__ */ jsx20(Button, { variant: "primary", disabled: loading || loadError, onClick: () => onApply(draft), children: "\u5E94\u7528" })
|
|
5813
5942
|
] }), children: [
|
|
5814
|
-
/* @__PURE__ */
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
"\
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5943
|
+
loading ? /* @__PURE__ */ jsx20("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u5217\u914D\u7F6E\u2026" }) : null,
|
|
5944
|
+
loadError ? /* @__PURE__ */ jsxs19("p", { role: "alert", children: [
|
|
5945
|
+
"\u8BFB\u53D6\u5217\u914D\u7F6E\u5931\u8D25\u3002",
|
|
5946
|
+
/* @__PURE__ */ jsx20(Button, { variant: "link", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
5947
|
+
] }) : null,
|
|
5948
|
+
/* @__PURE__ */ jsxs19("fieldset", { disabled: loading || loadError, style: { border: 0, padding: 0, margin: 0, minWidth: 0 }, "aria-busy": loading, children: [
|
|
5949
|
+
/* @__PURE__ */ jsxs19("label", { className: "sia-table-settings__all", children: [
|
|
5950
|
+
/* @__PURE__ */ jsx20(TableCheckbox, { label: "\u5168\u9009\u5217", checked: visibleCount === draft.length && draft.length > 0, indeterminate: visibleCount > 0 && visibleCount < draft.length, onChange: (checked) => setDraft((previous) => previous.map((item) => ({ ...item, visible: checked }))) }),
|
|
5951
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
5952
|
+
"\u5168\u9009\uFF08",
|
|
5953
|
+
visibleCount,
|
|
5954
|
+
"/",
|
|
5955
|
+
draft.length,
|
|
5956
|
+
"\uFF09"
|
|
5957
|
+
] })
|
|
5958
|
+
] }),
|
|
5959
|
+
/* @__PURE__ */ jsx20("div", { ref: listRef, className: `sia-table-settings__list${preview ? " is-sorting" : ""}`, children: draft.map((item) => /* @__PURE__ */ jsxs19(
|
|
5960
|
+
"div",
|
|
5961
|
+
{
|
|
5962
|
+
"data-column-key": item.key,
|
|
5963
|
+
className: `sia-table-settings__item${preview?.key === item.key ? " is-dragging" : ""}`,
|
|
5964
|
+
style: preview ? { transform: `translateY(${preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
5965
|
+
onPointerDown: (event) => startSort(event, item.key),
|
|
5966
|
+
children: [
|
|
5967
|
+
/* @__PURE__ */ jsx20(Icon, { name: "menu", size: 15 }),
|
|
5968
|
+
/* @__PURE__ */ jsx20(TableCheckbox, { label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`, checked: item.visible, onChange: (checked) => setDraft((previous) => previous.map((entry) => entry.key === item.key ? { ...entry, visible: checked } : entry)) }),
|
|
5969
|
+
/* @__PURE__ */ jsx20("span", { className: "sia-table-settings__name", title: labels.get(item.key) ?? item.key, children: labels.get(item.key) ?? item.key }),
|
|
5970
|
+
/* @__PURE__ */ jsxs19("div", { className: "sia-table-settings__actions", children: [
|
|
5971
|
+
/* @__PURE__ */ jsx20(Button, { size: "small", variant: (preview?.key === item.key ? preview.fixed : item.fixed) === "left" ? "primary" : "text", "aria-label": "\u5DE6\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "left" ? void 0 : "left"), children: "\u5DE6" }),
|
|
5972
|
+
/* @__PURE__ */ jsx20(Button, { size: "small", variant: (preview?.key === item.key ? preview.fixed : item.fixed) === "right" ? "primary" : "text", "aria-label": "\u53F3\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "right" ? void 0 : "right"), children: "\u53F3" })
|
|
5973
|
+
] })
|
|
5974
|
+
]
|
|
5975
|
+
},
|
|
5976
|
+
item.key
|
|
5977
|
+
)) })
|
|
5978
|
+
] })
|
|
5844
5979
|
] });
|
|
5845
5980
|
}
|
|
5981
|
+
var columnSettingLoadTokens = /* @__PURE__ */ new WeakMap();
|
|
5846
5982
|
function createColumnSettingPlugin(options = {}) {
|
|
5847
5983
|
const baseItems = (context) => createColumnSettingItems(context.baseColumns, options.defaultVisibleKeys);
|
|
5848
5984
|
const currentItems = (context) => context.state.items?.length ? context.state.items : baseItems(context);
|
|
5849
5985
|
const save = (snapshot) => options.adapter && options.scope ? options.adapter.save(options.scope, snapshot).catch(() => void 0) : Promise.resolve();
|
|
5850
5986
|
function apply(items, context, persist = true) {
|
|
5851
|
-
const normalized = [...items].sort((a, b) => a.order - b.order)
|
|
5987
|
+
const normalized = orderColumnSettings([...items].sort((a, b) => a.order - b.order));
|
|
5852
5988
|
context.setState((state) => ({ ...state, items: normalized, open: false }));
|
|
5853
5989
|
const columnMap = new Map(flattenTableColumns(context.baseColumns).map((column) => [column.key, column]));
|
|
5854
5990
|
options.onVisibleChange?.(normalized.filter((item) => item.visible).map((item) => columnMap.get(item.key)).filter(Boolean));
|
|
5855
5991
|
options.onOrderChange?.(normalized.map((item) => columnMap.get(item.key)).filter(Boolean));
|
|
5856
5992
|
if (persist) void save({ columns: normalized, pageSize: context.state.pageSize, version: 1 });
|
|
5857
5993
|
}
|
|
5994
|
+
function loadSettings(context, open = false) {
|
|
5995
|
+
const fallback = baseItems(context);
|
|
5996
|
+
const token = /* @__PURE__ */ Symbol("column-settings-load");
|
|
5997
|
+
columnSettingLoadTokens.set(context.setPluginState, token);
|
|
5998
|
+
let cancelled = false;
|
|
5999
|
+
const hasAdapter = Boolean(options.adapter && options.scope);
|
|
6000
|
+
context.setState((state) => ({
|
|
6001
|
+
...state,
|
|
6002
|
+
open: open || state.open,
|
|
6003
|
+
items: state.items.length ? state.items : fallback,
|
|
6004
|
+
loading: hasAdapter,
|
|
6005
|
+
loaded: !hasAdapter,
|
|
6006
|
+
loadError: false,
|
|
6007
|
+
loadToken: token
|
|
6008
|
+
}));
|
|
6009
|
+
if (hasAdapter) void Promise.resolve().then(() => options.adapter.load(options.scope)).then((snapshot) => {
|
|
6010
|
+
if (cancelled || columnSettingLoadTokens.get(context.setPluginState) !== token) return;
|
|
6011
|
+
if (snapshot?.pageSize) context.setPluginState("pagination", (state) => ({ ...state, pageSize: snapshot.pageSize }));
|
|
6012
|
+
context.setState((state) => state.loadToken !== token ? state : {
|
|
6013
|
+
...state,
|
|
6014
|
+
items: snapshot?.columns?.length ? snapshot.columns : fallback,
|
|
6015
|
+
pageSize: snapshot?.pageSize,
|
|
6016
|
+
loaded: true,
|
|
6017
|
+
loading: false,
|
|
6018
|
+
loadError: false
|
|
6019
|
+
});
|
|
6020
|
+
}).catch(() => {
|
|
6021
|
+
if (!cancelled) context.setState((state) => state.loadToken !== token ? state : { ...state, loading: false, loaded: true, loadError: true });
|
|
6022
|
+
});
|
|
6023
|
+
return () => {
|
|
6024
|
+
cancelled = true;
|
|
6025
|
+
};
|
|
6026
|
+
}
|
|
5858
6027
|
return {
|
|
5859
6028
|
id: "columnSetting",
|
|
5860
6029
|
order: 10,
|
|
5861
6030
|
initialState: { open: false, items: [], loaded: false },
|
|
5862
6031
|
onMount(context) {
|
|
5863
|
-
|
|
5864
|
-
context.setState((state) => ({ ...state, items: state.items.length ? state.items : fallback, loaded: !options.adapter }));
|
|
5865
|
-
if (options.adapter && options.scope) void options.adapter.load(options.scope).then((snapshot) => {
|
|
5866
|
-
const merged = snapshot?.columns?.length ? snapshot.columns : fallback;
|
|
5867
|
-
context.setState((state) => ({ ...state, items: merged, pageSize: snapshot?.pageSize, loaded: true }));
|
|
5868
|
-
if (snapshot?.pageSize) context.setPluginState("pagination", (state) => ({ ...state, pageSize: snapshot.pageSize }));
|
|
5869
|
-
}).catch(() => context.setState((state) => ({ ...state, items: fallback, loaded: true })));
|
|
6032
|
+
return loadSettings(context);
|
|
5870
6033
|
},
|
|
5871
6034
|
transformColumns(columns, context) {
|
|
5872
6035
|
return applyColumnSettingsToTree(columns, currentItems(context));
|
|
@@ -5904,7 +6067,7 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
5904
6067
|
];
|
|
5905
6068
|
return /* @__PURE__ */ jsx20(Dropdown, { disabled: options.buttonProps?.disabled || options.buttonProps?.loading, trigger: ["hover", "click"], placement: "bottomRight", popupClassName: "sia-table__settings-dropdown", menu: { items, onClick: ({ key }) => {
|
|
5906
6069
|
if (key === "builtin:export") void exportApi().download();
|
|
5907
|
-
else if (key === "builtin:columns") context
|
|
6070
|
+
else if (key === "builtin:columns") loadSettings(context, true);
|
|
5908
6071
|
else void customItems.find((item) => "custom:" + item.key === key)?.onClick?.(context);
|
|
5909
6072
|
} }, children: /* @__PURE__ */ jsx20(
|
|
5910
6073
|
Button,
|
|
@@ -5918,8 +6081,10 @@ function createColumnSettingPlugin(options = {}) {
|
|
|
5918
6081
|
}
|
|
5919
6082
|
) });
|
|
5920
6083
|
},
|
|
5921
|
-
renderOverlay: (context) => /* @__PURE__ */ jsx20(ColumnSettingPanel, { open: context.state.open, items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
|
|
5922
|
-
getApi: (context) => ({ open: () =>
|
|
6084
|
+
renderOverlay: (context) => /* @__PURE__ */ jsx20(ColumnSettingPanel, { open: context.state.open, loading: context.state.loading, loadError: context.state.loadError, onRetry: () => loadSettings(context, true), items: currentItems(context), columns: context.baseColumns, onClose: () => context.setState((state) => ({ ...state, open: false })), onApply: (items) => apply(items, context) }),
|
|
6085
|
+
getApi: (context) => ({ open: () => {
|
|
6086
|
+
loadSettings(context, true);
|
|
6087
|
+
}, close: () => context.setState((state) => ({ ...state, open: false })), getSettings: () => currentItems(context), apply: (items) => apply(items, context) })
|
|
5923
6088
|
};
|
|
5924
6089
|
}
|
|
5925
6090
|
function createLocalStorageTableSettingsAdapter(prefix = "sia-table") {
|
|
@@ -6617,11 +6782,12 @@ function TableInner(props, ref) {
|
|
|
6617
6782
|
let labelRendered = false;
|
|
6618
6783
|
return /* @__PURE__ */ jsx21("tr", { className: `sia-table__summary-row ${summary.className ?? ""}`.trim(), children: leafColumns.map((column) => {
|
|
6619
6784
|
const value = summary.values[column.key];
|
|
6620
|
-
const
|
|
6785
|
+
const isLabel = value === void 0 && !labelRendered && summary.label !== void 0;
|
|
6786
|
+
const content = value !== void 0 ? value : isLabel ? (labelRendered = true, summary.label) : null;
|
|
6621
6787
|
const fixed = normalizeFixed(column.fixed);
|
|
6622
6788
|
const fixedEdgeClass = fixed === "left" && column.key === leftFixedEdgeKey ? " sia-table__cell--fixed-left-edge" : fixed === "right" && column.key === rightFixedEdgeKey ? " sia-table__cell--fixed-right-edge" : "";
|
|
6623
6789
|
const autoWidthClass = column.autoWidth ? " sia-table__cell--auto-width" : "";
|
|
6624
|
-
return /* @__PURE__ */ jsx21("td", { "data-column-key": column.key, className: `sia-table__cell sia-table__cell--${column.align ?? "left"} sia-table__summary-cell${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}`, style: getFixedStyle(column), children: content }, column.key);
|
|
6790
|
+
return /* @__PURE__ */ jsx21("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__ */ jsx21("span", { className: "sia-table__summary-label", title: typeof content === "string" ? content : void 0, children: content }) : content }, column.key);
|
|
6625
6791
|
}) }, summary.key);
|
|
6626
6792
|
}
|
|
6627
6793
|
return /* @__PURE__ */ jsxs20(
|
|
@@ -7191,7 +7357,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7191
7357
|
showValue = false,
|
|
7192
7358
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
7193
7359
|
placeholderMode,
|
|
7194
|
-
size
|
|
7360
|
+
size: sizeProp,
|
|
7195
7361
|
status,
|
|
7196
7362
|
disabled = false,
|
|
7197
7363
|
loading = false,
|
|
@@ -7206,6 +7372,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
7206
7372
|
onOpenChange,
|
|
7207
7373
|
...inputProps
|
|
7208
7374
|
}, forwardedRef) {
|
|
7375
|
+
const size = useControlSize(sizeProp);
|
|
7209
7376
|
const [internal, setInternal] = useState18(defaultValue);
|
|
7210
7377
|
const current = value !== void 0 ? value : internal;
|
|
7211
7378
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|