shineout 3.4.3-beta.4 → 3.4.3-beta.5

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
@@ -492,5 +492,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
492
492
  // 此文件由脚本自动生成,请勿直接修改。
493
493
  // This file was generated automatically by a script. Please do not modify it directly.
494
494
  var _default = exports.default = {
495
- version: '3.4.3-beta.4'
495
+ version: '3.4.3-beta.5'
496
496
  };
package/dist/shineout.js CHANGED
@@ -11984,7 +11984,7 @@ var handleStyle = function handleStyle(style) {
11984
11984
  };
11985
11985
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11986
11986
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11987
- /* harmony default export */ var version = ('3.4.3-beta.4');
11987
+ /* harmony default export */ var version = ('3.4.3-beta.5');
11988
11988
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11989
11989
 
11990
11990
 
@@ -22437,9 +22437,6 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
22437
22437
  marginBottom: src.selectPlaceholderMarginY
22438
22438
  },
22439
22439
  multiple: {
22440
- '& $optionInner': {
22441
- paddingRight: src.selectOptionInnerPaddingRight
22442
- },
22443
22440
  '& $compressedWrapper': {
22444
22441
  flexWrap: 'nowrap'
22445
22442
  },
@@ -22451,6 +22448,11 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
22451
22448
  multipleCompressedWrapper: {
22452
22449
  flexWrap: 'nowrap'
22453
22450
  },
22451
+ multipleList: {
22452
+ '& $optionInner': {
22453
+ paddingRight: src.selectOptionInnerPaddingRight
22454
+ }
22455
+ },
22454
22456
  loading: {
22455
22457
  padding: 10,
22456
22458
  display: 'flex',
@@ -28758,6 +28760,201 @@ function isInDocument(element) {
28758
28760
  }
28759
28761
  return is_isBrowser() && document.documentElement.contains(element);
28760
28762
  }
28763
+ ;// CONCATENATED MODULE: ../hooks/src/utils/func.ts
28764
+ // 节流函数
28765
+ var throttle = function throttle(func, wait) {
28766
+ var that = {
28767
+ lock: false
28768
+ };
28769
+ if (!wait) return function () {
28770
+ if (that.lock) return;
28771
+ that.lock = true;
28772
+ func.apply(void 0, arguments);
28773
+ setTimeout(function () {
28774
+ that.lock = false;
28775
+ }, wait);
28776
+ };
28777
+ };
28778
+
28779
+ // eslint-disable-next-line @typescript-eslint/ban-types
28780
+ var debounce = function debounce(func, delay) {
28781
+ var that = {};
28782
+ var cleanTimer = function cleanTimer() {
28783
+ if (that.timer) {
28784
+ clearTimeout(that.timer);
28785
+ that.timer = null;
28786
+ }
28787
+ };
28788
+ if (!delay) return [func, cleanTimer];
28789
+ return [function () {
28790
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28791
+ args[_key] = arguments[_key];
28792
+ }
28793
+ cleanTimer();
28794
+ that.timer = setTimeout(function () {
28795
+ func.apply(void 0, args);
28796
+ }, delay);
28797
+ }, cleanTimer];
28798
+ };
28799
+ ;// CONCATENATED MODULE: ../hooks/src/utils/dom/element.tsx
28800
+
28801
+ var _this = undefined;
28802
+
28803
+
28804
+
28805
+
28806
+ /**
28807
+ * 判断是否是两个中文字符
28808
+ *
28809
+ * @param str 文本内容
28810
+ * @returns boolean
28811
+ */
28812
+
28813
+ var isTwoCNChar = function isTwoCNChar(str) {
28814
+ return /^[\u4e00-\u9fa5]{2}$/.test(str);
28815
+ };
28816
+ var SPACE = ' ';
28817
+
28818
+ /**
28819
+ * 处理文本内容,如果是两个中文字符,插入空格
28820
+ *
28821
+ * @param children ReactNode
28822
+ * @param insertSpace 是否需要插入空格
28823
+ * @returns 处理后的 ReactNode
28824
+ */
28825
+ function wrapSpan(children) {
28826
+ var insertSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
28827
+ var className = arguments.length > 2 ? arguments[2] : undefined;
28828
+ if (!children) return children;
28829
+ return external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(children, function (item) {
28830
+ if (typeof item === 'string') {
28831
+ if (insertSpace && isTwoCNChar(item)) return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
28832
+ children: item.split('').join(SPACE)
28833
+ });
28834
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
28835
+ className: className,
28836
+ children: item
28837
+ });
28838
+ }
28839
+ return item;
28840
+ });
28841
+ }
28842
+ var addResizeObserver = function addResizeObserver(el, handler) {
28843
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
28844
+ var direction = options.direction,
28845
+ timer = options.timer;
28846
+ var _debounce = debounce(handler, timer),
28847
+ _debounce2 = slicedToArray_default()(_debounce, 2),
28848
+ debounceHandler = _debounce2[0],
28849
+ cleanTimer = _debounce2[1];
28850
+ var h = debounceHandler;
28851
+ var lastWidth;
28852
+ var lastHeight;
28853
+ if (window.ResizeObserver) {
28854
+ if (direction) {
28855
+ lastWidth = el.clientWidth;
28856
+ lastHeight = el.clientHeight;
28857
+ h = function h(entry) {
28858
+ var _entry$0$contentRect = entry[0].contentRect,
28859
+ width = _entry$0$contentRect.width,
28860
+ height = _entry$0$contentRect.height;
28861
+ if (width && direction === 'x') {
28862
+ if (lastWidth !== width) {
28863
+ debounceHandler(entry);
28864
+ }
28865
+ } else if (direction === 'y') {
28866
+ if (height && lastHeight !== height) {
28867
+ debounceHandler(entry);
28868
+ }
28869
+ } else if (lastWidth !== width || lastHeight !== height) {
28870
+ debounceHandler(entry, {
28871
+ x: lastWidth !== width,
28872
+ y: lastHeight !== height
28873
+ });
28874
+ }
28875
+ lastWidth = width;
28876
+ lastHeight = height;
28877
+ };
28878
+ }
28879
+ var observer = new ResizeObserver(h);
28880
+ observer.observe(el);
28881
+ return function () {
28882
+ if (observer) {
28883
+ observer.disconnect();
28884
+ }
28885
+ cleanTimer(_this);
28886
+ observer = null;
28887
+ };
28888
+ }
28889
+ window.addEventListener('resize', debounceHandler);
28890
+ return function () {
28891
+ window.removeEventListener('resize', handler);
28892
+ cleanTimer();
28893
+ };
28894
+ };
28895
+ function getParent(el, target) {
28896
+ if (!target) {
28897
+ return null;
28898
+ }
28899
+ var temp = el;
28900
+ while (temp) {
28901
+ if (typeof target === 'string') {
28902
+ if (temp.matches && temp.matches(target)) {
28903
+ return temp;
28904
+ }
28905
+ } else if (temp === target) {
28906
+ return temp;
28907
+ }
28908
+ temp = temp.parentElement;
28909
+ }
28910
+ return null;
28911
+ }
28912
+ function getClosestScrollContainer(element) {
28913
+ if (!element) {
28914
+ return null;
28915
+ }
28916
+
28917
+ // 检查元素是否可滚动
28918
+ var isScrollable = function isScrollable(el) {
28919
+ var style = window.getComputedStyle(el);
28920
+ var overflowX = style.overflowX;
28921
+ var overflowY = style.overflowY;
28922
+ return (overflowX === 'auto' || overflowX === 'scroll' || overflowY === 'auto' || overflowY === 'scroll') && (el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth);
28923
+ };
28924
+
28925
+ // 如果元素本身是可滚动的,直接返回
28926
+ if (isScrollable(element)) {
28927
+ return element;
28928
+ }
28929
+
28930
+ // 遍历父元素
28931
+ var parent = element.parentElement;
28932
+ while (parent) {
28933
+ if (isScrollable(parent)) {
28934
+ return parent;
28935
+ }
28936
+ parent = parent.parentElement;
28937
+ }
28938
+
28939
+ // 如果没有找到可滚动的祖先,返回 body 或 documentElement
28940
+ return document.scrollingElement || document.documentElement;
28941
+ }
28942
+ function cssSupport(attr, value) {
28943
+ if (is_isBrowser()) {
28944
+ var element = document.createElement('div');
28945
+ if (attr in element.style) {
28946
+ if (attr !== 'length' && attr !== 'parentRule') {
28947
+ var attrs = element.style[attr];
28948
+ element.style[attr] = value;
28949
+ }
28950
+ return element.style[attr] === value;
28951
+ }
28952
+ }
28953
+ return false;
28954
+ }
28955
+ var parsePxToNumber = function parsePxToNumber(str) {
28956
+ return Number(str.replace(/\s+|px/gi, ''));
28957
+ };
28761
28958
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/index.ts
28762
28959
 
28763
28960
 
@@ -28765,6 +28962,7 @@ function isInDocument(element) {
28765
28962
 
28766
28963
 
28767
28964
 
28965
+
28768
28966
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
28769
28967
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
28770
28968
  var hideStyle = {
@@ -28883,6 +29081,7 @@ var usePositionStyle = function usePositionStyle(config) {
28883
29081
  }
28884
29082
  var targetPosition = position;
28885
29083
  var rootContainer = getContainer() || document.body;
29084
+ var closestScrollContainer = getClosestScrollContainer(parentElRef.current);
28886
29085
  var containerRect = rootContainer.getBoundingClientRect();
28887
29086
  var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
28888
29087
  var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
@@ -28901,7 +29100,7 @@ var usePositionStyle = function usePositionStyle(config) {
28901
29100
  var overRight = 0;
28902
29101
  var overLeft = 0;
28903
29102
  if (h === 'left') {
28904
- style.left = rect.left - containerRect.left + containerScroll.left;
29103
+ style.left = rect.left - containerRect.left + containerScroll.left + ((closestScrollContainer === null || closestScrollContainer === void 0 ? void 0 : closestScrollContainer.scrollLeft) || 0);
28905
29104
  style.transform = '';
28906
29105
  arrayStyle.left = "8px";
28907
29106
  if (adjust) {
@@ -29086,6 +29285,7 @@ var usePositionStyle = function usePositionStyle(config) {
29086
29285
  newStyle = _getStyle.newStyle,
29087
29286
  newArrayStyle = _getStyle.newArrayStyle;
29088
29287
  if (newStyle && !shallow_equal(style, newStyle)) {
29288
+ console.log('show, position, absolute, updateKey, fixedWidth: >>', show, position, absolute, updateKey, fixedWidth);
29089
29289
  setStyle(newStyle);
29090
29290
  setArrayStyle(newArrayStyle || {});
29091
29291
  }
@@ -30022,10 +30222,8 @@ var usePopup = function usePopup(props) {
30022
30222
  var updatePosition = use_persist_fn(function () {
30023
30223
  // if (isPositionControl) return;
30024
30224
  // if (props.position === 'auto' || !props.position) {
30025
- setTimeout(function () {
30026
- var newPosition = getPosition(targetRef.current, props.priorityDirection, autoMode, popupRef.current || undefined);
30027
- if (newPosition !== position) setPositionState(newPosition);
30028
- }, 10);
30225
+ var newPosition = getPosition(targetRef.current, props.priorityDirection, autoMode, popupRef.current || undefined);
30226
+ if (newPosition !== position) setPositionState(newPosition);
30029
30227
  });
30030
30228
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
30031
30229
  if (props.open) {
@@ -30365,171 +30563,6 @@ function extractEventHandlers(object) {
30365
30563
  });
30366
30564
  return result;
30367
30565
  }
30368
- ;// CONCATENATED MODULE: ../hooks/src/utils/func.ts
30369
- // 节流函数
30370
- var throttle = function throttle(func, wait) {
30371
- var that = {
30372
- lock: false
30373
- };
30374
- if (!wait) return function () {
30375
- if (that.lock) return;
30376
- that.lock = true;
30377
- func.apply(void 0, arguments);
30378
- setTimeout(function () {
30379
- that.lock = false;
30380
- }, wait);
30381
- };
30382
- };
30383
-
30384
- // eslint-disable-next-line @typescript-eslint/ban-types
30385
- var debounce = function debounce(func, delay) {
30386
- var that = {};
30387
- var cleanTimer = function cleanTimer() {
30388
- if (that.timer) {
30389
- clearTimeout(that.timer);
30390
- that.timer = null;
30391
- }
30392
- };
30393
- if (!delay) return [func, cleanTimer];
30394
- return [function () {
30395
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30396
- args[_key] = arguments[_key];
30397
- }
30398
- cleanTimer();
30399
- that.timer = setTimeout(function () {
30400
- func.apply(void 0, args);
30401
- }, delay);
30402
- }, cleanTimer];
30403
- };
30404
- ;// CONCATENATED MODULE: ../hooks/src/utils/dom/element.tsx
30405
-
30406
- var _this = undefined;
30407
-
30408
-
30409
-
30410
-
30411
- /**
30412
- * 判断是否是两个中文字符
30413
- *
30414
- * @param str 文本内容
30415
- * @returns boolean
30416
- */
30417
-
30418
- var isTwoCNChar = function isTwoCNChar(str) {
30419
- return /^[\u4e00-\u9fa5]{2}$/.test(str);
30420
- };
30421
- var SPACE = ' ';
30422
-
30423
- /**
30424
- * 处理文本内容,如果是两个中文字符,插入空格
30425
- *
30426
- * @param children ReactNode
30427
- * @param insertSpace 是否需要插入空格
30428
- * @returns 处理后的 ReactNode
30429
- */
30430
- function wrapSpan(children) {
30431
- var insertSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
30432
- var className = arguments.length > 2 ? arguments[2] : undefined;
30433
- if (!children) return children;
30434
- return external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(children, function (item) {
30435
- if (typeof item === 'string') {
30436
- if (insertSpace && isTwoCNChar(item)) return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
30437
- children: item.split('').join(SPACE)
30438
- });
30439
- return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
30440
- className: className,
30441
- children: item
30442
- });
30443
- }
30444
- return item;
30445
- });
30446
- }
30447
- var addResizeObserver = function addResizeObserver(el, handler) {
30448
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30449
- var direction = options.direction,
30450
- timer = options.timer;
30451
- var _debounce = debounce(handler, timer),
30452
- _debounce2 = slicedToArray_default()(_debounce, 2),
30453
- debounceHandler = _debounce2[0],
30454
- cleanTimer = _debounce2[1];
30455
- var h = debounceHandler;
30456
- var lastWidth;
30457
- var lastHeight;
30458
- if (window.ResizeObserver) {
30459
- if (direction) {
30460
- lastWidth = el.clientWidth;
30461
- lastHeight = el.clientHeight;
30462
- h = function h(entry) {
30463
- var _entry$0$contentRect = entry[0].contentRect,
30464
- width = _entry$0$contentRect.width,
30465
- height = _entry$0$contentRect.height;
30466
- if (width && direction === 'x') {
30467
- if (lastWidth !== width) {
30468
- debounceHandler(entry);
30469
- }
30470
- } else if (direction === 'y') {
30471
- if (height && lastHeight !== height) {
30472
- debounceHandler(entry);
30473
- }
30474
- } else if (lastWidth !== width || lastHeight !== height) {
30475
- debounceHandler(entry, {
30476
- x: lastWidth !== width,
30477
- y: lastHeight !== height
30478
- });
30479
- }
30480
- lastWidth = width;
30481
- lastHeight = height;
30482
- };
30483
- }
30484
- var observer = new ResizeObserver(h);
30485
- observer.observe(el);
30486
- return function () {
30487
- if (observer) {
30488
- observer.disconnect();
30489
- }
30490
- cleanTimer(_this);
30491
- observer = null;
30492
- };
30493
- }
30494
- window.addEventListener('resize', debounceHandler);
30495
- return function () {
30496
- window.removeEventListener('resize', handler);
30497
- cleanTimer();
30498
- };
30499
- };
30500
- function getParent(el, target) {
30501
- if (!target) {
30502
- return null;
30503
- }
30504
- var temp = el;
30505
- while (temp) {
30506
- if (typeof target === 'string') {
30507
- if (temp.matches && temp.matches(target)) {
30508
- return temp;
30509
- }
30510
- } else if (temp === target) {
30511
- return temp;
30512
- }
30513
- temp = temp.parentElement;
30514
- }
30515
- return null;
30516
- }
30517
- function cssSupport(attr, value) {
30518
- if (is_isBrowser()) {
30519
- var element = document.createElement('div');
30520
- if (attr in element.style) {
30521
- if (attr !== 'length' && attr !== 'parentRule') {
30522
- var attrs = element.style[attr];
30523
- element.style[attr] = value;
30524
- }
30525
- return element.style[attr] === value;
30526
- }
30527
- }
30528
- return false;
30529
- }
30530
- var parsePxToNumber = function parsePxToNumber(str) {
30531
- return Number(str.replace(/\s+|px/gi, ''));
30532
- };
30533
30566
  ;// CONCATENATED MODULE: ../hooks/src/components/use-button/use-button.ts
30534
30567
 
30535
30568
 
@@ -49403,6 +49436,7 @@ var useSelect = function useSelect(props) {
49403
49436
  value: value,
49404
49437
  multiple: multiple,
49405
49438
  disabled: disabled,
49439
+ // TODO: 类型定义需要修改
49406
49440
  onChange: onChange,
49407
49441
  prediction: prediction,
49408
49442
  keepCache: !noCache
@@ -49577,7 +49611,7 @@ var list_List = function List(props) {
49577
49611
  onOptionClick = props.onOptionClick;
49578
49612
  var dynamicVirtual = lineHeightProp === 'auto';
49579
49613
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$select = jssStyle.select) === null || _jssStyle$select === void 0 ? void 0 : _jssStyle$select.call(jssStyle);
49580
- var rootClass = classnames_default()(styles.list, defineProperty_default()(defineProperty_default()(defineProperty_default()({}, styles.controlMouse, controlType === 'mouse'), styles.controlKeyboard, controlType === 'keyboard'), styles.dynamicList, dynamicVirtual));
49614
+ var rootClass = classnames_default()(styles.list, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, styles.controlMouse, controlType === 'mouse'), styles.controlKeyboard, controlType === 'keyboard'), styles.dynamicList, dynamicVirtual), styles.multipleList, multiple));
49581
49615
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(hideCreateOption ? -1 : 0),
49582
49616
  _useState2 = slicedToArray_default()(_useState, 2),
49583
49617
  hoverIndex = _useState2[0],
@@ -52570,6 +52604,7 @@ var list_list_List = function List(props) {
52570
52604
  format: props.format,
52571
52605
  prediction: props.prediction,
52572
52606
  disabled: props.disabled,
52607
+ // TODO: 类型定义需要修改
52573
52608
  onChange: inputAble.onChange
52574
52609
  });
52575
52610
  var columnData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
@@ -65150,7 +65185,7 @@ var upload_interface = __webpack_require__(8821);
65150
65185
 
65151
65186
 
65152
65187
  /* harmony default export */ var src_0 = ({
65153
- version: '3.4.3-beta.4'
65188
+ version: '3.4.3-beta.5'
65154
65189
  });
65155
65190
  }();
65156
65191
  /******/ return __webpack_exports__;