one-design-next 0.0.50 → 0.0.52
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/composer/index.d.ts
CHANGED
|
@@ -110,9 +110,15 @@ export interface ComposerProps {
|
|
|
110
110
|
*/
|
|
111
111
|
skillGroups?: SkillGroup[];
|
|
112
112
|
/**
|
|
113
|
-
* 技能管理回调。提供后会在 skill
|
|
113
|
+
* 技能管理回调。提供后会在 skill 弹窗底部渲染按钮。
|
|
114
114
|
*/
|
|
115
115
|
onManageSkills?: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* 技能管理按钮的自定义内容(ReactNode)。
|
|
118
|
+
* 仅在 `onManageSkills` 提供时生效。
|
|
119
|
+
* 不传时默认渲染「技能管理」文字 + 右箭头图标。
|
|
120
|
+
*/
|
|
121
|
+
skillManageFooter?: React.ReactNode;
|
|
116
122
|
/**
|
|
117
123
|
* skill 弹窗列表的最大高度(px)。超出此高度后出现滚动条。
|
|
118
124
|
* 不传则不限高(适合 skill 较少的场景)。
|
package/dist/composer/index.js
CHANGED
|
@@ -97,6 +97,7 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
97
97
|
skills = _ref.skills,
|
|
98
98
|
skillGroups = _ref.skillGroups,
|
|
99
99
|
onManageSkills = _ref.onManageSkills,
|
|
100
|
+
skillManageFooter = _ref.skillManageFooter,
|
|
100
101
|
skillMenuMaxHeight = _ref.skillMenuMaxHeight,
|
|
101
102
|
skillMenuWidth = _ref.skillMenuWidth,
|
|
102
103
|
_ref$submitType = _ref.submitType,
|
|
@@ -743,7 +744,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
743
744
|
onSelect: function onSelect(s) {
|
|
744
745
|
return handleSelectSkill(s, 'btn');
|
|
745
746
|
},
|
|
746
|
-
onManageSkills: onManageSkills
|
|
747
|
+
onManageSkills: onManageSkills,
|
|
748
|
+
skillManageFooter: skillManageFooter
|
|
747
749
|
})
|
|
748
750
|
}, /*#__PURE__*/React.createElement(HoverFill, {
|
|
749
751
|
"data-odn-composer-tool-btn-wrap": true,
|
|
@@ -956,7 +958,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
956
958
|
onSelect: function onSelect(s) {
|
|
957
959
|
return handleSelectSkill(s, 'trigger');
|
|
958
960
|
},
|
|
959
|
-
onManageSkills: onManageSkills
|
|
961
|
+
onManageSkills: onManageSkills,
|
|
962
|
+
skillManageFooter: skillManageFooter
|
|
960
963
|
})
|
|
961
964
|
}, /*#__PURE__*/React.createElement("div", {
|
|
962
965
|
ref: triggerAnchorRef,
|
|
@@ -17,9 +17,16 @@ export interface SkillSlotProps {
|
|
|
17
17
|
value?: string | null;
|
|
18
18
|
onSelect?: (skill: SkillItem) => void;
|
|
19
19
|
/**
|
|
20
|
-
* 技能管理回调。提供后 menu
|
|
20
|
+
* 技能管理回调。提供后 menu 变体会在列表底部渲染按钮。
|
|
21
|
+
* 按钮内容默认显示「技能管理」文字 + 右箭头图标;可通过 `skillManageFooter` 自定义。
|
|
21
22
|
*/
|
|
22
23
|
onManageSkills?: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* 技能管理按钮的自定义内容(ReactNode)。
|
|
26
|
+
* 仅在 `onManageSkills` 提供且 `variant='menu'` 时生效。
|
|
27
|
+
* 不传时默认渲染「技能管理」文字 + 右箭头图标。
|
|
28
|
+
*/
|
|
29
|
+
skillManageFooter?: React.ReactNode;
|
|
23
30
|
/**
|
|
24
31
|
* 受控的"键盘高亮"项 index(区别于 `value` 的"业务选中"语义)。仅 menu 变体响应。
|
|
25
32
|
*
|
package/dist/skill-slot/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export var SkillSlot = /*#__PURE__*/forwardRef(function SkillSlot(_ref, ref) {
|
|
|
31
31
|
value = _ref.value,
|
|
32
32
|
onSelect = _ref.onSelect,
|
|
33
33
|
onManageSkills = _ref.onManageSkills,
|
|
34
|
+
skillManageFooter = _ref.skillManageFooter,
|
|
34
35
|
activeIndex = _ref.activeIndex,
|
|
35
36
|
onActiveIndexChange = _ref.onActiveIndexChange,
|
|
36
37
|
menuMaxHeight = _ref.menuMaxHeight,
|
|
@@ -240,6 +241,10 @@ export var SkillSlot = /*#__PURE__*/forwardRef(function SkillSlot(_ref, ref) {
|
|
|
240
241
|
/* 渲染底部"技能管理"按钮(仅 menu 变体 + 提供 onManageSkills 时。不参与键盘导航)。 */
|
|
241
242
|
var renderManageFooter = function renderManageFooter() {
|
|
242
243
|
if (variant !== 'menu' || !onManageSkills) return null;
|
|
244
|
+
var defaultFooter = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u6280\u80FD\u7BA1\u7406"), /*#__PURE__*/React.createElement(Icon, {
|
|
245
|
+
name: "right",
|
|
246
|
+
size: 12
|
|
247
|
+
}));
|
|
243
248
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
244
249
|
"data-odn-skill-slot-divider": true
|
|
245
250
|
}), /*#__PURE__*/React.createElement("button", {
|
|
@@ -249,10 +254,7 @@ export var SkillSlot = /*#__PURE__*/forwardRef(function SkillSlot(_ref, ref) {
|
|
|
249
254
|
return e.preventDefault();
|
|
250
255
|
},
|
|
251
256
|
onClick: onManageSkills
|
|
252
|
-
},
|
|
253
|
-
name: "right",
|
|
254
|
-
size: 12
|
|
255
|
-
})));
|
|
257
|
+
}, skillManageFooter !== null && skillManageFooter !== void 0 ? skillManageFooter : defaultFooter));
|
|
256
258
|
};
|
|
257
259
|
|
|
258
260
|
/* 分组模式下渲染 menu 列表(带分组标题)。 */
|
package/dist/table/index.d.ts
CHANGED
|
@@ -93,6 +93,17 @@ export interface TableProps<T = Record<string, unknown>> extends Omit<RcTablePro
|
|
|
93
93
|
colIndex: number;
|
|
94
94
|
}) => ReturnType<NonNullable<RcColumnType<T>['onHeaderCell']>> | void;
|
|
95
95
|
popoverIcon?: (typeof iconNames)[number];
|
|
96
|
+
/**
|
|
97
|
+
* 是否启用虚拟滚动。启用时需要同时设置 scroll.y 为数值(表示可视区域高度)。
|
|
98
|
+
* 当数据量较大时(如超过 1000 行),推荐开启虚拟滚动以提升性能。
|
|
99
|
+
*/
|
|
100
|
+
virtual?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 虚拟滚动每行高度(px),用于计算可视区域内显示的行数。
|
|
103
|
+
* 仅在 virtual 为 true 时生效。
|
|
104
|
+
* @default 24
|
|
105
|
+
*/
|
|
106
|
+
listItemHeight?: number;
|
|
96
107
|
}
|
|
97
|
-
declare const Table: <T extends Record<string, unknown> = Record<string, unknown>>({ dataSource, columns, bordered, striped, loading, rowExpansion, rowSelection, sortBgVisible, getCellProps, getHeaderCellProps, popoverIcon: globalPopoverIcon, className, style, emptyText, ...props }: TableProps<T>) => React.JSX.Element;
|
|
108
|
+
declare const Table: <T extends Record<string, unknown> = Record<string, unknown>>({ dataSource, columns, bordered, striped, loading, rowExpansion, rowSelection, sortBgVisible, getCellProps, getHeaderCellProps, popoverIcon: globalPopoverIcon, className, style, emptyText, virtual, listItemHeight, ...props }: TableProps<T>) => React.JSX.Element;
|
|
98
109
|
export default Table;
|
package/dist/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["dataSource", "columns", "bordered", "striped", "loading", "rowExpansion", "rowSelection", "sortBgVisible", "getCellProps", "getHeaderCellProps", "popoverIcon", "className", "style", "emptyText"],
|
|
2
|
+
var _excluded = ["dataSource", "columns", "bordered", "striped", "loading", "rowExpansion", "rowSelection", "sortBgVisible", "getCellProps", "getHeaderCellProps", "popoverIcon", "className", "style", "emptyText", "virtual", "listItemHeight"],
|
|
3
3
|
_excluded2 = ["onSort", "title", "popover", "popoverProps", "popoverIcon"],
|
|
4
4
|
_excluded3 = ["onSort", "filters", "filteredValue", "filterMultiple", "onFilter", "onFilterChange", "title", "popover", "popoverProps", "popoverIcon", "ellipsisPopoverProps", "sortOrder", "render"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -16,7 +16,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
16
|
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; }
|
|
17
17
|
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; } }
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
import RcTable from 'rc-table';
|
|
19
|
+
import RcTable, { VirtualTable as RcVirtualTable } from 'rc-table';
|
|
20
20
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
21
21
|
import Button from "../button";
|
|
22
22
|
import Checkbox from "../checkbox";
|
|
@@ -113,6 +113,7 @@ var FilterComponent = function FilterComponent(_ref) {
|
|
|
113
113
|
}, "\u786E\u5B9A")));
|
|
114
114
|
};
|
|
115
115
|
var Table = function Table(_ref2) {
|
|
116
|
+
var _props$scroll, _props$scroll2;
|
|
116
117
|
var dataSource = _ref2.dataSource,
|
|
117
118
|
columns = _ref2.columns,
|
|
118
119
|
_ref2$bordered = _ref2.bordered,
|
|
@@ -131,6 +132,8 @@ var Table = function Table(_ref2) {
|
|
|
131
132
|
className = _ref2.className,
|
|
132
133
|
style = _ref2.style,
|
|
133
134
|
emptyText = _ref2.emptyText,
|
|
135
|
+
virtual = _ref2.virtual,
|
|
136
|
+
listItemHeight = _ref2.listItemHeight,
|
|
134
137
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
135
138
|
// 渲染带 popover 的标题
|
|
136
139
|
var renderTitleWithPopover = function renderTitleWithPopover(titleContent, popover, popoverProps, popoverIcon) {
|
|
@@ -492,6 +495,12 @@ var Table = function Table(_ref2) {
|
|
|
492
495
|
// 1. 行选择
|
|
493
496
|
// 2. 行展开
|
|
494
497
|
var trClickable = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectOnRowClick) || (rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.expandOnRowClick);
|
|
498
|
+
|
|
499
|
+
// 虚拟模式使用 RcVirtualTable,否则使用 RcTable。
|
|
500
|
+
// 由于两者 props 类型存在差异(VirtualTableProps 重新定义了 scroll),
|
|
501
|
+
// 这里统一断言为 RcTable 类型,虚拟模式的专属 props 通过末尾的 spread 覆盖传入。
|
|
502
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
503
|
+
var TableComponent = virtual ? RcVirtualTable : RcTable;
|
|
495
504
|
return /*#__PURE__*/React.createElement("div", {
|
|
496
505
|
ref: tableRef,
|
|
497
506
|
"data-odn-table": true,
|
|
@@ -501,7 +510,7 @@ var Table = function Table(_ref2) {
|
|
|
501
510
|
"data-odn-table-loading": loading,
|
|
502
511
|
className: className,
|
|
503
512
|
style: style
|
|
504
|
-
}, /*#__PURE__*/React.createElement(
|
|
513
|
+
}, /*#__PURE__*/React.createElement(TableComponent, _extends({
|
|
505
514
|
prefixCls: "odn-table",
|
|
506
515
|
data: dataSource,
|
|
507
516
|
columns: finalColumns,
|
|
@@ -857,6 +866,12 @@ var Table = function Table(_ref2) {
|
|
|
857
866
|
offset: "1",
|
|
858
867
|
stopColor: "#C4C7CC"
|
|
859
868
|
})))), "\u6570\u636E\u4E3A\u7A7A")
|
|
860
|
-
}, props
|
|
869
|
+
}, props, virtual ? {
|
|
870
|
+
scroll: {
|
|
871
|
+
x: (_props$scroll = props.scroll) === null || _props$scroll === void 0 ? void 0 : _props$scroll.x,
|
|
872
|
+
y: (_props$scroll2 = props.scroll) === null || _props$scroll2 === void 0 ? void 0 : _props$scroll2.y
|
|
873
|
+
},
|
|
874
|
+
listItemHeight: listItemHeight
|
|
875
|
+
} : {})));
|
|
861
876
|
};
|
|
862
877
|
export default Table;
|
|
@@ -342,4 +342,30 @@ tr > .odn-table-cell:last-child {
|
|
|
342
342
|
height: 0;
|
|
343
343
|
overflow: hidden;
|
|
344
344
|
pointer-events: none;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.odn-table-placeholder .odn-table-expanded-row-fixed {
|
|
348
|
+
width: 100% !important;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.odn-table-tbody-virtual {
|
|
352
|
+
font-size: var(--odn-font-size);
|
|
353
|
+
line-height: var(--odn-line-height);
|
|
354
|
+
}
|
|
355
|
+
.odn-table-tbody-virtual .odn-table-row {
|
|
356
|
+
display: flex;
|
|
357
|
+
}
|
|
358
|
+
.odn-table-tbody-virtual .odn-table-row-extra {
|
|
359
|
+
position: absolute;
|
|
360
|
+
display: flex;
|
|
361
|
+
}
|
|
362
|
+
.odn-table-tbody-virtual .odn-table-cell {
|
|
363
|
+
box-sizing: border-box;
|
|
364
|
+
border-bottom: 1px solid var(--odn-table-border-color);
|
|
365
|
+
}
|
|
366
|
+
.odn-table-tbody-virtual .odn-table-row > .odn-table-cell:first-child {
|
|
367
|
+
padding-left: var(--odn-table-cell-first-padding-x-start);
|
|
368
|
+
}
|
|
369
|
+
.odn-table-tbody-virtual .odn-table-row > .odn-table-cell:last-child {
|
|
370
|
+
padding-right: var(--odn-table-cell-last-padding-x-end);
|
|
345
371
|
}
|