@qsxy/element-plus-react 1.0.0-next.3 → 1.0.0-next.4

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/README.md CHANGED
@@ -7,7 +7,11 @@
7
7
 
8
8
  ## Usage
9
9
 
10
- TODO
10
+ ```javascript
11
+ // how to use
12
+ import '@qsxy/element-plus-react/dist/index.css';
13
+ import { ElButton, ElLink } from '@qsxy/element-plus-react';
14
+ ```
11
15
 
12
16
  ## Options
13
17
 
@@ -20,12 +24,6 @@ TODO
20
24
  $ npm i @qsxy/element-plus-react
21
25
  ```
22
26
 
23
- ```javascript
24
- // how to use
25
- import '@qsxy/element-plus-react/dist/index.css';
26
- import { ElButton, ElLink } from '@qsxy/element-plus-react';
27
- ```
28
-
29
27
  ## LICENSE
30
28
 
31
29
  MIT
@@ -50,7 +50,7 @@ var Badge = (0, import_react.forwardRef)((props, ref) => {
50
50
  }
51
51
  return `${value}`;
52
52
  }, [isDot, max, value]);
53
- return /* @__PURE__ */ import_react.default.createElement("div", { ref, className: (0, import_classnames.default)(b(), props.className), style: props.style }, props.children, /* @__PURE__ */ import_react.default.createElement(import_Transition.default, { nodeRef, name: "r-zoom-in-center", visible: !hidden && (!!content || isDot) && !(!showZero && value === 0), display: "inline-flex" }, /* @__PURE__ */ import_react.default.createElement(
53
+ return /* @__PURE__ */ import_react.default.createElement("div", { ref, className: (0, import_classnames.default)(b(), props.className), style: props.style }, props.children, /* @__PURE__ */ import_react.default.createElement(import_Transition.default, { nodeRef, name: b("zoom-in-center", false), visible: !hidden && (!!content || isDot) && !(!showZero && value === 0), display: "inline-flex" }, /* @__PURE__ */ import_react.default.createElement(
54
54
  "sup",
55
55
  {
56
56
  ref: nodeRef,
@@ -79,7 +79,7 @@ var CollapseItem = (0, import_react.memo)((props) => {
79
79
  import_Transition.Transition,
80
80
  {
81
81
  nodeRef: containerRef,
82
- name: "r-menu-collapse",
82
+ name: b("menu-collapse", false),
83
83
  duration: 300,
84
84
  visible: active,
85
85
  beforeEnter: () => (0, import_CollapseTransition.beforeEnter)(containerRef),
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DateTimePickerRef } from './typings';
3
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("..").DatePickerProps, "name" | "value" | "type" | "defaultValue" | "onChange"> & {
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("..").DatePickerProps, "value" | "defaultValue" | "type" | "onChange" | "name"> & {
4
4
  name?: string;
5
5
  value?: string;
6
6
  defaultValue?: string;
@@ -71,7 +71,7 @@ var DateTimePicker = (0, import_react.forwardRef)((props, ref) => {
71
71
  formatter,
72
72
  ...rest
73
73
  } = props;
74
- const { e, is } = (0, import_hooks.useClassNames)(classPrefix);
74
+ const { b, e, is } = (0, import_hooks.useClassNames)(classPrefix);
75
75
  const [value, setValue] = (0, import_hooks.useControlled)(props.value, props.defaultValue);
76
76
  const [visible, setVisible] = (0, import_react.useState)(false);
77
77
  const [showTime, setShowTime] = (0, import_react.useState)(false);
@@ -129,7 +129,7 @@ var DateTimePicker = (0, import_react.forwardRef)((props, ref) => {
129
129
  onClick: onActive,
130
130
  value,
131
131
  onClear: () => handleChange(null, {}),
132
- className: (0, import_classnames.default)({ "r-date": readonly }, is({ active: visible })),
132
+ className: (0, import_classnames.default)({ [b("date", false)]: readonly }, is({ active: visible })),
133
133
  style: props.style,
134
134
  error,
135
135
  warning,
@@ -192,7 +192,7 @@ var DateTimePicker = (0, import_react.forwardRef)((props, ref) => {
192
192
  {
193
193
  nodeRef: () => ({ current: timePanelRef.current.ref }),
194
194
  visible: showTime,
195
- name: "r-slide-up",
195
+ name: b("slide-up", false),
196
196
  transitionAppear: true,
197
197
  unmountOnExit: true,
198
198
  display: "",
@@ -3,7 +3,7 @@ import { TransitionProps } from '../Transition';
3
3
  import { AnimationEventProps, BaseProps, NativeProps } from '../types/common';
4
4
  export interface DialogProps extends AnimationEventProps, BaseProps, NativeProps, TransitionProps {
5
5
  /** 是否显示模态框(可控) */
6
- visible?: boolean;
6
+ visible: boolean;
7
7
  /** 默认是否显示模态框 */
8
8
  defaultVisible?: boolean;
9
9
  /** 是否需要遮罩层 */
@@ -50,7 +50,7 @@ export interface DialogProps extends AnimationEventProps, BaseProps, NativeProps
50
50
  /** Dialog 关闭动画结束时的回调 */
51
51
  onClosed?: () => void;
52
52
  /** 关闭弹窗函数 */
53
- close?: () => void;
53
+ close: () => void;
54
54
  /** 关闭前的回调,会暂停 Dialog 的关闭. 回调函数内执行 done 参数方法的时候才是真正关闭对话框的时候. */
55
55
  beforeClose?: DialogBeforeCloseFn;
56
56
  }
@@ -39,6 +39,7 @@ var import_react_dom = require("react-dom");
39
39
  var import_Transition = require("../Transition");
40
40
  var import_Util = require("../Util");
41
41
  var import_hooks = require("../hooks");
42
+ var import_prefix = require("../hooks/prefix");
42
43
  var import_DrawerBody = __toESM(require("./DrawerBody"));
43
44
  var import_DrawerContext = require("./DrawerContext");
44
45
  var import_DrawerFooter = __toESM(require("./DrawerFooter"));
@@ -76,14 +77,14 @@ function InternalComp(props, ref) {
76
77
  setVisible(false);
77
78
  onClose == null ? void 0 : onClose();
78
79
  } else if (backdrop === "static") {
79
- (0, import_dom_lib.addClass)(drawerRef.current, "r-drawer-shake");
80
+ (0, import_dom_lib.addClass)(drawerRef.current, `${import_prefix.globalKey}-drawer-shake`);
80
81
  setTimeout(() => {
81
- (0, import_dom_lib.removeClass)(drawerRef.current, "r-drawer-shake");
82
+ (0, import_dom_lib.removeClass)(drawerRef.current, `${import_prefix.globalKey}-drawer-shake`);
82
83
  }, 300);
83
84
  }
84
85
  });
85
86
  }
86
- }, [backdrop, onClose, ref, setVisible, visible]);
87
+ }, [b, backdrop, onClose, ref, setVisible, visible]);
87
88
  return /* @__PURE__ */ import_react.default.createElement(import_DrawerContext.DrawerContext.Provider, { value: { backdrop, setVisible, isControlled, onClose } }, backdrop && (0, import_react_dom.createPortal)(
88
89
  /* @__PURE__ */ import_react.default.createElement(
89
90
  import_Transition.Transition,
@@ -95,12 +96,12 @@ function InternalComp(props, ref) {
95
96
  duration: 300,
96
97
  onEnter: () => {
97
98
  setTimeout(() => {
98
- (0, import_dom_lib.addClass)(backdropRef.current, "r-anim-in");
99
+ (0, import_dom_lib.addClass)(backdropRef.current, `${import_prefix.globalKey}-anim-in`);
99
100
  }, 10);
100
101
  },
101
- beforeLeave: () => (0, import_dom_lib.removeClass)(backdropRef.current, "r-anim-in")
102
+ beforeLeave: () => (0, import_dom_lib.removeClass)(backdropRef.current, `${import_prefix.globalKey}-anim-in`)
102
103
  },
103
- /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(b`backdrop`, "r-anim-fade"), style: { zIndex: import_Util.PopupManager.nextZIndex() }, ref: backdropRef })
104
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(b`backdrop`, `${import_prefix.globalKey}-anim-fade`), style: { zIndex: import_Util.PopupManager.nextZIndex() }, ref: backdropRef })
104
105
  ),
105
106
  document.body
106
107
  ), (0, import_react_dom.createPortal)(
@@ -119,15 +120,23 @@ function InternalComp(props, ref) {
119
120
  },
120
121
  beforeLeave: () => {
121
122
  var _a;
122
- (0, import_dom_lib.removeClass)(drawerRef.current, "r-anim-slide-in");
123
- (0, import_dom_lib.addClass)(drawerRef.current, "r-anim-slide-out");
123
+ (0, import_dom_lib.removeClass)(drawerRef.current, `${import_prefix.globalKey}-anim-slide-in`);
124
+ (0, import_dom_lib.addClass)(drawerRef.current, `${import_prefix.globalKey}-anim-slide-out`);
124
125
  (_a = props.beforeLeave) == null ? void 0 : _a.call(props);
125
126
  },
126
127
  onLeave: props.onLeave,
127
128
  afterLeave: props.afterLeave,
128
129
  duration: 300
129
130
  },
130
- /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(b`wrapper`, props.className), style: { ...props.style, zIndex: import_Util.PopupManager.nextZIndex() }, ref: ref || wrapperRef }, /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(wb(size, placement), "r-anim-slide-in", `r-anim-${placement}`), style: { display: "block" }, ref: drawerRef }, /* @__PURE__ */ import_react.default.createElement("div", { className: b`dialog` }, /* @__PURE__ */ import_react.default.createElement("div", { className: b`content` }, children))))
131
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(b`wrapper`, props.className), style: { ...props.style, zIndex: import_Util.PopupManager.nextZIndex() }, ref: ref || wrapperRef }, /* @__PURE__ */ import_react.default.createElement(
132
+ "div",
133
+ {
134
+ className: (0, import_classnames.default)(wb(size, placement), `${import_prefix.globalKey}-anim-slide-in`, `${import_prefix.globalKey}-anim-${placement}`),
135
+ style: { display: "block" },
136
+ ref: drawerRef
137
+ },
138
+ /* @__PURE__ */ import_react.default.createElement("div", { className: b`dialog` }, /* @__PURE__ */ import_react.default.createElement("div", { className: b`content` }, children))
139
+ ))
131
140
  ),
132
141
  document.body
133
142
  ));
@@ -86,7 +86,7 @@ var Dropdown = (props) => {
86
86
  import_Tooltip.default,
87
87
  {
88
88
  classPrefix,
89
- triggerRef: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children),
89
+ triggerRef: props.children,
90
90
  popperClass: e`popper`,
91
91
  disabled,
92
92
  enterable: true,
@@ -3,7 +3,7 @@ import { PopperOptions } from '../Popper';
3
3
  import { TransitionProps } from '../Transition';
4
4
  import { AnimationEventProps, BaseProps, NativeProps } from '../types/common';
5
5
  /** Dropdown 属性 */
6
- export interface DropdownProps extends BaseProps, NativeProps, PopperOptions, AnimationEventProps, TransitionProps {
6
+ export interface DropdownProps extends BaseProps<React.ReactElement>, NativeProps, PopperOptions, AnimationEventProps, Omit<TransitionProps, 'children'> {
7
7
  menu: React.ReactElement<DropdownMenuProps>;
8
8
  /** 触发下拉的行为 */
9
9
  trigger?: 'hover' | 'click' | 'contextmenu';
@@ -316,7 +316,7 @@ function InternalInput(props, ref) {
316
316
  }
317
317
  }
318
318
  ))),
319
- suffixSlot && /* @__PURE__ */ import_react.default.createElement("span", { ref: suffixRef, key: "suffixSlot", className: (0, import_classnames.default)(e`suffix`, { "r-click": suffixCanClick }), onClick: onClickSuffix }, /* @__PURE__ */ import_react.default.createElement("span", { className: e`suffix-inner` }, suffixSlot))
319
+ suffixSlot && /* @__PURE__ */ import_react.default.createElement("span", { ref: suffixRef, key: "suffixSlot", className: (0, import_classnames.default)(e`suffix`, { [b("click", false)]: suffixCanClick }), onClick: onClickSuffix }, /* @__PURE__ */ import_react.default.createElement("span", { className: e`suffix-inner` }, suffixSlot))
320
320
  );
321
321
  }, [
322
322
  type,
@@ -342,6 +342,7 @@ function InternalInput(props, ref) {
342
342
  maxLength,
343
343
  handelClear,
344
344
  suffixSlot,
345
+ b,
345
346
  suffixCanClick,
346
347
  onClickSuffix,
347
348
  showClear,
@@ -77,7 +77,7 @@ var Popconfirm = (props) => {
77
77
  classPrefix,
78
78
  popperClass: b("popover", false),
79
79
  popperStyle: { minWidth: 200 },
80
- triggerRef: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children),
80
+ triggerRef: props.children,
81
81
  enterable: true,
82
82
  effect: "light",
83
83
  trigger: "click",
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  import { IconName } from '../Icon';
2
3
  import { PopperOptions } from '../Popper';
3
4
  import { BaseProps, NativeProps, TypeAttributes } from '../types/common';
4
- export interface PopconfirmProps extends BaseProps, NativeProps, PopperOptions {
5
+ export interface PopconfirmProps extends BaseProps<React.ReactElement>, NativeProps, PopperOptions {
5
6
  classPrefix?: string;
6
7
  /** 显示的内容 */
7
8
  title: string;
@@ -71,7 +71,7 @@ var Popover = (props) => {
71
71
  classPrefix,
72
72
  popperClass: (0, import_classnames.default)(b(), { [m`plain`]: plain }),
73
73
  popperStyle: { width },
74
- triggerRef: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children),
74
+ triggerRef: props.children,
75
75
  enterable: true,
76
76
  effect: "light",
77
77
  placement,
@@ -3,7 +3,7 @@ import { PopperOptions } from '../Popper';
3
3
  import { TransitionProps } from '../Transition';
4
4
  import { AnimationEventProps, BaseProps, NativeProps } from '../types/common';
5
5
  /** Dropdown 属性 */
6
- export interface PopoverProps extends BaseProps, NativeProps, PopperOptions, AnimationEventProps, TransitionProps {
6
+ export interface PopoverProps extends BaseProps<React.ReactElement>, NativeProps, PopperOptions, AnimationEventProps, Omit<TransitionProps, 'children'> {
7
7
  /** 触发下拉的行为 */
8
8
  trigger?: 'hover' | 'click' | 'contextmenu';
9
9
  /** 标题 */
@@ -46,4 +46,4 @@ export declare const activeRow: <T>(payload: T) => Action;
46
46
  * @param payload
47
47
  * @returns
48
48
  */
49
- export declare const onCheck: <T>(payload: Pick<State<T>, "isIndeterminate" | "selection">) => Action;
49
+ export declare const onCheck: <T>(payload: Pick<State<T>, "selection" | "isIndeterminate">) => Action;
@@ -36,7 +36,7 @@ var import_prefix = require("../hooks/prefix");
36
36
  var TableIdManager = {
37
37
  tableId: 0,
38
38
  columnId: 0,
39
- nextTableId: () => `r-table_${++TableIdManager.tableId}`,
39
+ nextTableId: () => `${import_prefix.globalKey}-table_${++TableIdManager.tableId}`,
40
40
  nextColumnId: (start) => `column_${start ? ++start : ++TableIdManager.columnId}`
41
41
  };
42
42
  var cacheStringFunction = (fn) => {
package/dist/Tabs/Tabs.js CHANGED
@@ -171,7 +171,7 @@ var Tabs = (0, import_react.forwardRef)((props, ref) => {
171
171
  let offset = 0;
172
172
  let tabSize = 0;
173
173
  const sizeDir = sizeName === "offsetWidth" ? "X" : "Y";
174
- (0, import_forEach.default)((_a = elRef.current) == null ? void 0 : _a.querySelectorAll(".r-tabs__item"), (el) => {
174
+ (0, import_forEach.default)((_a = elRef.current) == null ? void 0 : _a.querySelectorAll("." + e`item`), (el) => {
175
175
  var _a2;
176
176
  if ((0, import_dom_lib.hasClass)(el, "is-active")) {
177
177
  tabSize = el[sizeName === "offsetWidth" ? "clientWidth" : "clientHeight"];
@@ -199,6 +199,7 @@ var TimePicker = (0, import_react.forwardRef)((props, ref) => {
199
199
  setVisible(false);
200
200
  setValue(initialValue.current);
201
201
  },
202
+ onEnter: () => timePanelRef.current.adjustSpinners(),
202
203
  ...animationInputProps,
203
204
  transitionAppear: true,
204
205
  unmountOnExit: true
@@ -186,8 +186,9 @@ var TimeSpinnerPanel = (0, import_react.memo)(
186
186
  ),
187
187
  type === "hours" ? 23 : 59
188
188
  );
189
- debouncedResetScroll(type);
190
189
  modifyDateField(type, value);
190
+ debouncedResetScroll(type);
191
+ isScrolling.current = false;
191
192
  },
192
193
  [debouncedResetScroll, listRefsMap, modifyDateField, scrollBarHeight, typeItemHeight]
193
194
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qsxy/element-plus-react",
3
- "version": "1.0.0-next.3",
3
+ "version": "1.0.0-next.4",
4
4
  "description": "element-plus-react",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",