@douyinfe/semi-ui 2.54.1 → 2.55.0-beta.0

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.
@@ -46281,10 +46281,6 @@ function sortable_esm_isAfter(a, b) {
46281
46281
 
46282
46282
 
46283
46283
  const defaultPrefix = 'semi-sortable';
46284
- const defaultConstraint = {
46285
- delay: 150,
46286
- tolerance: 5
46287
- };
46288
46284
  function DefaultContainer(props) {
46289
46285
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
46290
46286
  style: {
@@ -46292,6 +46288,9 @@ function DefaultContainer(props) {
46292
46288
  }
46293
46289
  }, props));
46294
46290
  }
46291
+ const defaultKeyBoardOptions = {
46292
+ coordinateGetter: sortableKeyboardCoordinates
46293
+ };
46295
46294
  function Sortable(_ref) {
46296
46295
  let {
46297
46296
  items,
@@ -46299,7 +46298,6 @@ function Sortable(_ref) {
46299
46298
  adjustScale,
46300
46299
  renderItem,
46301
46300
  transition,
46302
- activationConstraint = defaultConstraint,
46303
46301
  collisionDetection = closestCenter,
46304
46302
  strategy = rectSortingStrategy,
46305
46303
  useDragOverlay = true,
@@ -46308,13 +46306,7 @@ function Sortable(_ref) {
46308
46306
  prefix = defaultPrefix
46309
46307
  } = _ref;
46310
46308
  const [activeId, setActiveId] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
46311
- const sensors = useSensors(useSensor(MouseSensor, {
46312
- activationConstraint
46313
- }), useSensor(TouchSensor, {
46314
- activationConstraint
46315
- }), useSensor(KeyboardSensor, {
46316
- coordinateGetter: sortableKeyboardCoordinates
46317
- }));
46309
+ const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor), useSensor(KeyboardSensor, defaultKeyBoardOptions));
46318
46310
  const getIndex = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(id => items.indexOf(id), [items]);
46319
46311
  const activeIndex = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => activeId ? getIndex(activeId) : -1, [getIndex, activeId]);
46320
46312
  const onDragStart = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(_ref2 => {
@@ -46424,13 +46416,15 @@ function SortableItem(_ref4) {
46424
46416
  [`${prefix}-sortable-item-over`]: isOver,
46425
46417
  [`${prefix}-sortable-item-active`]: (active === null || active === void 0 ? void 0 : active.id) === id
46426
46418
  });
46427
- const wrapperStyle = !isNull_default()(animation) ? {
46428
- transform: CSS.Transform.toString(Object.assign(Object.assign({}, transform), {
46429
- scaleX: 1,
46430
- scaleY: 1
46431
- })),
46432
- transition: transition
46433
- } : undefined;
46419
+ const wrapperStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
46420
+ return !isNull_default()(animation) ? {
46421
+ transform: CSS.Transform.toString(Object.assign(Object.assign({}, transform), {
46422
+ scaleX: 1,
46423
+ scaleY: 1
46424
+ })),
46425
+ transition: transition
46426
+ } : undefined;
46427
+ }, [animation, transform, transition]);
46434
46428
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
46435
46429
  ref: setNodeRef,
46436
46430
  style: wrapperStyle,
@@ -65997,10 +65991,14 @@ class NavigationFoundation extends foundation {
65997
65991
  selectedKeys,
65998
65992
  mode
65999
65993
  } = this.getProps();
65994
+ const {
65995
+ openKeys: stateOpenKeys = []
65996
+ } = this.getStates();
66000
65997
  let willOpenKeys = openKeys || defaultOpenKeys || [];
66001
65998
  if (!(Array.isArray(defaultOpenKeys) || Array.isArray(openKeys)) && mode === navigation_constants_strings.MODE_VERTICAL && (Array.isArray(defaultSelectedKeys) || Array.isArray(selectedKeys))) {
66002
65999
  const currentSelectedKeys = Array.isArray(selectedKeys) ? selectedKeys : defaultSelectedKeys;
66003
- willOpenKeys = this.getShouldOpenKeys(itemKeysMap, currentSelectedKeys);
66000
+ willOpenKeys = stateOpenKeys.concat(this.getShouldOpenKeys(itemKeysMap, currentSelectedKeys));
66001
+ willOpenKeys = Array.from(new Set(willOpenKeys));
66004
66002
  }
66005
66003
  return [...willOpenKeys];
66006
66004
  }
@@ -66021,13 +66019,10 @@ class NavigationFoundation extends foundation {
66021
66019
  return [...willOpenKeySet];
66022
66020
  }
66023
66021
  destroy() {}
66024
- selectLevelZeroParentKeys(itemKeysMap) {
66022
+ selectLevelZeroParentKeys(itemKeysMap, itemKeys) {
66025
66023
  const _itemKeysMap = isNullOrUndefined(itemKeysMap) ? this.getState('itemKeysMap') : itemKeysMap;
66026
66024
  // console.log(itemKeysMap);
66027
66025
  const willAddKeys = [];
66028
- for (var _len2 = arguments.length, itemKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
66029
- itemKeys[_key2 - 1] = arguments[_key2];
66030
- }
66031
66026
  if (itemKeys.length) {
66032
66027
  for (const itemKey of itemKeys) {
66033
66028
  if (Array.isArray(_itemKeysMap[itemKey]) && _itemKeysMap[itemKey].length) {
@@ -85207,6 +85202,34 @@ class Tabs extends BaseComponent {
85207
85202
  current: ref
85208
85203
  };
85209
85204
  };
85205
+ this.getPanes = () => {
85206
+ const {
85207
+ tabList,
85208
+ children
85209
+ } = this.props;
85210
+ if (Array.isArray(tabList) && tabList.length) {
85211
+ return tabList;
85212
+ }
85213
+ return external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(children, child => {
85214
+ if (child) {
85215
+ const {
85216
+ tab,
85217
+ icon,
85218
+ disabled,
85219
+ itemKey,
85220
+ closable
85221
+ } = child.props;
85222
+ return {
85223
+ tab,
85224
+ icon,
85225
+ disabled,
85226
+ itemKey,
85227
+ closable
85228
+ };
85229
+ }
85230
+ return undefined;
85231
+ });
85232
+ };
85210
85233
  this.onTabClick = (activeKey, event) => {
85211
85234
  this.foundation.handleTabClick(activeKey, event);
85212
85235
  };
@@ -85245,7 +85268,7 @@ class Tabs extends BaseComponent {
85245
85268
  this.foundation = new tabs_foundation(this.adapter);
85246
85269
  this.state = {
85247
85270
  activeKey: this.foundation.getDefaultActiveKey(),
85248
- panes: [],
85271
+ panes: this.getPanes(),
85249
85272
  prevActiveKey: null,
85250
85273
  forceDisableMotion: false
85251
85274
  };
@@ -85255,41 +85278,12 @@ class Tabs extends BaseComponent {
85255
85278
  get adapter() {
85256
85279
  return Object.assign(Object.assign({}, super.adapter), {
85257
85280
  collectPane: () => {
85258
- const {
85259
- tabList,
85260
- children
85261
- } = this.props;
85262
- if (Array.isArray(tabList) && tabList.length) {
85263
- this.setState({
85264
- panes: tabList
85265
- });
85266
- return;
85267
- }
85268
- const panes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(children, child => {
85269
- if (child) {
85270
- const {
85271
- tab,
85272
- icon,
85273
- disabled,
85274
- itemKey,
85275
- closable
85276
- } = child.props;
85277
- return {
85278
- tab,
85279
- icon,
85280
- disabled,
85281
- itemKey,
85282
- closable
85283
- };
85284
- }
85285
- return undefined;
85286
- });
85281
+ const panes = this.getPanes();
85287
85282
  this.setState({
85288
85283
  panes
85289
85284
  });
85290
85285
  },
85291
85286
  collectActiveKey: () => {
85292
- let panes = [];
85293
85287
  const {
85294
85288
  tabList,
85295
85289
  children,
@@ -85301,29 +85295,7 @@ class Tabs extends BaseComponent {
85301
85295
  const {
85302
85296
  activeKey
85303
85297
  } = this.state;
85304
- if (Array.isArray(tabList) && tabList.length) {
85305
- panes = tabList;
85306
- } else {
85307
- panes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(children, child => {
85308
- if (child) {
85309
- const {
85310
- tab,
85311
- icon,
85312
- disabled,
85313
- itemKey,
85314
- closable
85315
- } = child.props;
85316
- return {
85317
- tab,
85318
- icon,
85319
- disabled,
85320
- itemKey,
85321
- closable
85322
- };
85323
- }
85324
- return undefined;
85325
- });
85326
- }
85298
+ const panes = this.getPanes();
85327
85299
  if (panes.findIndex(p => p.itemKey === activeKey) === -1) {
85328
85300
  if (panes.length > 0) {
85329
85301
  this.setState({