shineout 3.5.0-beta.7 → 3.5.0-beta.8

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
@@ -500,5 +500,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
500
500
  // 此文件由脚本自动生成,请勿直接修改。
501
501
  // This file was generated automatically by a script. Please do not modify it directly.
502
502
  var _default = exports.default = {
503
- version: '3.5.0-beta.7'
503
+ version: '3.5.0-beta.8'
504
504
  };
@@ -8,6 +8,7 @@ export declare function componentsClassTest(components: NodeListOf<Element>, boo
8
8
  export declare function textContentTest(element: Element, text: string | null | undefined): void;
9
9
  export declare function classContentTest(element: Element, name: string, bool?: boolean): void;
10
10
  export declare function styleTest(element: Element, style: string): void;
11
+ export declare function styleContainTest(element: Element, styleObject: object): void;
11
12
  export declare function styleContentTest(element: Element, name: string, bool?: boolean): void;
12
13
  export interface StyleProps {
13
14
  [key: string]: string;
@@ -17,6 +17,7 @@ exports.inputPlaceholderTest = inputPlaceholderTest;
17
17
  exports.inputValueTest = inputValueTest;
18
18
  exports.snapshotTest = snapshotTest;
19
19
  exports.snapshotTestByClick = snapshotTestByClick;
20
+ exports.styleContainTest = styleContainTest;
20
21
  exports.styleContentTest = styleContentTest;
21
22
  exports.styleTest = styleTest;
22
23
  exports.textContentTest = textContentTest;
@@ -83,6 +84,9 @@ function classContentTest(element, name) {
83
84
  function styleTest(element, style) {
84
85
  attributesTest(element, 'style', style);
85
86
  }
87
+ function styleContainTest(element, styleObject) {
88
+ expect(element.style).toEqual(expect.objectContaining(styleObject));
89
+ }
86
90
  function styleContentTest(element, name) {
87
91
  var _element$getAttribute2;
88
92
  var bool = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
package/dist/shineout.js CHANGED
@@ -11993,7 +11993,7 @@ var handleStyle = function handleStyle(style) {
11993
11993
  };
11994
11994
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11995
11995
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11996
- /* harmony default export */ var version = ('3.5.0-beta.7');
11996
+ /* harmony default export */ var version = ('3.5.0-beta.8');
11997
11997
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11998
11998
 
11999
11999
 
@@ -22330,7 +22330,7 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
22330
22330
  },
22331
22331
  '&:hover': objectSpread2_default()(objectSpread2_default()({}, select_wrapper['&:hover']), {}, {
22332
22332
  cursor: 'pointer',
22333
- '&$clearable:not($wrapperEmpty)': {
22333
+ '&$clearable:not($wrapperEmpty):not($wrapperDisabled)': {
22334
22334
  '& $clearIcon': {
22335
22335
  display: 'block'
22336
22336
  },
@@ -28831,129 +28831,6 @@ var getDataAttribute = function getDataAttribute(attrs) {
28831
28831
  var getDataAttributeName = function getDataAttributeName(name) {
28832
28832
  return "data-soui-".concat(name);
28833
28833
  };
28834
- ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-position-style.ts
28835
-
28836
- var ReverseDir = {
28837
- left: 'right',
28838
- right: 'left',
28839
- top: 'bottom',
28840
- bottom: 'top'
28841
- };
28842
- var getPositionStyle = function getPositionStyle(position, config) {
28843
- var _ref = config || {},
28844
- _ref$popupGap = _ref.popupGap,
28845
- popupGap = _ref$popupGap === void 0 ? 0 : _ref$popupGap;
28846
- var mainMargin = "calc(100% + ".concat(popupGap, "px)");
28847
- var halfMargin = "calc(50% + ".concat(popupGap, "px)");
28848
- var newStyle = {
28849
- zIndex: config === null || config === void 0 ? void 0 : config.zIndex
28850
- };
28851
- if (config !== null && config !== void 0 && config.fixedWidth) {
28852
- var key = config.fixedWidth === 'min' ? 'minWidth' : 'width';
28853
- newStyle[key] = '100%';
28854
- }
28855
- if (position === 'drop-down') {
28856
- newStyle.top = mainMargin;
28857
- newStyle.left = 0;
28858
- } else if (position === 'drop-up') {
28859
- newStyle.bottom = mainMargin;
28860
- newStyle.left = 0;
28861
- } else {
28862
- var positionArr = (position || '').split('-');
28863
- if (positionArr.length === 2) {
28864
- var _positionArr = slicedToArray_default()(positionArr, 2),
28865
- m = _positionArr[0],
28866
- n = _positionArr[1];
28867
- newStyle[ReverseDir[m]] = mainMargin;
28868
- newStyle[n] = 0;
28869
- } else {
28870
- var _positionArr2 = slicedToArray_default()(positionArr, 1),
28871
- _m = _positionArr2[0];
28872
- newStyle[ReverseDir[_m]] = mainMargin;
28873
- if (_m === 'left' || _m === 'right') {
28874
- newStyle.top = halfMargin;
28875
- newStyle.transform = 'translateY(-50%)';
28876
- }
28877
- if (_m === 'top' || _m === 'bottom') {
28878
- newStyle.left = halfMargin;
28879
- newStyle.transform = 'translateX(-50%)';
28880
- }
28881
- }
28882
- }
28883
- return newStyle;
28884
- };
28885
- // EXTERNAL MODULE: ../../node_modules/.pnpm/react-fast-compare@3.2.2/node_modules/react-fast-compare/index.js
28886
- var react_fast_compare = __webpack_require__(5284);
28887
- var react_fast_compare_default = /*#__PURE__*/__webpack_require__.n(react_fast_compare);
28888
- ;// CONCATENATED MODULE: ../hooks/src/utils/shallow-equal.ts
28889
-
28890
-
28891
- var shallow_equal_hasOwnProperty = Object.prototype.hasOwnProperty;
28892
- function is(x, y) {
28893
- if (x === y) {
28894
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
28895
- }
28896
- // eslint-disable-next-line
28897
- return x !== x && y !== y;
28898
- }
28899
- function getOption(options, key) {
28900
- if (!options[key]) return [];
28901
- var val = options[key];
28902
- return Array.isArray(val) ? val : [val];
28903
- }
28904
- function compareColumns(columns1, columns2) {
28905
- if (!columns1 || !columns2) return true;
28906
- if (columns1.length !== columns2.length) return false;
28907
- var simpleCompare = columns1.every(function (c, i) {
28908
- return c.width === columns2[i].width || Number.isNaN(c.width) && Number.isNaN(columns2[i].width);
28909
- });
28910
- if (!simpleCompare) return false;
28911
- var complexCompare = columns1.every(function (c, i) {
28912
- if (Array.isArray(c.group) && Array.isArray(columns2[i].group)) return c.group.every(function (d, index) {
28913
- return d === columns2[i].group[index];
28914
- });
28915
- return c.group === columns2[i].group;
28916
- });
28917
- return complexCompare;
28918
- }
28919
- function shallowEqual(objA, objB) {
28920
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
28921
- if (is(objA, objB)) {
28922
- return true;
28923
- }
28924
- if (typeof_default()(objA) !== 'object' || objA === null || typeof_default()(objB) !== 'object' || objB === null) {
28925
- return false;
28926
- }
28927
- var keysA = Object.keys(objA);
28928
- var keysB = Object.keys(objB);
28929
- var skip = getOption(options, 'skip');
28930
- var deep = getOption(options, 'deep');
28931
- if (keysA.length !== keysB.length) {
28932
- return false;
28933
- }
28934
- keysA.sort(function (a, b) {
28935
- return deep.indexOf(a) - deep.indexOf(b);
28936
- });
28937
-
28938
- // Test for A's keys different from B.
28939
- for (var i = 0; i < keysA.length; i++) {
28940
- var k = keysA[i];
28941
- if (skip.includes(k)) continue;
28942
- if (!shallow_equal_hasOwnProperty.call(objB, k) || !is(objA[k], objB[k])) {
28943
- if (objA[k] instanceof Error && objB[k] instanceof Error) {
28944
- if (objA[k].message !== objB[k].message) return false;
28945
- continue;
28946
- }
28947
- if (deep.includes(k)) {
28948
- if (!react_fast_compare_default()(objA[k], objB[k])) return false;
28949
- } else {
28950
- return false;
28951
- }
28952
- }
28953
- }
28954
- return true;
28955
- }
28956
- /* harmony default export */ var shallow_equal = (shallowEqual);
28957
28834
  ;// CONCATENATED MODULE: ../hooks/src/utils/func.ts
28958
28835
  // 节流函数
28959
28836
  var throttle = function throttle(func, wait) {
@@ -29149,6 +29026,209 @@ function cssSupport(attr, value) {
29149
29026
  var parsePxToNumber = function parsePxToNumber(str) {
29150
29027
  return Number(str.replace(/\s+|px/gi, ''));
29151
29028
  };
29029
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/get-position-style.ts
29030
+
29031
+ var ReverseDir = {
29032
+ left: 'right',
29033
+ right: 'left',
29034
+ top: 'bottom',
29035
+ bottom: 'top'
29036
+ };
29037
+ var getPositionStyle = function getPositionStyle(position, config) {
29038
+ var _ref = config || {},
29039
+ _ref$popupGap = _ref.popupGap,
29040
+ popupGap = _ref$popupGap === void 0 ? 0 : _ref$popupGap;
29041
+ var mainMargin = "calc(100% + ".concat(popupGap, "px)");
29042
+ var halfMargin = "calc(50% + ".concat(popupGap, "px)");
29043
+ var newStyle = {
29044
+ zIndex: config === null || config === void 0 ? void 0 : config.zIndex
29045
+ };
29046
+ if (config !== null && config !== void 0 && config.fixedWidth) {
29047
+ var key = config.fixedWidth === 'min' ? 'minWidth' : 'width';
29048
+ newStyle[key] = '100%';
29049
+ }
29050
+ if (position === 'drop-down') {
29051
+ newStyle.top = mainMargin;
29052
+ newStyle.left = 0;
29053
+ } else if (position === 'drop-up') {
29054
+ newStyle.bottom = mainMargin;
29055
+ newStyle.left = 0;
29056
+ } else {
29057
+ var positionArr = (position || '').split('-');
29058
+ if (positionArr.length === 2) {
29059
+ var _positionArr = slicedToArray_default()(positionArr, 2),
29060
+ m = _positionArr[0],
29061
+ n = _positionArr[1];
29062
+ newStyle[ReverseDir[m]] = mainMargin;
29063
+ newStyle[n] = 0;
29064
+ } else {
29065
+ var _positionArr2 = slicedToArray_default()(positionArr, 1),
29066
+ _m = _positionArr2[0];
29067
+ newStyle[ReverseDir[_m]] = mainMargin;
29068
+ if (_m === 'left' || _m === 'right') {
29069
+ newStyle.top = halfMargin;
29070
+ newStyle.transform = 'translateY(-50%)';
29071
+ }
29072
+ if (_m === 'top' || _m === 'bottom') {
29073
+ newStyle.left = halfMargin;
29074
+ newStyle.transform = 'translateX(-50%)';
29075
+ }
29076
+ }
29077
+ }
29078
+ return newStyle;
29079
+ };
29080
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/check-position.ts
29081
+
29082
+
29083
+ var useCheckElementPosition = function useCheckElementPosition(elementRef) {
29084
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29085
+ var enable = options.enable,
29086
+ scrollContainer = options.scrollContainer;
29087
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
29088
+ top: 0,
29089
+ left: 0
29090
+ }),
29091
+ _useState2 = slicedToArray_default()(_useState, 2),
29092
+ position = _useState2[0],
29093
+ setPosition = _useState2[1];
29094
+ var lastPosition = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
29095
+ top: 0,
29096
+ left: 0
29097
+ });
29098
+ var checkPosition = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
29099
+ if (elementRef.current) {
29100
+ var rect = elementRef.current.getBoundingClientRect();
29101
+ var scrollContainerRect = scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.getBoundingClientRect();
29102
+ var newPosition;
29103
+ if (scrollContainerRect) {
29104
+ newPosition = {
29105
+ top: rect.top - scrollContainerRect.top,
29106
+ left: rect.left - scrollContainerRect.left
29107
+ };
29108
+ } else {
29109
+ newPosition = {
29110
+ top: rect.top,
29111
+ left: rect.left
29112
+ };
29113
+ }
29114
+ if (newPosition.top !== lastPosition.current.top || newPosition.left !== lastPosition.current.left) {
29115
+ setPosition(newPosition);
29116
+ lastPosition.current = newPosition;
29117
+ }
29118
+ }
29119
+ }, [elementRef, scrollContainer]);
29120
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
29121
+ var _window;
29122
+ if (!enable) return;
29123
+ var element = elementRef.current;
29124
+ var container = scrollContainer || window;
29125
+ if (!element) return;
29126
+
29127
+ // 初始检查
29128
+ checkPosition();
29129
+ var resizeObserver = null;
29130
+ if ((_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
29131
+ resizeObserver = new ResizeObserver(checkPosition);
29132
+ resizeObserver.observe(element);
29133
+ if (container instanceof Element) {
29134
+ resizeObserver.observe(container);
29135
+ }
29136
+ }
29137
+ // 滚动事件监听
29138
+ container.addEventListener('scroll', checkPosition);
29139
+
29140
+ // 如果容器不是 window,我们仍然需要监听 window 的 resize 事件
29141
+ if (container !== window) {
29142
+ window.addEventListener('resize', checkPosition);
29143
+ }
29144
+
29145
+ // 清理函数
29146
+ return function () {
29147
+ var _resizeObserver;
29148
+ (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
29149
+ container.removeEventListener('scroll', checkPosition);
29150
+ if (container !== window) {
29151
+ window.removeEventListener('resize', checkPosition);
29152
+ }
29153
+ };
29154
+ }, [enable, elementRef, scrollContainer, checkPosition]);
29155
+ if (!enable || !elementRef) {
29156
+ return null;
29157
+ }
29158
+ return position;
29159
+ };
29160
+ // EXTERNAL MODULE: ../../node_modules/.pnpm/react-fast-compare@3.2.2/node_modules/react-fast-compare/index.js
29161
+ var react_fast_compare = __webpack_require__(5284);
29162
+ var react_fast_compare_default = /*#__PURE__*/__webpack_require__.n(react_fast_compare);
29163
+ ;// CONCATENATED MODULE: ../hooks/src/utils/shallow-equal.ts
29164
+
29165
+
29166
+ var shallow_equal_hasOwnProperty = Object.prototype.hasOwnProperty;
29167
+ function is(x, y) {
29168
+ if (x === y) {
29169
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
29170
+ }
29171
+ // eslint-disable-next-line
29172
+ return x !== x && y !== y;
29173
+ }
29174
+ function getOption(options, key) {
29175
+ if (!options[key]) return [];
29176
+ var val = options[key];
29177
+ return Array.isArray(val) ? val : [val];
29178
+ }
29179
+ function compareColumns(columns1, columns2) {
29180
+ if (!columns1 || !columns2) return true;
29181
+ if (columns1.length !== columns2.length) return false;
29182
+ var simpleCompare = columns1.every(function (c, i) {
29183
+ return c.width === columns2[i].width || Number.isNaN(c.width) && Number.isNaN(columns2[i].width);
29184
+ });
29185
+ if (!simpleCompare) return false;
29186
+ var complexCompare = columns1.every(function (c, i) {
29187
+ if (Array.isArray(c.group) && Array.isArray(columns2[i].group)) return c.group.every(function (d, index) {
29188
+ return d === columns2[i].group[index];
29189
+ });
29190
+ return c.group === columns2[i].group;
29191
+ });
29192
+ return complexCompare;
29193
+ }
29194
+ function shallowEqual(objA, objB) {
29195
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
29196
+ if (is(objA, objB)) {
29197
+ return true;
29198
+ }
29199
+ if (typeof_default()(objA) !== 'object' || objA === null || typeof_default()(objB) !== 'object' || objB === null) {
29200
+ return false;
29201
+ }
29202
+ var keysA = Object.keys(objA);
29203
+ var keysB = Object.keys(objB);
29204
+ var skip = getOption(options, 'skip');
29205
+ var deep = getOption(options, 'deep');
29206
+ if (keysA.length !== keysB.length) {
29207
+ return false;
29208
+ }
29209
+ keysA.sort(function (a, b) {
29210
+ return deep.indexOf(a) - deep.indexOf(b);
29211
+ });
29212
+
29213
+ // Test for A's keys different from B.
29214
+ for (var i = 0; i < keysA.length; i++) {
29215
+ var k = keysA[i];
29216
+ if (skip.includes(k)) continue;
29217
+ if (!shallow_equal_hasOwnProperty.call(objB, k) || !is(objA[k], objB[k])) {
29218
+ if (objA[k] instanceof Error && objB[k] instanceof Error) {
29219
+ if (objA[k].message !== objB[k].message) return false;
29220
+ continue;
29221
+ }
29222
+ if (deep.includes(k)) {
29223
+ if (!react_fast_compare_default()(objA[k], objB[k])) return false;
29224
+ } else {
29225
+ return false;
29226
+ }
29227
+ }
29228
+ }
29229
+ return true;
29230
+ }
29231
+ /* harmony default export */ var shallow_equal = (shallowEqual);
29152
29232
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/index.ts
29153
29233
 
29154
29234
 
@@ -29162,8 +29242,7 @@ var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right',
29162
29242
  var hideStyle = {
29163
29243
  pointerEvents: 'none',
29164
29244
  position: 'fixed',
29165
- zIndex: -1000,
29166
- opacity: 0
29245
+ visibility: 'hidden'
29167
29246
  };
29168
29247
  var usePositionStyle = function usePositionStyle(config) {
29169
29248
  var _ref = config || {},
@@ -29191,7 +29270,6 @@ var usePositionStyle = function usePositionStyle(config) {
29191
29270
  arrayStyle = _useState4[0],
29192
29271
  setArrayStyle = _useState4[1];
29193
29272
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
29194
- element: null,
29195
29273
  containerRect: {
29196
29274
  left: 0,
29197
29275
  width: 0
@@ -29205,10 +29283,13 @@ var usePositionStyle = function usePositionStyle(config) {
29205
29283
  width: 0
29206
29284
  },
29207
29285
  popUpHeight: 0,
29208
- popUpWidth: 0,
29209
- opsStyle: {}
29286
+ popUpWidth: 0
29210
29287
  }),
29211
29288
  context = _React$useRef.current;
29289
+ var parentElNewPosition = useCheckElementPosition(parentElRef, {
29290
+ scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
29291
+ enable: show && adjust
29292
+ });
29212
29293
  var adjustPosition = function adjustPosition(position) {
29213
29294
  var winHeight = docSize.height;
29214
29295
  if (!verticalPosition.includes(position)) return position;
@@ -29275,7 +29356,6 @@ var usePositionStyle = function usePositionStyle(config) {
29275
29356
  }
29276
29357
  var targetPosition = position;
29277
29358
  var rootContainer = getContainer() || document.body;
29278
- var closestScrollContainer = absolute ? null : getClosestScrollContainer(parentElRef.current);
29279
29359
  var containerRect = rootContainer.getBoundingClientRect();
29280
29360
  var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
29281
29361
  var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
@@ -29294,7 +29374,7 @@ var usePositionStyle = function usePositionStyle(config) {
29294
29374
  var overRight = 0;
29295
29375
  var overLeft = 0;
29296
29376
  if (h === 'left') {
29297
- style.left = rect.left - containerRect.left + containerScroll.left + ((closestScrollContainer === null || closestScrollContainer === void 0 ? void 0 : closestScrollContainer.scrollLeft) || 0);
29377
+ style.left = rect.left - containerRect.left + containerScroll.left;
29298
29378
  style.transform = '';
29299
29379
  arrayStyle.left = "8px";
29300
29380
  if (adjust) {
@@ -29483,7 +29563,7 @@ var usePositionStyle = function usePositionStyle(config) {
29483
29563
  setArrayStyle(newArrayStyle || {});
29484
29564
  }
29485
29565
  });
29486
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
29566
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition]);
29487
29567
  return {
29488
29568
  style: style,
29489
29569
  arrayStyle: arrayStyle
@@ -30114,7 +30194,9 @@ var useContainer = function useContainer() {
30114
30194
  'use client';
30115
30195
 
30116
30196
 
30117
- var AbsoluteContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)(false);
30197
+ var AbsoluteContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)({
30198
+ absolute: false
30199
+ });
30118
30200
  AbsoluteContext.displayName = 'AbsoluteContext';
30119
30201
  /* harmony default export */ var absolute_context = (AbsoluteContext);
30120
30202
  ;// CONCATENATED MODULE: ../base/src/absolute-list/absolute-list.tsx
@@ -30128,7 +30210,7 @@ var AbsoluteList = function AbsoluteList(props) {
30128
30210
  var position = props.position,
30129
30211
  children = props.children,
30130
30212
  parentElRef = props.parentElRef,
30131
- scrollElRef = props.scrollElRef,
30213
+ scrollElRefProp = props.scrollElRef,
30132
30214
  fixedWidth = props.fixedWidth,
30133
30215
  _props$zIndex = props.zIndex,
30134
30216
  zIndex = _props$zIndex === void 0 ? 1051 : _props$zIndex,
@@ -30142,7 +30224,9 @@ var AbsoluteList = function AbsoluteList(props) {
30142
30224
  destroy = _props$destroy === void 0 ? false : _props$destroy,
30143
30225
  _props$lazy = props.lazy,
30144
30226
  lazy = _props$lazy === void 0 ? true : _props$lazy;
30145
- var defaultAbsolute = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(absolute_context);
30227
+ var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(absolute_context),
30228
+ defaultAbsolute = _useContext.absolute,
30229
+ scrollElRefContext = _useContext.scrollElRef;
30146
30230
  var absolute = props.absolute === undefined ? defaultAbsolute : props.absolute;
30147
30231
  var _useContainer = use_container({
30148
30232
  container: typeof absolute === 'function' ? absolute : undefined
@@ -30152,6 +30236,19 @@ var AbsoluteList = function AbsoluteList(props) {
30152
30236
  rendered: false
30153
30237
  }),
30154
30238
  context = _useRef.current;
30239
+ var closestScrollContainerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
30240
+
30241
+ // scrollElRef的3个来源:1. 外部传入 2. 上下文传入 3. 最接近的滚动容器
30242
+ var finalScrollElRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
30243
+ return scrollElRefProp || scrollElRefContext || closestScrollContainerRef;
30244
+ }, [scrollElRefProp, scrollElRefContext]);
30245
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
30246
+ if (scrollElRefProp || scrollElRefContext) return;
30247
+ var closestScrollContainer = getClosestScrollContainer(parentElRef.current);
30248
+ if (closestScrollContainer) {
30249
+ closestScrollContainerRef.current = closestScrollContainer;
30250
+ }
30251
+ }, [parentElRef, scrollElRefProp, scrollElRefContext]);
30155
30252
  var _usePositionStyle = usePositionStyle({
30156
30253
  getContainer: getRoot,
30157
30254
  position: position,
@@ -30160,7 +30257,7 @@ var AbsoluteList = function AbsoluteList(props) {
30160
30257
  show: focus,
30161
30258
  fixedWidth: fixedWidth,
30162
30259
  zIndex: zIndex,
30163
- scrollElRef: scrollElRef,
30260
+ scrollElRef: finalScrollElRef,
30164
30261
  popupElRef: popupElRef,
30165
30262
  updateKey: updateKey,
30166
30263
  popupGap: popupGap,
@@ -38468,6 +38565,7 @@ var result_Result = function Result(props) {
38468
38565
  if (!multiple && valueProp && valueProp !== 0) {
38469
38566
  var _result = getDataByValues(value);
38470
38567
  _placeholder = renderResultContent(_result[0]);
38568
+ if (_placeholder === undefined) _placeholder = placeholder;
38471
38569
  }
38472
38570
  return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
38473
38571
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(result_input, {
@@ -38654,7 +38752,26 @@ var result_Result = function Result(props) {
38654
38752
  if (_result2.length > 0) {
38655
38753
  var inputTmpText = renderResultContent(_result2[0]);
38656
38754
  if (inputTmpText) {
38657
- props.setInputText(inputTmpText);
38755
+ // 提取result文本
38756
+ var getTextFromReactElement = function getTextFromReactElement(element) {
38757
+ if (!element) return '';
38758
+ // 如果是字符串或数字,直接返回
38759
+ if (typeof element === 'string' || typeof element === 'number') return String(element);
38760
+ // 如果是 React Element,处理的是renderResult返回的是React Element的场景
38761
+ if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(element)) {
38762
+ var _element$props;
38763
+ var children = (_element$props = element.props) === null || _element$props === void 0 ? void 0 : _element$props.children;
38764
+ if (Array.isArray(children)) {
38765
+ return children.map(function (child) {
38766
+ return getTextFromReactElement(child);
38767
+ }).join('');
38768
+ }
38769
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(children) ? getTextFromReactElement(children) : String(children || '');
38770
+ }
38771
+ return '';
38772
+ };
38773
+ var textContent = getTextFromReactElement(inputTmpText);
38774
+ props.setInputText(textContent);
38658
38775
  }
38659
38776
  }
38660
38777
  setTimeout(function () {
@@ -44511,7 +44628,7 @@ var DatePicker = function DatePicker(props0) {
44511
44628
  }
44512
44629
  }, []);
44513
44630
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute(defineProperty_default()(defineProperty_default()({}, 'input-border', 'true'), "type", type))), {}, {
44514
- className: classnames_default()(props.className, styles === null || styles === void 0 ? void 0 : styles.wrapper, props.innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), disabledStatus === 'all' && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), range && (styles === null || styles === void 0 ? void 0 : styles.wrapperRange), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!props.underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline)),
44631
+ className: classnames_default()(props.className, styles === null || styles === void 0 ? void 0 : styles.wrapper, props.innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), focused && disabled !== true && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), disabledStatus === 'all' && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), range && (styles === null || styles === void 0 ? void 0 : styles.wrapperRange), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!props.underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline)),
44515
44632
  style: objectSpread2_default()({
44516
44633
  width: props.width
44517
44634
  }, props.style),
@@ -49658,6 +49775,11 @@ var useNumberFormat = function useNumberFormat(props) {
49658
49775
  setInternalInputValue(getStringValue(val));
49659
49776
  if (typeof val === 'string') {
49660
49777
  var num = parseFloat(val);
49778
+ if (val === '') {
49779
+ // 如果允许空值,则返回 null,否则返回 undefined
49780
+ onChange === null || onChange === void 0 || onChange(allowNull ? null : undefined);
49781
+ return;
49782
+ }
49661
49783
  if (isNaN(num)) return;
49662
49784
  onChange === null || onChange === void 0 || onChange(num);
49663
49785
  } else {
@@ -58352,18 +58474,18 @@ var thead_toNum = toNum;
58352
58474
  }),
58353
58475
  groupColumns = _useTableGroup.groupColumns,
58354
58476
  columnLevel = _useTableGroup.columnLevel;
58355
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
58356
- var heights = trRefs.current.map(function (tr) {
58357
- return (tr === null || tr === void 0 ? void 0 : tr.offsetHeight) || 0;
58358
- });
58359
- context.trHeights = heights;
58360
- }, [groupColumns]);
58361
58477
  var config = useConfig();
58362
58478
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
58363
58479
  dragIndex: -1,
58364
58480
  trHeights: []
58365
58481
  }),
58366
58482
  context = _useRef.current;
58483
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
58484
+ var heights = trRefs.current.map(function (tr) {
58485
+ return (tr === null || tr === void 0 ? void 0 : tr.offsetHeight) || 0;
58486
+ });
58487
+ context.trHeights = heights;
58488
+ }, [groupColumns]);
58367
58489
  var handleDragMove = usePersistFn(function (deltaX) {
58368
58490
  props === null || props === void 0 || props.dragCol(context.dragIndex, deltaX);
58369
58491
  });
@@ -58386,7 +58508,7 @@ var thead_toNum = toNum;
58386
58508
  });
58387
58509
  };
58388
58510
  var renderSort = function renderSort(column) {
58389
- var _sortInfo$get;
58511
+ var _sortInfo$get, _ref, _column$sortDirection;
58390
58512
  if (!column.sorter) {
58391
58513
  return null;
58392
58514
  }
@@ -58397,6 +58519,7 @@ var thead_toNum = toNum;
58397
58519
  }
58398
58520
  };
58399
58521
  var isCustomRender = props.renderSorter && typeof props.renderSorter === 'function';
58522
+ var renderedSortDirections = (_ref = (_column$sortDirection = column.sortDirections) !== null && _column$sortDirection !== void 0 ? _column$sortDirection : props.sortDirections) !== null && _ref !== void 0 ? _ref : ['asc', 'desc'];
58400
58523
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
58401
58524
  className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sorterContainer,
58402
58525
  dir: config.direction,
@@ -58409,13 +58532,13 @@ var thead_toNum = toNum;
58409
58532
  return handleChange('desc');
58410
58533
  }
58411
58534
  }) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
58412
- children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
58535
+ children: [renderedSortDirections.includes('asc') && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
58413
58536
  className: classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sorterAsc, currentOrder === 'asc' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sorterActive)),
58414
58537
  onClick: function onClick() {
58415
58538
  handleChange(currentOrder === 'asc' ? null : 'asc');
58416
58539
  },
58417
58540
  children: icons_config.table.SortUp
58418
- }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
58541
+ }), renderedSortDirections.includes('desc') && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
58419
58542
  className: classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sorterDesc, currentOrder === 'desc' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sorterActive)),
58420
58543
  onClick: function onClick() {
58421
58544
  handleChange(currentOrder === 'desc' ? null : 'desc');
@@ -59053,9 +59176,13 @@ var Tr = function Tr(props) {
59053
59176
  var tagName = el.tagName;
59054
59177
  if (tagName === 'TD' || tagName === 'TR') return false;
59055
59178
  if (tagName === 'A' || tagName === 'BUTTON' || tagName === 'INPUT') return true;
59056
- if (preventClasses.find(function (c) {
59057
- return el.classList.contains(c);
59058
- })) return true;
59179
+ var isPreventElement = preventClasses.find(function (cl) {
59180
+ var classes = cl === null || cl === void 0 ? void 0 : cl.split(' ');
59181
+ return classes.some(function (c) {
59182
+ return el.classList.contains(c);
59183
+ });
59184
+ });
59185
+ if (isPreventElement) return true;
59059
59186
  if (!el.parentElement) return true;
59060
59187
  return isNotExpandableElement(el.parentElement);
59061
59188
  };
@@ -59079,8 +59206,8 @@ var Tr = function Tr(props) {
59079
59206
  }
59080
59207
  }
59081
59208
  }
59082
- if (isNotExpandableElement(target)) return;
59083
59209
  if (props.rowClickExpand) {
59210
+ if (isNotExpandableElement(target)) return;
59084
59211
  props.handleExpandClick(props.expandCol, props.rawData, props.rowIndex);
59085
59212
  }
59086
59213
  });
@@ -59593,6 +59720,7 @@ var emptyRef = {
59593
59720
  data: treeData,
59594
59721
  colgroup: colgroup,
59595
59722
  sortInfo: sortInfo,
59723
+ sortDirections: props.sortDirections,
59596
59724
  onSorterChange: onSorterChange,
59597
59725
  dragCol: layoutFunc.dragCol,
59598
59726
  resizeCol: layoutFunc.resizeCol,
@@ -59815,7 +59943,10 @@ var emptyRef = {
59815
59943
  ref: tableRef,
59816
59944
  dir: config.direction,
59817
59945
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)(absolute_context.Provider, {
59818
- value: true,
59946
+ value: {
59947
+ absolute: true,
59948
+ scrollElRef: scrollRef
59949
+ },
59819
59950
  children: [renderTable(), renderLoading(), props.children]
59820
59951
  })
59821
59952
  })), renderPagination()]
@@ -66015,7 +66146,7 @@ var upload_interface = __webpack_require__(8821);
66015
66146
 
66016
66147
 
66017
66148
  /* harmony default export */ var src_0 = ({
66018
- version: '3.5.0-beta.7'
66149
+ version: '3.5.0-beta.8'
66019
66150
  });
66020
66151
  }();
66021
66152
  /******/ return __webpack_exports__;