shineout 3.5.5-beta.5 → 3.5.5-beta.6

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/cjs/index.js CHANGED
@@ -507,5 +507,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
507
507
  // 此文件由脚本自动生成,请勿直接修改。
508
508
  // This file was generated automatically by a script. Please do not modify it directly.
509
509
  var _default = exports.default = {
510
- version: '3.5.5-beta.5'
510
+ version: '3.5.5-beta.6'
511
511
  };
@@ -3,4 +3,4 @@ import { TabsPanelProps as UnStyleTabsPanelProps } from '@sheinx/base';
3
3
  * @title Tabs.Panel
4
4
  * @sort 2
5
5
  */
6
- export type TabsPanelProps = Omit<UnStyleTabsPanelProps, 'jssStyle' | 'active' | 'shape' | 'isVertical' | 'lazy' | 'inactiveBackground' | 'onChange' | 'onCollapsible' | 'setTabs' | 'tabs'>;
6
+ export type TabsPanelProps = Omit<UnStyleTabsPanelProps, 'jssStyle' | 'active' | 'shape' | 'isVertical' | 'lazy' | 'inactiveBackground' | 'onChange' | 'onCollapsible' | 'setTabs' | 'tabs' | 'index'>;
package/dist/shineout.js CHANGED
@@ -12040,7 +12040,7 @@ var handleStyle = function handleStyle(style) {
12040
12040
  };
12041
12041
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12042
12042
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12043
- /* harmony default export */ var version = ('3.5.5-beta.5');
12043
+ /* harmony default export */ var version = ('3.5.5-beta.6');
12044
12044
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12045
12045
 
12046
12046
 
@@ -61113,6 +61113,7 @@ var TabsPanel = function TabsPanel(props) {
61113
61113
  var _jssStyle$tabs;
61114
61114
  var children = props.children,
61115
61115
  id = props.id,
61116
+ indexInTabs = props.index,
61116
61117
  tab = props.tab,
61117
61118
  className = props.className,
61118
61119
  style = props.style,
@@ -61134,16 +61135,22 @@ var TabsPanel = function TabsPanel(props) {
61134
61135
  color: props.color || (active === id ? color : undefined)
61135
61136
  };
61136
61137
  setTabs(function (prev) {
61137
- var prevTab = prev.find(function (item) {
61138
+ var oldTab = prev.find(function (item) {
61138
61139
  return item.id === id;
61139
61140
  });
61140
- if (prevTab) {
61141
+ if (oldTab) {
61141
61142
  return prev.map(function (item) {
61142
61143
  if (item.id !== id) return item;
61143
61144
  return objectSpread2_default()(objectSpread2_default()({}, item), tabData);
61144
61145
  });
61145
61146
  }
61146
- return [].concat(toConsumableArray_default()(prev), [tabData]);
61147
+ if (indexInTabs === undefined) {
61148
+ return [].concat(toConsumableArray_default()(prev), [tabData]);
61149
+ }
61150
+
61151
+ // 向indexInTabs位置插入tabData
61152
+ var newTabs = [].concat(toConsumableArray_default()(prev.slice(0, indexInTabs)), [tabData], toConsumableArray_default()(prev.slice(indexInTabs)));
61153
+ return newTabs;
61147
61154
  });
61148
61155
  return function () {
61149
61156
  // Panel卸载了通知父组件,去销毁相应的TabsHeader
@@ -61153,7 +61160,7 @@ var TabsPanel = function TabsPanel(props) {
61153
61160
  });
61154
61161
  });
61155
61162
  };
61156
- }, [id, tab, color].concat(toConsumableArray_default()(color ? [active] : []), [props.disabled, props.jssStyle]));
61163
+ }, [id, tab, color, active, props.disabled, props.jssStyle]);
61157
61164
  if (!isActive && lazy && !keekAlive.current) {
61158
61165
  return null;
61159
61166
  }
@@ -61489,14 +61496,9 @@ var TabsHeader = function TabsHeader(props) {
61489
61496
  extra = props.extra,
61490
61497
  splitColor = props.splitColor,
61491
61498
  tabBarStyle = props.tabBarStyle,
61492
- getPosition = props.getPosition,
61493
- sticky = props.sticky;
61499
+ getPosition = props.getPosition;
61494
61500
  var headerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
61495
61501
  var scrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
61496
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
61497
- _useState2 = slicedToArray_default()(_useState, 2),
61498
- loaded = _useState2[0],
61499
- setLoaded = _useState2[1];
61500
61502
  var tabRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
61501
61503
  var _useTabsContext = useTabsContext(),
61502
61504
  shape = _useTabsContext.shape,
@@ -61505,11 +61507,6 @@ var TabsHeader = function TabsHeader(props) {
61505
61507
  active = _useTabsContext.active;
61506
61508
  var config = useConfig();
61507
61509
  var isRtl = config.direction === 'rtl';
61508
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
61509
- if (sticky && headerRef.current && scrollRef.current && !loaded) {
61510
- setLoaded(true);
61511
- }
61512
- }, [loaded, sticky]);
61513
61510
  var _useTransform = use_transform({
61514
61511
  autoScroll: true,
61515
61512
  direction: isVertical ? 'Y' : 'X',
@@ -61571,17 +61568,17 @@ var TabsHeader = function TabsHeader(props) {
61571
61568
  var single = isRtl && !isVertical ? -1 : 1;
61572
61569
  setTransform(delta + headerRef.current.clientWidth * single);
61573
61570
  };
61574
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
61571
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
61575
61572
  offsetTop: 0,
61576
61573
  offsetLeft: 0
61577
61574
  }),
61575
+ _useState2 = slicedToArray_default()(_useState, 2),
61576
+ currentTabOffset = _useState2[0],
61577
+ setCurrentTabOffset = _useState2[1];
61578
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
61578
61579
  _useState4 = slicedToArray_default()(_useState3, 2),
61579
- currentTabOffset = _useState4[0],
61580
- setCurrentTabOffset = _useState4[1];
61581
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
61582
- _useState6 = slicedToArray_default()(_useState5, 2),
61583
- currentTabRect = _useState6[0],
61584
- setCurrentTabRect = _useState6[1];
61580
+ currentTabRect = _useState4[0],
61581
+ setCurrentTabRect = _useState4[1];
61585
61582
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
61586
61583
  var _currentTab$getBoundi;
61587
61584
  if (shape !== 'line' && shape !== 'dash') return;
@@ -61877,7 +61874,8 @@ var Tabs = function Tabs(props) {
61877
61874
  var Child = child;
61878
61875
  if (tabs_isNamedComponent(Child.type) && Child.type.displayName === 'ShineoutTabsPanel') {
61879
61876
  return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(Child, {
61880
- id: Child.props.id !== undefined ? Child.props.id : index
61877
+ id: Child.props.id !== undefined ? Child.props.id : index,
61878
+ index: index
61881
61879
  });
61882
61880
  }
61883
61881
  if (allowNonPanel) {
@@ -67184,7 +67182,7 @@ var upload_interface = __webpack_require__(8821);
67184
67182
 
67185
67183
 
67186
67184
  /* harmony default export */ var src_0 = ({
67187
- version: '3.5.5-beta.5'
67185
+ version: '3.5.5-beta.6'
67188
67186
  });
67189
67187
  }();
67190
67188
  /******/ return __webpack_exports__;