@ucloud-fe/react-components 1.5.1 → 1.5.2

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.
@@ -22,6 +22,8 @@ export interface DefinedActionListProps {
22
22
  actionList: ActionInfo[];
23
23
  /** 暴露的操作数量 */
24
24
  exposeCount?: number;
25
+ /** 是否自动按照宽度调整展示数量 */
26
+ autoAdjustment?: boolean;
25
27
  /** 控件尺寸 */
26
28
  size?: Size;
27
29
  /** 操作数量等于 exposeCount+1 时是否直接显示按钮而不是显示下拉菜单 */
@@ -34,5 +36,5 @@ export interface DefinedActionListProps {
34
36
  popoverProps?: any;
35
37
  }
36
38
  export declare type ActionListProps = DefinedActionListProps & Override<HTMLAttributes<HTMLDivElement>, DefinedActionListProps>;
37
- declare const _default: React.MemoExoticComponent<({ actionList, exposeCount, size, smart, buttonStyleType, popoverProps, dropdownButton, className, ...rest }: ActionListProps) => JSX.Element>;
39
+ declare const _default: React.MemoExoticComponent<({ autoAdjustment: _autoAdjustment, ...rest }: ActionListProps) => JSX.Element>;
38
40
  export default _default;
@@ -33,18 +33,24 @@ var _Popover = _interopRequireDefault(require("../../components/Popover"));
33
33
 
34
34
  var _Tooltip = _interopRequireDefault(require("../../components/Tooltip"));
35
35
 
36
- var _Combine = _interopRequireDefault(require("../../components/Combine"));
37
-
38
36
  var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
39
37
 
40
38
  var _usePopoverConfig = _interopRequireDefault(require("../../hooks/usePopoverConfig"));
41
39
 
40
+ var _useOverflow3 = _interopRequireDefault(require("../../hooks/useOverflow"));
41
+
42
42
  var _style = require("./style");
43
43
 
44
+ var _useConfig2 = _interopRequireDefault(require("../../hooks/useConfig"));
45
+
46
+ var _config = _interopRequireDefault(require("../../config"));
47
+
44
48
  var _excluded = ["onClick", "disabled", "handleHide"],
45
49
  _excluded2 = ["label", "tooltip"],
46
50
  _excluded3 = ["label", "disabled", "onClick"],
47
- _excluded4 = ["actionList", "exposeCount", "size", "smart", "buttonStyleType", "popoverProps", "dropdownButton", "className"];
51
+ _excluded4 = ["actionList", "exposeCount", "size", "smart", "buttonStyleType", "popoverProps", "dropdownButton", "className"],
52
+ _excluded5 = ["actionList", "exposeCount", "smart"],
53
+ _excluded6 = ["autoAdjustment"];
48
54
 
49
55
  var _this = void 0;
50
56
 
@@ -190,7 +196,10 @@ var ActionMenu = function ActionMenu(_ref3) {
190
196
  }));
191
197
  }.bind(void 0);
192
198
 
193
- var ActionList = function ActionList(_ref4) {
199
+ var _uid = 0;
200
+ var ID_KEY = 'data-urc-action_list-id';
201
+
202
+ var PureActionList = function PureActionList(_ref4) {
194
203
  (0, _newArrowCheck2.default)(this, _this);
195
204
  var _ref4$actionList = _ref4.actionList,
196
205
  actionList = _ref4$actionList === void 0 ? [] : _ref4$actionList,
@@ -229,7 +238,7 @@ var ActionList = function ActionList(_ref4) {
229
238
  size: size,
230
239
  buttonStyleType: buttonStyleType
231
240
  };
232
- return /*#__PURE__*/_react.default.createElement(_Combine.default, (0, _extends2.default)({}, rest, {
241
+ return /*#__PURE__*/_react.default.createElement(_style.SWrap, (0, _extends2.default)({}, rest, {
233
242
  className: (0, _classnames.default)(_style.prefixCls, className),
234
243
  sharedProps: {
235
244
  size: size
@@ -245,6 +254,70 @@ var ActionList = function ActionList(_ref4) {
245
254
  })) : null);
246
255
  }.bind(void 0);
247
256
 
257
+ var AutoAdjustmentActionList = function AutoAdjustmentActionList(_ref5) {
258
+ var _this6 = this;
259
+
260
+ (0, _newArrowCheck2.default)(this, _this);
261
+
262
+ var _ref5$actionList = _ref5.actionList,
263
+ actionList = _ref5$actionList === void 0 ? [] : _ref5$actionList,
264
+ _ref5$exposeCount = _ref5.exposeCount,
265
+ _exposeCount = _ref5$exposeCount === void 0 ? 3 : _ref5$exposeCount,
266
+ smart = _ref5.smart,
267
+ rest = (0, _objectWithoutProperties2.default)(_ref5, _excluded5);
268
+
269
+ var _useState3 = (0, _react.useState)(function () {
270
+ (0, _newArrowCheck2.default)(this, _this6);
271
+ return _uid++;
272
+ }.bind(this)),
273
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
274
+ uid = _useState4[0];
275
+
276
+ var l = actionList.length;
277
+ var containerRef = (0, _react.useRef)(null);
278
+ (0, _react.useLayoutEffect)(function () {
279
+ (0, _newArrowCheck2.default)(this, _this6);
280
+ containerRef.current = document.querySelector("[".concat(ID_KEY, "=\"").concat(uid, "\"]"));
281
+ }.bind(this), [uid]);
282
+ var maxCount = (0, _react.useMemo)(function () {
283
+ (0, _newArrowCheck2.default)(this, _this6);
284
+ var maxCount = Math.min(l, Math.max(_exposeCount, 0));
285
+ if (maxCount === l - 1 && smart) maxCount = l;
286
+ return maxCount;
287
+ }.bind(this), [_exposeCount, l, smart]);
288
+
289
+ var _useOverflow = (0, _useOverflow3.default)({
290
+ containerRef: containerRef,
291
+ defaultCount: maxCount,
292
+ maxCount: maxCount
293
+ }),
294
+ _useOverflow2 = (0, _slicedToArray2.default)(_useOverflow, 1),
295
+ exposeCount = _useOverflow2[0];
296
+
297
+ return /*#__PURE__*/_react.default.createElement(PureActionList, (0, _extends2.default)({}, rest, {
298
+ actionList: actionList,
299
+ exposeCount: exposeCount,
300
+ smart: false
301
+ }, (0, _defineProperty2.default)({}, ID_KEY, uid)));
302
+ }.bind(void 0);
303
+
304
+ var ActionList = function ActionList(_ref7) {
305
+ (0, _newArrowCheck2.default)(this, _this);
306
+ var _autoAdjustment = _ref7.autoAdjustment,
307
+ rest = (0, _objectWithoutProperties2.default)(_ref7, _excluded6);
308
+
309
+ var _useConfig = (0, _useConfig2.default)(),
310
+ actionListAutoAdjustment = _useConfig.actionListAutoAdjustment;
311
+
312
+ var autoAdjustment = _autoAdjustment === undefined ? actionListAutoAdjustment === undefined ? _config.default.actionListAutoAdjustment : actionListAutoAdjustment : _autoAdjustment;
313
+
314
+ if (autoAdjustment) {
315
+ return /*#__PURE__*/_react.default.createElement(AutoAdjustmentActionList, rest);
316
+ } else {
317
+ return /*#__PURE__*/_react.default.createElement(PureActionList, rest);
318
+ }
319
+ }.bind(void 0);
320
+
248
321
  ActionList.propTypes = {
249
322
  actionList: _propTypes.default.arrayOf(_propTypes.default.shape({
250
323
  label: _propTypes.default.node,
@@ -266,6 +339,7 @@ ActionList.propTypes = {
266
339
  disabled: _propTypes.default.bool
267
340
  })).isRequired,
268
341
  exposeCount: _propTypes.default.number,
342
+ autoAdjustment: _propTypes.default.bool,
269
343
  smart: _propTypes.default.bool,
270
344
  popoverProps: _propTypes.default.any
271
345
  };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ActionListProps } from './ActionList';
3
3
  declare const ExportActionList: import("react").NamedExoticComponent<import("./ActionList").DefinedActionListProps & Omit<import("react").HTMLAttributes<HTMLDivElement>, keyof import("./ActionList").DefinedActionListProps>> & {
4
- readonly type: ({ actionList, exposeCount, size, smart, buttonStyleType, popoverProps, dropdownButton, className, ...rest }: ActionListProps) => JSX.Element;
4
+ readonly type: ({ autoAdjustment: _autoAdjustment, ...rest }: ActionListProps) => JSX.Element;
5
5
  } & {
6
6
  Sizes: ["sm", "md", "lg"];
7
7
  ButtonStyleTypes: ["primary", "border", "border-gray"];
@@ -1 +1,3 @@
1
+ /// <reference types="react" />
1
2
  export declare const prefixCls: string;
3
+ export declare const SWrap: import("@emotion/styled-base").StyledComponent<import("../../Combine/Combine").DefinedCombineProps & Omit<import("react").HTMLAttributes<HTMLDivElement>, keyof import("../../Combine/Combine").DefinedCombineProps>, Pick<import("../../Combine/Combine").DefinedCombineProps & Omit<import("react").HTMLAttributes<HTMLDivElement>, keyof import("../../Combine/Combine").DefinedCombineProps>, "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | keyof import("../../Combine/Combine").DefinedCombineProps>, object>;
@@ -5,10 +5,41 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.prefixCls = void 0;
8
+ exports.SWrap = exports.prefixCls = void 0;
9
+
10
+ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
11
+
12
+ var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));
13
+
14
+ var _core = require("@emotion/core");
15
+
16
+ var _Combine = _interopRequireDefault(require("../../../components/Combine"));
9
17
 
10
18
  var _config = _interopRequireDefault(require("../../../config"));
11
19
 
20
+ var _this = void 0;
21
+
22
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
23
+
12
24
  var _prefixCls = _config.default.prefixCls;
13
25
  var prefixCls = _prefixCls + '-actionlist';
14
- exports.prefixCls = prefixCls;
26
+ exports.prefixCls = prefixCls;
27
+
28
+ var _ref = process.env.NODE_ENV === "production" ? {
29
+ name: "1rn6kt6-SWrap",
30
+ styles: "white-space:nowrap;;label:SWrap;"
31
+ } : {
32
+ name: "1rn6kt6-SWrap",
33
+ styles: "white-space:nowrap;;label:SWrap;",
34
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0FjdGlvbkxpc3Qvc3R5bGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBVWMiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvQWN0aW9uTGlzdC9zdHlsZS9pbmRleC50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgQ29tYmluZSBmcm9tICdzcmMvY29tcG9uZW50cy9Db21iaW5lJztcbmltcG9ydCBjb25maWcgZnJvbSAnc3JjL2NvbmZpZyc7XG5cbmNvbnN0IHsgcHJlZml4Q2xzOiBfcHJlZml4Q2xzIH0gPSBjb25maWc7XG5leHBvcnQgY29uc3QgcHJlZml4Q2xzID0gX3ByZWZpeENscyArICctYWN0aW9ubGlzdCc7XG5cbmV4cG9ydCBjb25zdCBTV3JhcCA9IHN0eWxlZChDb21iaW5lKSgoKSA9PiB7XG4gICAgcmV0dXJuIGNzc2BcbiAgICAgICAgd2hpdGUtc3BhY2U6IG5vd3JhcDtcbiAgICBgO1xufSk7XG4iXX0= */",
35
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
36
+ };
37
+
38
+ var SWrap = ( /*#__PURE__*/0, _styledBase.default)(_Combine.default, {
39
+ target: "e17ez9160",
40
+ label: "SWrap"
41
+ })(function () {
42
+ (0, _newArrowCheck2.default)(this, _this);
43
+ return _ref;
44
+ }.bind(void 0), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0FjdGlvbkxpc3Qvc3R5bGUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU3FCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0FjdGlvbkxpc3Qvc3R5bGUvaW5kZXgudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IENvbWJpbmUgZnJvbSAnc3JjL2NvbXBvbmVudHMvQ29tYmluZSc7XG5pbXBvcnQgY29uZmlnIGZyb20gJ3NyYy9jb25maWcnO1xuXG5jb25zdCB7IHByZWZpeENsczogX3ByZWZpeENscyB9ID0gY29uZmlnO1xuZXhwb3J0IGNvbnN0IHByZWZpeENscyA9IF9wcmVmaXhDbHMgKyAnLWFjdGlvbmxpc3QnO1xuXG5leHBvcnQgY29uc3QgU1dyYXAgPSBzdHlsZWQoQ29tYmluZSkoKCkgPT4ge1xuICAgIHJldHVybiBjc3NgXG4gICAgICAgIHdoaXRlLXNwYWNlOiBub3dyYXA7XG4gICAgYDtcbn0pO1xuIl19 */");
45
+ exports.SWrap = SWrap;
@@ -4,6 +4,6 @@ export declare const defaultConfig: {
4
4
  forwardPopupContainer: boolean;
5
5
  preventFormDefaultAction: boolean;
6
6
  };
7
- export declare type ConfigContextType = Pick<ConfigProviderProps, 'forwardPopupContainer' | 'popover' | 'preventFormDefaultAction' | 'iconDefaultPrefix'>;
7
+ export declare type ConfigContextType = Pick<ConfigProviderProps, 'forwardPopupContainer' | 'popover' | 'preventFormDefaultAction' | 'iconDefaultPrefix' | 'actionListAutoAdjustment'>;
8
8
  declare const _default: import("react").Context<ConfigContextType>;
9
9
  export default _default;
@@ -33,6 +33,8 @@ export interface ConfigProviderProps {
33
33
  theme?: any;
34
34
  /** 提供时会使用 LocaleProvider 包裹 */
35
35
  locale?: AllLocaleMap;
36
+ /** 是否默认启用 ActionList 的 autoAdJustment 参数 */
37
+ actionListAutoAdjustment?: boolean;
36
38
  }
37
39
  declare const ConfigProvider: ({ children, theme, locale, ...rest }: ConfigProviderProps) => JSX.Element;
38
40
  export default ConfigProvider;
@@ -68,7 +68,8 @@ ConfigProvider.propTypes = {
68
68
  }),
69
69
  preventFormDefaultAction: _propTypes.default.bool,
70
70
  iconDefaultPrefix: _propTypes.default.string,
71
- theme: _propTypes.default.any
71
+ theme: _propTypes.default.any,
72
+ actionListAutoAdjustment: _propTypes.default.bool
72
73
  };
73
74
  var _default = ConfigProvider;
74
75
  exports.default = _default;
@@ -1,2 +1,4 @@
1
- import ConfigProvider from './ConfigProvider';
2
- export default ConfigProvider;
1
+ declare const ExportConfigProvider: (({ children, theme, locale, ...rest }: import("./ConfigProvider").ConfigProviderProps) => JSX.Element) & {
2
+ setConfig: (_config: any) => void;
3
+ };
4
+ export default ExportConfigProvider;
@@ -7,7 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _config = require("../../config");
11
+
12
+ var _type = require("../../type");
13
+
10
14
  var _ConfigProvider = _interopRequireDefault(require("./ConfigProvider"));
11
15
 
12
- var _default = _ConfigProvider.default;
16
+ var ExportConfigProvider = (0, _type.ExportComponent)(_ConfigProvider.default, {
17
+ setConfig: _config.setConfig
18
+ });
19
+ var _default = ExportConfigProvider;
13
20
  exports.default = _default;
@@ -44,7 +44,11 @@ export declare type DatePickerProps = {
44
44
  status?: 'default' | 'error';
45
45
  /** placeholder */
46
46
  placeholder?: string;
47
- /** 面板快捷内容 */
47
+ /**
48
+ * @deprecated 新版交互已移除相关展示
49
+ * @ignore
50
+ * 面板快捷内容
51
+ */
48
52
  shortcuts?: TShortcut[] | null;
49
53
  /** 自定义 popover,参考 popover */
50
54
  popoverProps?: any;
@@ -2,8 +2,6 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -17,9 +15,7 @@ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/new
17
15
 
18
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
19
17
 
20
- var _react = _interopRequireWildcard(require("react"));
21
-
22
- var _SelectContext = _interopRequireDefault(require("./SelectContext"));
18
+ var _react = _interopRequireDefault(require("react"));
23
19
 
24
20
  var _style = require("./style");
25
21
 
@@ -28,34 +24,12 @@ var _excluded = ["value", "children"],
28
24
 
29
25
  var _this = void 0;
30
26
 
31
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
-
33
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
-
35
27
  var Option = function Option(_ref) {
36
- var _this2 = this;
37
-
38
28
  (0, _newArrowCheck2.default)(this, _this);
39
29
  var value = _ref.value,
40
30
  children = _ref.children,
41
31
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
42
-
43
- var _useContext = (0, _react.useContext)(_SelectContext.default),
44
- handleSearch = _useContext.handleSearch,
45
- searchValue = _useContext.searchValue;
46
-
47
- var visible = (0, _react.useMemo)(function () {
48
- (0, _newArrowCheck2.default)(this, _this2);
49
- return handleSearch(value, {
50
- value: value,
51
- children: children
52
- });
53
- }.bind(this), // change when searchValue change
54
- // eslint-disable-next-line react-hooks/exhaustive-deps
55
- [children, handleSearch, value, searchValue]);
56
- return /*#__PURE__*/_react.default.createElement(_style.OptionWrap, (0, _extends2.default)({
57
- hidden: !visible
58
- }, rest, {
32
+ return /*#__PURE__*/_react.default.createElement(_style.OptionWrap, (0, _extends2.default)({}, rest, {
59
33
  itemKey: value
60
34
  }), children);
61
35
  }.bind(void 0);
@@ -25,7 +25,7 @@ export declare const SSelector: import("@emotion/styled-base").StyledComponent<P
25
25
  styleType: string;
26
26
  size: string;
27
27
  type: string;
28
- }, "styleType" | "size" | "type">> & Partial<Pick<{
28
+ }, "size" | "styleType" | "type">> & Partial<Pick<{
29
29
  styleType: string;
30
30
  size: string;
31
31
  type: string;
@@ -37,11 +37,11 @@ export declare const SSelector: import("@emotion/styled-base").StyledComponent<P
37
37
  styleType: string;
38
38
  size: string;
39
39
  type: string;
40
- }, "styleType" | "size" | "type">> & Partial<Pick<{
40
+ }, "size" | "styleType" | "type">> & Partial<Pick<{
41
41
  styleType: string;
42
42
  size: string;
43
43
  type: string;
44
- }, never>>, "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "form" | "block" | "loading" | "styleType" | "size" | "checked" | "disabled" | "value" | "type" | "icon" | "shape" | "fakeDisabled" | "checkAble" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name">, object>;
44
+ }, never>>, "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "form" | "size" | "block" | "loading" | "styleType" | "checked" | "disabled" | "value" | "type" | "icon" | "shape" | "fakeDisabled" | "checkAble" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name">, object>;
45
45
  export declare const SSelectorMultiple: React.ForwardRefExoticComponent<Pick<import("../../../components/Input").InputProps, "block" | "customStyle" | "disabled" | "status"> & Required<Pick<import("../../../components/Input").InputProps, "size">> & {
46
46
  focused?: boolean | undefined;
47
47
  empty?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TabsProps } from '../Tabs';
3
3
  export declare const prefixCls: string;
4
- export declare const SWrap: import("react").ForwardRefExoticComponent<Required<Pick<TabsProps, "styleType" | "size" | "tabBarPosition">> & import("react").HTMLAttributes<HTMLElement> & {
4
+ export declare const SWrap: import("react").ForwardRefExoticComponent<Required<Pick<TabsProps, "size" | "styleType" | "tabBarPosition">> & import("react").HTMLAttributes<HTMLElement> & {
5
5
  theme?: import("../../../style").Theme | undefined;
6
6
  } & import("react").RefAttributes<HTMLElement>>;
package/lib/config.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- declare namespace _default {
1
+ export default config;
2
+ export function setConfig(_config: any): void;
3
+ declare namespace config {
2
4
  const prefixCls: string;
5
+ const actionListAutoAdjustment: boolean;
3
6
  }
4
- export default _default;
package/lib/config.js CHANGED
@@ -1,10 +1,28 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.default = void 0;
7
- var _default = {
8
- prefixCls: 'uc-fe'
8
+ exports.setConfig = exports.default = void 0;
9
+
10
+ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
11
+
12
+ var _this = void 0;
13
+
14
+ var config = {
15
+ prefixCls: 'uc-fe',
16
+ actionListAutoAdjustment: false
9
17
  };
10
- exports.default = _default;
18
+ var _default = config;
19
+ /** 只能在组件初始化时使用,否则会导致意外的问题 */
20
+
21
+ exports.default = _default;
22
+
23
+ var setConfig = function setConfig(_config) {
24
+ (0, _newArrowCheck2.default)(this, _this);
25
+ Object.assign(config, _config);
26
+ }.bind(void 0);
27
+
28
+ exports.setConfig = setConfig;
@@ -0,0 +1,2 @@
1
+ declare const useConfig: () => import("../components/ConfigProvider/ConfigContext").ConfigContextType;
2
+ export default useConfig;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _ConfigContext = _interopRequireDefault(require("../components/ConfigProvider/ConfigContext"));
17
+
18
+ var _this = void 0;
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ var useConfig = function useConfig() {
25
+ (0, _newArrowCheck2.default)(this, _this);
26
+ return (0, _react.useContext)(_ConfigContext.default);
27
+ }.bind(void 0);
28
+
29
+ var _default = useConfig;
30
+ exports.default = _default;
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * 计算容器内的元素最大展示数量
4
+ * @returns {[number, number, boolean]} [当前测试的展示数, 最终确定的展示数, 是否在测试过程中]
5
+ */
6
+ declare const useOverflow: ({ containerRef, defaultCount, maxCount, minCount }: {
7
+ /**
8
+ * 容器元素的 ref
9
+ */
10
+ containerRef?: import("react").MutableRefObject<HTMLElement | null> | undefined;
11
+ /**
12
+ * 默认的初始展示数量
13
+ */
14
+ defaultCount?: number | undefined;
15
+ /**
16
+ * 最大展示数量,一般传入元素数量即可
17
+ */
18
+ maxCount: number;
19
+ /**
20
+ * 最小展示数量
21
+ */
22
+ minCount?: number | undefined;
23
+ }, deps?: any[]) => [number, number, boolean];
24
+ export default useOverflow;