antd-mobile 5.10.3 → 5.11.1

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 (134) hide show
  1. package/2x/cjs/components/button/button.d.ts +6 -4
  2. package/2x/cjs/components/button/button.js +31 -7
  3. package/2x/cjs/components/calendar/calendar.css +2 -2
  4. package/2x/cjs/components/calendar/calendar.d.ts +2 -0
  5. package/2x/cjs/components/calendar/calendar.js +6 -1
  6. package/2x/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  7. package/2x/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
  8. package/2x/cjs/components/cascade-picker/cascade-picker.js +2 -7
  9. package/2x/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
  10. package/2x/cjs/components/date-picker/date-picker.js +1 -0
  11. package/2x/cjs/components/dialog/dialog-action-button.js +3 -26
  12. package/2x/cjs/components/floating-panel/floating-panel.js +1 -1
  13. package/2x/cjs/components/form/context.d.ts +1 -0
  14. package/2x/cjs/components/form/context.js +2 -1
  15. package/2x/cjs/components/form/form-item.css +2 -2
  16. package/2x/cjs/components/form/form-item.js +5 -2
  17. package/2x/cjs/components/form/form.d.ts +0 -3
  18. package/2x/cjs/components/form/form.js +4 -2
  19. package/2x/cjs/components/form/index.css +2 -2
  20. package/2x/cjs/components/form/index.d.ts +2 -2
  21. package/2x/cjs/components/form/index.js +2 -1
  22. package/2x/cjs/components/index-bar/panel.d.ts +1 -0
  23. package/2x/cjs/components/input/input.css +4 -0
  24. package/2x/cjs/components/input/input.d.ts +2 -0
  25. package/2x/cjs/components/input/input.js +13 -2
  26. package/2x/cjs/components/modal/modal-action-button.js +3 -26
  27. package/2x/cjs/components/search-bar/search-bar.d.ts +2 -0
  28. package/2x/cjs/components/search-bar/search-bar.js +2 -0
  29. package/2x/cjs/global/index.js +2 -0
  30. package/2x/cjs/utils/get-scroll-parent.js +7 -4
  31. package/2x/es/components/button/button.d.ts +6 -4
  32. package/2x/es/components/button/button.js +30 -8
  33. package/2x/es/components/calendar/calendar.css +2 -2
  34. package/2x/es/components/calendar/calendar.d.ts +2 -0
  35. package/2x/es/components/calendar/calendar.js +6 -2
  36. package/2x/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  37. package/2x/es/components/cascade-picker/cascade-picker-utils.js +35 -15
  38. package/2x/es/components/cascade-picker/cascade-picker.js +3 -7
  39. package/2x/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
  40. package/2x/es/components/date-picker/date-picker.js +1 -0
  41. package/2x/es/components/dialog/dialog-action-button.js +3 -21
  42. package/2x/es/components/floating-panel/floating-panel.js +1 -1
  43. package/2x/es/components/form/context.d.ts +1 -0
  44. package/2x/es/components/form/context.js +2 -1
  45. package/2x/es/components/form/form-item.css +2 -2
  46. package/2x/es/components/form/form-item.js +5 -2
  47. package/2x/es/components/form/form.d.ts +0 -3
  48. package/2x/es/components/form/form.js +4 -2
  49. package/2x/es/components/form/index.css +2 -2
  50. package/2x/es/components/form/index.d.ts +2 -2
  51. package/2x/es/components/form/index.js +3 -2
  52. package/2x/es/components/index-bar/panel.d.ts +1 -0
  53. package/2x/es/components/input/input.css +4 -0
  54. package/2x/es/components/input/input.d.ts +2 -0
  55. package/2x/es/components/input/input.js +13 -2
  56. package/2x/es/components/modal/modal-action-button.js +3 -21
  57. package/2x/es/components/search-bar/search-bar.d.ts +2 -0
  58. package/2x/es/components/search-bar/search-bar.js +2 -0
  59. package/2x/es/global/index.js +2 -0
  60. package/2x/es/utils/get-scroll-parent.js +7 -4
  61. package/2x/package.json +2 -2
  62. package/bundle/antd-mobile.cjs.js +107 -98
  63. package/bundle/antd-mobile.es.js +108 -99
  64. package/bundle/style.css +7 -4
  65. package/cjs/components/button/button.d.ts +6 -4
  66. package/cjs/components/button/button.js +31 -7
  67. package/cjs/components/calendar/calendar.css +2 -2
  68. package/cjs/components/calendar/calendar.d.ts +2 -0
  69. package/cjs/components/calendar/calendar.js +6 -1
  70. package/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  71. package/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
  72. package/cjs/components/cascade-picker/cascade-picker.js +2 -7
  73. package/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
  74. package/cjs/components/date-picker/date-picker.js +1 -0
  75. package/cjs/components/dialog/dialog-action-button.js +3 -26
  76. package/cjs/components/floating-panel/floating-panel.js +1 -1
  77. package/cjs/components/form/context.d.ts +1 -0
  78. package/cjs/components/form/context.js +2 -1
  79. package/cjs/components/form/form-item.css +2 -2
  80. package/cjs/components/form/form-item.js +5 -2
  81. package/cjs/components/form/form.d.ts +0 -3
  82. package/cjs/components/form/form.js +4 -2
  83. package/cjs/components/form/index.css +2 -2
  84. package/cjs/components/form/index.d.ts +2 -2
  85. package/cjs/components/form/index.js +2 -1
  86. package/cjs/components/index-bar/panel.d.ts +1 -0
  87. package/cjs/components/input/input.css +3 -0
  88. package/cjs/components/input/input.d.ts +2 -0
  89. package/cjs/components/input/input.js +13 -2
  90. package/cjs/components/modal/modal-action-button.js +3 -26
  91. package/cjs/components/search-bar/search-bar.d.ts +2 -0
  92. package/cjs/components/search-bar/search-bar.js +2 -0
  93. package/cjs/global/index.js +2 -0
  94. package/cjs/utils/get-scroll-parent.js +7 -4
  95. package/es/components/button/button.d.ts +6 -4
  96. package/es/components/button/button.js +30 -8
  97. package/es/components/calendar/calendar.css +2 -2
  98. package/es/components/calendar/calendar.d.ts +2 -0
  99. package/es/components/calendar/calendar.js +6 -2
  100. package/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  101. package/es/components/cascade-picker/cascade-picker-utils.js +35 -15
  102. package/es/components/cascade-picker/cascade-picker.js +3 -7
  103. package/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
  104. package/es/components/date-picker/date-picker.js +1 -0
  105. package/es/components/dialog/dialog-action-button.js +3 -21
  106. package/es/components/floating-panel/floating-panel.js +1 -1
  107. package/es/components/form/context.d.ts +1 -0
  108. package/es/components/form/context.js +2 -1
  109. package/es/components/form/form-item.css +2 -2
  110. package/es/components/form/form-item.js +5 -2
  111. package/es/components/form/form.d.ts +0 -3
  112. package/es/components/form/form.js +4 -2
  113. package/es/components/form/index.css +2 -2
  114. package/es/components/form/index.d.ts +2 -2
  115. package/es/components/form/index.js +3 -2
  116. package/es/components/index-bar/panel.d.ts +1 -0
  117. package/es/components/input/input.css +3 -0
  118. package/es/components/input/input.d.ts +2 -0
  119. package/es/components/input/input.js +13 -2
  120. package/es/components/modal/modal-action-button.js +3 -21
  121. package/es/components/search-bar/search-bar.d.ts +2 -0
  122. package/es/components/search-bar/search-bar.js +2 -0
  123. package/es/global/index.js +2 -0
  124. package/es/utils/get-scroll-parent.js +7 -4
  125. package/package.json +2 -2
  126. package/umd/antd-mobile.js +1 -1
  127. package/2x/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  128. package/2x/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
  129. package/2x/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  130. package/2x/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
  131. package/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  132. package/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
  133. package/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  134. package/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
@@ -68,6 +68,10 @@
68
68
  display: none;
69
69
  }
70
70
 
71
+ .adm-input-element:disabled {
72
+ opacity: 1;
73
+ }
74
+
71
75
  .adm-input-element[type='date'],
72
76
  .adm-input-element[type='time'],
73
77
  .adm-input-element[type='datetime-local'] {
@@ -9,6 +9,7 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
9
9
  disabled?: boolean;
10
10
  readOnly?: boolean;
11
11
  clearable?: boolean;
12
+ onlyShowClearWhenFocus?: boolean;
12
13
  onClear?: () => void;
13
14
  id?: string;
14
15
  onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
@@ -30,6 +31,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProp
30
31
  disabled?: boolean | undefined;
31
32
  readOnly?: boolean | undefined;
32
33
  clearable?: boolean | undefined;
34
+ onlyShowClearWhenFocus?: boolean | undefined;
33
35
  onClear?: (() => void) | undefined;
34
36
  id?: string | undefined;
35
37
  onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
@@ -8,7 +8,8 @@ import { useIsomorphicLayoutEffect } from 'ahooks';
8
8
  import { bound } from '../../utils/bound';
9
9
  const classPrefix = `adm-input`;
10
10
  const defaultProps = {
11
- defaultValue: ''
11
+ defaultValue: '',
12
+ onlyShowClearWhenFocus: true
12
13
  };
13
14
  export const Input = forwardRef((p, ref) => {
14
15
  const props = mergeProps(defaultProps, p);
@@ -70,6 +71,16 @@ export const Input = forwardRef((p, ref) => {
70
71
  }
71
72
  }
72
73
 
74
+ const shouldShowClear = (() => {
75
+ if (!props.clearable || !value || props.readOnly) return false;
76
+
77
+ if (props.onlyShowClearWhenFocus) {
78
+ return hasFocus;
79
+ } else {
80
+ return true;
81
+ }
82
+ })();
83
+
73
84
  return withNativeProps(props, React.createElement("div", {
74
85
  className: classNames(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
75
86
  }, React.createElement("input", {
@@ -112,7 +123,7 @@ export const Input = forwardRef((p, ref) => {
112
123
  onCompositionStart: props.onCompositionStart,
113
124
  onCompositionEnd: props.onCompositionEnd,
114
125
  onClick: props.onClick
115
- }), props.clearable && !!value && !props.readOnly && hasFocus && React.createElement("div", {
126
+ }), shouldShowClear && React.createElement("div", {
116
127
  className: `${classPrefix}-clear`,
117
128
  onMouseDown: e => {
118
129
  e.preventDefault();
@@ -1,5 +1,4 @@
1
- import { __awaiter } from "tslib";
2
- import React, { useState } from 'react';
1
+ import React from 'react';
3
2
  import classNames from 'classnames';
4
3
  import Button from '../button';
5
4
  import { withNativeProps } from '../../utils/native-props';
@@ -7,26 +6,9 @@ export const ModalActionButton = props => {
7
6
  const {
8
7
  action
9
8
  } = props;
10
- const [loading, setLoading] = useState(false);
11
-
12
- function handleClick() {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- setLoading(true);
15
-
16
- try {
17
- const promise = props.onAction();
18
- yield promise;
19
- setLoading(false);
20
- } catch (e) {
21
- setLoading(false);
22
- throw e;
23
- }
24
- });
25
- }
26
-
27
9
  return withNativeProps(props.action, React.createElement(Button, {
28
10
  key: action.key,
29
- onClick: handleClick,
11
+ onClick: props.onAction,
30
12
  className: classNames('adm-modal-button', {
31
13
  'adm-modal-button-primary': props.action.primary
32
14
  }),
@@ -34,7 +16,7 @@ export const ModalActionButton = props => {
34
16
  size: props.action.primary ? 'large' : 'middle',
35
17
  block: true,
36
18
  color: action.danger ? 'danger' : 'primary',
37
- loading: loading,
19
+ loading: 'auto',
38
20
  disabled: action.disabled
39
21
  }, action.text));
40
22
  };
@@ -8,6 +8,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
8
8
  maxLength?: number;
9
9
  placeholder?: string;
10
10
  clearable?: boolean;
11
+ onlyShowClearWhenFocus?: boolean;
11
12
  showCancelButton?: boolean | ((focus: boolean, value: string) => boolean);
12
13
  cancelText?: string;
13
14
  icon?: ReactNode;
@@ -22,6 +23,7 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
22
23
  maxLength?: number | undefined;
23
24
  placeholder?: string | undefined;
24
25
  clearable?: boolean | undefined;
26
+ onlyShowClearWhenFocus?: boolean | undefined;
25
27
  showCancelButton?: boolean | ((focus: boolean, value: string) => boolean) | undefined;
26
28
  cancelText?: string | undefined;
27
29
  icon?: ReactNode;
@@ -10,6 +10,7 @@ import { useConfig } from '../config-provider';
10
10
  const classPrefix = `adm-search-bar`;
11
11
  const defaultProps = {
12
12
  clearable: true,
13
+ onlyShowClearWhenFocus: false,
13
14
  showCancelButton: false,
14
15
  defaultValue: '',
15
16
  clearOnCancel: true,
@@ -101,6 +102,7 @@ export const SearchBar = forwardRef((p, ref) => {
101
102
  maxLength: props.maxLength,
102
103
  placeholder: props.placeholder,
103
104
  clearable: props.clearable,
105
+ onlyShowClearWhenFocus: props.onlyShowClearWhenFocus,
104
106
  onFocus: e => {
105
107
  var _a;
106
108
 
@@ -2,5 +2,7 @@ import "./global.css";
2
2
  import { canUseDom } from '../utils/can-use-dom';
3
3
 
4
4
  if (canUseDom) {
5
+ // Make sure the `:active` CSS selector of `button` and `a` take effect
6
+ // See: https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari
5
7
  document.addEventListener('touchstart', () => {}, true);
6
8
  }
@@ -1,22 +1,25 @@
1
1
  import { canUseDom } from './can-use-dom';
2
- const overflowScrollReg = /scroll|auto|overlay/i;
3
2
  const defaultRoot = canUseDom ? window : undefined;
3
+ const overflowStylePatterns = ['scroll', 'auto', 'overlay'];
4
4
 
5
5
  function isElement(node) {
6
6
  const ELEMENT_NODE_TYPE = 1;
7
7
  return node.nodeType === ELEMENT_NODE_TYPE;
8
- } // https://github.com/youzan/vant/issues/3823
9
-
8
+ }
10
9
 
11
10
  export function getScrollParent(el, root = defaultRoot) {
12
11
  let node = el;
13
12
 
14
13
  while (node && node !== root && isElement(node)) {
14
+ if (node === document.body) {
15
+ return root;
16
+ }
17
+
15
18
  const {
16
19
  overflowY
17
20
  } = window.getComputedStyle(node);
18
21
 
19
- if (overflowScrollReg.test(overflowY)) {
22
+ if (overflowStylePatterns.includes(overflowY)) {
20
23
  return node;
21
24
  }
22
25
 
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.10.3",
3
+ "version": "5.11.1",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^0.4.2",
6
6
  "@react-spring/web": "^9.4.4",
@@ -16,7 +16,7 @@
16
16
  "classnames": "^2.3.1",
17
17
  "dayjs": "^1.11.0",
18
18
  "lodash": "^4.17.21",
19
- "rc-field-form": "^1.24.0",
19
+ "rc-field-form": "^1.26.2",
20
20
  "react-is": "^17.0.2",
21
21
  "staged-components": "^1.1.2",
22
22
  "tslib": "^2.3.1"
@@ -1593,8 +1593,8 @@ function useTouch() {
1593
1593
  isHorizontal
1594
1594
  };
1595
1595
  }
1596
- const overflowScrollReg = /scroll|auto|overlay/i;
1597
1596
  const defaultRoot = canUseDom ? window : void 0;
1597
+ const overflowStylePatterns = ["scroll", "auto", "overlay"];
1598
1598
  function isElement(node) {
1599
1599
  const ELEMENT_NODE_TYPE = 1;
1600
1600
  return node.nodeType === ELEMENT_NODE_TYPE;
@@ -1602,10 +1602,13 @@ function isElement(node) {
1602
1602
  function getScrollParent(el, root2 = defaultRoot) {
1603
1603
  let node = el;
1604
1604
  while (node && node !== root2 && isElement(node)) {
1605
+ if (node === document.body) {
1606
+ return root2;
1607
+ }
1605
1608
  const {
1606
1609
  overflowY
1607
1610
  } = window.getComputedStyle(node);
1608
- if (overflowScrollReg.test(overflowY)) {
1611
+ if (overflowStylePatterns.includes(overflowY)) {
1609
1612
  return node;
1610
1613
  }
1611
1614
  node = node.parentNode;
@@ -8442,29 +8445,52 @@ const DotLoading = React$1.memo((p) => {
8442
8445
  keyTimes: "0; 0.1; 0.3; 0.4; 1"
8443
8446
  }))))))))));
8444
8447
  });
8448
+ function isPromise(obj) {
8449
+ return !!obj && typeof obj === "object" && typeof obj.then === "function";
8450
+ }
8445
8451
  const classPrefix$1d = `adm-button`;
8446
8452
  const defaultProps$W = {
8447
8453
  color: "default",
8448
8454
  fill: "solid",
8449
8455
  block: false,
8450
8456
  loading: false,
8457
+ loadingIcon: React__default["default"].createElement(DotLoading, {
8458
+ color: "currentColor"
8459
+ }),
8451
8460
  type: "button",
8452
8461
  shape: "default",
8453
8462
  size: "middle"
8454
8463
  };
8455
8464
  const Button = React$1.forwardRef((p, ref) => {
8456
8465
  const props = mergeProps(defaultProps$W, p);
8457
- const disabled = props.disabled || props.loading;
8466
+ const [innerLoading, setInnerLoading] = React$1.useState(false);
8458
8467
  const nativeButtonRef = React$1.useRef(null);
8468
+ const loading = props.loading === "auto" ? innerLoading : props.loading;
8469
+ const disabled = props.disabled || loading;
8459
8470
  React$1.useImperativeHandle(ref, () => ({
8460
8471
  get nativeElement() {
8461
8472
  return nativeButtonRef.current;
8462
8473
  }
8463
8474
  }));
8475
+ const handleClick = (e) => tslib.__awaiter(void 0, void 0, void 0, function* () {
8476
+ if (!props.onClick)
8477
+ return;
8478
+ const promise = props.onClick(e);
8479
+ if (isPromise(promise)) {
8480
+ try {
8481
+ setInnerLoading(true);
8482
+ yield promise;
8483
+ setInnerLoading(false);
8484
+ } catch (e2) {
8485
+ setInnerLoading(false);
8486
+ throw e2;
8487
+ }
8488
+ }
8489
+ });
8464
8490
  return withNativeProps(props, React__default["default"].createElement("button", {
8465
8491
  ref: nativeButtonRef,
8466
8492
  type: props.type,
8467
- onClick: props.onClick,
8493
+ onClick: handleClick,
8468
8494
  className: classNames__default["default"](classPrefix$1d, props.color ? `${classPrefix$1d}-${props.color}` : null, {
8469
8495
  [`${classPrefix$1d}-block`]: props.block,
8470
8496
  [`${classPrefix$1d}-disabled`]: disabled,
@@ -8473,14 +8499,12 @@ const Button = React$1.forwardRef((p, ref) => {
8473
8499
  [`${classPrefix$1d}-mini`]: props.size === "mini",
8474
8500
  [`${classPrefix$1d}-small`]: props.size === "small",
8475
8501
  [`${classPrefix$1d}-large`]: props.size === "large",
8476
- [`${classPrefix$1d}-loading`]: props.loading
8502
+ [`${classPrefix$1d}-loading`]: loading
8477
8503
  }, `${classPrefix$1d}-shape-${props.shape}`),
8478
8504
  disabled
8479
- }, props.loading ? React__default["default"].createElement("div", {
8505
+ }, loading ? React__default["default"].createElement("div", {
8480
8506
  className: `${classPrefix$1d}-loading-wrapper`
8481
- }, React__default["default"].createElement(DotLoading, {
8482
- color: "currentColor"
8483
- }), props.loadingText) : props.children));
8507
+ }, props.loadingIcon, props.loadingText) : props.children));
8484
8508
  });
8485
8509
  var safeArea = "";
8486
8510
  const classPrefix$1c = "adm-safe-area";
@@ -8911,6 +8935,8 @@ const Calendar = React$1.forwardRef((p, ref) => {
8911
8935
  setCurrent(current.add(1, "year"));
8912
8936
  }
8913
8937
  }, React__default["default"].createElement(ArrowLeftDouble, null)));
8938
+ const maxDay = React$1.useMemo(() => props.max && dayjs__default["default"](props.max), [props.max]);
8939
+ const minDay = React$1.useMemo(() => props.min && dayjs__default["default"](props.min), [props.min]);
8914
8940
  function renderCells() {
8915
8941
  var _a;
8916
8942
  const cells = [];
@@ -8930,9 +8956,10 @@ const Calendar = React$1.forwardRef((p, ref) => {
8930
8956
  isSelect = isBegin || isEnd || d.isAfter(begin, "day") && d.isBefore(end, "day");
8931
8957
  }
8932
8958
  const inThisMonth = d.month() === current.month();
8959
+ const disabled = !inThisMonth || maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
8933
8960
  cells.push(React__default["default"].createElement("div", {
8934
8961
  key: d.valueOf(),
8935
- className: classNames__default["default"](`${classPrefix$17}-cell`, inThisMonth ? `${classPrefix$17}-cell-in` : `${classPrefix$17}-cell-out`, inThisMonth && {
8962
+ className: classNames__default["default"](`${classPrefix$17}-cell`, disabled && `${classPrefix$17}-cell-disabled`, inThisMonth && {
8936
8963
  [`${classPrefix$17}-cell-today`]: d.isSame(today, "day"),
8937
8964
  [`${classPrefix$17}-cell-selected`]: isSelect,
8938
8965
  [`${classPrefix$17}-cell-selected-begin`]: isBegin,
@@ -8941,6 +8968,8 @@ const Calendar = React$1.forwardRef((p, ref) => {
8941
8968
  onClick: () => {
8942
8969
  if (!props.selectionMode)
8943
8970
  return;
8971
+ if (disabled)
8972
+ return;
8944
8973
  const date = d.toDate();
8945
8974
  if (!inThisMonth) {
8946
8975
  setCurrent(d.clone().date(1));
@@ -9987,62 +10016,52 @@ function prompt$3(props) {
9987
10016
  var Picker = attachPropertiesToComponent(Picker$1, {
9988
10017
  prompt: prompt$3
9989
10018
  });
9990
- function useCascadePickerOptions(options) {
9991
- return React$1.useMemo(() => {
9992
- let depth = 1;
9993
- const subOptionsRecord = {};
9994
- function traverse(option, currentDepth) {
9995
- if (!option.children) {
9996
- return;
9997
- }
9998
- subOptionsRecord[option.value] = option.children;
10019
+ function useColumnsFn(options) {
10020
+ const depth = React$1.useMemo(() => {
10021
+ let depth2 = 0;
10022
+ function traverse(options2, currentDepth) {
10023
+ if (currentDepth > depth2)
10024
+ depth2 = currentDepth;
9999
10025
  const nextDepth = currentDepth + 1;
10000
- if (nextDepth > depth) {
10001
- depth = nextDepth;
10002
- }
10003
- option.children.forEach((option2) => {
10004
- traverse(option2, nextDepth);
10026
+ options2.forEach((option) => {
10027
+ if (option.children) {
10028
+ traverse(option.children, nextDepth);
10029
+ }
10005
10030
  });
10006
10031
  }
10007
- options.forEach((option) => {
10008
- traverse(option, 1);
10009
- });
10010
- return {
10011
- depth,
10012
- subOptionsRecord
10013
- };
10032
+ traverse(options, 1);
10033
+ return depth2;
10014
10034
  }, [options]);
10015
- }
10016
- function generateCascadePickerColumns(value, options, depth, subOptionsRecord) {
10017
- const columns = [];
10018
- columns.push(options.map((option) => ({
10019
- label: option.label,
10020
- value: option.value
10021
- })));
10022
- for (let i = 0; i < depth - 1; i++) {
10023
- const x = value[i];
10024
- const subOptions = subOptionsRecord[x];
10025
- if (!subOptions) {
10026
- columns.push([]);
10027
- } else {
10028
- columns.push(subOptions.map((option) => ({
10035
+ return (selected) => {
10036
+ const columns = [];
10037
+ let currentOptions = options;
10038
+ let i = 0;
10039
+ while (true) {
10040
+ columns.push(currentOptions.map((option) => ({
10029
10041
  label: option.label,
10030
10042
  value: option.value
10031
10043
  })));
10044
+ const x = selected[i];
10045
+ const targetOptions = currentOptions.find((option) => option.value === x);
10046
+ if (!targetOptions || !targetOptions.children)
10047
+ break;
10048
+ currentOptions = targetOptions.children;
10049
+ i++;
10032
10050
  }
10033
- }
10034
- return columns;
10051
+ while (i < depth - 1) {
10052
+ columns.push([]);
10053
+ i++;
10054
+ }
10055
+ return columns;
10056
+ };
10035
10057
  }
10036
10058
  const CascadePicker = (props) => {
10037
10059
  const {
10038
10060
  options
10039
10061
  } = props, pickerProps = tslib.__rest(props, ["options"]);
10040
- const {
10041
- depth,
10042
- subOptionsRecord
10043
- } = useCascadePickerOptions(options);
10062
+ const columnsFn = useColumnsFn(options);
10044
10063
  return React__default["default"].createElement(Picker, Object.assign({}, pickerProps, {
10045
- columns: (selected) => generateCascadePickerColumns(selected, options, depth, subOptionsRecord)
10064
+ columns: columnsFn
10046
10065
  }));
10047
10066
  };
10048
10067
  function prompt$2(props) {
@@ -10082,12 +10101,9 @@ const CascadePickerView = (props) => {
10082
10101
  const {
10083
10102
  options
10084
10103
  } = props, pickerProps = tslib.__rest(props, ["options"]);
10085
- const {
10086
- depth,
10087
- subOptionsRecord
10088
- } = useCascadePickerOptions(options);
10104
+ const columnsFn = useColumnsFn(options);
10089
10105
  return React__default["default"].createElement(PickerView, Object.assign({}, pickerProps, {
10090
- columns: (selected) => generateCascadePickerColumns(selected, options, depth, subOptionsRecord)
10106
+ columns: columnsFn
10091
10107
  }));
10092
10108
  };
10093
10109
  var cascaderView = "";
@@ -11398,6 +11414,7 @@ const DatePicker = (p) => {
11398
11414
  value: pickerValue,
11399
11415
  onCancel: props.onCancel,
11400
11416
  onClose: props.onClose,
11417
+ closeOnMaskClick: props.closeOnMaskClick,
11401
11418
  visible: props.visible,
11402
11419
  confirmText: props.confirmText,
11403
11420
  cancelText: props.cancelText,
@@ -11483,23 +11500,9 @@ const DialogActionButton = (props) => {
11483
11500
  const {
11484
11501
  action
11485
11502
  } = props;
11486
- const [loading, setLoading] = React$1.useState(false);
11487
- function handleClick() {
11488
- return tslib.__awaiter(this, void 0, void 0, function* () {
11489
- setLoading(true);
11490
- try {
11491
- const promise = props.onAction();
11492
- yield promise;
11493
- setLoading(false);
11494
- } catch (e) {
11495
- setLoading(false);
11496
- throw e;
11497
- }
11498
- });
11499
- }
11500
11503
  return withNativeProps(props.action, React__default["default"].createElement(Button, {
11501
11504
  key: action.key,
11502
- onClick: handleClick,
11505
+ onClick: props.onAction,
11503
11506
  className: classNames__default["default"]("adm-dialog-button", {
11504
11507
  "adm-dialog-button-bold": action.bold
11505
11508
  }),
@@ -11507,7 +11510,7 @@ const DialogActionButton = (props) => {
11507
11510
  shape: "rectangular",
11508
11511
  block: true,
11509
11512
  color: action.danger ? "danger" : "primary",
11510
- loading,
11513
+ loading: "auto",
11511
11514
  disabled: action.disabled
11512
11515
  }, action.text));
11513
11516
  };
@@ -12780,7 +12783,7 @@ const FloatingPanel = React$1.forwardRef((p, ref) => {
12780
12783
  tension: 300
12781
12784
  },
12782
12785
  onChange: (result2) => {
12783
- onHeightChange(result2.value.y, y2.isAnimating);
12786
+ onHeightChange(-result2.value.y, y2.isAnimating);
12784
12787
  }
12785
12788
  }));
12786
12789
  react.useDrag((state) => {
@@ -12874,7 +12877,8 @@ const defaultFormContext = {
12874
12877
  name: void 0,
12875
12878
  hasFeedback: true,
12876
12879
  layout: "vertical",
12877
- requiredMarkStyle: "asterisk"
12880
+ requiredMarkStyle: "asterisk",
12881
+ disabled: false
12878
12882
  };
12879
12883
  const FormContext = React__default["default"].createContext(defaultFormContext);
12880
12884
  const NoStyleItemContext = React__default["default"].createContext(null);
@@ -12923,8 +12927,9 @@ const Form$1 = React$1.forwardRef((p, ref) => {
12923
12927
  layout,
12924
12928
  footer,
12925
12929
  mode,
12930
+ disabled,
12926
12931
  requiredMarkStyle
12927
- } = props, formProps = tslib.__rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "requiredMarkStyle"]);
12932
+ } = props, formProps = tslib.__rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "disabled", "requiredMarkStyle"]);
12928
12933
  const {
12929
12934
  locale
12930
12935
  } = useConfig();
@@ -12971,7 +12976,8 @@ const Form$1 = React$1.forwardRef((p, ref) => {
12971
12976
  name: formProps.name,
12972
12977
  hasFeedback,
12973
12978
  layout,
12974
- requiredMarkStyle
12979
+ requiredMarkStyle,
12980
+ disabled
12975
12981
  }
12976
12982
  }, lists), footer && React__default["default"].createElement("div", {
12977
12983
  className: `${classPrefix$K}-footer`
@@ -13123,7 +13129,9 @@ var Context = /* @__PURE__ */ React.createContext({
13123
13129
  registerField: warningFunc,
13124
13130
  useSubscribe: warningFunc,
13125
13131
  setInitialValues: warningFunc,
13132
+ destroyForm: warningFunc,
13126
13133
  setCallbacks: warningFunc,
13134
+ registerWatch: warningFunc,
13127
13135
  getFields: warningFunc,
13128
13136
  setValidateMessages: warningFunc,
13129
13137
  setPreserve: warningFunc,
@@ -13398,6 +13406,7 @@ const MemoInput = React__default["default"].memo(({
13398
13406
  children
13399
13407
  }) => children, (prev, next) => prev.value === next.value && prev.update === next.update);
13400
13408
  const FormItemLayout = (props) => {
13409
+ var _a;
13401
13410
  const {
13402
13411
  className,
13403
13412
  style,
@@ -13405,7 +13414,6 @@ const FormItemLayout = (props) => {
13405
13414
  label,
13406
13415
  help,
13407
13416
  required,
13408
- disabled,
13409
13417
  children,
13410
13418
  htmlFor,
13411
13419
  hidden,
@@ -13418,6 +13426,7 @@ const FormItemLayout = (props) => {
13418
13426
  } = useConfig();
13419
13427
  const hasFeedback = props.hasFeedback !== void 0 ? props.hasFeedback : context.hasFeedback;
13420
13428
  const layout = props.layout || context.layout;
13429
+ const disabled = (_a = props.disabled) !== null && _a !== void 0 ? _a : context.disabled;
13421
13430
  const requiredMark = (() => {
13422
13431
  const {
13423
13432
  requiredMarkStyle
@@ -13466,7 +13475,8 @@ const FormItemLayout = (props) => {
13466
13475
  extra,
13467
13476
  description,
13468
13477
  className: classNames__default["default"](classPrefix$H, className, `${classPrefix$H}-${layout}`, {
13469
- [`${classPrefix$H}-hidden`]: hidden
13478
+ [`${classPrefix$H}-hidden`]: hidden,
13479
+ [`${classPrefix$H}-has-error`]: props.errors.length
13470
13480
  }),
13471
13481
  disabled,
13472
13482
  onClick: props.onClick,
@@ -13653,7 +13663,8 @@ var Form = attachPropertiesToComponent(Form$1, {
13653
13663
  Subscribe: FormSubscribe,
13654
13664
  Header,
13655
13665
  Array: FormArray,
13656
- useForm: RcForm.useForm
13666
+ useForm: RcForm.useForm,
13667
+ useWatch: RcForm.useWatch
13657
13668
  });
13658
13669
  var grid = "";
13659
13670
  const classPrefix$G = `adm-grid`;
@@ -14559,7 +14570,8 @@ const InfiniteScroll = (p) => {
14559
14570
  var input = "";
14560
14571
  const classPrefix$v = `adm-input`;
14561
14572
  const defaultProps$r = {
14562
- defaultValue: ""
14573
+ defaultValue: "",
14574
+ onlyShowClearWhenFocus: true
14563
14575
  };
14564
14576
  const Input = React$1.forwardRef((p, ref) => {
14565
14577
  const props = mergeProps(defaultProps$r, p);
@@ -14608,6 +14620,15 @@ const Input = React$1.forwardRef((p, ref) => {
14608
14620
  setValue(nextValue);
14609
14621
  }
14610
14622
  }
14623
+ const shouldShowClear = (() => {
14624
+ if (!props.clearable || !value || props.readOnly)
14625
+ return false;
14626
+ if (props.onlyShowClearWhenFocus) {
14627
+ return hasFocus;
14628
+ } else {
14629
+ return true;
14630
+ }
14631
+ })();
14611
14632
  return withNativeProps(props, React__default["default"].createElement("div", {
14612
14633
  className: classNames__default["default"](`${classPrefix$v}`, props.disabled && `${classPrefix$v}-disabled`)
14613
14634
  }, React__default["default"].createElement("input", {
@@ -14648,7 +14669,7 @@ const Input = React$1.forwardRef((p, ref) => {
14648
14669
  onCompositionStart: props.onCompositionStart,
14649
14670
  onCompositionEnd: props.onCompositionEnd,
14650
14671
  onClick: props.onClick
14651
- }), props.clearable && !!value && !props.readOnly && hasFocus && React__default["default"].createElement("div", {
14672
+ }), shouldShowClear && React__default["default"].createElement("div", {
14652
14673
  className: `${classPrefix$v}-clear`,
14653
14674
  onMouseDown: (e) => {
14654
14675
  e.preventDefault();
@@ -14761,23 +14782,9 @@ const ModalActionButton = (props) => {
14761
14782
  const {
14762
14783
  action
14763
14784
  } = props;
14764
- const [loading, setLoading] = React$1.useState(false);
14765
- function handleClick() {
14766
- return tslib.__awaiter(this, void 0, void 0, function* () {
14767
- setLoading(true);
14768
- try {
14769
- const promise = props.onAction();
14770
- yield promise;
14771
- setLoading(false);
14772
- } catch (e) {
14773
- setLoading(false);
14774
- throw e;
14775
- }
14776
- });
14777
- }
14778
14785
  return withNativeProps(props.action, React__default["default"].createElement(Button, {
14779
14786
  key: action.key,
14780
- onClick: handleClick,
14787
+ onClick: props.onAction,
14781
14788
  className: classNames__default["default"]("adm-modal-button", {
14782
14789
  "adm-modal-button-primary": props.action.primary
14783
14790
  }),
@@ -14785,7 +14792,7 @@ const ModalActionButton = (props) => {
14785
14792
  size: props.action.primary ? "large" : "middle",
14786
14793
  block: true,
14787
14794
  color: action.danger ? "danger" : "primary",
14788
- loading,
14795
+ loading: "auto",
14789
14796
  disabled: action.disabled
14790
14797
  }, action.text));
14791
14798
  };
@@ -15762,6 +15769,7 @@ var searchBar = "";
15762
15769
  const classPrefix$i = `adm-search-bar`;
15763
15770
  const defaultProps$f = {
15764
15771
  clearable: true,
15772
+ onlyShowClearWhenFocus: false,
15765
15773
  showCancelButton: false,
15766
15774
  defaultValue: "",
15767
15775
  clearOnCancel: true,
@@ -15841,6 +15849,7 @@ const SearchBar = React$1.forwardRef((p, ref) => {
15841
15849
  maxLength: props.maxLength,
15842
15850
  placeholder: props.placeholder,
15843
15851
  clearable: props.clearable,
15852
+ onlyShowClearWhenFocus: props.onlyShowClearWhenFocus,
15844
15853
  onFocus: (e) => {
15845
15854
  var _a;
15846
15855
  setHasFocus(true);