shineout 3.5.5-beta.4 → 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.4'
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.4');
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
 
@@ -21467,7 +21467,8 @@ var setToken = function setToken(options) {
21467
21467
  _ref$selector = _ref.selector,
21468
21468
  selector = _ref$selector === void 0 ? 'body' : _ref$selector,
21469
21469
  target = _ref.target,
21470
- tokenName = _ref.tokenName,
21470
+ _ref$tokenName = _ref.tokenName,
21471
+ tokenName = _ref$tokenName === void 0 ? 'shineout-token' : _ref$tokenName,
21471
21472
  token = _ref.token,
21472
21473
  attributes = _ref.attributes,
21473
21474
  onlyExtra = _ref.onlyExtra,
@@ -21476,7 +21477,7 @@ var setToken = function setToken(options) {
21476
21477
  var _getConfig = getConfig(),
21477
21478
  prefix = _getConfig.prefix;
21478
21479
  if (typeof window === 'undefined') return;
21479
- var id = "__shineoutThemeStyleContainer__".concat(createHash(selector));
21480
+ var id = "shineout-next-token-".concat(createHash(selector));
21480
21481
  var cacheTag = document.querySelector("[data-token-id=\"".concat(id, "\"]"));
21481
21482
  var tag = cacheTag || document.createElement(tagName);
21482
21483
  var tokens = [];
@@ -21599,8 +21600,6 @@ var scopeNormalizeStyle = function scopeNormalizeStyle() {
21599
21600
  appendNormalizeStyle(scopedStyleString, uniqueStyleId);
21600
21601
  };
21601
21602
  token_setter({
21602
- onlyExtra: true,
21603
- tokenName: 'shineout-extra',
21604
21603
  selector: 'html'
21605
21604
  });
21606
21605
  ;// CONCATENATED MODULE: ../shineout-style/src/pagination/pagination.ts
@@ -29679,7 +29678,7 @@ var usePositionStyle = function usePositionStyle(config) {
29679
29678
  style: hideStyle
29680
29679
  };
29681
29680
  var rect = context.parentRect;
29682
- if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
29681
+ if (!show && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
29683
29682
  var _scrollElRef$current2;
29684
29683
  var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
29685
29684
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
@@ -61114,6 +61113,7 @@ var TabsPanel = function TabsPanel(props) {
61114
61113
  var _jssStyle$tabs;
61115
61114
  var children = props.children,
61116
61115
  id = props.id,
61116
+ indexInTabs = props.index,
61117
61117
  tab = props.tab,
61118
61118
  className = props.className,
61119
61119
  style = props.style,
@@ -61135,16 +61135,22 @@ var TabsPanel = function TabsPanel(props) {
61135
61135
  color: props.color || (active === id ? color : undefined)
61136
61136
  };
61137
61137
  setTabs(function (prev) {
61138
- var prevTab = prev.find(function (item) {
61138
+ var oldTab = prev.find(function (item) {
61139
61139
  return item.id === id;
61140
61140
  });
61141
- if (prevTab) {
61141
+ if (oldTab) {
61142
61142
  return prev.map(function (item) {
61143
61143
  if (item.id !== id) return item;
61144
61144
  return objectSpread2_default()(objectSpread2_default()({}, item), tabData);
61145
61145
  });
61146
61146
  }
61147
- 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;
61148
61154
  });
61149
61155
  return function () {
61150
61156
  // Panel卸载了通知父组件,去销毁相应的TabsHeader
@@ -61154,7 +61160,7 @@ var TabsPanel = function TabsPanel(props) {
61154
61160
  });
61155
61161
  });
61156
61162
  };
61157
- }, [id, tab, color].concat(toConsumableArray_default()(color ? [active] : []), [props.disabled, props.jssStyle]));
61163
+ }, [id, tab, color, active, props.disabled, props.jssStyle]);
61158
61164
  if (!isActive && lazy && !keekAlive.current) {
61159
61165
  return null;
61160
61166
  }
@@ -61490,14 +61496,9 @@ var TabsHeader = function TabsHeader(props) {
61490
61496
  extra = props.extra,
61491
61497
  splitColor = props.splitColor,
61492
61498
  tabBarStyle = props.tabBarStyle,
61493
- getPosition = props.getPosition,
61494
- sticky = props.sticky;
61499
+ getPosition = props.getPosition;
61495
61500
  var headerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
61496
61501
  var scrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
61497
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
61498
- _useState2 = slicedToArray_default()(_useState, 2),
61499
- loaded = _useState2[0],
61500
- setLoaded = _useState2[1];
61501
61502
  var tabRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
61502
61503
  var _useTabsContext = useTabsContext(),
61503
61504
  shape = _useTabsContext.shape,
@@ -61506,11 +61507,6 @@ var TabsHeader = function TabsHeader(props) {
61506
61507
  active = _useTabsContext.active;
61507
61508
  var config = useConfig();
61508
61509
  var isRtl = config.direction === 'rtl';
61509
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
61510
- if (sticky && headerRef.current && scrollRef.current && !loaded) {
61511
- setLoaded(true);
61512
- }
61513
- }, [loaded, sticky]);
61514
61510
  var _useTransform = use_transform({
61515
61511
  autoScroll: true,
61516
61512
  direction: isVertical ? 'Y' : 'X',
@@ -61572,17 +61568,17 @@ var TabsHeader = function TabsHeader(props) {
61572
61568
  var single = isRtl && !isVertical ? -1 : 1;
61573
61569
  setTransform(delta + headerRef.current.clientWidth * single);
61574
61570
  };
61575
- 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)({
61576
61572
  offsetTop: 0,
61577
61573
  offsetLeft: 0
61578
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),
61579
61579
  _useState4 = slicedToArray_default()(_useState3, 2),
61580
- currentTabOffset = _useState4[0],
61581
- setCurrentTabOffset = _useState4[1];
61582
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
61583
- _useState6 = slicedToArray_default()(_useState5, 2),
61584
- currentTabRect = _useState6[0],
61585
- setCurrentTabRect = _useState6[1];
61580
+ currentTabRect = _useState4[0],
61581
+ setCurrentTabRect = _useState4[1];
61586
61582
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
61587
61583
  var _currentTab$getBoundi;
61588
61584
  if (shape !== 'line' && shape !== 'dash') return;
@@ -61878,7 +61874,8 @@ var Tabs = function Tabs(props) {
61878
61874
  var Child = child;
61879
61875
  if (tabs_isNamedComponent(Child.type) && Child.type.displayName === 'ShineoutTabsPanel') {
61880
61876
  return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(Child, {
61881
- id: Child.props.id !== undefined ? Child.props.id : index
61877
+ id: Child.props.id !== undefined ? Child.props.id : index,
61878
+ index: index
61882
61879
  });
61883
61880
  }
61884
61881
  if (allowNonPanel) {
@@ -67185,7 +67182,7 @@ var upload_interface = __webpack_require__(8821);
67185
67182
 
67186
67183
 
67187
67184
  /* harmony default export */ var src_0 = ({
67188
- version: '3.5.5-beta.4'
67185
+ version: '3.5.5-beta.6'
67189
67186
  });
67190
67187
  }();
67191
67188
  /******/ return __webpack_exports__;