@agentscope-ai/design 1.0.26-beta.1767839208001 → 1.0.26-beta.1767843408082

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.
@@ -64,24 +64,28 @@ var SparkTabs = function SparkTabs(props) {
64
64
  return classNames("".concat(sparkPrefix, "-segmented-tab-bar"), _defineProperty({}, "".concat(sparkPrefix, "-segmented-tab-bar-centered"), centered));
65
65
  }, [sparkPrefix, centered]);
66
66
 
67
- // 缓存 renderTabBar 函数
68
- var renderTabBar = useCallback(function () {
69
- return /*#__PURE__*/_jsx(Segmented, {
70
- options: segmentedOptions,
71
- onChange: handleChange,
72
- className: segmentedClassName,
73
- value: mergedActiveKey,
74
- size: props.size
67
+ // 获取当前选中 tab 的内容
68
+ var activeContent = useMemo(function () {
69
+ var _props$items2;
70
+ var activeItem = (_props$items2 = props.items) === null || _props$items2 === void 0 ? void 0 : _props$items2.find(function (item) {
71
+ return item.key === mergedActiveKey;
75
72
  });
76
- }, [segmentedOptions, handleChange, segmentedClassName, mergedActiveKey, props.size]);
73
+ return activeItem === null || activeItem === void 0 ? void 0 : activeItem.children;
74
+ }, [props.items, mergedActiveKey]);
75
+
76
+ // segmented 类型:分离 Segmented 和内容渲染,避免 renderTabBar 导致的样式问题
77
77
  if (type === 'segmented') {
78
78
  return /*#__PURE__*/_jsxs(_Fragment, {
79
- children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Tabs, _objectSpread(_objectSpread({
80
- animated: false
81
- }, restProps), {}, {
82
- activeKey: mergedActiveKey,
83
- renderTabBar: renderTabBar
84
- }))]
79
+ children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Segmented, {
80
+ options: segmentedOptions,
81
+ value: mergedActiveKey,
82
+ onChange: handleChange,
83
+ className: segmentedClassName,
84
+ size: props.size
85
+ }), /*#__PURE__*/_jsx("div", {
86
+ className: "".concat(sparkPrefix, "-segmented-tab-content"),
87
+ children: activeContent
88
+ })]
85
89
  });
86
90
  }
87
91
  return /*#__PURE__*/_jsxs(_Fragment, {