@sia.soul/sia-react-ui 0.1.52 → 0.1.54
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/core.css +72 -4
- package/dist/index.cjs +552 -459
- package/dist/index.css +72 -4
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +160 -67
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -2190,14 +2190,24 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2190
2190
|
overflow: var(--sia-scroll-overflow, auto);
|
|
2191
2191
|
padding: 10vh 16px 32px;
|
|
2192
2192
|
color: var(--sia-color-text);
|
|
2193
|
+
isolation: isolate;
|
|
2194
|
+
}
|
|
2195
|
+
.sia-modal-root::before {
|
|
2196
|
+
content: "";
|
|
2197
|
+
position: fixed;
|
|
2198
|
+
inset: 0;
|
|
2199
|
+
z-index: 0;
|
|
2193
2200
|
background: rgb(0 0 0 / 45%);
|
|
2194
|
-
animation: sia-modal-mask-in
|
|
2201
|
+
animation: sia-modal-mask-in 220ms ease both;
|
|
2202
|
+
will-change: opacity;
|
|
2195
2203
|
}
|
|
2196
2204
|
.sia-modal-root--centered {
|
|
2197
2205
|
align-items: center;
|
|
2198
2206
|
padding-block: 24px;
|
|
2199
2207
|
}
|
|
2200
2208
|
.sia-modal {
|
|
2209
|
+
position: relative;
|
|
2210
|
+
z-index: 1;
|
|
2201
2211
|
width: min(var(--sia-modal-width), calc(100vw - 32px));
|
|
2202
2212
|
overflow: hidden;
|
|
2203
2213
|
background: var(--sia-color-surface);
|
|
@@ -2210,6 +2220,8 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2210
2220
|
}
|
|
2211
2221
|
.sia-modal-root[data-state=closing] {
|
|
2212
2222
|
pointer-events: none;
|
|
2223
|
+
}
|
|
2224
|
+
.sia-modal-root[data-state=closing]::before {
|
|
2213
2225
|
animation: sia-modal-mask-out 220ms ease both;
|
|
2214
2226
|
}
|
|
2215
2227
|
.sia-modal-root[data-state=closing] .sia-modal {
|
|
@@ -4164,6 +4176,56 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4164
4176
|
align-items: center;
|
|
4165
4177
|
min-width: 0;
|
|
4166
4178
|
}
|
|
4179
|
+
.sia-table__cell--tree-lines {
|
|
4180
|
+
padding-block: 0;
|
|
4181
|
+
}
|
|
4182
|
+
.sia-table__cell--tree-lines > .sia-table__cell-content {
|
|
4183
|
+
position: absolute;
|
|
4184
|
+
inset: 0 12px;
|
|
4185
|
+
}
|
|
4186
|
+
.sia-table__tree-cell--lines {
|
|
4187
|
+
height: 100%;
|
|
4188
|
+
}
|
|
4189
|
+
.sia-table__tree-guide {
|
|
4190
|
+
position: relative;
|
|
4191
|
+
align-self: stretch;
|
|
4192
|
+
flex: 0 0 18px;
|
|
4193
|
+
width: 18px;
|
|
4194
|
+
}
|
|
4195
|
+
.sia-table__tree-guide--branch::before,
|
|
4196
|
+
.sia-table__tree-guide--continued::before {
|
|
4197
|
+
position: absolute;
|
|
4198
|
+
content: "";
|
|
4199
|
+
left: 10px;
|
|
4200
|
+
top: 0;
|
|
4201
|
+
height: 50%;
|
|
4202
|
+
border-left: 1px solid var(--sia-color-border);
|
|
4203
|
+
}
|
|
4204
|
+
.sia-table__tree-guide--continued::before {
|
|
4205
|
+
height: 100%;
|
|
4206
|
+
}
|
|
4207
|
+
.sia-table__tree-guide--branch::after {
|
|
4208
|
+
position: absolute;
|
|
4209
|
+
content: "";
|
|
4210
|
+
left: 10px;
|
|
4211
|
+
right: 0;
|
|
4212
|
+
top: 50%;
|
|
4213
|
+
border-top: 1px solid var(--sia-color-border);
|
|
4214
|
+
}
|
|
4215
|
+
.sia-table__tree-node {
|
|
4216
|
+
position: relative;
|
|
4217
|
+
align-self: stretch;
|
|
4218
|
+
display: inline-flex;
|
|
4219
|
+
align-items: center;
|
|
4220
|
+
flex: 0 0 20px;
|
|
4221
|
+
}
|
|
4222
|
+
.sia-table__tree-stem {
|
|
4223
|
+
position: absolute;
|
|
4224
|
+
left: 10px;
|
|
4225
|
+
top: calc(50% + 10px);
|
|
4226
|
+
bottom: 0;
|
|
4227
|
+
border-left: 1px solid var(--sia-color-border);
|
|
4228
|
+
}
|
|
4167
4229
|
.sia-table__tree-toggle,
|
|
4168
4230
|
.sia-table__tree-placeholder {
|
|
4169
4231
|
display: inline-grid;
|
|
@@ -4401,12 +4463,18 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4401
4463
|
}
|
|
4402
4464
|
@keyframes sia-modal-mask-in {
|
|
4403
4465
|
from {
|
|
4404
|
-
|
|
4466
|
+
opacity: 0;
|
|
4467
|
+
}
|
|
4468
|
+
to {
|
|
4469
|
+
opacity: 1;
|
|
4405
4470
|
}
|
|
4406
4471
|
}
|
|
4407
4472
|
@keyframes sia-modal-mask-out {
|
|
4473
|
+
from {
|
|
4474
|
+
opacity: 1;
|
|
4475
|
+
}
|
|
4408
4476
|
to {
|
|
4409
|
-
|
|
4477
|
+
opacity: 0;
|
|
4410
4478
|
}
|
|
4411
4479
|
}
|
|
4412
4480
|
@keyframes sia-modal-slide-in {
|
|
@@ -4554,7 +4622,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4554
4622
|
.sia-button::after,
|
|
4555
4623
|
.sia-icon--spin,
|
|
4556
4624
|
.sia-icon--pulse,
|
|
4557
|
-
.sia-modal-root,
|
|
4625
|
+
.sia-modal-root::before,
|
|
4558
4626
|
.sia-modal,
|
|
4559
4627
|
.sia-drawer,
|
|
4560
4628
|
.sia-drawer__mask,
|
package/dist/index.d.cts
CHANGED
|
@@ -2109,6 +2109,19 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
|
|
|
2109
2109
|
emptyText?: ReactNode;
|
|
2110
2110
|
/** 高度;数值按像素处理,字符串可使用 CSS 尺寸。 */
|
|
2111
2111
|
height?: number | string;
|
|
2112
|
+
/**
|
|
2113
|
+
* 自动填充从表格顶部到可视区域底部的剩余高度,包含工具栏和分页;true 使用当前窗口视口。
|
|
2114
|
+
* 查询区尺寸、祖先布局、窗口尺寸及隐藏页签显示后自动重测。height / tableHeight 显式设置时优先。
|
|
2115
|
+
* 默认关闭;不要同时使用依赖表格自身高度的容器或垂直居中布局。
|
|
2116
|
+
*/
|
|
2117
|
+
fillRemaining?: boolean | {
|
|
2118
|
+
/** 返回具有独立确定高度的容器,按其内边距内侧底边计算;默认使用窗口视口,返回 null 时等待容器就绪。 */
|
|
2119
|
+
container?: () => HTMLElement | null;
|
|
2120
|
+
/** 从可用高度中额外扣除的底部留白,单位 px,默认 0;不自动预留表格之后的兄弟内容。 */
|
|
2121
|
+
bottomOffset?: number;
|
|
2122
|
+
/** 最小总高度,单位 px,默认 0;超过可用空间时允许溢出,以保证最低可操作区域。 */
|
|
2123
|
+
minHeight?: number;
|
|
2124
|
+
};
|
|
2112
2125
|
/** 表格滚动区域的高度。 */
|
|
2113
2126
|
tableHeight?: number | string;
|
|
2114
2127
|
/**
|
|
@@ -2574,6 +2587,8 @@ interface TableIndexPluginOptions {
|
|
|
2574
2587
|
declare function createIndexPlugin<T extends Record<string, unknown>>(options?: TableIndexPluginOptions): TablePlugin<T, undefined>;
|
|
2575
2588
|
/** TableTree的插件配置。 */
|
|
2576
2589
|
interface TableTreePluginOptions<T> {
|
|
2590
|
+
/** 显示树形层级连接线;仅在 ignoreChildrenColumn=false 时生效,默认 false。 */
|
|
2591
|
+
showLine?: boolean;
|
|
2577
2592
|
/** 行数据中存放子行的字段名。 */
|
|
2578
2593
|
childrenColumnName?: string;
|
|
2579
2594
|
/** 是否忽略数据内的子行字段。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -2109,6 +2109,19 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
|
|
|
2109
2109
|
emptyText?: ReactNode;
|
|
2110
2110
|
/** 高度;数值按像素处理,字符串可使用 CSS 尺寸。 */
|
|
2111
2111
|
height?: number | string;
|
|
2112
|
+
/**
|
|
2113
|
+
* 自动填充从表格顶部到可视区域底部的剩余高度,包含工具栏和分页;true 使用当前窗口视口。
|
|
2114
|
+
* 查询区尺寸、祖先布局、窗口尺寸及隐藏页签显示后自动重测。height / tableHeight 显式设置时优先。
|
|
2115
|
+
* 默认关闭;不要同时使用依赖表格自身高度的容器或垂直居中布局。
|
|
2116
|
+
*/
|
|
2117
|
+
fillRemaining?: boolean | {
|
|
2118
|
+
/** 返回具有独立确定高度的容器,按其内边距内侧底边计算;默认使用窗口视口,返回 null 时等待容器就绪。 */
|
|
2119
|
+
container?: () => HTMLElement | null;
|
|
2120
|
+
/** 从可用高度中额外扣除的底部留白,单位 px,默认 0;不自动预留表格之后的兄弟内容。 */
|
|
2121
|
+
bottomOffset?: number;
|
|
2122
|
+
/** 最小总高度,单位 px,默认 0;超过可用空间时允许溢出,以保证最低可操作区域。 */
|
|
2123
|
+
minHeight?: number;
|
|
2124
|
+
};
|
|
2112
2125
|
/** 表格滚动区域的高度。 */
|
|
2113
2126
|
tableHeight?: number | string;
|
|
2114
2127
|
/**
|
|
@@ -2574,6 +2587,8 @@ interface TableIndexPluginOptions {
|
|
|
2574
2587
|
declare function createIndexPlugin<T extends Record<string, unknown>>(options?: TableIndexPluginOptions): TablePlugin<T, undefined>;
|
|
2575
2588
|
/** TableTree的插件配置。 */
|
|
2576
2589
|
interface TableTreePluginOptions<T> {
|
|
2590
|
+
/** 显示树形层级连接线;仅在 ignoreChildrenColumn=false 时生效,默认 false。 */
|
|
2591
|
+
showLine?: boolean;
|
|
2577
2592
|
/** 行数据中存放子行的字段名。 */
|
|
2578
2593
|
childrenColumnName?: string;
|
|
2579
2594
|
/** 是否忽略数据内的子行字段。 */
|
package/dist/index.js
CHANGED
|
@@ -4751,8 +4751,86 @@ function TableCellContent({ children, ellipsis, title }) {
|
|
|
4751
4751
|
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 });
|
|
4752
4752
|
}
|
|
4753
4753
|
|
|
4754
|
+
// src/components/Table/useRemainingHeight.ts
|
|
4755
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState17 } from "react";
|
|
4756
|
+
function useRemainingHeight(rootRef, options) {
|
|
4757
|
+
const [height, setHeight] = useState17();
|
|
4758
|
+
const enabled = !!options;
|
|
4759
|
+
const container = typeof options === "object" ? options.container : void 0;
|
|
4760
|
+
const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
|
|
4761
|
+
const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
|
|
4762
|
+
useLayoutEffect4(() => {
|
|
4763
|
+
const root = rootRef.current;
|
|
4764
|
+
if (!enabled || !root) return;
|
|
4765
|
+
const win = root.ownerDocument.defaultView;
|
|
4766
|
+
if (!win) return;
|
|
4767
|
+
let frame = 0;
|
|
4768
|
+
let disposed = false;
|
|
4769
|
+
const observed = /* @__PURE__ */ new Set();
|
|
4770
|
+
const observe = (element) => {
|
|
4771
|
+
if (observed.has(element)) return;
|
|
4772
|
+
observed.add(element);
|
|
4773
|
+
resize?.observe(element);
|
|
4774
|
+
};
|
|
4775
|
+
const measure = () => {
|
|
4776
|
+
frame = 0;
|
|
4777
|
+
if (disposed || !root.isConnected || !root.getClientRects().length) return;
|
|
4778
|
+
const target = container?.();
|
|
4779
|
+
if (container && (!target || !target.getClientRects().length)) return;
|
|
4780
|
+
let branch = root;
|
|
4781
|
+
while (branch.parentElement) {
|
|
4782
|
+
const parent = branch.parentElement;
|
|
4783
|
+
observe(parent);
|
|
4784
|
+
for (const sibling of parent.children) if (sibling !== branch) observe(sibling);
|
|
4785
|
+
branch = parent;
|
|
4786
|
+
}
|
|
4787
|
+
if (target) observe(target);
|
|
4788
|
+
const viewport = win.visualViewport;
|
|
4789
|
+
const bottom = target ? target.getBoundingClientRect().top + target.clientTop + target.clientHeight - (parseFloat(win.getComputedStyle(target).paddingBottom) || 0) : viewport ? viewport.offsetTop + viewport.height : win.innerHeight;
|
|
4790
|
+
const next = Math.max(0, minHeight, Math.floor(bottom - root.getBoundingClientRect().top - bottomOffset));
|
|
4791
|
+
setHeight((previous) => previous === next ? previous : next);
|
|
4792
|
+
};
|
|
4793
|
+
const schedule = () => {
|
|
4794
|
+
if (!disposed && !frame) frame = win.requestAnimationFrame(measure);
|
|
4795
|
+
};
|
|
4796
|
+
const onScroll = (event) => {
|
|
4797
|
+
if (event.target instanceof Node && root.contains(event.target)) return;
|
|
4798
|
+
schedule();
|
|
4799
|
+
};
|
|
4800
|
+
const onMotionEnd = (event) => {
|
|
4801
|
+
if (event.target instanceof Element && event.target.contains(root)) schedule();
|
|
4802
|
+
};
|
|
4803
|
+
const resize = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(schedule);
|
|
4804
|
+
const mutation = new MutationObserver(schedule);
|
|
4805
|
+
for (let node = root.parentElement; node; node = node.parentElement) {
|
|
4806
|
+
mutation.observe(node, { attributes: true, attributeFilter: ["style", "class", "hidden"], childList: true });
|
|
4807
|
+
}
|
|
4808
|
+
measure();
|
|
4809
|
+
schedule();
|
|
4810
|
+
win.addEventListener("resize", schedule);
|
|
4811
|
+
win.addEventListener("scroll", onScroll, true);
|
|
4812
|
+
win.addEventListener("transitionend", onMotionEnd, true);
|
|
4813
|
+
win.addEventListener("animationend", onMotionEnd, true);
|
|
4814
|
+
win.visualViewport?.addEventListener("resize", schedule);
|
|
4815
|
+
win.visualViewport?.addEventListener("scroll", schedule);
|
|
4816
|
+
return () => {
|
|
4817
|
+
disposed = true;
|
|
4818
|
+
win.cancelAnimationFrame(frame);
|
|
4819
|
+
resize?.disconnect();
|
|
4820
|
+
mutation.disconnect();
|
|
4821
|
+
win.removeEventListener("resize", schedule);
|
|
4822
|
+
win.removeEventListener("scroll", onScroll, true);
|
|
4823
|
+
win.removeEventListener("transitionend", onMotionEnd, true);
|
|
4824
|
+
win.removeEventListener("animationend", onMotionEnd, true);
|
|
4825
|
+
win.visualViewport?.removeEventListener("resize", schedule);
|
|
4826
|
+
win.visualViewport?.removeEventListener("scroll", schedule);
|
|
4827
|
+
};
|
|
4828
|
+
}, [rootRef, enabled, container, bottomOffset, minHeight]);
|
|
4829
|
+
return enabled ? height : void 0;
|
|
4830
|
+
}
|
|
4831
|
+
|
|
4754
4832
|
// src/components/Table/TableCanvasLayer.tsx
|
|
4755
|
-
import { useLayoutEffect as
|
|
4833
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef14 } from "react";
|
|
4756
4834
|
|
|
4757
4835
|
// src/components/Table/utils.ts
|
|
4758
4836
|
var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
|
|
@@ -4808,7 +4886,7 @@ function toTablePageParams(current, pageSize) {
|
|
|
4808
4886
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
4809
4887
|
function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
|
|
4810
4888
|
const canvasRef = useRef14(null);
|
|
4811
|
-
|
|
4889
|
+
useLayoutEffect5(() => {
|
|
4812
4890
|
const canvas = canvasRef.current;
|
|
4813
4891
|
const scroller = viewport.current;
|
|
4814
4892
|
if (!canvas || !scroller) return;
|
|
@@ -4935,10 +5013,10 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
4935
5013
|
}
|
|
4936
5014
|
|
|
4937
5015
|
// src/components/Table/Table.tsx
|
|
4938
|
-
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef16, useState as
|
|
5016
|
+
import { Fragment as Fragment8, forwardRef as forwardRef5, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect12, useImperativeHandle, useMemo as useMemo9, useRef as useRef16, useState as useState19 } from "react";
|
|
4939
5017
|
|
|
4940
5018
|
// src/components/Table/plugins.tsx
|
|
4941
|
-
import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef15, useState as
|
|
5019
|
+
import { isValidElement as isValidElement3, useEffect as useEffect11, useRef as useRef15, useState as useState18 } from "react";
|
|
4942
5020
|
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4943
5021
|
function TableCheckbox({
|
|
4944
5022
|
checked,
|
|
@@ -5565,7 +5643,7 @@ function TableSelectedItemsPanel({
|
|
|
5565
5643
|
onRemove,
|
|
5566
5644
|
onClear
|
|
5567
5645
|
}) {
|
|
5568
|
-
const [showAll, setShowAll] =
|
|
5646
|
+
const [showAll, setShowAll] = useState18(false);
|
|
5569
5647
|
const visibleEntries = showAll ? entries : entries.slice(0, maxCount);
|
|
5570
5648
|
const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
|
|
5571
5649
|
const baseColumnMap = new Map(
|
|
@@ -5964,8 +6042,8 @@ function TableFilterControl({
|
|
|
5964
6042
|
placeholder,
|
|
5965
6043
|
onApply
|
|
5966
6044
|
}) {
|
|
5967
|
-
const [open, setOpen] =
|
|
5968
|
-
const [draft, setDraft] =
|
|
6045
|
+
const [open, setOpen] = useState18(false);
|
|
6046
|
+
const [draft, setDraft] = useState18(value);
|
|
5969
6047
|
const label = getColumnLabel(column);
|
|
5970
6048
|
useEffect11(() => {
|
|
5971
6049
|
if (open) setDraft(value);
|
|
@@ -6281,14 +6359,15 @@ function createTreePlugin(options = {}) {
|
|
|
6281
6359
|
transformRows(rows, context) {
|
|
6282
6360
|
if (options.ignoreChildrenColumn ?? true) return rows;
|
|
6283
6361
|
const result = [];
|
|
6284
|
-
const walk = (items, depth) => {
|
|
6285
|
-
for (const row of items) {
|
|
6362
|
+
const walk = (items, depth, guides) => {
|
|
6363
|
+
for (const [rowIndex, row] of items.entries()) {
|
|
6364
|
+
const hasNextSibling = rowIndex < items.length - 1;
|
|
6286
6365
|
const children = row.record[childKey];
|
|
6287
6366
|
const hasChildren = Array.isArray(children) && children.length > 0 && (options.canExpand?.(row.record) ?? true);
|
|
6288
6367
|
result.push({
|
|
6289
6368
|
...row,
|
|
6290
6369
|
depth,
|
|
6291
|
-
meta: { ...row.meta, treeHasChildren: hasChildren }
|
|
6370
|
+
meta: { ...row.meta, treeHasChildren: hasChildren, treeGuides: guides, treeHasNextSibling: hasNextSibling }
|
|
6292
6371
|
});
|
|
6293
6372
|
if (hasChildren && current(context).includes(row.key)) {
|
|
6294
6373
|
walk(
|
|
@@ -6299,12 +6378,13 @@ function createTreePlugin(options = {}) {
|
|
|
6299
6378
|
depth: depth + 1,
|
|
6300
6379
|
meta: {}
|
|
6301
6380
|
})),
|
|
6302
|
-
depth + 1
|
|
6381
|
+
depth + 1,
|
|
6382
|
+
depth > 0 ? [...guides, hasNextSibling] : guides
|
|
6303
6383
|
);
|
|
6304
6384
|
}
|
|
6305
6385
|
}
|
|
6306
6386
|
};
|
|
6307
|
-
walk(rows, 0);
|
|
6387
|
+
walk(rows, 0, []);
|
|
6308
6388
|
return result;
|
|
6309
6389
|
},
|
|
6310
6390
|
transformColumns(columns, context) {
|
|
@@ -6316,32 +6396,40 @@ function createTreePlugin(options = {}) {
|
|
|
6316
6396
|
const previousRender = column.render;
|
|
6317
6397
|
return {
|
|
6318
6398
|
...column,
|
|
6399
|
+
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
6319
6400
|
render: (value, record, index, info) => /* @__PURE__ */ jsxs20(
|
|
6320
6401
|
"span",
|
|
6321
6402
|
{
|
|
6322
|
-
className: "sia-table__tree-cell"
|
|
6323
|
-
style: { paddingLeft: info.row.depth * 18 },
|
|
6403
|
+
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
6404
|
+
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
6324
6405
|
children: [
|
|
6325
|
-
info.row.
|
|
6326
|
-
"
|
|
6327
|
-
{
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
{
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
}
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6406
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
6407
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
6408
|
+
/* @__PURE__ */ jsx22("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
6409
|
+
] }),
|
|
6410
|
+
/* @__PURE__ */ jsxs20("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
6411
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
6412
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ jsx22(
|
|
6413
|
+
"button",
|
|
6414
|
+
{
|
|
6415
|
+
type: "button",
|
|
6416
|
+
className: "sia-table__tree-toggle",
|
|
6417
|
+
"aria-label": current(context).includes(info.row.key) ? "\u6536\u8D77\u5B50\u8282\u70B9" : "\u5C55\u5F00\u5B50\u8282\u70B9",
|
|
6418
|
+
"aria-expanded": current(context).includes(info.row.key),
|
|
6419
|
+
onClick: (event) => {
|
|
6420
|
+
event.stopPropagation();
|
|
6421
|
+
toggle(info.row.key, context);
|
|
6422
|
+
},
|
|
6423
|
+
children: /* @__PURE__ */ jsx22(
|
|
6424
|
+
Icon,
|
|
6425
|
+
{
|
|
6426
|
+
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
6427
|
+
size: 13
|
|
6428
|
+
}
|
|
6429
|
+
)
|
|
6430
|
+
}
|
|
6431
|
+
) : /* @__PURE__ */ jsx22("span", { className: "sia-table__tree-placeholder" })
|
|
6432
|
+
] }),
|
|
6345
6433
|
previousRender ? previousRender(value, record, index, info) : value
|
|
6346
6434
|
]
|
|
6347
6435
|
}
|
|
@@ -6349,6 +6437,9 @@ function createTreePlugin(options = {}) {
|
|
|
6349
6437
|
};
|
|
6350
6438
|
});
|
|
6351
6439
|
},
|
|
6440
|
+
getCellProps(_row, column) {
|
|
6441
|
+
return column.meta?.treeLines ? { className: "sia-table__cell--tree-lines" } : void 0;
|
|
6442
|
+
},
|
|
6352
6443
|
getApi: (context) => ({
|
|
6353
6444
|
getExpandedKeys: () => current(context),
|
|
6354
6445
|
setExpandedKeys: (keys) => setKeys(keys, context),
|
|
@@ -6392,8 +6483,8 @@ function EditableTableCell({
|
|
|
6392
6483
|
trigger
|
|
6393
6484
|
}) {
|
|
6394
6485
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
6395
|
-
const [editValue, setEditValue] =
|
|
6396
|
-
const [saving, setSaving] =
|
|
6486
|
+
const [editValue, setEditValue] = useState18(value);
|
|
6487
|
+
const [saving, setSaving] = useState18(false);
|
|
6397
6488
|
const inputRef = useRef15(null);
|
|
6398
6489
|
const editorRef = useRef15(null);
|
|
6399
6490
|
const editValueRef = useRef15(value);
|
|
@@ -6738,10 +6829,10 @@ function ColumnSettingPanel({
|
|
|
6738
6829
|
onClose,
|
|
6739
6830
|
onApply
|
|
6740
6831
|
}) {
|
|
6741
|
-
const [draft, setDraft] =
|
|
6832
|
+
const [draft, setDraft] = useState18(items);
|
|
6742
6833
|
const listRef = useRef15(null);
|
|
6743
6834
|
const cancelDrag = useRef15(null);
|
|
6744
|
-
const [preview, setPreview] =
|
|
6835
|
+
const [preview, setPreview] = useState18(null);
|
|
6745
6836
|
useEffect11(() => {
|
|
6746
6837
|
cancelDrag.current?.();
|
|
6747
6838
|
if (open) setDraft(orderColumnSettings(items));
|
|
@@ -7541,6 +7632,7 @@ function TableInner(props, ref) {
|
|
|
7541
7632
|
emptyText = "\u6682\u65E0\u6570\u636E",
|
|
7542
7633
|
height,
|
|
7543
7634
|
tableHeight,
|
|
7635
|
+
fillRemaining,
|
|
7544
7636
|
size = "medium",
|
|
7545
7637
|
bordered = true,
|
|
7546
7638
|
rowBordered = true,
|
|
@@ -7566,16 +7658,17 @@ function TableInner(props, ref) {
|
|
|
7566
7658
|
...htmlProps
|
|
7567
7659
|
} = props;
|
|
7568
7660
|
const rootRef = useRef16(null);
|
|
7661
|
+
const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
|
|
7569
7662
|
const scrollRef = useRef16(null);
|
|
7570
7663
|
const tableRef = useRef16(null);
|
|
7571
7664
|
useScrollbarProximity();
|
|
7572
7665
|
const scrollbarDragRef = useRef16(null);
|
|
7573
|
-
const [internalLoading, setInternalLoading] =
|
|
7574
|
-
const [scrollTop, setScrollTop] =
|
|
7575
|
-
const [scrollLeft, setScrollLeft] =
|
|
7576
|
-
const [viewportHeight, setViewportHeight] =
|
|
7577
|
-
const [viewportWidth, setViewportWidth] =
|
|
7578
|
-
const [autoColumnWidths, setAutoColumnWidths] =
|
|
7666
|
+
const [internalLoading, setInternalLoading] = useState19(false);
|
|
7667
|
+
const [scrollTop, setScrollTop] = useState19(0);
|
|
7668
|
+
const [scrollLeft, setScrollLeft] = useState19(0);
|
|
7669
|
+
const [viewportHeight, setViewportHeight] = useState19(420);
|
|
7670
|
+
const [viewportWidth, setViewportWidth] = useState19(0);
|
|
7671
|
+
const [autoColumnWidths, setAutoColumnWidths] = useState19({});
|
|
7579
7672
|
const getRowKey = useCallback2((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
|
|
7580
7673
|
const builtInResizePlugin = useMemo9(() => createResizePlugin(), []);
|
|
7581
7674
|
const builtInHighlightPlugin = useMemo9(() => createHighlightPlugin(), []);
|
|
@@ -7592,7 +7685,7 @@ function TableInner(props, ref) {
|
|
|
7592
7685
|
const sortedPlugins = useMemo9(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
|
|
7593
7686
|
const pluginsByIdRef = useRef16(/* @__PURE__ */ new Map());
|
|
7594
7687
|
pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
|
|
7595
|
-
const [pluginStates, setPluginStates] =
|
|
7688
|
+
const [pluginStates, setPluginStates] = useState19(() => Object.fromEntries(
|
|
7596
7689
|
sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
|
|
7597
7690
|
));
|
|
7598
7691
|
const pluginApisRef = useRef16({});
|
|
@@ -7854,7 +7947,7 @@ function TableInner(props, ref) {
|
|
|
7854
7947
|
return content ? /* @__PURE__ */ jsx23(Fragment8, { children: content }, `overlay-${plugin.id}`) : null;
|
|
7855
7948
|
}).filter(Boolean);
|
|
7856
7949
|
const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
|
|
7857
|
-
const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
7950
|
+
const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
|
|
7858
7951
|
const rootStyle = {
|
|
7859
7952
|
...style,
|
|
7860
7953
|
height: effectiveHeight,
|
|
@@ -8266,7 +8359,7 @@ function applySiaTheme(mode, target = document.documentElement) {
|
|
|
8266
8359
|
}
|
|
8267
8360
|
|
|
8268
8361
|
// src/components/InputSelect.tsx
|
|
8269
|
-
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef17, useState as
|
|
8362
|
+
import { forwardRef as forwardRef7, useEffect as useEffect13, useRef as useRef17, useState as useState20 } from "react";
|
|
8270
8363
|
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8271
8364
|
var InputSelect = forwardRef7(function InputSelect2({
|
|
8272
8365
|
options,
|
|
@@ -8294,19 +8387,19 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8294
8387
|
...inputProps
|
|
8295
8388
|
}, forwardedRef) {
|
|
8296
8389
|
const size = useControlSize(sizeProp);
|
|
8297
|
-
const [internal, setInternal] =
|
|
8390
|
+
const [internal, setInternal] = useState20(defaultValue);
|
|
8298
8391
|
const current = value !== void 0 ? value : internal;
|
|
8299
8392
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|
|
8300
8393
|
const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
|
|
8301
|
-
const [draft, setDraft] =
|
|
8394
|
+
const [draft, setDraft] = useState20(text);
|
|
8302
8395
|
useEffect13(() => {
|
|
8303
8396
|
setDraft(text);
|
|
8304
8397
|
}, [text, current]);
|
|
8305
|
-
const [open, setOpen] =
|
|
8306
|
-
const [search, setSearch] =
|
|
8307
|
-
const [modalOpen, setModalOpen] =
|
|
8308
|
-
const [modalValues, setModalValues] =
|
|
8309
|
-
const [selectedOnly, setSelectedOnly] =
|
|
8398
|
+
const [open, setOpen] = useState20(false);
|
|
8399
|
+
const [search, setSearch] = useState20("");
|
|
8400
|
+
const [modalOpen, setModalOpen] = useState20(false);
|
|
8401
|
+
const [modalValues, setModalValues] = useState20([]);
|
|
8402
|
+
const [selectedOnly, setSelectedOnly] = useState20(false);
|
|
8310
8403
|
const rootRef = useRef17(null);
|
|
8311
8404
|
const popupRef = useRef17(null);
|
|
8312
8405
|
const inputRef = useRef17(null);
|
|
@@ -8470,7 +8563,7 @@ var InputSelect = forwardRef7(function InputSelect2({
|
|
|
8470
8563
|
});
|
|
8471
8564
|
|
|
8472
8565
|
// src/components/QueryForm.tsx
|
|
8473
|
-
import { Children as Children4, useLayoutEffect as
|
|
8566
|
+
import { Children as Children4, useLayoutEffect as useLayoutEffect6, useRef as useRef18, useState as useState21 } from "react";
|
|
8474
8567
|
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8475
8568
|
function QueryForm({
|
|
8476
8569
|
fields,
|
|
@@ -8504,17 +8597,17 @@ function QueryForm({
|
|
|
8504
8597
|
...formProps
|
|
8505
8598
|
}) {
|
|
8506
8599
|
const [form] = useForm(providedForm);
|
|
8507
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
8508
|
-
const [needsCollapse, setNeedsCollapse] =
|
|
8600
|
+
const [internalCollapsed, setInternalCollapsed] = useState21(defaultCollapsed);
|
|
8601
|
+
const [needsCollapse, setNeedsCollapse] = useState21(false);
|
|
8509
8602
|
const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed);
|
|
8510
|
-
const [searching, setSearching] =
|
|
8511
|
-
const [saving, setSaving] =
|
|
8512
|
-
const [removing, setRemoving] =
|
|
8513
|
-
const [saveOpen, setSaveOpen] =
|
|
8514
|
-
const [saveName, setSaveName] =
|
|
8515
|
-
const [saveError, setSaveError] =
|
|
8516
|
-
const [error, setError] =
|
|
8517
|
-
const [activeShortcut, setActiveShortcut] =
|
|
8603
|
+
const [searching, setSearching] = useState21(false);
|
|
8604
|
+
const [saving, setSaving] = useState21(false);
|
|
8605
|
+
const [removing, setRemoving] = useState21(false);
|
|
8606
|
+
const [saveOpen, setSaveOpen] = useState21(false);
|
|
8607
|
+
const [saveName, setSaveName] = useState21("");
|
|
8608
|
+
const [saveError, setSaveError] = useState21("");
|
|
8609
|
+
const [error, setError] = useState21("");
|
|
8610
|
+
const [activeShortcut, setActiveShortcut] = useState21("");
|
|
8518
8611
|
const source = useRef18({ source: "submit" });
|
|
8519
8612
|
const searchLock = useRef18(false);
|
|
8520
8613
|
const saveLock = useRef18(false);
|
|
@@ -8527,8 +8620,8 @@ function QueryForm({
|
|
|
8527
8620
|
const rowRef = useRef18(null);
|
|
8528
8621
|
const actionsRef = useRef18(null);
|
|
8529
8622
|
const toggleRef = useRef18(null);
|
|
8530
|
-
const [fittingCount, setFittingCount] =
|
|
8531
|
-
|
|
8623
|
+
const [fittingCount, setFittingCount] = useState21(limit);
|
|
8624
|
+
useLayoutEffect6(() => {
|
|
8532
8625
|
const row = rowRef.current;
|
|
8533
8626
|
const actions = actionsRef.current;
|
|
8534
8627
|
if (!row || !actions) return;
|