@sia.soul/sia-react-ui 0.1.53 → 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 +50 -0
- package/dist/index.cjs +40 -27
- package/dist/index.css +50 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -27
- package/package.json +1 -1
package/dist/core.css
CHANGED
|
@@ -4176,6 +4176,56 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4176
4176
|
align-items: center;
|
|
4177
4177
|
min-width: 0;
|
|
4178
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
|
+
}
|
|
4179
4229
|
.sia-table__tree-toggle,
|
|
4180
4230
|
.sia-table__tree-placeholder {
|
|
4181
4231
|
display: inline-grid;
|
package/dist/index.cjs
CHANGED
|
@@ -13612,14 +13612,15 @@ function createTreePlugin(options = {}) {
|
|
|
13612
13612
|
transformRows(rows, context) {
|
|
13613
13613
|
if (options.ignoreChildrenColumn ?? true) return rows;
|
|
13614
13614
|
const result = [];
|
|
13615
|
-
const walk = (items, depth) => {
|
|
13616
|
-
for (const row of items) {
|
|
13615
|
+
const walk = (items, depth, guides) => {
|
|
13616
|
+
for (const [rowIndex, row] of items.entries()) {
|
|
13617
|
+
const hasNextSibling = rowIndex < items.length - 1;
|
|
13617
13618
|
const children = row.record[childKey];
|
|
13618
13619
|
const hasChildren = Array.isArray(children) && children.length > 0 && (options.canExpand?.(row.record) ?? true);
|
|
13619
13620
|
result.push({
|
|
13620
13621
|
...row,
|
|
13621
13622
|
depth,
|
|
13622
|
-
meta: { ...row.meta, treeHasChildren: hasChildren }
|
|
13623
|
+
meta: { ...row.meta, treeHasChildren: hasChildren, treeGuides: guides, treeHasNextSibling: hasNextSibling }
|
|
13623
13624
|
});
|
|
13624
13625
|
if (hasChildren && current(context).includes(row.key)) {
|
|
13625
13626
|
walk(
|
|
@@ -13630,12 +13631,13 @@ function createTreePlugin(options = {}) {
|
|
|
13630
13631
|
depth: depth + 1,
|
|
13631
13632
|
meta: {}
|
|
13632
13633
|
})),
|
|
13633
|
-
depth + 1
|
|
13634
|
+
depth + 1,
|
|
13635
|
+
depth > 0 ? [...guides, hasNextSibling] : guides
|
|
13634
13636
|
);
|
|
13635
13637
|
}
|
|
13636
13638
|
}
|
|
13637
13639
|
};
|
|
13638
|
-
walk(rows, 0);
|
|
13640
|
+
walk(rows, 0, []);
|
|
13639
13641
|
return result;
|
|
13640
13642
|
},
|
|
13641
13643
|
transformColumns(columns, context) {
|
|
@@ -13647,32 +13649,40 @@ function createTreePlugin(options = {}) {
|
|
|
13647
13649
|
const previousRender = column.render;
|
|
13648
13650
|
return {
|
|
13649
13651
|
...column,
|
|
13652
|
+
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
13650
13653
|
render: (value, record, index, info) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
13651
13654
|
"span",
|
|
13652
13655
|
{
|
|
13653
|
-
className: "sia-table__tree-cell"
|
|
13654
|
-
style: { paddingLeft: info.row.depth * 18 },
|
|
13656
|
+
className: `sia-table__tree-cell${options.showLine ? " sia-table__tree-cell--lines" : ""}`,
|
|
13657
|
+
style: options.showLine ? void 0 : { paddingLeft: info.row.depth * 18 },
|
|
13655
13658
|
children: [
|
|
13656
|
-
info.row.
|
|
13657
|
-
"
|
|
13658
|
-
{
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
{
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
}
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13659
|
+
options.showLine && info.row.depth > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
13660
|
+
info.row.meta.treeGuides.map((continued, level) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: `sia-table__tree-guide${continued ? " sia-table__tree-guide--continued" : ""}` }, level)),
|
|
13661
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: `sia-table__tree-guide sia-table__tree-guide--branch${info.row.meta.treeHasNextSibling ? " sia-table__tree-guide--continued" : ""}` })
|
|
13662
|
+
] }),
|
|
13663
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: options.showLine ? "sia-table__tree-node" : void 0, style: options.showLine ? void 0 : { display: "contents" }, children: [
|
|
13664
|
+
options.showLine && !!info.row.meta.treeHasChildren && current(context).includes(info.row.key) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": "true", className: "sia-table__tree-stem" }),
|
|
13665
|
+
info.row.meta.treeHasChildren ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13666
|
+
"button",
|
|
13667
|
+
{
|
|
13668
|
+
type: "button",
|
|
13669
|
+
className: "sia-table__tree-toggle",
|
|
13670
|
+
"aria-label": current(context).includes(info.row.key) ? "\u6536\u8D77\u5B50\u8282\u70B9" : "\u5C55\u5F00\u5B50\u8282\u70B9",
|
|
13671
|
+
"aria-expanded": current(context).includes(info.row.key),
|
|
13672
|
+
onClick: (event) => {
|
|
13673
|
+
event.stopPropagation();
|
|
13674
|
+
toggle(info.row.key, context);
|
|
13675
|
+
},
|
|
13676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13677
|
+
Icon,
|
|
13678
|
+
{
|
|
13679
|
+
name: current(context).includes(info.row.key) ? "chevron-down" : "chevron-right",
|
|
13680
|
+
size: 13
|
|
13681
|
+
}
|
|
13682
|
+
)
|
|
13683
|
+
}
|
|
13684
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "sia-table__tree-placeholder" })
|
|
13685
|
+
] }),
|
|
13676
13686
|
previousRender ? previousRender(value, record, index, info) : value
|
|
13677
13687
|
]
|
|
13678
13688
|
}
|
|
@@ -13680,6 +13690,9 @@ function createTreePlugin(options = {}) {
|
|
|
13680
13690
|
};
|
|
13681
13691
|
});
|
|
13682
13692
|
},
|
|
13693
|
+
getCellProps(_row, column) {
|
|
13694
|
+
return column.meta?.treeLines ? { className: "sia-table__cell--tree-lines" } : void 0;
|
|
13695
|
+
},
|
|
13683
13696
|
getApi: (context) => ({
|
|
13684
13697
|
getExpandedKeys: () => current(context),
|
|
13685
13698
|
setExpandedKeys: (keys) => setKeys(keys, context),
|
package/dist/index.css
CHANGED
|
@@ -4176,6 +4176,56 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4176
4176
|
align-items: center;
|
|
4177
4177
|
min-width: 0;
|
|
4178
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
|
+
}
|
|
4179
4229
|
.sia-table__tree-toggle,
|
|
4180
4230
|
.sia-table__tree-placeholder {
|
|
4181
4231
|
display: inline-grid;
|
package/dist/index.d.cts
CHANGED
|
@@ -2587,6 +2587,8 @@ interface TableIndexPluginOptions {
|
|
|
2587
2587
|
declare function createIndexPlugin<T extends Record<string, unknown>>(options?: TableIndexPluginOptions): TablePlugin<T, undefined>;
|
|
2588
2588
|
/** TableTree的插件配置。 */
|
|
2589
2589
|
interface TableTreePluginOptions<T> {
|
|
2590
|
+
/** 显示树形层级连接线;仅在 ignoreChildrenColumn=false 时生效,默认 false。 */
|
|
2591
|
+
showLine?: boolean;
|
|
2590
2592
|
/** 行数据中存放子行的字段名。 */
|
|
2591
2593
|
childrenColumnName?: string;
|
|
2592
2594
|
/** 是否忽略数据内的子行字段。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -2587,6 +2587,8 @@ interface TableIndexPluginOptions {
|
|
|
2587
2587
|
declare function createIndexPlugin<T extends Record<string, unknown>>(options?: TableIndexPluginOptions): TablePlugin<T, undefined>;
|
|
2588
2588
|
/** TableTree的插件配置。 */
|
|
2589
2589
|
interface TableTreePluginOptions<T> {
|
|
2590
|
+
/** 显示树形层级连接线;仅在 ignoreChildrenColumn=false 时生效,默认 false。 */
|
|
2591
|
+
showLine?: boolean;
|
|
2590
2592
|
/** 行数据中存放子行的字段名。 */
|
|
2591
2593
|
childrenColumnName?: string;
|
|
2592
2594
|
/** 是否忽略数据内的子行字段。 */
|
package/dist/index.js
CHANGED
|
@@ -6359,14 +6359,15 @@ function createTreePlugin(options = {}) {
|
|
|
6359
6359
|
transformRows(rows, context) {
|
|
6360
6360
|
if (options.ignoreChildrenColumn ?? true) return rows;
|
|
6361
6361
|
const result = [];
|
|
6362
|
-
const walk = (items, depth) => {
|
|
6363
|
-
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;
|
|
6364
6365
|
const children = row.record[childKey];
|
|
6365
6366
|
const hasChildren = Array.isArray(children) && children.length > 0 && (options.canExpand?.(row.record) ?? true);
|
|
6366
6367
|
result.push({
|
|
6367
6368
|
...row,
|
|
6368
6369
|
depth,
|
|
6369
|
-
meta: { ...row.meta, treeHasChildren: hasChildren }
|
|
6370
|
+
meta: { ...row.meta, treeHasChildren: hasChildren, treeGuides: guides, treeHasNextSibling: hasNextSibling }
|
|
6370
6371
|
});
|
|
6371
6372
|
if (hasChildren && current(context).includes(row.key)) {
|
|
6372
6373
|
walk(
|
|
@@ -6377,12 +6378,13 @@ function createTreePlugin(options = {}) {
|
|
|
6377
6378
|
depth: depth + 1,
|
|
6378
6379
|
meta: {}
|
|
6379
6380
|
})),
|
|
6380
|
-
depth + 1
|
|
6381
|
+
depth + 1,
|
|
6382
|
+
depth > 0 ? [...guides, hasNextSibling] : guides
|
|
6381
6383
|
);
|
|
6382
6384
|
}
|
|
6383
6385
|
}
|
|
6384
6386
|
};
|
|
6385
|
-
walk(rows, 0);
|
|
6387
|
+
walk(rows, 0, []);
|
|
6386
6388
|
return result;
|
|
6387
6389
|
},
|
|
6388
6390
|
transformColumns(columns, context) {
|
|
@@ -6394,32 +6396,40 @@ function createTreePlugin(options = {}) {
|
|
|
6394
6396
|
const previousRender = column.render;
|
|
6395
6397
|
return {
|
|
6396
6398
|
...column,
|
|
6399
|
+
...options.showLine ? { ellipsis: false, meta: { ...column.meta, treeLines: true } } : {},
|
|
6397
6400
|
render: (value, record, index, info) => /* @__PURE__ */ jsxs20(
|
|
6398
6401
|
"span",
|
|
6399
6402
|
{
|
|
6400
|
-
className: "sia-table__tree-cell"
|
|
6401
|
-
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 },
|
|
6402
6405
|
children: [
|
|
6403
|
-
info.row.
|
|
6404
|
-
"
|
|
6405
|
-
{
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
{
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
}
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
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
|
+
] }),
|
|
6423
6433
|
previousRender ? previousRender(value, record, index, info) : value
|
|
6424
6434
|
]
|
|
6425
6435
|
}
|
|
@@ -6427,6 +6437,9 @@ function createTreePlugin(options = {}) {
|
|
|
6427
6437
|
};
|
|
6428
6438
|
});
|
|
6429
6439
|
},
|
|
6440
|
+
getCellProps(_row, column) {
|
|
6441
|
+
return column.meta?.treeLines ? { className: "sia-table__cell--tree-lines" } : void 0;
|
|
6442
|
+
},
|
|
6430
6443
|
getApi: (context) => ({
|
|
6431
6444
|
getExpandedKeys: () => current(context),
|
|
6432
6445
|
setExpandedKeys: (keys) => setKeys(keys, context),
|