@pisell/materials 6.11.207 → 6.11.208

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.
@@ -44,6 +44,16 @@ var buildTabbarScrollViewProps = function buildTabbarScrollViewProps(isExpanded)
44
44
  };
45
45
  };
46
46
 
47
+ /**
48
+ * 生成 Tabbar 实例 ID,隔离多实例下的面板挂载容器。
49
+ *
50
+ * @example
51
+ * const tabbarId = createTabbarId();
52
+ */
53
+ function createTabbarId() {
54
+ return "tabbar-".concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
55
+ }
56
+
47
57
  /**
48
58
  * PisellTabbar - 多层级 Tabbar 组件
49
59
  *
@@ -72,6 +82,7 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
72
82
  maxLevel = _props$maxLevel === void 0 ? 3 : _props$maxLevel,
73
83
  _onSearch = props.onSearch;
74
84
  var containerRef = useRef(null);
85
+ var tabbarIdRef = useRef(createTabbarId());
75
86
  var searchRef = useRef(null);
76
87
 
77
88
  // 激活的 key 管理
@@ -290,12 +301,13 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
290
301
  return renderLevelNNormalCard(cardProps, 'level3');
291
302
  },
292
303
  panelContainer: function panelContainer() {
293
- return document.querySelector(".pisell-super-tabs-slot-bottom-sku-list-tabbar-".concat(panelProps2.dataSource.id));
304
+ var selector = ".pisell-super-tabs-slot-bottom-".concat(tabbarIdRef.current, "-").concat(panelProps2.dataSource.id);
305
+ return document.querySelector(selector);
294
306
  }
295
307
  }));
296
308
  };
297
309
  return /*#__PURE__*/React.createElement(SuperTabs, {
298
- id: "sku-list-tabbar-".concat(panelProps2.dataSource.id),
310
+ id: "".concat(tabbarIdRef.current, "-").concat(panelProps2.dataSource.id),
299
311
  tabItemStyle: {},
300
312
  isControlled: true,
301
313
  dataSource: _dataSource2,
@@ -365,12 +377,13 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
365
377
  return null;
366
378
  },
367
379
  panelContainer: function panelContainer() {
368
- return document.querySelector(".pisell-super-tabs-slot-bottom-sku-list-tabbar-".concat(panelProps.dataSource.id));
380
+ var selector = ".pisell-super-tabs-slot-bottom-".concat(tabbarIdRef.current, "-").concat(panelProps.dataSource.id);
381
+ return document.querySelector(selector);
369
382
  }
370
383
  }));
371
384
  };
372
385
  return /*#__PURE__*/React.createElement(SuperTabs, {
373
- id: "sku-list-tabbar-".concat(panelProps.dataSource.id),
386
+ id: "".concat(tabbarIdRef.current, "-").concat(panelProps.dataSource.id),
374
387
  tabItemStyle: {},
375
388
  dataSource: _dataSource,
376
389
  value: level2Value,
@@ -431,7 +444,7 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
431
444
  _onSearch === null || _onSearch === void 0 || _onSearch(e);
432
445
  },
433
446
  getContainer: function getContainer() {
434
- return document.querySelector('#sku-list-tabbar') || document.body;
447
+ return document.querySelector("#".concat(tabbarIdRef.current)) || document.body;
435
448
  },
436
449
  modalStyle: {
437
450
  width: '100%'
@@ -495,7 +508,8 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
495
508
  return null;
496
509
  },
497
510
  panelContainer: function panelContainer() {
498
- return document.querySelector(".pisell-super-tabs-slot-bottom-sku-list-tabbar");
511
+ var selector = ".pisell-super-tabs-slot-bottom-".concat(tabbarIdRef.current);
512
+ return document.querySelector(selector);
499
513
  }
500
514
  }));
501
515
  });
@@ -520,7 +534,7 @@ var PisellTabbar = /*#__PURE__*/forwardRef(function (props, ref) {
520
534
  ref: containerRef
521
535
  }, /*#__PURE__*/React.createElement(SuperTabs, {
522
536
  isControlled: true,
523
- id: "sku-list-tabbar",
537
+ id: tabbarIdRef.current,
524
538
  tabItemStyle: {},
525
539
  dataSource: level1DataSource,
526
540
  value: level1Value,
@@ -56,6 +56,9 @@ var buildTabbarScrollViewProps = (isExpanded) => ({
56
56
  scrollbarStyle: "none",
57
57
  scrollActionsConfig: TABBAR_SCROLL_ACTIONS_CONFIG
58
58
  });
59
+ function createTabbarId() {
60
+ return `tabbar-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
61
+ }
59
62
  var PisellTabbar = (0, import_react.forwardRef)(
60
63
  (props, ref) => {
61
64
  const {
@@ -70,6 +73,7 @@ var PisellTabbar = (0, import_react.forwardRef)(
70
73
  onSearch
71
74
  } = props;
72
75
  const containerRef = (0, import_react.useRef)(null);
76
+ const tabbarIdRef = (0, import_react.useRef)(createTabbarId());
73
77
  const searchRef = (0, import_react.useRef)(null);
74
78
  const {
75
79
  activeKey,
@@ -259,16 +263,17 @@ var PisellTabbar = (0, import_react.forwardRef)(
259
263
  {
260
264
  ...itemProps,
261
265
  card: (cardProps) => renderLevelNNormalCard(cardProps, "level3"),
262
- panelContainer: () => document.querySelector(
263
- `.pisell-super-tabs-slot-bottom-sku-list-tabbar-${panelProps2.dataSource.id}`
264
- )
266
+ panelContainer: () => {
267
+ const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps2.dataSource.id}`;
268
+ return document.querySelector(selector);
269
+ }
265
270
  }
266
271
  );
267
272
  };
268
273
  return /* @__PURE__ */ import_react.default.createElement(
269
274
  import_PisellSuperTabs.default,
270
275
  {
271
- id: `sku-list-tabbar-${panelProps2.dataSource.id}`,
276
+ id: `${tabbarIdRef.current}-${panelProps2.dataSource.id}`,
272
277
  tabItemStyle: {},
273
278
  isControlled: true,
274
279
  dataSource: _dataSource2,
@@ -339,16 +344,17 @@ var PisellTabbar = (0, import_react.forwardRef)(
339
344
  }
340
345
  return null;
341
346
  },
342
- panelContainer: () => document.querySelector(
343
- `.pisell-super-tabs-slot-bottom-sku-list-tabbar-${panelProps.dataSource.id}`
344
- )
347
+ panelContainer: () => {
348
+ const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}-${panelProps.dataSource.id}`;
349
+ return document.querySelector(selector);
350
+ }
345
351
  }
346
352
  );
347
353
  };
348
354
  return /* @__PURE__ */ import_react.default.createElement(
349
355
  import_PisellSuperTabs.default,
350
356
  {
351
- id: `sku-list-tabbar-${panelProps.dataSource.id}`,
357
+ id: `${tabbarIdRef.current}-${panelProps.dataSource.id}`,
352
358
  tabItemStyle: {},
353
359
  dataSource: _dataSource,
354
360
  value: level2Value,
@@ -431,7 +437,7 @@ var PisellTabbar = (0, import_react.forwardRef)(
431
437
  onSearch == null ? void 0 : onSearch(e);
432
438
  },
433
439
  getContainer: () => {
434
- return document.querySelector("#sku-list-tabbar") || document.body;
440
+ return document.querySelector(`#${tabbarIdRef.current}`) || document.body;
435
441
  },
436
442
  modalStyle: {
437
443
  width: "100%"
@@ -504,9 +510,10 @@ var PisellTabbar = (0, import_react.forwardRef)(
504
510
  }
505
511
  return null;
506
512
  },
507
- panelContainer: () => document.querySelector(
508
- `.pisell-super-tabs-slot-bottom-sku-list-tabbar`
509
- )
513
+ panelContainer: () => {
514
+ const selector = `.pisell-super-tabs-slot-bottom-${tabbarIdRef.current}`;
515
+ return document.querySelector(selector);
516
+ }
510
517
  }
511
518
  );
512
519
  }
@@ -532,7 +539,7 @@ var PisellTabbar = (0, import_react.forwardRef)(
532
539
  import_PisellSuperTabs.default,
533
540
  {
534
541
  isControlled: true,
535
- id: "sku-list-tabbar",
542
+ id: tabbarIdRef.current,
536
543
  tabItemStyle: {},
537
544
  dataSource: level1DataSource,
538
545
  value: level1Value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.11.207",
3
+ "version": "6.11.208",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -98,9 +98,9 @@
98
98
  "swiper": "^8.4.7",
99
99
  "antd-mobile": "^5.38.1",
100
100
  "vod-js-sdk-v6": "^1.4.11",
101
- "@pisell/date-picker": "3.0.8",
101
+ "@pisell/icon": "0.0.11",
102
102
  "@pisell/utils": "3.0.2",
103
- "@pisell/icon": "0.0.11"
103
+ "@pisell/date-picker": "3.0.8"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "react": "^18.0.0",