@sia.soul/sia-react-ui 0.1.21 → 0.1.23
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-BO3VyE2n.d.cts +305 -0
- package/dist/Select-BoVx-D0D.d.ts +305 -0
- package/dist/{chunk-VN6PIPP7.js → chunk-GM47DAAN.js} +1 -1
- package/dist/{chunk-7RNS52YG.js → chunk-NPB33IXJ.js} +1 -1
- package/dist/{chunk-3TRRBMXY.js → chunk-VX2JECOU.js} +24 -5
- package/dist/{core-DeZknKwc.d.ts → core-Cqgl6Z7h.d.ts} +3 -160
- package/dist/{core-C5OnrCi4.d.cts → core-DF0pknX6.d.cts} +3 -160
- package/dist/core.cjs +24 -5
- package/dist/core.css +19 -4
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -2
- package/dist/index.cjs +67 -11
- package/dist/index.css +19 -4
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/index.js +46 -9
- package/dist/{select-date-range-DDmYGDD4.d.cts → select-date-range-IOe6MMqu.d.cts} +1 -1
- package/dist/{select-date-range-CGRb3-W8.d.ts → select-date-range-a6nzK7Wu.d.ts} +1 -1
- package/dist/select-date-range.cjs +24 -5
- package/dist/select-date-range.d.cts +2 -2
- package/dist/select-date-range.d.ts +2 -2
- package/dist/select-date-range.js +2 -2
- package/package.json +1 -1
- package/dist/Select-4hGJt3RJ.d.cts +0 -142
- package/dist/Select-BNSE67xn.d.ts +0 -142
package/dist/index.cjs
CHANGED
|
@@ -3355,6 +3355,8 @@ var Select = (0, import_react17.forwardRef)(function Select2({
|
|
|
3355
3355
|
const [openedMode, setOpenedMode] = (0, import_react17.useState)(automaticMode);
|
|
3356
3356
|
const popupMode = open ? openedMode : automaticMode;
|
|
3357
3357
|
const [modalValues, setModalValues] = (0, import_react17.useState)([]);
|
|
3358
|
+
const [modalSubmitting, setModalSubmitting] = (0, import_react17.useState)(false);
|
|
3359
|
+
const modalSubmitLock = (0, import_react17.useRef)(false);
|
|
3358
3360
|
const [selectedOnly, setSelectedOnly] = (0, import_react17.useState)(false);
|
|
3359
3361
|
const [query, setQuery] = (0, import_react17.useState)("");
|
|
3360
3362
|
const [activeIndex, setActiveIndex] = (0, import_react17.useState)(-1);
|
|
@@ -3423,6 +3425,24 @@ var Select = (0, import_react17.forwardRef)(function Select2({
|
|
|
3423
3425
|
setQuery("");
|
|
3424
3426
|
setScrollTop(0);
|
|
3425
3427
|
}
|
|
3428
|
+
async function confirmModalSelection() {
|
|
3429
|
+
if (disabled || loading || modalSubmitLock.current) return;
|
|
3430
|
+
modalSubmitLock.current = true;
|
|
3431
|
+
const nextValue = multiple ? [...modalValues] : modalValues[0] ?? null;
|
|
3432
|
+
const selected = modalValues.map((selectedValue) => availableOptions.find((option) => option.value === selectedValue) ?? (allowInput ? { value: selectedValue, label: String(selectedValue) } : void 0)).filter((option) => option !== void 0);
|
|
3433
|
+
const extraValues = { ...modalConfig?.extraValues };
|
|
3434
|
+
setModalSubmitting(true);
|
|
3435
|
+
try {
|
|
3436
|
+
const result = await modalConfig?.onConfirm?.(nextValue, multiple ? selected : selected[0] ?? null, extraValues);
|
|
3437
|
+
if (result === false) return;
|
|
3438
|
+
setCurrentValue(nextValue);
|
|
3439
|
+
closeDropdown();
|
|
3440
|
+
} catch {
|
|
3441
|
+
} finally {
|
|
3442
|
+
modalSubmitLock.current = false;
|
|
3443
|
+
setModalSubmitting(false);
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3426
3446
|
function openDropdown() {
|
|
3427
3447
|
if (disabled || loading) return;
|
|
3428
3448
|
setOpenedMode(automaticMode);
|
|
@@ -3647,6 +3667,7 @@ var Select = (0, import_react17.forwardRef)(function Select2({
|
|
|
3647
3667
|
open,
|
|
3648
3668
|
title: modalConfig?.title ?? placeholder,
|
|
3649
3669
|
width: modalConfig?.width ?? 900,
|
|
3670
|
+
confirmLoading: modalSubmitting,
|
|
3650
3671
|
onOpenChange: (next) => {
|
|
3651
3672
|
if (!next) closeDropdown();
|
|
3652
3673
|
},
|
|
@@ -3654,14 +3675,12 @@ var Select = (0, import_react17.forwardRef)(function Select2({
|
|
|
3654
3675
|
footer: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sia-select-modal__footer", children: [
|
|
3655
3676
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: modalConfig?.footerExtra }),
|
|
3656
3677
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
3657
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { onClick: closeDropdown, children: "\u53D6\u6D88" }),
|
|
3658
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "primary", disabled: disabled || loading, onClick:
|
|
3659
|
-
setCurrentValue(multiple ? modalValues : modalValues[0] ?? null);
|
|
3660
|
-
closeDropdown();
|
|
3661
|
-
}, children: "\u786E\u5B9A" })
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { disabled: modalSubmitting, onClick: closeDropdown, children: "\u53D6\u6D88" }),
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "primary", loading: modalSubmitting, disabled: disabled || loading, onClick: confirmModalSelection, children: "\u786E\u5B9A" })
|
|
3662
3680
|
] })
|
|
3663
3681
|
] }),
|
|
3664
3682
|
children: open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3683
|
+
modalConfig?.headerExtra != null && modalConfig.headerExtra !== false ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "sia-select-modal__header-extra", children: modalConfig.headerExtra }) : null,
|
|
3665
3684
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "sia-select-modal__heading", children: [
|
|
3666
3685
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
3667
3686
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
@@ -9961,6 +9980,7 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
9961
9980
|
onChange([...next]);
|
|
9962
9981
|
};
|
|
9963
9982
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
9983
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
9964
9984
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "sia-select-modal__heading", children: [
|
|
9965
9985
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
9966
9986
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
@@ -10032,7 +10052,7 @@ function openSelectModal(config) {
|
|
|
10032
10052
|
} });
|
|
10033
10053
|
}
|
|
10034
10054
|
function modalConfig() {
|
|
10035
|
-
const { options, value, mode, showValue, columns, maxHeight, searchPlaceholder, filterOption, onSearch, onConfirm, ...modal } = current;
|
|
10055
|
+
const { options, value, mode, showValue, columns, maxHeight, headerExtra, extraValues, searchPlaceholder, filterOption, onSearch, onConfirm, ...modal } = current;
|
|
10036
10056
|
return {
|
|
10037
10057
|
...modal,
|
|
10038
10058
|
title: current.title ?? "\u8BF7\u9009\u62E9",
|
|
@@ -10046,7 +10066,8 @@ function openSelectModal(config) {
|
|
|
10046
10066
|
try {
|
|
10047
10067
|
return await current.onConfirm?.(
|
|
10048
10068
|
current.mode === "multiple" ? [...values] : values[0] ?? null,
|
|
10049
|
-
current.mode === "multiple" ? selected : selected[0] ?? null
|
|
10069
|
+
current.mode === "multiple" ? selected : selected[0] ?? null,
|
|
10070
|
+
{ ...current.extraValues }
|
|
10050
10071
|
);
|
|
10051
10072
|
} finally {
|
|
10052
10073
|
submitting = false;
|
|
@@ -11061,6 +11082,7 @@ function isInteractiveTableTarget(target) {
|
|
|
11061
11082
|
function createCellSelectionPlugin(options = {}) {
|
|
11062
11083
|
let dragMode = null;
|
|
11063
11084
|
let dragAnchor = null;
|
|
11085
|
+
let textCell = null;
|
|
11064
11086
|
let headerDragAnchorKey = null;
|
|
11065
11087
|
let snapshotCache = null;
|
|
11066
11088
|
let latestContext = null;
|
|
@@ -11362,12 +11384,17 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11362
11384
|
return;
|
|
11363
11385
|
}
|
|
11364
11386
|
if (!isSelectable(row, column, context)) return;
|
|
11365
|
-
event.preventDefault();
|
|
11366
11387
|
window.getSelection()?.removeAllRanges();
|
|
11367
11388
|
focusTable(event.currentTarget);
|
|
11368
11389
|
const address = { rowKey: row.key, columnKey: column.key };
|
|
11369
|
-
|
|
11370
|
-
|
|
11390
|
+
const extendRange = event.shiftKey && context.state.range;
|
|
11391
|
+
dragAnchor = extendRange ? extendRange.anchor : address;
|
|
11392
|
+
dragMode = extendRange ? "cells" : "text";
|
|
11393
|
+
textCell = extendRange ? null : event.currentTarget;
|
|
11394
|
+
if (extendRange) {
|
|
11395
|
+
event.preventDefault();
|
|
11396
|
+
window.getSelection()?.removeAllRanges();
|
|
11397
|
+
}
|
|
11371
11398
|
setSelection(context, { anchor: dragAnchor, focus: address });
|
|
11372
11399
|
},
|
|
11373
11400
|
onCellPointerMove(row, column, event, context) {
|
|
@@ -11375,6 +11402,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11375
11402
|
if ((event.buttons & 1) === 0) {
|
|
11376
11403
|
dragMode = null;
|
|
11377
11404
|
dragAnchor = null;
|
|
11405
|
+
textCell = null;
|
|
11378
11406
|
return;
|
|
11379
11407
|
}
|
|
11380
11408
|
if (dragMode === "rows") {
|
|
@@ -11384,6 +11412,12 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11384
11412
|
return;
|
|
11385
11413
|
}
|
|
11386
11414
|
if (!isSelectable(row, column, context)) return;
|
|
11415
|
+
if (dragMode === "text") {
|
|
11416
|
+
if (sameCellAddress(dragAnchor, { rowKey: row.key, columnKey: column.key })) return;
|
|
11417
|
+
dragMode = "cells";
|
|
11418
|
+
textCell = null;
|
|
11419
|
+
focusTable(event.currentTarget);
|
|
11420
|
+
}
|
|
11387
11421
|
event.preventDefault();
|
|
11388
11422
|
window.getSelection()?.removeAllRanges();
|
|
11389
11423
|
setSelection(context, {
|
|
@@ -11417,14 +11451,29 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11417
11451
|
},
|
|
11418
11452
|
onMount() {
|
|
11419
11453
|
const stopDragging = () => {
|
|
11454
|
+
constrainTextSelection();
|
|
11420
11455
|
dragMode = null;
|
|
11421
11456
|
dragAnchor = null;
|
|
11457
|
+
textCell = null;
|
|
11422
11458
|
headerDragAnchorKey = null;
|
|
11423
11459
|
};
|
|
11460
|
+
const constrainTextSelection = () => {
|
|
11461
|
+
if (!dragMode) return;
|
|
11462
|
+
const selection = window.getSelection();
|
|
11463
|
+
if (!selection || selection.isCollapsed) return;
|
|
11464
|
+
if (dragMode !== "text" || !textCell?.contains(selection.anchorNode) || !textCell.contains(selection.focusNode)) {
|
|
11465
|
+
selection.removeAllRanges();
|
|
11466
|
+
}
|
|
11467
|
+
};
|
|
11468
|
+
const handleSelectStart = (event) => {
|
|
11469
|
+
if (dragMode && dragMode !== "text") event.preventDefault();
|
|
11470
|
+
};
|
|
11424
11471
|
const handleCopy = (event) => {
|
|
11425
11472
|
const context = latestContext;
|
|
11426
11473
|
if (options.copyable === false || !context || !activeRoot || !activeRoot.contains(document.activeElement) || isInteractiveTableTarget(document.activeElement))
|
|
11427
11474
|
return;
|
|
11475
|
+
const selection = window.getSelection();
|
|
11476
|
+
if (selection && !selection.isCollapsed && selection.toString()) return;
|
|
11428
11477
|
const text = copyText(context);
|
|
11429
11478
|
if (!text) return;
|
|
11430
11479
|
event.preventDefault();
|
|
@@ -11432,11 +11481,18 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
11432
11481
|
options.onCopy?.(text, selectedCells(context));
|
|
11433
11482
|
};
|
|
11434
11483
|
window.addEventListener("pointerup", stopDragging);
|
|
11484
|
+
window.addEventListener("pointercancel", stopDragging);
|
|
11435
11485
|
window.addEventListener("blur", stopDragging);
|
|
11486
|
+
document.addEventListener("selectionchange", constrainTextSelection);
|
|
11487
|
+
document.addEventListener("selectstart", handleSelectStart);
|
|
11436
11488
|
document.addEventListener("copy", handleCopy);
|
|
11437
11489
|
return () => {
|
|
11490
|
+
stopDragging();
|
|
11438
11491
|
window.removeEventListener("pointerup", stopDragging);
|
|
11492
|
+
window.removeEventListener("pointercancel", stopDragging);
|
|
11439
11493
|
window.removeEventListener("blur", stopDragging);
|
|
11494
|
+
document.removeEventListener("selectionchange", constrainTextSelection);
|
|
11495
|
+
document.removeEventListener("selectstart", handleSelectStart);
|
|
11440
11496
|
document.removeEventListener("copy", handleCopy);
|
|
11441
11497
|
};
|
|
11442
11498
|
},
|
|
@@ -22145,7 +22201,7 @@ function QueryForm({
|
|
|
22145
22201
|
{
|
|
22146
22202
|
className: "sia-query-form__field",
|
|
22147
22203
|
hidden: collapsed && index >= Math.min(limit, fittingCount),
|
|
22148
|
-
style: entry.width !== void 0 ? {
|
|
22204
|
+
style: entry.width !== void 0 ? { "--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width } : void 0,
|
|
22149
22205
|
children: entry.content
|
|
22150
22206
|
},
|
|
22151
22207
|
entry.key
|
package/dist/index.css
CHANGED
|
@@ -4419,6 +4419,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4419
4419
|
border: 1px solid var(--sia-table-border-color, #EFF2F6);
|
|
4420
4420
|
border-radius: 0 0 var(--sia-radius) var(--sia-radius);
|
|
4421
4421
|
}
|
|
4422
|
+
.sia-select-modal__header-extra {
|
|
4423
|
+
display: flex;
|
|
4424
|
+
align-items: center;
|
|
4425
|
+
flex-wrap: wrap;
|
|
4426
|
+
gap: 12px;
|
|
4427
|
+
min-width: 0;
|
|
4428
|
+
margin-bottom: 16px;
|
|
4429
|
+
}
|
|
4422
4430
|
.sia-select-modal__heading {
|
|
4423
4431
|
display: flex;
|
|
4424
4432
|
justify-content: space-between;
|
|
@@ -4757,15 +4765,22 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4757
4765
|
display: flex;
|
|
4758
4766
|
flex-wrap: wrap;
|
|
4759
4767
|
align-items: center;
|
|
4760
|
-
gap: 12px;
|
|
4768
|
+
gap: var(--sia-query-field-gap, 12px);
|
|
4761
4769
|
padding-top: 8px;
|
|
4762
4770
|
}
|
|
4763
4771
|
.sia-query-form__field {
|
|
4764
|
-
|
|
4765
|
-
|
|
4772
|
+
--sia-query-item-width: var(--sia-query-field-width, 220px);
|
|
4773
|
+
flex: 0 1 var(--sia-query-item-width);
|
|
4774
|
+
width: var(--sia-query-item-width);
|
|
4766
4775
|
min-width: 0;
|
|
4767
4776
|
max-width: 100%;
|
|
4768
4777
|
}
|
|
4778
|
+
.sia-query-form__field:has(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical) > :nth-child(2)) {
|
|
4779
|
+
--sia-query-item-width: calc(var(--sia-query-field-width, 220px) + var(--sia-query-field-width, 220px) + var(--sia-query-field-gap, 12px));
|
|
4780
|
+
}
|
|
4781
|
+
.sia-query-form__field :is(.sia-picker-range-control, .sia-time-range, .sia-select-date-range, .sia-space-compact:not(.sia-space-compact--vertical)) {
|
|
4782
|
+
width: 100%;
|
|
4783
|
+
}
|
|
4769
4784
|
.sia-query-form__field[hidden] {
|
|
4770
4785
|
display: none;
|
|
4771
4786
|
}
|
|
@@ -4848,7 +4863,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4848
4863
|
@media (max-width: 600px) {
|
|
4849
4864
|
.sia-query-form__fields.is-collapsed > .sia-query-form__field {
|
|
4850
4865
|
flex-basis: auto !important;
|
|
4851
|
-
width: var(--sia-query-
|
|
4866
|
+
width: var(--sia-query-item-width) !important;
|
|
4852
4867
|
}
|
|
4853
4868
|
}
|
|
4854
4869
|
.sia-query-form__quick > .sia-badge:has(.sia-badge__count) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-DF0pknX6.cjs';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Tooltip, aE as TooltipProps, aF as Tour, aG as TourProps, aH as TourStep, aI as Tree, aJ as TreeDropPosition, aK as TreeKey, aL as TreeNode, aM as TreeProps, aN as Typography, aO as TypographyLinkProps, aP as TypographyProps, aQ as TypographyTitleProps, aR as TypographyType, aS as Upload, aT as UploadChangeInfo, aU as UploadDraggerProps, aV as UploadFile, aW as UploadFileStatus, aX as UploadProps, aY as UploadRequestOptions, aZ as Watermark, a_ as WatermarkFont, a$ as WatermarkProps, b0 as message, b1 as notification } from './core-DF0pknX6.cjs';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
6
|
-
|
|
6
|
+
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult, B as ButtonProps, e as ButtonSize } from './Select-BO3VyE2n.cjs';
|
|
7
|
+
export { f as Button, g as ButtonVariant, h as Modal, i as ModalProps, j as ModalType, k as Select, l as SelectMode, m as SelectValue } from './Select-BO3VyE2n.cjs';
|
|
8
|
+
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-IOe6MMqu.cjs';
|
|
7
9
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.cjs';
|
|
8
10
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.cjs';
|
|
9
11
|
import * as Monaco from 'monaco-editor';
|
|
10
|
-
import { S as SelectOption, a as SelectChangeValue, b as SelectProps } from './Select-4hGJt3RJ.cjs';
|
|
11
|
-
export { c as Select, d as SelectMode, e as SelectValue } from './Select-4hGJt3RJ.cjs';
|
|
12
12
|
export { BaiduMapHostOptions, BaiduMapInstance, BaiduMapNamespace, BaiduMapPoint, BarChart, BarChartProps, BarDatum, BarSeries, CHART_VIEWBOX_HEIGHT, CHART_VIEWBOX_WIDTH, CandlestickChart, CandlestickChartProps, CandlestickDatum, CartesianChartProps, ChartAxis, ChartAxisProps, ChartComposite, ChartCompositeLayer, ChartCompositeProps, ChartCompositeRef, ChartDataClickInfo, ChartDataEditor, ChartDataEditorProps, ChartDataZoom, ChartDataZoomProps, ChartLegend, ChartLegendItem, ChartLegendProps, ChartMapOverlay, ChartMapOverlayProps, ChartMark, ChartMarkProps, ChartRoamController, ChartRoamControllerProps, ChartSeries, ChartTimeline, ChartTimelineProps, ChartToolbox, ChartToolboxFeature, ChartToolboxOptions, ChartToolboxProps, ChartTooltip, ChartTooltipProps, ChartValueAddress, ChartValueChannel, ChartValueIsland, ChartValueIslandProps, ChartValueTransferHandler, ChartVisualMap, ChartVisualMapProps, ChartWhirlingLoading, ChartWhirlingLoadingProps, ChordChart, ChordChartProps, ChordLink, ChordNode, DEFAULT_CHART_PALETTE, EventRiverChart, EventRiverChartProps, EventRiverEvent, EventRiverEvolution, EventRiverSeries, ForceChart, ForceGraphChart, FunnelChart, FunnelChartProps, FunnelDatum, FunnelSeries, GaugeChart, GaugeChartProps, GaugeDatum, GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonMultiPolygonGeometry, GeoJsonPolygonGeometry, GraphChart, GraphChartProps, GraphLink, GraphNode, HeatmapChart, HeatmapChartProps, HeatmapPoint, KLineChart, LineChart, LineChartProps, LinePoint, LineSeries, LineShareChart, LineShareChartProps, MapChart, MapChartProps, MapDatum, MapMarkLine, MapMarkPoint, MapOverlayEvent, MapOverlayHost, MapOverlaySnapshot, MixedChart, MixedChartProps, MixedSeries, PieChart, PieChartProps, PieDatum, PieSeries, RadarChart, RadarChartProps, RadarIndicator, RadarPanel, RadarSeries, ScatterChart, ScatterChartProps, ScatterDatum, ScatterVisualMap, SiaChart, SiaChartProps, SiaChartRef, SvgMapPlot, SvgMapPlotProps, ThemeRiverChart, ThemeRiverChartProps, ThemeRiverSeries, TreeChart, TreeChartProps, TreeDatum, TreemapChart, TreemapChartProps, TreemapDatum, TreemapItemStyle, VennChart, VennChartProps, VennIntersection, VennSet, WordCloudChart, WordCloudChartProps, WordCloudDatum, XYChart, XYChartProps, XYSeries, chartColor, chartTicks, createBaiduMapHost, formatChartNumber, getChartMap, linearScale, niceChartDomain, paddedValueExtent, registerChartMap, saveCompositeImage, serializeChartStack, smoothSvgPath, svgArcPath, transferCompositeValue } from './chart.cjs';
|
|
13
13
|
import 'vditor';
|
|
14
14
|
|
|
@@ -1682,6 +1682,10 @@ interface SelectModalConfig extends Omit<ModalOpenConfig, "children" | "footer"
|
|
|
1682
1682
|
columns?: number;
|
|
1683
1683
|
/** 允许的最大高度。 */
|
|
1684
1684
|
maxHeight?: number;
|
|
1685
|
+
/** 标题下方的独立首行扩展内容,位于选项范围和搜索框上方。 */
|
|
1686
|
+
headerExtra?: ReactNode;
|
|
1687
|
+
/** 扩展控件数据,确认时作为第三个参数传出;可通过句柄 update({ extraValues }) 更新。 */
|
|
1688
|
+
extraValues?: Record<string, unknown>;
|
|
1685
1689
|
/** 搜索框的占位提示文字。 */
|
|
1686
1690
|
searchPlaceholder?: string;
|
|
1687
1691
|
/** 自定义搜索匹配函数,返回 true 时保留该选项。 */
|
|
@@ -1689,7 +1693,7 @@ interface SelectModalConfig extends Omit<ModalOpenConfig, "children" | "footer"
|
|
|
1689
1693
|
/** 搜索条件变化或提交搜索时调用,具体参数见签名。 */
|
|
1690
1694
|
onSearch?: SelectProps["onSearch"];
|
|
1691
1695
|
/** 确认后接收选中的值和对应选项;单选为单值,多选为数组。支持异步处理;返回 false 或抛出异常时保留弹框,允许重试。 */
|
|
1692
|
-
onConfirm?: (value: SelectChangeValue, option: SelectOption | SelectOption[] | null) => ModalActionResult;
|
|
1696
|
+
onConfirm?: (value: SelectChangeValue, option: SelectOption | SelectOption[] | null, extraValues: Record<string, unknown>) => ModalActionResult;
|
|
1693
1697
|
}
|
|
1694
1698
|
/** 无需渲染 Select,直接打开选择弹框。取消不提交,确认支持异步处理及返回 false 阻止关闭。 */
|
|
1695
1699
|
declare function openSelectModal(config: SelectModalConfig): OverlayApiHandle<SelectModalConfig>;
|
|
@@ -3003,7 +3007,7 @@ declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & re
|
|
|
3003
3007
|
interface QueryFormField extends FormItemProps {
|
|
3004
3008
|
/** 字段布局的稳定唯一标识;用于 React 渲染,不替代 Form.Item 的 name 字段路径。 */
|
|
3005
3009
|
key: string;
|
|
3006
|
-
/**
|
|
3010
|
+
/** 字段占用宽度,优先于自动布局。未指定时普通控件占一列,日期/时间区间及横向组合控件占两列(含列间距)。 */
|
|
3007
3011
|
width?: number | string;
|
|
3008
3012
|
}
|
|
3009
3013
|
/** 预设或已保存的快捷查询,包含名称、条件、颜色和可选数量徽标。 */
|
|
@@ -3046,7 +3050,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3046
3050
|
*/
|
|
3047
3051
|
loading?: boolean;
|
|
3048
3052
|
/**
|
|
3049
|
-
*
|
|
3053
|
+
* 单列查询字段的默认宽度,数值单位为像素,可传 CSS 尺寸字符串。区间及横向组合控件默认为两倍此宽度加列间距;列间距可通过 --sia-query-field-gap 调整(默认 12px)。
|
|
3050
3054
|
* @defaultValue 220
|
|
3051
3055
|
*/
|
|
3052
3056
|
fieldWidth?: number | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-Cqgl6Z7h.js';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Tooltip, aE as TooltipProps, aF as Tour, aG as TourProps, aH as TourStep, aI as Tree, aJ as TreeDropPosition, aK as TreeKey, aL as TreeNode, aM as TreeProps, aN as Typography, aO as TypographyLinkProps, aP as TypographyProps, aQ as TypographyTitleProps, aR as TypographyType, aS as Upload, aT as UploadChangeInfo, aU as UploadDraggerProps, aV as UploadFile, aW as UploadFileStatus, aX as UploadProps, aY as UploadRequestOptions, aZ as Watermark, a_ as WatermarkFont, a$ as WatermarkProps, b0 as message, b1 as notification } from './core-Cqgl6Z7h.js';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
6
|
-
|
|
6
|
+
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult, B as ButtonProps, e as ButtonSize } from './Select-BoVx-D0D.js';
|
|
7
|
+
export { f as Button, g as ButtonVariant, h as Modal, i as ModalProps, j as ModalType, k as Select, l as SelectMode, m as SelectValue } from './Select-BoVx-D0D.js';
|
|
8
|
+
export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-a6nzK7Wu.js';
|
|
7
9
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.js';
|
|
8
10
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.js';
|
|
9
11
|
import * as Monaco from 'monaco-editor';
|
|
10
|
-
import { S as SelectOption, a as SelectChangeValue, b as SelectProps } from './Select-BNSE67xn.js';
|
|
11
|
-
export { c as Select, d as SelectMode, e as SelectValue } from './Select-BNSE67xn.js';
|
|
12
12
|
export { BaiduMapHostOptions, BaiduMapInstance, BaiduMapNamespace, BaiduMapPoint, BarChart, BarChartProps, BarDatum, BarSeries, CHART_VIEWBOX_HEIGHT, CHART_VIEWBOX_WIDTH, CandlestickChart, CandlestickChartProps, CandlestickDatum, CartesianChartProps, ChartAxis, ChartAxisProps, ChartComposite, ChartCompositeLayer, ChartCompositeProps, ChartCompositeRef, ChartDataClickInfo, ChartDataEditor, ChartDataEditorProps, ChartDataZoom, ChartDataZoomProps, ChartLegend, ChartLegendItem, ChartLegendProps, ChartMapOverlay, ChartMapOverlayProps, ChartMark, ChartMarkProps, ChartRoamController, ChartRoamControllerProps, ChartSeries, ChartTimeline, ChartTimelineProps, ChartToolbox, ChartToolboxFeature, ChartToolboxOptions, ChartToolboxProps, ChartTooltip, ChartTooltipProps, ChartValueAddress, ChartValueChannel, ChartValueIsland, ChartValueIslandProps, ChartValueTransferHandler, ChartVisualMap, ChartVisualMapProps, ChartWhirlingLoading, ChartWhirlingLoadingProps, ChordChart, ChordChartProps, ChordLink, ChordNode, DEFAULT_CHART_PALETTE, EventRiverChart, EventRiverChartProps, EventRiverEvent, EventRiverEvolution, EventRiverSeries, ForceChart, ForceGraphChart, FunnelChart, FunnelChartProps, FunnelDatum, FunnelSeries, GaugeChart, GaugeChartProps, GaugeDatum, GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonMultiPolygonGeometry, GeoJsonPolygonGeometry, GraphChart, GraphChartProps, GraphLink, GraphNode, HeatmapChart, HeatmapChartProps, HeatmapPoint, KLineChart, LineChart, LineChartProps, LinePoint, LineSeries, LineShareChart, LineShareChartProps, MapChart, MapChartProps, MapDatum, MapMarkLine, MapMarkPoint, MapOverlayEvent, MapOverlayHost, MapOverlaySnapshot, MixedChart, MixedChartProps, MixedSeries, PieChart, PieChartProps, PieDatum, PieSeries, RadarChart, RadarChartProps, RadarIndicator, RadarPanel, RadarSeries, ScatterChart, ScatterChartProps, ScatterDatum, ScatterVisualMap, SiaChart, SiaChartProps, SiaChartRef, SvgMapPlot, SvgMapPlotProps, ThemeRiverChart, ThemeRiverChartProps, ThemeRiverSeries, TreeChart, TreeChartProps, TreeDatum, TreemapChart, TreemapChartProps, TreemapDatum, TreemapItemStyle, VennChart, VennChartProps, VennIntersection, VennSet, WordCloudChart, WordCloudChartProps, WordCloudDatum, XYChart, XYChartProps, XYSeries, chartColor, chartTicks, createBaiduMapHost, formatChartNumber, getChartMap, linearScale, niceChartDomain, paddedValueExtent, registerChartMap, saveCompositeImage, serializeChartStack, smoothSvgPath, svgArcPath, transferCompositeValue } from './chart.js';
|
|
13
13
|
import 'vditor';
|
|
14
14
|
|
|
@@ -1682,6 +1682,10 @@ interface SelectModalConfig extends Omit<ModalOpenConfig, "children" | "footer"
|
|
|
1682
1682
|
columns?: number;
|
|
1683
1683
|
/** 允许的最大高度。 */
|
|
1684
1684
|
maxHeight?: number;
|
|
1685
|
+
/** 标题下方的独立首行扩展内容,位于选项范围和搜索框上方。 */
|
|
1686
|
+
headerExtra?: ReactNode;
|
|
1687
|
+
/** 扩展控件数据,确认时作为第三个参数传出;可通过句柄 update({ extraValues }) 更新。 */
|
|
1688
|
+
extraValues?: Record<string, unknown>;
|
|
1685
1689
|
/** 搜索框的占位提示文字。 */
|
|
1686
1690
|
searchPlaceholder?: string;
|
|
1687
1691
|
/** 自定义搜索匹配函数,返回 true 时保留该选项。 */
|
|
@@ -1689,7 +1693,7 @@ interface SelectModalConfig extends Omit<ModalOpenConfig, "children" | "footer"
|
|
|
1689
1693
|
/** 搜索条件变化或提交搜索时调用,具体参数见签名。 */
|
|
1690
1694
|
onSearch?: SelectProps["onSearch"];
|
|
1691
1695
|
/** 确认后接收选中的值和对应选项;单选为单值,多选为数组。支持异步处理;返回 false 或抛出异常时保留弹框,允许重试。 */
|
|
1692
|
-
onConfirm?: (value: SelectChangeValue, option: SelectOption | SelectOption[] | null) => ModalActionResult;
|
|
1696
|
+
onConfirm?: (value: SelectChangeValue, option: SelectOption | SelectOption[] | null, extraValues: Record<string, unknown>) => ModalActionResult;
|
|
1693
1697
|
}
|
|
1694
1698
|
/** 无需渲染 Select,直接打开选择弹框。取消不提交,确认支持异步处理及返回 false 阻止关闭。 */
|
|
1695
1699
|
declare function openSelectModal(config: SelectModalConfig): OverlayApiHandle<SelectModalConfig>;
|
|
@@ -3003,7 +3007,7 @@ declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & re
|
|
|
3003
3007
|
interface QueryFormField extends FormItemProps {
|
|
3004
3008
|
/** 字段布局的稳定唯一标识;用于 React 渲染,不替代 Form.Item 的 name 字段路径。 */
|
|
3005
3009
|
key: string;
|
|
3006
|
-
/**
|
|
3010
|
+
/** 字段占用宽度,优先于自动布局。未指定时普通控件占一列,日期/时间区间及横向组合控件占两列(含列间距)。 */
|
|
3007
3011
|
width?: number | string;
|
|
3008
3012
|
}
|
|
3009
3013
|
/** 预设或已保存的快捷查询,包含名称、条件、颜色和可选数量徽标。 */
|
|
@@ -3046,7 +3050,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
|
|
|
3046
3050
|
*/
|
|
3047
3051
|
loading?: boolean;
|
|
3048
3052
|
/**
|
|
3049
|
-
*
|
|
3053
|
+
* 单列查询字段的默认宽度,数值单位为像素,可传 CSS 尺寸字符串。区间及横向组合控件默认为两倍此宽度加列间距;列间距可通过 --sia-query-field-gap 调整(默认 12px)。
|
|
3050
3054
|
* @defaultValue 220
|
|
3051
3055
|
*/
|
|
3052
3056
|
fieldWidth?: number | string;
|
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-NPB33IXJ.js";
|
|
83
83
|
import {
|
|
84
84
|
TextArea
|
|
85
85
|
} from "./chunk-YT6E3X2K.js";
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
DatePicker,
|
|
95
95
|
SelectDateRange,
|
|
96
96
|
TimePanel
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-GM47DAAN.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-VX2JECOU.js";
|
|
113
113
|
import {
|
|
114
114
|
Dropdown,
|
|
115
115
|
FILLED_ICON_NAMES,
|
|
@@ -4096,6 +4096,7 @@ function SelectModalBody({ config, values, disabled, onChange }) {
|
|
|
4096
4096
|
onChange([...next]);
|
|
4097
4097
|
};
|
|
4098
4098
|
return /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
4099
|
+
config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ jsx18("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
|
|
4099
4100
|
/* @__PURE__ */ jsxs18("div", { className: "sia-select-modal__heading", children: [
|
|
4100
4101
|
/* @__PURE__ */ jsxs18("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
4101
4102
|
/* @__PURE__ */ jsx18(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|
|
@@ -4167,7 +4168,7 @@ function openSelectModal(config) {
|
|
|
4167
4168
|
} });
|
|
4168
4169
|
}
|
|
4169
4170
|
function modalConfig() {
|
|
4170
|
-
const { options, value, mode, showValue, columns, maxHeight, searchPlaceholder, filterOption, onSearch, onConfirm, ...modal } = current;
|
|
4171
|
+
const { options, value, mode, showValue, columns, maxHeight, headerExtra, extraValues, searchPlaceholder, filterOption, onSearch, onConfirm, ...modal } = current;
|
|
4171
4172
|
return {
|
|
4172
4173
|
...modal,
|
|
4173
4174
|
title: current.title ?? "\u8BF7\u9009\u62E9",
|
|
@@ -4181,7 +4182,8 @@ function openSelectModal(config) {
|
|
|
4181
4182
|
try {
|
|
4182
4183
|
return await current.onConfirm?.(
|
|
4183
4184
|
current.mode === "multiple" ? [...values] : values[0] ?? null,
|
|
4184
|
-
current.mode === "multiple" ? selected : selected[0] ?? null
|
|
4185
|
+
current.mode === "multiple" ? selected : selected[0] ?? null,
|
|
4186
|
+
{ ...current.extraValues }
|
|
4185
4187
|
);
|
|
4186
4188
|
} finally {
|
|
4187
4189
|
submitting = false;
|
|
@@ -4838,6 +4840,7 @@ function isInteractiveTableTarget(target) {
|
|
|
4838
4840
|
function createCellSelectionPlugin(options = {}) {
|
|
4839
4841
|
let dragMode = null;
|
|
4840
4842
|
let dragAnchor = null;
|
|
4843
|
+
let textCell = null;
|
|
4841
4844
|
let headerDragAnchorKey = null;
|
|
4842
4845
|
let snapshotCache = null;
|
|
4843
4846
|
let latestContext = null;
|
|
@@ -5139,12 +5142,17 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5139
5142
|
return;
|
|
5140
5143
|
}
|
|
5141
5144
|
if (!isSelectable(row, column, context)) return;
|
|
5142
|
-
event.preventDefault();
|
|
5143
5145
|
window.getSelection()?.removeAllRanges();
|
|
5144
5146
|
focusTable(event.currentTarget);
|
|
5145
5147
|
const address = { rowKey: row.key, columnKey: column.key };
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
+
const extendRange = event.shiftKey && context.state.range;
|
|
5149
|
+
dragAnchor = extendRange ? extendRange.anchor : address;
|
|
5150
|
+
dragMode = extendRange ? "cells" : "text";
|
|
5151
|
+
textCell = extendRange ? null : event.currentTarget;
|
|
5152
|
+
if (extendRange) {
|
|
5153
|
+
event.preventDefault();
|
|
5154
|
+
window.getSelection()?.removeAllRanges();
|
|
5155
|
+
}
|
|
5148
5156
|
setSelection(context, { anchor: dragAnchor, focus: address });
|
|
5149
5157
|
},
|
|
5150
5158
|
onCellPointerMove(row, column, event, context) {
|
|
@@ -5152,6 +5160,7 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5152
5160
|
if ((event.buttons & 1) === 0) {
|
|
5153
5161
|
dragMode = null;
|
|
5154
5162
|
dragAnchor = null;
|
|
5163
|
+
textCell = null;
|
|
5155
5164
|
return;
|
|
5156
5165
|
}
|
|
5157
5166
|
if (dragMode === "rows") {
|
|
@@ -5161,6 +5170,12 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5161
5170
|
return;
|
|
5162
5171
|
}
|
|
5163
5172
|
if (!isSelectable(row, column, context)) return;
|
|
5173
|
+
if (dragMode === "text") {
|
|
5174
|
+
if (sameCellAddress(dragAnchor, { rowKey: row.key, columnKey: column.key })) return;
|
|
5175
|
+
dragMode = "cells";
|
|
5176
|
+
textCell = null;
|
|
5177
|
+
focusTable(event.currentTarget);
|
|
5178
|
+
}
|
|
5164
5179
|
event.preventDefault();
|
|
5165
5180
|
window.getSelection()?.removeAllRanges();
|
|
5166
5181
|
setSelection(context, {
|
|
@@ -5194,14 +5209,29 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5194
5209
|
},
|
|
5195
5210
|
onMount() {
|
|
5196
5211
|
const stopDragging = () => {
|
|
5212
|
+
constrainTextSelection();
|
|
5197
5213
|
dragMode = null;
|
|
5198
5214
|
dragAnchor = null;
|
|
5215
|
+
textCell = null;
|
|
5199
5216
|
headerDragAnchorKey = null;
|
|
5200
5217
|
};
|
|
5218
|
+
const constrainTextSelection = () => {
|
|
5219
|
+
if (!dragMode) return;
|
|
5220
|
+
const selection = window.getSelection();
|
|
5221
|
+
if (!selection || selection.isCollapsed) return;
|
|
5222
|
+
if (dragMode !== "text" || !textCell?.contains(selection.anchorNode) || !textCell.contains(selection.focusNode)) {
|
|
5223
|
+
selection.removeAllRanges();
|
|
5224
|
+
}
|
|
5225
|
+
};
|
|
5226
|
+
const handleSelectStart = (event) => {
|
|
5227
|
+
if (dragMode && dragMode !== "text") event.preventDefault();
|
|
5228
|
+
};
|
|
5201
5229
|
const handleCopy = (event) => {
|
|
5202
5230
|
const context = latestContext;
|
|
5203
5231
|
if (options.copyable === false || !context || !activeRoot || !activeRoot.contains(document.activeElement) || isInteractiveTableTarget(document.activeElement))
|
|
5204
5232
|
return;
|
|
5233
|
+
const selection = window.getSelection();
|
|
5234
|
+
if (selection && !selection.isCollapsed && selection.toString()) return;
|
|
5205
5235
|
const text = copyText(context);
|
|
5206
5236
|
if (!text) return;
|
|
5207
5237
|
event.preventDefault();
|
|
@@ -5209,11 +5239,18 @@ function createCellSelectionPlugin(options = {}) {
|
|
|
5209
5239
|
options.onCopy?.(text, selectedCells(context));
|
|
5210
5240
|
};
|
|
5211
5241
|
window.addEventListener("pointerup", stopDragging);
|
|
5242
|
+
window.addEventListener("pointercancel", stopDragging);
|
|
5212
5243
|
window.addEventListener("blur", stopDragging);
|
|
5244
|
+
document.addEventListener("selectionchange", constrainTextSelection);
|
|
5245
|
+
document.addEventListener("selectstart", handleSelectStart);
|
|
5213
5246
|
document.addEventListener("copy", handleCopy);
|
|
5214
5247
|
return () => {
|
|
5248
|
+
stopDragging();
|
|
5215
5249
|
window.removeEventListener("pointerup", stopDragging);
|
|
5250
|
+
window.removeEventListener("pointercancel", stopDragging);
|
|
5216
5251
|
window.removeEventListener("blur", stopDragging);
|
|
5252
|
+
document.removeEventListener("selectionchange", constrainTextSelection);
|
|
5253
|
+
document.removeEventListener("selectstart", handleSelectStart);
|
|
5217
5254
|
document.removeEventListener("copy", handleCopy);
|
|
5218
5255
|
};
|
|
5219
5256
|
},
|
|
@@ -8341,7 +8378,7 @@ function QueryForm({
|
|
|
8341
8378
|
{
|
|
8342
8379
|
className: "sia-query-form__field",
|
|
8343
8380
|
hidden: collapsed && index >= Math.min(limit, fittingCount),
|
|
8344
|
-
style: entry.width !== void 0 ? {
|
|
8381
|
+
style: entry.width !== void 0 ? { "--sia-query-item-width": typeof entry.width === "number" ? `${entry.width}px` : entry.width } : void 0,
|
|
8345
8382
|
children: entry.content
|
|
8346
8383
|
},
|
|
8347
8384
|
entry.key
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
4
|
-
import { S as SelectOption,
|
|
4
|
+
import { S as SelectOption, m as SelectValue } from './Select-BO3VyE2n.cjs';
|
|
5
5
|
|
|
6
6
|
/** 日期选择附带的时间选择配置。 */
|
|
7
7
|
type DatePickerShowTime = boolean | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
4
|
-
import { S as SelectOption,
|
|
4
|
+
import { S as SelectOption, m as SelectValue } from './Select-BoVx-D0D.js';
|
|
5
5
|
|
|
6
6
|
/** 日期选择附带的时间选择配置。 */
|
|
7
7
|
type DatePickerShowTime = boolean | {
|
|
@@ -3198,6 +3198,8 @@ var Select = (0, import_react16.forwardRef)(function Select2({
|
|
|
3198
3198
|
const [openedMode, setOpenedMode] = (0, import_react16.useState)(automaticMode);
|
|
3199
3199
|
const popupMode = open ? openedMode : automaticMode;
|
|
3200
3200
|
const [modalValues, setModalValues] = (0, import_react16.useState)([]);
|
|
3201
|
+
const [modalSubmitting, setModalSubmitting] = (0, import_react16.useState)(false);
|
|
3202
|
+
const modalSubmitLock = (0, import_react16.useRef)(false);
|
|
3201
3203
|
const [selectedOnly, setSelectedOnly] = (0, import_react16.useState)(false);
|
|
3202
3204
|
const [query, setQuery] = (0, import_react16.useState)("");
|
|
3203
3205
|
const [activeIndex, setActiveIndex] = (0, import_react16.useState)(-1);
|
|
@@ -3266,6 +3268,24 @@ var Select = (0, import_react16.forwardRef)(function Select2({
|
|
|
3266
3268
|
setQuery("");
|
|
3267
3269
|
setScrollTop(0);
|
|
3268
3270
|
}
|
|
3271
|
+
async function confirmModalSelection() {
|
|
3272
|
+
if (disabled || loading || modalSubmitLock.current) return;
|
|
3273
|
+
modalSubmitLock.current = true;
|
|
3274
|
+
const nextValue = multiple ? [...modalValues] : modalValues[0] ?? null;
|
|
3275
|
+
const selected = modalValues.map((selectedValue) => availableOptions.find((option) => option.value === selectedValue) ?? (allowInput ? { value: selectedValue, label: String(selectedValue) } : void 0)).filter((option) => option !== void 0);
|
|
3276
|
+
const extraValues = { ...modalConfig?.extraValues };
|
|
3277
|
+
setModalSubmitting(true);
|
|
3278
|
+
try {
|
|
3279
|
+
const result = await modalConfig?.onConfirm?.(nextValue, multiple ? selected : selected[0] ?? null, extraValues);
|
|
3280
|
+
if (result === false) return;
|
|
3281
|
+
setCurrentValue(nextValue);
|
|
3282
|
+
closeDropdown();
|
|
3283
|
+
} catch {
|
|
3284
|
+
} finally {
|
|
3285
|
+
modalSubmitLock.current = false;
|
|
3286
|
+
setModalSubmitting(false);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3269
3289
|
function openDropdown() {
|
|
3270
3290
|
if (disabled || loading) return;
|
|
3271
3291
|
setOpenedMode(automaticMode);
|
|
@@ -3490,6 +3510,7 @@ var Select = (0, import_react16.forwardRef)(function Select2({
|
|
|
3490
3510
|
open,
|
|
3491
3511
|
title: modalConfig?.title ?? placeholder,
|
|
3492
3512
|
width: modalConfig?.width ?? 900,
|
|
3513
|
+
confirmLoading: modalSubmitting,
|
|
3493
3514
|
onOpenChange: (next) => {
|
|
3494
3515
|
if (!next) closeDropdown();
|
|
3495
3516
|
},
|
|
@@ -3497,14 +3518,12 @@ var Select = (0, import_react16.forwardRef)(function Select2({
|
|
|
3497
3518
|
footer: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "sia-select-modal__footer", children: [
|
|
3498
3519
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: modalConfig?.footerExtra }),
|
|
3499
3520
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
3500
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { onClick: closeDropdown, children: "\u53D6\u6D88" }),
|
|
3501
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "primary", disabled: disabled || loading, onClick:
|
|
3502
|
-
setCurrentValue(multiple ? modalValues : modalValues[0] ?? null);
|
|
3503
|
-
closeDropdown();
|
|
3504
|
-
}, children: "\u786E\u5B9A" })
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { disabled: modalSubmitting, onClick: closeDropdown, children: "\u53D6\u6D88" }),
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "primary", loading: modalSubmitting, disabled: disabled || loading, onClick: confirmModalSelection, children: "\u786E\u5B9A" })
|
|
3505
3523
|
] })
|
|
3506
3524
|
] }),
|
|
3507
3525
|
children: open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
3526
|
+
modalConfig?.headerExtra != null && modalConfig.headerExtra !== false ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "sia-select-modal__header-extra", children: modalConfig.headerExtra }) : null,
|
|
3508
3527
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "sia-select-modal__heading", children: [
|
|
3509
3528
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
|
|
3510
3529
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
|