doui-react 2.0.0 → 2.0.1-dev

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.
Files changed (47) hide show
  1. package/es/api/component/react-dom.js +11 -7
  2. package/es/form/component/form-item-map.d.ts +1 -0
  3. package/es/form/component/form-item-map.js +2 -1
  4. package/es/form/component/utils.d.ts +7 -7
  5. package/es/form/component/utils.js +1 -1
  6. package/es/grid/component/pagination.d.ts +10 -10
  7. package/es/hooks/hook/use-fetch.js +5 -12
  8. package/es/icon/hook/index.d.ts +258 -258
  9. package/es/open-modal/component/index.js +16 -1
  10. package/es/open-modal/component/modal.js +2 -0
  11. package/es/open-modal/style/index.js +2 -1
  12. package/es/open-modal/type/index.d.ts +5 -0
  13. package/es/radio/component/abstract-box.d.ts +61 -61
  14. package/es/radio/component/utils.js +1 -1
  15. package/es/select/component/use-select-options.d.ts +1 -1
  16. package/es/select/component/use-select-options.js +5 -2
  17. package/es/select/type/index.d.ts +2 -1
  18. package/es/table/component/utils.js +4 -5
  19. package/es/tabs/component/utils.d.ts +6 -6
  20. package/es/tooltip/component/index.d.ts +6 -6
  21. package/es/virtual-list/component/index.d.ts +1 -1
  22. package/es/virtual-list/component/index.js +4 -2
  23. package/es/virtual-list/type/index.d.ts +2 -1
  24. package/lib/api/component/react-dom.js +13 -9
  25. package/lib/form/component/form-item-map.d.ts +1 -0
  26. package/lib/form/component/form-item-map.js +2 -1
  27. package/lib/form/component/utils.d.ts +7 -7
  28. package/lib/form/component/utils.js +1 -1
  29. package/lib/grid/component/pagination.d.ts +10 -10
  30. package/lib/hooks/hook/use-fetch.js +5 -12
  31. package/lib/icon/hook/index.d.ts +258 -258
  32. package/lib/open-modal/component/index.js +17 -1
  33. package/lib/open-modal/component/modal.js +2 -0
  34. package/lib/open-modal/style/index.js +2 -1
  35. package/lib/open-modal/type/index.d.ts +5 -0
  36. package/lib/radio/component/abstract-box.d.ts +61 -61
  37. package/lib/radio/component/utils.js +1 -1
  38. package/lib/select/component/use-select-options.d.ts +1 -1
  39. package/lib/select/component/use-select-options.js +5 -2
  40. package/lib/select/type/index.d.ts +2 -1
  41. package/lib/table/component/utils.js +4 -5
  42. package/lib/tabs/component/utils.d.ts +6 -6
  43. package/lib/tooltip/component/index.d.ts +6 -6
  44. package/lib/virtual-list/component/index.d.ts +1 -1
  45. package/lib/virtual-list/component/index.js +4 -2
  46. package/lib/virtual-list/type/index.d.ts +2 -1
  47. package/package.json +1 -1
@@ -1,12 +1,15 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["hideBodyScroll"];
4
- import { hideBodyScroll } from "./..";
3
+ var _excluded = ["hideBodyScroll", "getContainer"];
4
+ import { $, executeFunction, hideBodyScroll } from "./..";
5
+ import _ from 'lodash';
5
6
  import { createRoot } from 'react-dom/client';
6
7
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
7
8
  function getContainer() {
9
+ var to = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
8
10
  var container = document.createElement('div');
9
- document.body.append(container);
11
+ var root = _.isString(to) ? $(to) : executeFunction(to);
12
+ root.append(container);
10
13
  return container;
11
14
  }
12
15
  // 处理React17和18版本的兼容性
@@ -29,7 +32,11 @@ function getReactDOM() {
29
32
  var closeFunctionSet = new Set();
30
33
  export function mountComponent(Component) {
31
34
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
32
- var container = getContainer();
35
+ var _props$hideBodyScroll = props.hideBodyScroll,
36
+ hide = _props$hideBodyScroll === void 0 ? false : _props$hideBodyScroll,
37
+ outerContainer = props.getContainer,
38
+ restProps = _objectWithoutProperties(props, _excluded);
39
+ var container = getContainer(outerContainer);
33
40
  var _getReactDOM = getReactDOM(),
34
41
  render = _getReactDOM.render,
35
42
  unmount = _getReactDOM.unmount;
@@ -39,9 +46,6 @@ export function mountComponent(Component) {
39
46
  closeFunctionSet.delete(close);
40
47
  !closeFunctionSet.size && hideBodyScroll(false);
41
48
  };
42
- var _props$hideBodyScroll = props.hideBodyScroll,
43
- hide = _props$hideBodyScroll === void 0 ? false : _props$hideBodyScroll,
44
- restProps = _objectWithoutProperties(props, _excluded);
45
49
  hide && hideBodyScroll();
46
50
  render(_jsx(Component, _objectSpread(_objectSpread({}, restProps), {}, {
47
51
  unmount: close,
@@ -14,6 +14,7 @@ export interface FormItemSelectProps extends Pick<FormItemProps, 'requiredInOpti
14
14
  export declare function useCollectFormItemState({ name, collectState, filterNotExistValue, requiredInOptions, form: outerForm, ...props }: FormItemSelectProps): {
15
15
  __filterNotExistValue__: boolean;
16
16
  __callback__: import("use-debounce").DebouncedState<({ loading, options, value }: SelectCallbackProps) => Promise<void>>;
17
+ __callbackDeps__: (string | number | boolean | undefined)[];
17
18
  labelInValue?: boolean | undefined;
18
19
  };
19
20
  declare function FormItemSelect(props: FormItemSelectProps & SelectProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -84,7 +84,8 @@ export function useCollectFormItemState(_ref) {
84
84
  }
85
85
  return _objectSpread(_objectSpread({}, props), {}, {
86
86
  __filterNotExistValue__: !!requiredInOptionsAndFilterNotExistValue,
87
- __callback__: useDebounce(onCallback)
87
+ __callback__: useDebounce(onCallback),
88
+ __callbackDeps__: [filterNotExistValue, requiredInOptions]
88
89
  });
89
90
  }
90
91
  function FormItemSelect(props) {
@@ -38,21 +38,21 @@ export declare function getFormItemProps(props: any): {
38
38
  defaultVisible?: boolean | undefined;
39
39
  onVisibleChange?: ((visible: boolean) => void) | undefined;
40
40
  afterVisibleChange?: ((visible: boolean) => void) | undefined;
41
- zIndex?: number | undefined;
42
41
  animation?: string | undefined;
43
- motion?: import("rc-motion").CSSMotionProps | undefined;
44
- id?: string | undefined;
45
- prefixCls?: string | undefined;
46
42
  transitionName?: string | undefined;
43
+ prefixCls?: string | undefined;
44
+ zIndex?: number | undefined;
45
+ forceRender?: boolean | undefined;
46
+ id?: string | undefined;
47
+ align?: import("@rc-component/trigger").AlignType | undefined;
48
+ motion?: import("rc-motion").CSSMotionProps | undefined;
47
49
  mouseEnterDelay?: number | undefined;
48
50
  mouseLeaveDelay?: number | undefined;
49
51
  onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
50
52
  overlayClassName?: string | undefined;
51
- align?: import("@rc-component/trigger").AlignType | undefined;
52
53
  overlayStyle?: import("react").CSSProperties | undefined;
53
54
  trigger?: import("@rc-component/trigger").ActionType | import("@rc-component/trigger").ActionType[] | undefined;
54
55
  popupVisible?: boolean | undefined;
55
- forceRender?: boolean | undefined;
56
56
  fresh?: boolean | undefined;
57
57
  getTooltipContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
58
58
  showArrow?: boolean | import("@rc-component/trigger").ArrowType | undefined;
@@ -85,7 +85,7 @@ export declare function transformPathToName(path?: NamePath): string | undefined
85
85
  export declare function transformKeyToPath(params?: Record<string, any>): Record<string, any>;
86
86
  export declare function parseFormFailedError(error: ValidateErrorEntity): Record<string, string>;
87
87
  export declare function noStyle(item: FormItemProps): boolean;
88
- export declare function transformOptions(item: FormItemProps, values: FormValues, params: CommonParams): import("../../api").FunctionReturn<SelectOptions> | ((values: FormValues, params: import("..").OptionsParams) => import("../../api").FunctionReturn<SelectOptions>) | ((search?: string) => import("../../api").FunctionReturn<SelectOptions>) | undefined;
88
+ export declare function transformOptions(item: FormItemProps, values: FormValues, params: CommonParams): ((values: FormValues, params: import("..").OptionsParams) => import("../../api").FunctionReturn<SelectOptions>) | import("../../api").FunctionReturn<SelectOptions> | ((search?: string) => import("../../api").FunctionReturn<SelectOptions>) | undefined;
89
89
  interface FocusFirstInputParams extends CommonParams {
90
90
  focusFirstOnMount: FormProps['focusFirstOnMount'];
91
91
  }
@@ -149,7 +149,7 @@ function generateRules(_ref2) {
149
149
  var _form$getItems;
150
150
  var value = _ref3.value;
151
151
  var options = (_form$getItems = form.getItems(item.name)) === null || _form$getItems === void 0 ? void 0 : _form$getItems.options;
152
- if (!isEmpty(value) && isValueNotExistInOptions(value, options)) {
152
+ if (!isEmpty(value) && options && isValueNotExistInOptions(value, options)) {
153
153
  return _message;
154
154
  }
155
155
  };
@@ -23,11 +23,13 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
23
23
  showSizeChanger?: boolean | import("antd").SelectProps<any, import("rc-select/lib/Select").DefaultOptionType> | undefined;
24
24
  selectComponentClass?: any;
25
25
  pageSizeOptions?: (string | number)[] | undefined;
26
- style?: import("react").CSSProperties | undefined;
27
26
  className?: string | undefined;
27
+ style?: import("react").CSSProperties | undefined;
28
+ prefixCls?: string | undefined;
29
+ disabled?: boolean | undefined;
28
30
  "aria-activedescendant"?: string | undefined;
29
31
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
30
- "aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
32
+ "aria-autocomplete"?: "inline" | "none" | "list" | "both" | undefined;
31
33
  "aria-braillelabel"?: string | undefined;
32
34
  "aria-brailleroledescription"?: string | undefined;
33
35
  "aria-busy"?: (boolean | "true" | "false") | undefined;
@@ -37,7 +39,7 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
37
39
  "aria-colindextext"?: string | undefined;
38
40
  "aria-colspan"?: number | undefined;
39
41
  "aria-controls"?: string | undefined;
40
- "aria-current"?: boolean | "time" | "page" | "true" | "false" | "step" | "location" | "date" | undefined;
42
+ "aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
41
43
  "aria-describedby"?: string | undefined;
42
44
  "aria-description"?: string | undefined;
43
45
  "aria-details"?: string | undefined;
@@ -47,7 +49,7 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
47
49
  "aria-expanded"?: (boolean | "true" | "false") | undefined;
48
50
  "aria-flowto"?: string | undefined;
49
51
  "aria-grabbed"?: (boolean | "true" | "false") | undefined;
50
- "aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined;
52
+ "aria-haspopup"?: boolean | "dialog" | "menu" | "tree" | "true" | "false" | "grid" | "listbox" | undefined;
51
53
  "aria-hidden"?: (boolean | "true" | "false") | undefined;
52
54
  "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
53
55
  "aria-keyshortcuts"?: string | undefined;
@@ -58,13 +60,13 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
58
60
  "aria-modal"?: (boolean | "true" | "false") | undefined;
59
61
  "aria-multiline"?: (boolean | "true" | "false") | undefined;
60
62
  "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
61
- "aria-orientation"?: "vertical" | "horizontal" | undefined;
63
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
62
64
  "aria-owns"?: string | undefined;
63
65
  "aria-placeholder"?: string | undefined;
64
66
  "aria-posinset"?: number | undefined;
65
67
  "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
66
68
  "aria-readonly"?: (boolean | "true" | "false") | undefined;
67
- "aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
69
+ "aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
68
70
  "aria-required"?: (boolean | "true" | "false") | undefined;
69
71
  "aria-roledescription"?: string | undefined;
70
72
  "aria-rowcount"?: number | undefined;
@@ -78,12 +80,10 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
78
80
  "aria-valuemin"?: number | undefined;
79
81
  "aria-valuenow"?: number | undefined;
80
82
  "aria-valuetext"?: string | undefined;
81
- disabled?: boolean | undefined;
82
83
  locale?: import("rc-pagination").PaginationLocale | undefined;
84
+ align?: "center" | "start" | "end" | undefined;
83
85
  prevIcon?: import("react").ReactNode | import("react").ComponentType<{}>;
84
86
  nextIcon?: import("react").ReactNode | import("react").ComponentType<{}>;
85
- prefixCls?: string | undefined;
86
- align?: "center" | "end" | "start" | undefined;
87
87
  selectPrefixCls?: string | undefined;
88
88
  defaultCurrent?: number | undefined;
89
89
  defaultPageSize?: number | undefined;
@@ -98,7 +98,7 @@ export declare function usePagination({ data, rows, column, pagination }: Pagina
98
98
  jumpPrevIcon?: import("react").ReactNode | import("react").ComponentType<{}>;
99
99
  jumpNextIcon?: import("react").ReactNode | import("react").ComponentType<{}>;
100
100
  onShowSizeChange?: ((current: number, size: number) => void) | undefined;
101
- itemRender?: ((page: number, type: "page" | "prev" | "next" | "jump-prev" | "jump-next", element: import("react").ReactNode) => import("react").ReactNode) | undefined;
101
+ itemRender?: ((page: number, type: "next" | "page" | "prev" | "jump-prev" | "jump-next", element: import("react").ReactNode) => import("react").ReactNode) | undefined;
102
102
  showTotal?: ((total: number, range: [number, number]) => import("react").ReactNode) | undefined;
103
103
  justify?: "center" | "left" | "right" | "between" | undefined;
104
104
  };
@@ -6,7 +6,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
6
  var _excluded = ["wait"];
7
7
  import { useDebounce, useDeepEffect } from "./..";
8
8
  import _ from 'lodash';
9
- import isEqual from 'react-fast-compare';
10
9
  import { useLatest, useSetState } from 'react-use';
11
10
  var defaultOptions = {
12
11
  automatic: true,
@@ -45,7 +44,8 @@ export function useFetch(_fn, dependencyList, options) {
45
44
  args[_key] = _args[_key];
46
45
  }
47
46
  setState({
48
- loading: true
47
+ loading: true,
48
+ error: undefined
49
49
  });
50
50
  _context.prev = 2;
51
51
  _context.next = 5;
@@ -65,16 +65,9 @@ export function useFetch(_fn, dependencyList, options) {
65
65
  }
66
66
  return _context.abrupt("return");
67
67
  case 10:
68
- setState(function (prevState) {
69
- if (isEqual(prevState.data, data)) {
70
- return {
71
- loading: false
72
- };
73
- }
74
- return {
75
- loading: false,
76
- data: data
77
- };
68
+ setState({
69
+ loading: false,
70
+ data: data
78
71
  });
79
72
  _context.next = 16;
80
73
  break;