@rainbow-oh/yee-c 0.5.1 → 0.6.1
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/cjs/Anchor/anchor-item.js +10 -2
- package/dist/cjs/Anchor/interface.d.ts +1 -1
- package/dist/cjs/Dialog/dialog.js +16 -2
- package/dist/cjs/Dialog/interface.d.ts +1 -1
- package/dist/cjs/Input/style/index.less +2 -0
- package/dist/cjs/Table/demo/components-override.d.ts +3 -0
- package/dist/cjs/Table/demo/components-override.js +54 -0
- package/dist/cjs/Table/demo/grouping.d.ts +3 -0
- package/dist/cjs/Table/demo/grouping.js +129 -0
- package/dist/cjs/Table/hooks/useColumns.d.ts +2 -2
- package/dist/cjs/Table/hooks/useColumns.js +15 -37
- package/dist/cjs/Table/index.d.ts +1 -1
- package/dist/cjs/Table/interface.d.ts +59 -8
- package/dist/cjs/Table/style/index.less +19 -1
- package/dist/cjs/Table/table.js +5 -7
- package/dist/cjs/Table/tbody/cell.d.ts +0 -1
- package/dist/cjs/Table/tbody/cell.js +0 -4
- package/dist/cjs/Table/tbody/index.js +19 -2
- package/dist/cjs/Table/tbody/row.js +15 -11
- package/dist/cjs/Table/theader/cell.js +7 -1
- package/dist/cjs/Table/theader/index.d.ts +5 -5
- package/dist/cjs/Table/theader/index.js +41 -27
- package/dist/cjs/Table/util/header.d.ts +23 -0
- package/dist/cjs/Table/util/header.js +109 -0
- package/dist/cjs/TextArea/style/index.less +1 -0
- package/dist/cjs/style/size.css +1 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +2 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Anchor/anchor-item.js +4 -3
- package/dist/esm/Anchor/interface.d.ts +1 -1
- package/dist/esm/Dialog/dialog.js +4 -2
- package/dist/esm/Dialog/interface.d.ts +1 -1
- package/dist/esm/Input/style/index.less +2 -0
- package/dist/esm/Table/demo/components-override.d.ts +3 -0
- package/dist/esm/Table/demo/components-override.js +86 -0
- package/dist/esm/Table/demo/grouping.d.ts +3 -0
- package/dist/esm/Table/demo/grouping.js +102 -0
- package/dist/esm/Table/hooks/useColumns.d.ts +2 -2
- package/dist/esm/Table/hooks/useColumns.js +24 -50
- package/dist/esm/Table/index.d.ts +1 -1
- package/dist/esm/Table/interface.d.ts +59 -8
- package/dist/esm/Table/style/index.less +19 -1
- package/dist/esm/Table/table.js +5 -7
- package/dist/esm/Table/tbody/cell.d.ts +0 -1
- package/dist/esm/Table/tbody/cell.js +0 -5
- package/dist/esm/Table/tbody/index.js +21 -2
- package/dist/esm/Table/tbody/row.js +19 -15
- package/dist/esm/Table/theader/cell.js +6 -2
- package/dist/esm/Table/theader/index.d.ts +5 -5
- package/dist/esm/Table/theader/index.js +48 -35
- package/dist/esm/Table/util/header.d.ts +23 -0
- package/dist/esm/Table/util/header.js +107 -0
- package/dist/esm/TextArea/style/index.less +1 -0
- package/dist/esm/style/size.css +1 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +2 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Anchor/anchor-item.tsx +7 -3
- package/src/Anchor/interface.ts +1 -1
- package/src/Dialog/dialog.tsx +10 -2
- package/src/Dialog/interface.ts +1 -1
- package/src/Input/style/index.less +2 -0
- package/src/Table/demo/components-override.tsx +49 -0
- package/src/Table/demo/grouping.tsx +104 -0
- package/src/Table/hooks/useColumns.ts +29 -46
- package/src/Table/index.en-US.md +31 -3
- package/src/Table/index.ts +4 -0
- package/src/Table/index.zh-CN.md +30 -2
- package/src/Table/interface.ts +66 -8
- package/src/Table/style/index.less +19 -1
- package/src/Table/table.tsx +5 -7
- package/src/Table/tbody/cell.tsx +0 -6
- package/src/Table/tbody/index.tsx +21 -2
- package/src/Table/tbody/row.tsx +25 -14
- package/src/Table/theader/cell.tsx +4 -0
- package/src/Table/theader/index.tsx +61 -42
- package/src/Table/util/header.ts +111 -0
- package/src/TextArea/style/index.less +1 -0
- package/src/style/size.css +1 -0
- package/src/version.ts +1 -1
|
@@ -127,20 +127,24 @@ var TableRow = (props) => {
|
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
129
|
const getSelection = (column) => {
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const props2 = onCell ? onCell(record, index)
|
|
133
|
-
const checked = selectedRowKeys == null ? void 0 : selectedRowKeys.includes(
|
|
134
|
-
const
|
|
130
|
+
const { type, disabled: colDisabled, onCell } = column;
|
|
131
|
+
const rowKeyValue = record[rowKey];
|
|
132
|
+
const props2 = (onCell == null ? void 0 : onCell(record, index)) || {};
|
|
133
|
+
const checked = selectedRowKeys == null ? void 0 : selectedRowKeys.includes(rowKeyValue);
|
|
134
|
+
const disabled = typeof colDisabled === "function" ? colDisabled(record, index) : Array.isArray(colDisabled) ? colDisabled[index] : !!colDisabled;
|
|
135
|
+
const commonProps = __spreadValues({
|
|
135
136
|
checked,
|
|
136
|
-
value:
|
|
137
|
-
onChange: onSelectionChange
|
|
138
|
-
|
|
137
|
+
value: rowKeyValue,
|
|
138
|
+
onChange: onSelectionChange,
|
|
139
|
+
disabled
|
|
140
|
+
}, props2);
|
|
139
141
|
if (type === "checkbox") {
|
|
140
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
143
|
+
import_Checkbox.default,
|
|
144
|
+
__spreadValues({}, commonProps)
|
|
145
|
+
);
|
|
143
146
|
}
|
|
147
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Radio.default, __spreadValues({}, commonProps));
|
|
144
148
|
};
|
|
145
149
|
let colSpanStart = Infinity;
|
|
146
150
|
let colSpanEnd = -1;
|
|
@@ -86,6 +86,8 @@ var HeadCell = (props) => {
|
|
|
86
86
|
internalFilters,
|
|
87
87
|
style,
|
|
88
88
|
width,
|
|
89
|
+
colSpan,
|
|
90
|
+
rowSpan,
|
|
89
91
|
onHeaderCell,
|
|
90
92
|
onSort,
|
|
91
93
|
onInternalFilter
|
|
@@ -107,6 +109,8 @@ var HeadCell = (props) => {
|
|
|
107
109
|
"internalFilters",
|
|
108
110
|
"style",
|
|
109
111
|
"width",
|
|
112
|
+
"colSpan",
|
|
113
|
+
"rowSpan",
|
|
110
114
|
"onHeaderCell",
|
|
111
115
|
"onSort",
|
|
112
116
|
"onInternalFilter"
|
|
@@ -203,7 +207,9 @@ var HeadCell = (props) => {
|
|
|
203
207
|
return __spreadProps(__spreadValues({}, cellProps), {
|
|
204
208
|
className: cls,
|
|
205
209
|
scope: "col",
|
|
206
|
-
style: styles2
|
|
210
|
+
style: styles2,
|
|
211
|
+
colSpan,
|
|
212
|
+
rowSpan
|
|
207
213
|
});
|
|
208
214
|
};
|
|
209
215
|
const thProps = getThProps();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { HeaderCell } from '../interface';
|
|
3
3
|
export interface TableHeadProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Resolved 2D header rows (one array per header row), produced by parseHeaderRows
|
|
6
|
+
*/
|
|
7
|
+
headerRows?: HeaderCell[][];
|
|
8
8
|
}
|
|
9
9
|
declare const _default: React.NamedExoticComponent<any>;
|
|
10
10
|
export default _default;
|
|
@@ -67,39 +67,53 @@ var import_Checkbox = __toESM(require("../../Checkbox"));
|
|
|
67
67
|
var import_table = require("../table");
|
|
68
68
|
var import_cell = __toESM(require("./cell"));
|
|
69
69
|
var TableHead = (props) => {
|
|
70
|
-
const _a = props, {
|
|
70
|
+
const _a = props, { headerRows = [], onCheckAll, checkedAll, onHeaderRow } = _a, rest = __objRest(_a, ["headerRows", "onCheckAll", "checkedAll", "onHeaderRow"]);
|
|
71
71
|
const { prefixCls } = (0, import_react.useContext)(import_table.TableCtx);
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const renderCell = (cell, rowIndex, colIndex) => {
|
|
73
|
+
const { column, colSpan, rowSpan } = cell;
|
|
74
|
+
const { key, type, visible } = column;
|
|
75
|
+
const cellKey = "title-column-" + (column.key || column.dataIndex || `${rowIndex}-${colIndex}`);
|
|
76
|
+
if (key === "YEE_SELECTION_COL") {
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
78
|
+
"th",
|
|
79
|
+
{
|
|
77
80
|
className: `${prefixCls}-cell ${prefixCls}-selection-col`,
|
|
78
81
|
scope: "col",
|
|
79
|
-
key:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
className: (0, import_clsx.default)(`${prefixCls}-cell`, `${prefixCls}-expand-col`),
|
|
88
|
-
scope: "col",
|
|
89
|
-
key: "title-column-expandable"
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
}
|
|
82
|
+
key: cellKey,
|
|
83
|
+
colSpan,
|
|
84
|
+
rowSpan
|
|
85
|
+
},
|
|
86
|
+
type === "checkbox" ? /* @__PURE__ */ import_react.default.createElement(import_Checkbox.default, { checked: checkedAll, onChange: onCheckAll }) : null
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (key === "YEE_EXPAND_COL" && visible !== false) {
|
|
93
90
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
"th",
|
|
92
|
+
{
|
|
93
|
+
className: (0, import_clsx.default)(`${prefixCls}-cell`, `${prefixCls}-expand-col`),
|
|
94
|
+
scope: "col",
|
|
95
|
+
key: cellKey,
|
|
96
|
+
colSpan,
|
|
97
|
+
rowSpan
|
|
98
|
+
}
|
|
98
99
|
);
|
|
99
|
-
}
|
|
100
|
+
}
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
102
|
+
import_cell.default,
|
|
103
|
+
__spreadProps(__spreadValues(__spreadValues({}, rest), column), {
|
|
104
|
+
colSpan,
|
|
105
|
+
rowSpan,
|
|
106
|
+
key: cellKey
|
|
107
|
+
})
|
|
108
|
+
);
|
|
100
109
|
};
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
return /* @__PURE__ */ import_react.default.createElement("thead", { className: (0, import_clsx.default)(`${prefixCls}-thead`) }, headerRows.map((row, rowIndex) => {
|
|
111
|
+
const rowColumns = row.map((cell) => cell.column);
|
|
112
|
+
const rowProps = onHeaderRow ? onHeaderRow(rowColumns) : {};
|
|
113
|
+
return /* @__PURE__ */ import_react.default.createElement("tr", __spreadProps(__spreadValues({}, rowProps), { key: `thead-row-${rowIndex}` }), row.map(
|
|
114
|
+
(cell, colIndex) => renderCell(cell, rowIndex, colIndex)
|
|
115
|
+
));
|
|
116
|
+
}));
|
|
103
117
|
};
|
|
104
118
|
var Row = (props) => {
|
|
105
119
|
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ColumnProps, ExpandableType, HeaderCell, RowSelectionType, WrapedColumnProps } from '../interface';
|
|
2
|
+
type FixedType = ColumnProps['fixed'];
|
|
3
|
+
/**
|
|
4
|
+
* Recursively flatten a (possibly grouped) column tree into its leaf columns.
|
|
5
|
+
* A parent's `fixed` is inherited by its children when the child does not set its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare function flattenLeafColumns(columns: WrapedColumnProps[], parentFixed?: FixedType): WrapedColumnProps[];
|
|
8
|
+
/**
|
|
9
|
+
* Convert a column tree into a 2D array of header cells (one array per header row),
|
|
10
|
+
* computing each cell's colSpan/rowSpan. Mirrors rc-table's parseHeaderRows.
|
|
11
|
+
*
|
|
12
|
+
* - Pass 1 (DFS): place each column into the row matching its depth; a group's
|
|
13
|
+
* colSpan equals the sum of its children's colSpans.
|
|
14
|
+
* - Pass 2: leaf cells (no sub-columns) get rowSpan = rowCount - rowIndex so
|
|
15
|
+
* they stretch down to the last header row; group cells keep rowSpan = 1.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseHeaderRows(rootColumns: WrapedColumnProps[]): HeaderCell[][];
|
|
18
|
+
/**
|
|
19
|
+
* Inject selection / expand columns into the top level of the column tree.
|
|
20
|
+
* `index` is a 1-based position among the top-level columns.
|
|
21
|
+
*/
|
|
22
|
+
export declare function injectSelectionExpand(columns: WrapedColumnProps[], rowSelection?: RowSelectionType, expandable?: ExpandableType): WrapedColumnProps[];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// src/Table/util/header.ts
|
|
37
|
+
var header_exports = {};
|
|
38
|
+
__export(header_exports, {
|
|
39
|
+
flattenLeafColumns: () => flattenLeafColumns,
|
|
40
|
+
injectSelectionExpand: () => injectSelectionExpand,
|
|
41
|
+
parseHeaderRows: () => parseHeaderRows
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(header_exports);
|
|
44
|
+
function flattenLeafColumns(columns, parentFixed) {
|
|
45
|
+
return columns.reduce((list, column) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const fixed = (_a = column.fixed) != null ? _a : parentFixed;
|
|
48
|
+
const subColumns = column.children;
|
|
49
|
+
if (subColumns && subColumns.length > 0) {
|
|
50
|
+
return [...list, ...flattenLeafColumns(subColumns, fixed)];
|
|
51
|
+
}
|
|
52
|
+
return [...list, __spreadProps(__spreadValues({}, column), { fixed })];
|
|
53
|
+
}, []);
|
|
54
|
+
}
|
|
55
|
+
function parseHeaderRows(rootColumns) {
|
|
56
|
+
const rows = [];
|
|
57
|
+
const fillRowCells = (columns, rowIndex) => {
|
|
58
|
+
rows[rowIndex] = rows[rowIndex] || [];
|
|
59
|
+
let colSpanTotal = 0;
|
|
60
|
+
columns.filter(Boolean).forEach((column) => {
|
|
61
|
+
const cell = {
|
|
62
|
+
column,
|
|
63
|
+
colSpan: 1,
|
|
64
|
+
rowSpan: 1
|
|
65
|
+
};
|
|
66
|
+
const subColumns = column.children;
|
|
67
|
+
if (subColumns && subColumns.length > 0) {
|
|
68
|
+
cell.colSpan = fillRowCells(subColumns, rowIndex + 1);
|
|
69
|
+
cell.hasSubColumns = true;
|
|
70
|
+
}
|
|
71
|
+
rows[rowIndex].push(cell);
|
|
72
|
+
colSpanTotal += cell.colSpan;
|
|
73
|
+
});
|
|
74
|
+
return colSpanTotal;
|
|
75
|
+
};
|
|
76
|
+
fillRowCells(rootColumns, 0);
|
|
77
|
+
const rowCount = rows.length;
|
|
78
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
79
|
+
rows[rowIndex].forEach((cell) => {
|
|
80
|
+
if (!cell.hasSubColumns) {
|
|
81
|
+
cell.rowSpan = rowCount - rowIndex;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return rows;
|
|
86
|
+
}
|
|
87
|
+
function injectSelectionExpand(columns, rowSelection, expandable) {
|
|
88
|
+
const result = [...columns];
|
|
89
|
+
if (rowSelection) {
|
|
90
|
+
const { index = 1 } = rowSelection;
|
|
91
|
+
result.splice(index - 1, 0, __spreadProps(__spreadValues({
|
|
92
|
+
width: 50
|
|
93
|
+
}, rowSelection), {
|
|
94
|
+
key: "YEE_SELECTION_COL"
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
if (expandable) {
|
|
98
|
+
const { index = 1, visible = true } = expandable;
|
|
99
|
+
const loc = index ? index - 1 : rowSelection ? 1 : 0;
|
|
100
|
+
if (visible !== false) {
|
|
101
|
+
result.splice(loc, 0, __spreadProps(__spreadValues({
|
|
102
|
+
width: 50
|
|
103
|
+
}, expandable), {
|
|
104
|
+
key: "YEE_EXPAND_COL"
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
package/dist/cjs/style/size.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @rainbow-oh/yee-c CSS Variables
|
|
3
3
|
* Auto-generated, do not edit manually
|
|
4
|
-
* Generated on 2026-07-
|
|
4
|
+
* Generated on 2026-07-13T08:55:27.235Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/* ========== color.css ========== */
|
|
@@ -1117,6 +1117,7 @@
|
|
|
1117
1117
|
|
|
1118
1118
|
/* ========== size.css ========== */
|
|
1119
1119
|
:root {
|
|
1120
|
+
--yee-font-family: inherit;
|
|
1120
1121
|
/* ── z-index 基础层级 ── */
|
|
1121
1122
|
--yee-z-index-fixed: 990; /* L1 吸顶 */
|
|
1122
1123
|
--yee-z-index-mask: 1000; /* L2 遮罩背景 */
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -39,16 +39,17 @@ var AnchorItem = function AnchorItem(props) {
|
|
|
39
39
|
var itemStyle = _objectSpread(_objectSpread(_objectSpread({}, style), isActive ? styles === null || styles === void 0 ? void 0 : styles.active : undefined), {}, {
|
|
40
40
|
paddingLeft: "".concat(level * INDENT_WIDTH, "px")
|
|
41
41
|
});
|
|
42
|
-
var
|
|
42
|
+
var node = /*#__PURE__*/React.createElement("li", _extends({
|
|
43
43
|
className: cls,
|
|
44
44
|
style: itemStyle
|
|
45
45
|
}, rest), /*#__PURE__*/React.createElement("a", {
|
|
46
46
|
href: "#".concat(targetKey),
|
|
47
47
|
onClick: handleClick
|
|
48
48
|
}, /*#__PURE__*/React.createElement("span", {
|
|
49
|
-
className: "".concat(prefixCls, "-item-label"),
|
|
49
|
+
className: clsx("".concat(prefixCls, "-item-label"), classNames === null || classNames === void 0 ? void 0 : classNames.label),
|
|
50
|
+
style: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
50
51
|
title: String(title)
|
|
51
52
|
}, title)));
|
|
52
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, node, children);
|
|
53
54
|
};
|
|
54
55
|
export default AnchorItem;
|
|
@@ -44,7 +44,7 @@ export interface AnchorItemProps {
|
|
|
44
44
|
*/
|
|
45
45
|
children?: React.ReactNode;
|
|
46
46
|
}
|
|
47
|
-
export type AnchorSemanticDOM = 'item' | 'active' | 'content';
|
|
47
|
+
export type AnchorSemanticDOM = 'item' | 'active' | 'content' | 'label';
|
|
48
48
|
export interface AnchorProps extends DataAttributeProps {
|
|
49
49
|
/**
|
|
50
50
|
* Custom class name prefix
|
|
@@ -188,11 +188,13 @@ var Dialog = function Dialog(baseprops) {
|
|
|
188
188
|
"aria-label": "close",
|
|
189
189
|
onClick: onCancel
|
|
190
190
|
}) : null, title ? /*#__PURE__*/React.createElement("div", {
|
|
191
|
-
className: "".concat(prefixCls, "-header")
|
|
191
|
+
className: clsx("".concat(prefixCls, "-header"), classNames === null || classNames === void 0 ? void 0 : classNames.header),
|
|
192
|
+
style: styles === null || styles === void 0 ? void 0 : styles.header
|
|
192
193
|
}, /*#__PURE__*/React.createElement("div", {
|
|
193
194
|
className: "".concat(prefixCls, "-title")
|
|
194
195
|
}, title)) : null, /*#__PURE__*/React.createElement("div", {
|
|
195
|
-
className: "".concat(prefixCls, "-body")
|
|
196
|
+
className: clsx("".concat(prefixCls, "-body"), classNames === null || classNames === void 0 ? void 0 : classNames.body),
|
|
197
|
+
style: styles === null || styles === void 0 ? void 0 : styles.body
|
|
196
198
|
}, children), renderFooter())));
|
|
197
199
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
198
200
|
open: open,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonType } from '../Button';
|
|
3
3
|
import type { DataAttributeProps } from '../utils/types';
|
|
4
|
-
export type SemanticDOM = 'content' | 'footer' | 'mask';
|
|
4
|
+
export type SemanticDOM = 'content' | 'header' | 'body' | 'footer' | 'mask';
|
|
5
5
|
export interface DialogProps extends DataAttributeProps {
|
|
6
6
|
/**
|
|
7
7
|
* Custom class name prefix
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
line-height: var(--yee-input-line-height);
|
|
12
12
|
border: var(--yee-input-border-width) solid var(--yee-input-border-color);
|
|
13
13
|
border-radius: var(--yee-input-border-radius, 4px);
|
|
14
|
+
font-family: var(--yee-font-family);
|
|
14
15
|
|
|
15
16
|
&:not(@{pls}-disabled):hover {
|
|
16
17
|
border-color: var(--yee-input-hover-border-color);
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
|
|
47
48
|
&-inner {
|
|
48
49
|
width: 100%;
|
|
50
|
+
font-family: var(--yee-font-family);
|
|
49
51
|
line-height: var(--yee-input-line-height);
|
|
50
52
|
background-color: inherit;
|
|
51
53
|
border: none;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自定义表格元素(可被外部接管)
|
|
3
|
+
*
|
|
4
|
+
* Table 暴露两个接缝供外部库(如 dnd-kit)接管行/体渲染:
|
|
5
|
+
* - components.body.tbody —— 替换 <tbody>,外部可在此包 SortableContext 等 Provider;
|
|
6
|
+
* - components.body.row —— 整行接管,消费方自行渲染 <tr> + 单元格,可在任意单元格里放拖拽手柄。
|
|
7
|
+
*
|
|
8
|
+
* Table 本身不依赖任何拖拽库;本 demo 不引入 dnd,仅证明替换点生效。
|
|
9
|
+
*/
|
|
10
|
+
import { Table } from "../..";
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
// 替换 <tbody>:保持渲染 <tbody>,外部库可在此包 SortableContext。
|
|
14
|
+
var CustomTbody = function CustomTbody(props) {
|
|
15
|
+
return /*#__PURE__*/React.createElement("tbody", {
|
|
16
|
+
className: props.className,
|
|
17
|
+
"data-custom-tbody": true
|
|
18
|
+
}, props.children);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// 整行接管:消费方渲染整 <tr> + 单元格,可在此放拖拽手柄等任意内容。
|
|
22
|
+
var CustomRow = function CustomRow(_ref) {
|
|
23
|
+
var record = _ref.record,
|
|
24
|
+
index = _ref.index,
|
|
25
|
+
columns = _ref.columns,
|
|
26
|
+
rowKey = _ref.rowKey;
|
|
27
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
28
|
+
"data-row-key": rowKey,
|
|
29
|
+
style: {
|
|
30
|
+
background: index % 2 === 0 ? '#f8fafc' : undefined
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
33
|
+
style: {
|
|
34
|
+
width: 40,
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
color: '#2563eb',
|
|
37
|
+
fontWeight: 700
|
|
38
|
+
}
|
|
39
|
+
}, index + 1), columns.map(function (col) {
|
|
40
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
41
|
+
key: String(col.key)
|
|
42
|
+
}, record[col.dataIndex || '']);
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
export default (function () {
|
|
46
|
+
var columns = [{
|
|
47
|
+
title: 'Name',
|
|
48
|
+
dataIndex: 'name',
|
|
49
|
+
key: 'name'
|
|
50
|
+
}, {
|
|
51
|
+
title: 'Age',
|
|
52
|
+
dataIndex: 'age',
|
|
53
|
+
key: 'age'
|
|
54
|
+
}, {
|
|
55
|
+
title: 'Address',
|
|
56
|
+
dataIndex: 'address',
|
|
57
|
+
key: 'address'
|
|
58
|
+
}];
|
|
59
|
+
var dataSource = [{
|
|
60
|
+
key: '1',
|
|
61
|
+
name: 'John Brown',
|
|
62
|
+
age: 32,
|
|
63
|
+
address: 'New York No. 1 Lake Park'
|
|
64
|
+
}, {
|
|
65
|
+
key: '2',
|
|
66
|
+
name: 'Jim Green',
|
|
67
|
+
age: 42,
|
|
68
|
+
address: 'London No. 1 Lake Park'
|
|
69
|
+
}, {
|
|
70
|
+
key: '3',
|
|
71
|
+
name: 'Joe Black',
|
|
72
|
+
age: 32,
|
|
73
|
+
address: 'Sidney No. 1 Lake Park'
|
|
74
|
+
}];
|
|
75
|
+
var components = {
|
|
76
|
+
body: {
|
|
77
|
+
tbody: CustomTbody,
|
|
78
|
+
row: CustomRow
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
82
|
+
columns: columns,
|
|
83
|
+
dataSource: dataSource,
|
|
84
|
+
components: components
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { Table } from "../..";
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
export default (function () {
|
|
10
|
+
var _useState = useState([]),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
selectedRowKeys = _useState2[0],
|
|
13
|
+
setSelectedRowKeys = _useState2[1];
|
|
14
|
+
var columns = [{
|
|
15
|
+
title: 'Name',
|
|
16
|
+
dataIndex: 'name',
|
|
17
|
+
key: 'name',
|
|
18
|
+
fixed: 'left',
|
|
19
|
+
width: 120,
|
|
20
|
+
sorter: true
|
|
21
|
+
}, {
|
|
22
|
+
title: 'Info',
|
|
23
|
+
key: 'info',
|
|
24
|
+
children: [{
|
|
25
|
+
title: 'Age',
|
|
26
|
+
dataIndex: 'age',
|
|
27
|
+
key: 'age',
|
|
28
|
+
width: 100,
|
|
29
|
+
sorter: true
|
|
30
|
+
}, {
|
|
31
|
+
title: 'Address',
|
|
32
|
+
dataIndex: 'address',
|
|
33
|
+
key: 'address',
|
|
34
|
+
width: 200
|
|
35
|
+
}]
|
|
36
|
+
}, {
|
|
37
|
+
title: 'Company',
|
|
38
|
+
key: 'company',
|
|
39
|
+
children: [{
|
|
40
|
+
title: 'Name',
|
|
41
|
+
dataIndex: 'companyName',
|
|
42
|
+
key: 'companyName',
|
|
43
|
+
width: 180
|
|
44
|
+
}, {
|
|
45
|
+
title: 'Address',
|
|
46
|
+
dataIndex: 'companyAddress',
|
|
47
|
+
key: 'companyAddress',
|
|
48
|
+
width: 220
|
|
49
|
+
}]
|
|
50
|
+
}, {
|
|
51
|
+
title: 'Action',
|
|
52
|
+
key: 'action',
|
|
53
|
+
fixed: 'right',
|
|
54
|
+
width: 100,
|
|
55
|
+
render: function render(record) {
|
|
56
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return console.log(record);
|
|
59
|
+
}
|
|
60
|
+
}, "Edit");
|
|
61
|
+
}
|
|
62
|
+
}];
|
|
63
|
+
var dataSource = [{
|
|
64
|
+
key: '1',
|
|
65
|
+
name: 'John Brown',
|
|
66
|
+
age: 32,
|
|
67
|
+
address: 'New York No. 1 Lake Park',
|
|
68
|
+
companyName: 'Acme Inc.',
|
|
69
|
+
companyAddress: 'NY Office'
|
|
70
|
+
}, {
|
|
71
|
+
key: '2',
|
|
72
|
+
name: 'Jim Green',
|
|
73
|
+
age: 42,
|
|
74
|
+
address: 'London No. 1 Lake Park',
|
|
75
|
+
companyName: 'Globex',
|
|
76
|
+
companyAddress: 'London Office'
|
|
77
|
+
}, {
|
|
78
|
+
key: '3',
|
|
79
|
+
name: 'Joe Black',
|
|
80
|
+
age: 28,
|
|
81
|
+
address: 'Sidney No. 1 Lake Park',
|
|
82
|
+
companyName: 'Initech',
|
|
83
|
+
companyAddress: 'Sidney Office'
|
|
84
|
+
}];
|
|
85
|
+
var rowSelection = {
|
|
86
|
+
type: 'checkbox',
|
|
87
|
+
selectedRowKeys: selectedRowKeys,
|
|
88
|
+
onChange: function onChange(keys) {
|
|
89
|
+
return setSelectedRowKeys(keys);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
93
|
+
columns: columns,
|
|
94
|
+
dataSource: dataSource,
|
|
95
|
+
rowKey: "key",
|
|
96
|
+
rowSelection: rowSelection,
|
|
97
|
+
bordered: true,
|
|
98
|
+
scroll: {
|
|
99
|
+
x: 1200
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ColumnProps, ExpandableType, RowSelectionType } from '../interface';
|
|
2
|
+
import type { ColumnProps, ExpandableType, RowSelectionType } from '../interface';
|
|
3
3
|
export default function useColumns({ children, columns, rowSelection, expandable, }: {
|
|
4
4
|
children?: React.ReactElement<ColumnProps> | React.ReactElement<ColumnProps>[];
|
|
5
5
|
columns: ColumnProps[];
|
|
@@ -7,5 +7,5 @@ export default function useColumns({ children, columns, rowSelection, expandable
|
|
|
7
7
|
expandable?: ExpandableType;
|
|
8
8
|
}): {
|
|
9
9
|
wrapedColumns: any;
|
|
10
|
-
|
|
10
|
+
headerRows: any;
|
|
11
11
|
};
|