antd-mobile 5.17.1 → 5.19.0

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 (219) hide show
  1. package/2x/bundle/antd-mobile.cjs.js +47 -19173
  2. package/2x/bundle/antd-mobile.compatible.umd.js +25752 -0
  3. package/2x/bundle/antd-mobile.es.js +16416 -17055
  4. package/2x/bundle/antd-mobile.umd.js +64 -0
  5. package/2x/bundle/style.css +240 -277
  6. package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  7. package/2x/cjs/components/button/button.js +1 -1
  8. package/2x/cjs/components/calendar/calendar.d.ts +3 -3
  9. package/2x/cjs/components/calendar/index.d.ts +1 -1
  10. package/2x/cjs/components/cascader/cascader.d.ts +2 -0
  11. package/2x/cjs/components/cascader/index.d.ts +1 -0
  12. package/2x/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  13. package/2x/cjs/components/cascader-view/cascader-view.js +2 -1
  14. package/2x/cjs/components/dialog/show.d.ts +1 -1
  15. package/2x/cjs/components/floating-panel/floating-panel.css +4 -4
  16. package/2x/cjs/components/form/form-item.js +6 -4
  17. package/2x/cjs/components/image-viewer/slide.js +75 -56
  18. package/2x/cjs/components/input/input.js +9 -2
  19. package/2x/cjs/components/modal/show.d.ts +1 -1
  20. package/2x/cjs/components/notice-bar/notice-bar.css +9 -0
  21. package/2x/cjs/components/notice-bar/notice-bar.js +5 -3
  22. package/2x/cjs/components/number-keyboard/number-keyboard.css +11 -15
  23. package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  24. package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
  25. package/2x/cjs/components/passcode-input/index.d.ts +1 -1
  26. package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
  27. package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
  28. package/2x/cjs/components/picker-view/wheel.js +1 -1
  29. package/2x/cjs/components/rate/rate.js +7 -2
  30. package/2x/cjs/components/rate/star.js +0 -10
  31. package/2x/cjs/components/result/result.d.ts +1 -1
  32. package/2x/cjs/components/result/result.js +7 -1
  33. package/2x/cjs/components/search-bar/search-bar.js +12 -2
  34. package/2x/cjs/components/switch/switch.d.ts +2 -1
  35. package/2x/cjs/components/switch/switch.js +16 -3
  36. package/2x/cjs/components/text-area/text-area.js +1 -0
  37. package/2x/cjs/locales/base.d.ts +9 -0
  38. package/2x/cjs/locales/base.js +9 -0
  39. package/2x/cjs/locales/en-US.d.ts +9 -0
  40. package/2x/cjs/locales/es-ES.d.ts +9 -0
  41. package/2x/cjs/locales/fa-IR.d.ts +9 -0
  42. package/2x/cjs/locales/fr-FR.d.ts +9 -0
  43. package/2x/cjs/locales/id-ID.d.ts +9 -0
  44. package/2x/cjs/locales/kk-KZ.d.ts +9 -0
  45. package/2x/cjs/locales/ko-KR.d.ts +9 -0
  46. package/2x/cjs/locales/zh-CN.d.ts +9 -0
  47. package/2x/cjs/locales/zh-CN.js +9 -0
  48. package/2x/cjs/locales/zh-HK.d.ts +9 -0
  49. package/2x/cjs/locales/zh-TW.d.ts +9 -0
  50. package/2x/cjs/utils/matrix.d.ts +10 -0
  51. package/2x/cjs/utils/matrix.js +60 -0
  52. package/2x/cjs/utils/merge-locale.d.ts +1 -1
  53. package/2x/cjs/utils/merge-locale.js +15 -5
  54. package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  55. package/2x/cjs/utils/use-props-value.js +1 -1
  56. package/2x/cjs/utils/with-default-props.js +2 -6
  57. package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
  58. package/2x/es/components/button/button.js +1 -1
  59. package/2x/es/components/calendar/calendar.d.ts +3 -3
  60. package/2x/es/components/calendar/index.d.ts +1 -1
  61. package/2x/es/components/cascader/cascader.d.ts +2 -0
  62. package/2x/es/components/cascader/index.d.ts +1 -0
  63. package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
  64. package/2x/es/components/cascader-view/cascader-view.js +2 -1
  65. package/2x/es/components/dialog/show.d.ts +1 -1
  66. package/2x/es/components/floating-panel/floating-panel.css +4 -4
  67. package/2x/es/components/form/form-item.js +5 -4
  68. package/2x/es/components/image-viewer/slide.js +73 -56
  69. package/2x/es/components/input/input.js +8 -2
  70. package/2x/es/components/modal/show.d.ts +1 -1
  71. package/2x/es/components/notice-bar/notice-bar.css +9 -0
  72. package/2x/es/components/notice-bar/notice-bar.js +5 -3
  73. package/2x/es/components/number-keyboard/number-keyboard.css +11 -15
  74. package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  75. package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
  76. package/2x/es/components/passcode-input/index.d.ts +1 -1
  77. package/2x/es/components/passcode-input/passcode-input.css +12 -12
  78. package/2x/es/components/passcode-input/passcode-input.js +15 -8
  79. package/2x/es/components/picker-view/wheel.js +1 -1
  80. package/2x/es/components/rate/rate.js +7 -2
  81. package/2x/es/components/rate/star.js +0 -10
  82. package/2x/es/components/result/result.d.ts +1 -1
  83. package/2x/es/components/result/result.js +6 -1
  84. package/2x/es/components/search-bar/search-bar.js +12 -2
  85. package/2x/es/components/switch/switch.d.ts +2 -1
  86. package/2x/es/components/switch/switch.js +15 -3
  87. package/2x/es/components/text-area/text-area.js +1 -0
  88. package/2x/es/locales/base.d.ts +9 -0
  89. package/2x/es/locales/base.js +9 -0
  90. package/2x/es/locales/en-US.d.ts +9 -0
  91. package/2x/es/locales/es-ES.d.ts +9 -0
  92. package/2x/es/locales/fa-IR.d.ts +9 -0
  93. package/2x/es/locales/fr-FR.d.ts +9 -0
  94. package/2x/es/locales/id-ID.d.ts +9 -0
  95. package/2x/es/locales/kk-KZ.d.ts +9 -0
  96. package/2x/es/locales/ko-KR.d.ts +9 -0
  97. package/2x/es/locales/zh-CN.d.ts +9 -0
  98. package/2x/es/locales/zh-CN.js +9 -0
  99. package/2x/es/locales/zh-HK.d.ts +9 -0
  100. package/2x/es/locales/zh-TW.d.ts +9 -0
  101. package/2x/es/utils/matrix.d.ts +10 -0
  102. package/2x/es/utils/matrix.js +27 -0
  103. package/2x/es/utils/merge-locale.d.ts +1 -1
  104. package/2x/es/utils/merge-locale.js +17 -3
  105. package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
  106. package/2x/es/utils/use-props-value.js +1 -1
  107. package/2x/es/utils/with-default-props.js +2 -4
  108. package/2x/package.json +4 -4
  109. package/2x/umd/antd-mobile.js +25752 -2
  110. package/bundle/antd-mobile.cjs.js +47 -19173
  111. package/bundle/antd-mobile.compatible.umd.js +25752 -0
  112. package/bundle/antd-mobile.es.js +16416 -17055
  113. package/bundle/antd-mobile.umd.js +64 -0
  114. package/bundle/style.css +1 -4080
  115. package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  116. package/cjs/components/button/button.js +1 -1
  117. package/cjs/components/calendar/calendar.d.ts +3 -3
  118. package/cjs/components/calendar/index.d.ts +1 -1
  119. package/cjs/components/cascader/cascader.d.ts +2 -0
  120. package/cjs/components/cascader/index.d.ts +1 -0
  121. package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  122. package/cjs/components/cascader-view/cascader-view.js +2 -1
  123. package/cjs/components/dialog/show.d.ts +1 -1
  124. package/cjs/components/floating-panel/floating-panel.css +4 -4
  125. package/cjs/components/form/form-item.js +6 -4
  126. package/cjs/components/image-viewer/slide.js +75 -56
  127. package/cjs/components/input/input.js +9 -2
  128. package/cjs/components/modal/show.d.ts +1 -1
  129. package/cjs/components/notice-bar/notice-bar.css +8 -0
  130. package/cjs/components/notice-bar/notice-bar.js +5 -3
  131. package/cjs/components/number-keyboard/number-keyboard.css +11 -14
  132. package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  133. package/cjs/components/number-keyboard/number-keyboard.js +19 -17
  134. package/cjs/components/passcode-input/index.d.ts +1 -1
  135. package/cjs/components/passcode-input/passcode-input.css +12 -12
  136. package/cjs/components/passcode-input/passcode-input.js +16 -8
  137. package/cjs/components/picker-view/wheel.js +1 -1
  138. package/cjs/components/rate/rate.js +7 -2
  139. package/cjs/components/rate/star.js +0 -10
  140. package/cjs/components/result/result.d.ts +1 -1
  141. package/cjs/components/result/result.js +7 -1
  142. package/cjs/components/search-bar/search-bar.js +12 -2
  143. package/cjs/components/switch/switch.d.ts +2 -1
  144. package/cjs/components/switch/switch.js +16 -3
  145. package/cjs/components/text-area/text-area.js +1 -0
  146. package/cjs/locales/base.d.ts +9 -0
  147. package/cjs/locales/base.js +9 -0
  148. package/cjs/locales/en-US.d.ts +9 -0
  149. package/cjs/locales/es-ES.d.ts +9 -0
  150. package/cjs/locales/fa-IR.d.ts +9 -0
  151. package/cjs/locales/fr-FR.d.ts +9 -0
  152. package/cjs/locales/id-ID.d.ts +9 -0
  153. package/cjs/locales/kk-KZ.d.ts +9 -0
  154. package/cjs/locales/ko-KR.d.ts +9 -0
  155. package/cjs/locales/zh-CN.d.ts +9 -0
  156. package/cjs/locales/zh-CN.js +9 -0
  157. package/cjs/locales/zh-HK.d.ts +9 -0
  158. package/cjs/locales/zh-TW.d.ts +9 -0
  159. package/cjs/utils/matrix.d.ts +10 -0
  160. package/cjs/utils/matrix.js +60 -0
  161. package/cjs/utils/merge-locale.d.ts +1 -1
  162. package/cjs/utils/merge-locale.js +15 -5
  163. package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
  164. package/cjs/utils/use-props-value.js +1 -1
  165. package/cjs/utils/with-default-props.js +2 -6
  166. package/es/components/action-sheet/action-sheet.d.ts +1 -1
  167. package/es/components/button/button.js +1 -1
  168. package/es/components/calendar/calendar.d.ts +3 -3
  169. package/es/components/calendar/index.d.ts +1 -1
  170. package/es/components/cascader/cascader.d.ts +2 -0
  171. package/es/components/cascader/index.d.ts +1 -0
  172. package/es/components/cascader-view/cascader-view.d.ts +2 -1
  173. package/es/components/cascader-view/cascader-view.js +2 -1
  174. package/es/components/dialog/show.d.ts +1 -1
  175. package/es/components/floating-panel/floating-panel.css +4 -4
  176. package/es/components/form/form-item.js +5 -4
  177. package/es/components/image-viewer/slide.js +73 -56
  178. package/es/components/input/input.js +8 -2
  179. package/es/components/modal/show.d.ts +1 -1
  180. package/es/components/notice-bar/notice-bar.css +8 -0
  181. package/es/components/notice-bar/notice-bar.js +5 -3
  182. package/es/components/number-keyboard/number-keyboard.css +11 -14
  183. package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  184. package/es/components/number-keyboard/number-keyboard.js +19 -17
  185. package/es/components/passcode-input/index.d.ts +1 -1
  186. package/es/components/passcode-input/passcode-input.css +12 -12
  187. package/es/components/passcode-input/passcode-input.js +15 -8
  188. package/es/components/picker-view/wheel.js +1 -1
  189. package/es/components/rate/rate.js +7 -2
  190. package/es/components/rate/star.js +0 -10
  191. package/es/components/result/result.d.ts +1 -1
  192. package/es/components/result/result.js +6 -1
  193. package/es/components/search-bar/search-bar.js +12 -2
  194. package/es/components/switch/switch.d.ts +2 -1
  195. package/es/components/switch/switch.js +15 -3
  196. package/es/components/text-area/text-area.js +1 -0
  197. package/es/locales/base.d.ts +9 -0
  198. package/es/locales/base.js +9 -0
  199. package/es/locales/en-US.d.ts +9 -0
  200. package/es/locales/es-ES.d.ts +9 -0
  201. package/es/locales/fa-IR.d.ts +9 -0
  202. package/es/locales/fr-FR.d.ts +9 -0
  203. package/es/locales/id-ID.d.ts +9 -0
  204. package/es/locales/kk-KZ.d.ts +9 -0
  205. package/es/locales/ko-KR.d.ts +9 -0
  206. package/es/locales/zh-CN.d.ts +9 -0
  207. package/es/locales/zh-CN.js +9 -0
  208. package/es/locales/zh-HK.d.ts +9 -0
  209. package/es/locales/zh-TW.d.ts +9 -0
  210. package/es/utils/matrix.d.ts +10 -0
  211. package/es/utils/matrix.js +27 -0
  212. package/es/utils/merge-locale.d.ts +1 -1
  213. package/es/utils/merge-locale.js +17 -3
  214. package/es/utils/use-drag-and-pinch.d.ts +1 -1
  215. package/es/utils/use-props-value.js +1 -1
  216. package/es/utils/with-default-props.js +2 -4
  217. package/package.json +4 -4
  218. package/umd/antd-mobile.js +1 -1
  219. package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
@@ -0,0 +1,10 @@
1
+ export declare type Matrix = readonly [number, number, number, number, number, number];
2
+ export declare const create: () => Matrix;
3
+ export declare const getTranslateX: (m: Matrix) => number;
4
+ export declare const getTranslateY: (m: Matrix) => number;
5
+ export declare const getScaleX: (m: Matrix) => number;
6
+ export declare const getScaleY: (m: Matrix) => number;
7
+ export declare const translate: (m: Matrix, x: number, y: number) => Matrix;
8
+ export declare const scale: (m: Matrix, scaleX: number, scaleY?: number) => Matrix;
9
+ export declare const apply: (m: Matrix, [ox, oy]: [number, number]) => [number, number];
10
+ export declare const multiply: (m1: Matrix, m2: Matrix) => Matrix;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.translate = exports.scale = exports.multiply = exports.getTranslateY = exports.getTranslateX = exports.getScaleY = exports.getScaleX = exports.create = exports.apply = void 0;
7
+
8
+ const create = () => {
9
+ return [1, 0, 0, 1, 0, 0];
10
+ };
11
+
12
+ exports.create = create;
13
+
14
+ const getTranslateX = m => {
15
+ return m[4];
16
+ };
17
+
18
+ exports.getTranslateX = getTranslateX;
19
+
20
+ const getTranslateY = m => {
21
+ return m[5];
22
+ };
23
+
24
+ exports.getTranslateY = getTranslateY;
25
+
26
+ const getScaleX = m => {
27
+ return m[0];
28
+ };
29
+
30
+ exports.getScaleX = getScaleX;
31
+
32
+ const getScaleY = m => {
33
+ return m[3];
34
+ };
35
+
36
+ exports.getScaleY = getScaleY;
37
+
38
+ const translate = (m, x, y) => {
39
+ return multiply([1, 0, 0, 1, x, y], m);
40
+ };
41
+
42
+ exports.translate = translate;
43
+
44
+ const scale = (m, scaleX, scaleY = scaleX) => {
45
+ return multiply([scaleX, 0, 0, scaleY, 0, 0], m);
46
+ };
47
+
48
+ exports.scale = scale;
49
+
50
+ const apply = (m, [ox, oy]) => {
51
+ return [m[0] * ox + m[2] * oy + m[4], m[1] * ox + m[3] * oy + m[5]];
52
+ };
53
+
54
+ exports.apply = apply;
55
+
56
+ const multiply = (m1, m2) => {
57
+ return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
58
+ };
59
+
60
+ exports.multiply = multiply;
@@ -1 +1 @@
1
- export declare function mergeLocale<T, P>(base: T, patch: P): T;
1
+ export declare function mergeLocale<T extends object, P extends object>(base: T, patch: P): T;
@@ -5,12 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mergeLocale = mergeLocale;
7
7
 
8
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
8
+ function mergeLocale(base, patch) {
9
+ function merge(a, b) {
10
+ if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b)) {
11
+ return b !== undefined ? b : a;
12
+ }
9
13
 
10
- var _merge = _interopRequireDefault(require("lodash/merge"));
14
+ const result = {};
11
15
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ for (const key in a) {
17
+ if (a.hasOwnProperty(key)) {
18
+ result[key] = merge(a[key], b[key]);
19
+ }
20
+ }
13
21
 
14
- function mergeLocale(base, patch) {
15
- return (0, _merge.default)((0, _cloneDeep.default)(base), patch);
22
+ return result;
23
+ }
24
+
25
+ return merge(base, patch);
16
26
  }
@@ -1 +1 @@
1
- export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react").ReactDOMAttributes;
1
+ export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react/dist/declarations/src/types").ReactDOMAttributes;
@@ -28,7 +28,7 @@ function usePropsValue(options) {
28
28
  if (!forceTrigger && nextValue === stateRef.current) return;
29
29
  stateRef.current = nextValue;
30
30
  update();
31
- onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
31
+ return onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
32
32
  });
33
33
  return [stateRef.current, setState];
34
34
  }
@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mergeProps = mergeProps;
7
7
 
8
- var _assign = _interopRequireDefault(require("lodash/assign"));
9
-
10
8
  var _assignWith = _interopRequireDefault(require("lodash/assignWith"));
11
9
 
12
- var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
11
 
16
12
  function mergeProps(...items) {
17
13
  function customizer(objValue, srcValue) {
18
- return (0, _isUndefined.default)(srcValue) ? objValue : srcValue;
14
+ return srcValue === undefined ? objValue : srcValue;
19
15
  }
20
16
 
21
- let ret = (0, _assign.default)({}, items[0]);
17
+ let ret = Object.assign({}, items[0]);
22
18
 
23
19
  for (let i = 1; i < items.length; i++) {
24
20
  ret = (0, _assignWith.default)(ret, items[i], customizer);
@@ -27,4 +27,4 @@ export declare const ActionSheet: FC<ActionSheetProps>;
27
27
  export declare type ActionSheetShowHandler = {
28
28
  close: () => void;
29
29
  };
30
- export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): ActionSheetShowHandler;
30
+ export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible' | 'destroyOnClose' | 'forceRender'>): ActionSheetShowHandler;
@@ -68,5 +68,5 @@ export const Button = forwardRef((p, ref) => {
68
68
  onTouchEnd: props.onTouchEnd
69
69
  }, loading ? React.createElement("div", {
70
70
  className: `${classPrefix}-loading-wrapper`
71
- }, props.loadingIcon, props.loadingText) : props.children));
71
+ }, props.loadingIcon, props.loadingText) : React.createElement("span", null, props.children)));
72
72
  });
@@ -4,7 +4,7 @@ declare type Page = {
4
4
  month: number;
5
5
  year: number;
6
6
  };
7
- export declare type CalenderRef = {
7
+ export declare type CalendarRef = {
8
8
  jumpTo: (page: Page | ((page: Page) => Page)) => void;
9
9
  jumpToToday: () => void;
10
10
  };
@@ -15,7 +15,7 @@ export declare type CalendarProps = {
15
15
  nextYearButton?: React.ReactNode;
16
16
  onPageChange?: (year: number, month: number) => void;
17
17
  weekStartsOn?: 'Monday' | 'Sunday';
18
- renderLabel?: (date: Date) => string | null | undefined;
18
+ renderLabel?: (date: Date) => React.ReactNode;
19
19
  allowClear?: boolean;
20
20
  max?: Date;
21
21
  min?: Date;
@@ -36,5 +36,5 @@ export declare type CalendarProps = {
36
36
  defaultValue?: [Date, Date] | null;
37
37
  onChange?: (val: [Date, Date] | null) => void;
38
38
  }) & NativeProps;
39
- export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalenderRef>>;
39
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;
40
40
  export {};
@@ -1,4 +1,4 @@
1
1
  import './calendar.less';
2
2
  import { Calendar } from './calendar';
3
- export type { CalendarProps, CalenderRef } from './calendar';
3
+ export type { CalendarProps, CalendarRef } from './calendar';
4
4
  export default Calendar;
@@ -23,6 +23,7 @@ export declare type CascaderProps = {
23
23
  cancelText?: ReactNode;
24
24
  children?: (items: (CascaderOption | null)[], actions: CascaderActions) => ReactNode;
25
25
  onTabsChange?: (index: number) => void;
26
+ activeIcon?: ReactNode;
26
27
  } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation' | 'destroyOnClose' | 'forceRender'> & NativeProps;
27
28
  export declare const Cascader: React.ForwardRefExoticComponent<{
28
29
  options: CascaderOption[];
@@ -39,6 +40,7 @@ export declare const Cascader: React.ForwardRefExoticComponent<{
39
40
  cancelText?: ReactNode;
40
41
  children?: ((items: (CascaderOption | null)[], actions: CascaderActions) => ReactNode) | undefined;
41
42
  onTabsChange?: ((index: number) => void) | undefined;
43
+ activeIcon?: ReactNode;
42
44
  } & Pick<PopupProps, "onClick" | "destroyOnClose" | "forceRender" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & {
43
45
  className?: string | undefined;
44
46
  style?: (React.CSSProperties & Partial<Record<never, string>>) | undefined;
@@ -18,6 +18,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
18
18
  cancelText?: import("react").ReactNode;
19
19
  children?: ((items: (import("../cascader-view").CascaderOption | null)[], actions: import("./cascader").CascaderActions) => import("react").ReactNode) | undefined;
20
20
  onTabsChange?: ((index: number) => void) | undefined;
21
+ activeIcon?: import("react").ReactNode;
21
22
  } & Pick<import("../popup").PopupProps, "onClick" | "destroyOnClose" | "forceRender" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & {
22
23
  className?: string | undefined;
23
24
  style?: (import("react").CSSProperties & Partial<Record<never, string>>) | undefined;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type CascaderValue = string;
4
4
  export declare type CascaderOption = {
@@ -18,5 +18,6 @@ export declare type CascaderViewProps = {
18
18
  onChange?: (value: CascaderValue[], extend: CascaderValueExtend) => void;
19
19
  placeholder?: string;
20
20
  onTabsChange?: (index: number) => void;
21
+ activeIcon?: ReactNode;
21
22
  } & NativeProps<'--height'>;
22
23
  export declare const CascaderView: FC<CascaderViewProps>;
@@ -121,7 +121,8 @@ export const CascaderView = p => {
121
121
  animated: true
122
122
  })) : React.createElement(CheckList, {
123
123
  value: [value[index]],
124
- onChange: selectValue => onItemSelect(selectValue[0], index)
124
+ onChange: selectValue => onItemSelect(selectValue[0], index),
125
+ activeIcon: props.activeIcon
125
126
  }, level.options.map(option => {
126
127
  const active = value[index] === option.value;
127
128
  return React.createElement(CheckList.Item, {
@@ -1,5 +1,5 @@
1
1
  import { DialogProps } from './dialog';
2
- export declare type DialogShowProps = Omit<DialogProps, 'visible'>;
2
+ export declare type DialogShowProps = Omit<DialogProps, 'visible' | 'destroyOnClose' | 'forceRender'>;
3
3
  export declare type DialogShowHandler = {
4
4
  close: () => void;
5
5
  };
@@ -2,9 +2,6 @@
2
2
  --border-radius: 8px;
3
3
  --header-height: 28px;
4
4
  --z-index: var(--adm-floating-panel-z-index, 900);
5
- border-top-left-radius: var(--border-radius);
6
- border-top-right-radius: var(--border-radius);
7
- background: var(--adm-color-white);
8
5
  position: fixed;
9
6
  z-index: var(--z-index);
10
7
  bottom: 0;
@@ -30,7 +27,7 @@
30
27
  bottom: -100vh;
31
28
  height: 100vh;
32
29
  width: 100vw;
33
- background: var(--adm-color-white);
30
+ background: var(--adm-color-background);
34
31
  }
35
32
  .adm-floating-panel .adm-floating-panel-header {
36
33
  flex: none;
@@ -43,6 +40,8 @@
43
40
  -webkit-user-select: none;
44
41
  user-select: none;
45
42
  background-color: var(--adm-color-background);
43
+ border-top-left-radius: var(--border-radius);
44
+ border-top-right-radius: var(--border-radius);
46
45
  }
47
46
  .adm-floating-panel .adm-floating-panel-header .adm-floating-panel-bar {
48
47
  height: 3px;
@@ -53,4 +52,5 @@
53
52
  .adm-floating-panel .adm-floating-panel-content {
54
53
  flex: 1;
55
54
  overflow-y: scroll;
55
+ background: var(--adm-color-background);
56
56
  }
@@ -1,6 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useContext, useCallback, useState, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
+ import { withNativeProps } from '../../utils/native-props';
4
5
  import { Field } from 'rc-field-form';
5
6
  import FieldContext from 'rc-field-form/lib/FieldContext';
6
7
  import { devWarning } from '../../utils/dev-log';
@@ -87,7 +88,7 @@ const FormItemLayout = props => {
87
88
  key: `warning-${index}`,
88
89
  className: `${classPrefix}-feedback-warning`
89
90
  }, warning)))) : null;
90
- return React.createElement(List.Item, {
91
+ return withNativeProps(props, React.createElement(List.Item, {
91
92
  style: style,
92
93
  title: layout === 'vertical' && labelElement,
93
94
  prefix: layout === 'horizontal' && labelElement,
@@ -105,7 +106,7 @@ const FormItemLayout = props => {
105
106
  className: classNames(`${classPrefix}-child`, `${classPrefix}-child-position-${childElementPosition}`)
106
107
  }, React.createElement("div", {
107
108
  className: classNames(`${classPrefix}-child-inner`)
108
- }, children)));
109
+ }, children))));
109
110
  };
110
111
 
111
112
  export const FormItem = props => {
@@ -197,7 +198,7 @@ export const FormItem = props => {
197
198
 
198
199
  return subWarnings;
199
200
  }, curWarnings);
200
- return React.createElement(FormItemLayout, {
201
+ return withNativeProps(props, React.createElement(FormItemLayout, {
201
202
  className: className,
202
203
  style: style,
203
204
  label: label,
@@ -218,7 +219,7 @@ export const FormItem = props => {
218
219
  arrow: arrow
219
220
  }, React.createElement(NoStyleItemContext.Provider, {
220
221
  value: onSubMetaChange
221
- }, baseChildren));
222
+ }, baseChildren)));
222
223
  }
223
224
 
224
225
  const isRenderProps = typeof children === 'function';
@@ -1,8 +1,10 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { useSpring, animated } from '@react-spring/web';
3
+ import { useSize } from 'ahooks';
3
4
  import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
4
5
  import { useDragAndPinch } from '../../utils/use-drag-and-pinch';
5
6
  import { bound } from '../../utils/bound';
7
+ import * as mat from '../../utils/matrix';
6
8
  const classPrefix = `adm-image-viewer`;
7
9
  export const Slide = props => {
8
10
  const {
@@ -11,54 +13,71 @@ export const Slide = props => {
11
13
  const controlRef = useRef(null);
12
14
  const imgRef = useRef(null);
13
15
  const [{
14
- zoom,
15
- x,
16
- y
16
+ matrix
17
17
  }, api] = useSpring(() => ({
18
- zoom: 1,
19
- x: 0,
20
- y: 0,
18
+ matrix: mat.create(),
21
19
  config: {
22
20
  tension: 200
23
21
  }
24
22
  }));
23
+ const controlSize = useSize(controlRef);
24
+ const imgSize = useSize(imgRef);
25
25
  const pinchLockRef = useRef(false);
26
26
 
27
- function boundXY([x, y], rubberband) {
28
- const currentZoom = zoom.get();
29
- let xOffset = 0,
30
- yOffset = 0;
27
+ const boundMatrix = (nextMatrix, type, last = false) => {
28
+ if (!controlSize || !imgSize) return nextMatrix;
29
+ const controlLeft = -controlSize.width / 2;
30
+ const controlTop = -controlSize.height / 2;
31
+ const imgLeft = -imgSize.width / 2;
32
+ const imgTop = -imgSize.height / 2;
33
+ const zoom = mat.getScaleX(nextMatrix);
34
+ const scaledImgWidth = zoom * imgSize.width;
35
+ const scaledImgHeight = zoom * imgSize.height;
36
+ const [x, y] = mat.apply(nextMatrix, [imgLeft, imgTop]);
31
37
 
32
- if (imgRef.current && controlRef.current) {
33
- xOffset = ((currentZoom * imgRef.current.width || 0) - controlRef.current.clientWidth) / 2;
34
- yOffset = ((currentZoom * imgRef.current.height || 0) - controlRef.current.clientHeight) / 2;
38
+ if (type === 'translate') {
39
+ let boundedX = x;
40
+ let boundedY = y;
41
+
42
+ if (scaledImgWidth > controlSize.width) {
43
+ const minX = controlLeft - (scaledImgWidth - controlSize.width);
44
+ const maxX = controlLeft;
45
+ boundedX = last ? bound(x, minX, maxX) : rubberbandIfOutOfBounds(x, minX, maxX, zoom * 50);
46
+ } else {
47
+ boundedX = -scaledImgWidth / 2;
48
+ }
49
+
50
+ if (scaledImgHeight > controlSize.height) {
51
+ const minY = controlTop - (scaledImgHeight - controlSize.height);
52
+ const maxY = controlTop;
53
+ boundedY = last ? bound(y, minY, maxY) : rubberbandIfOutOfBounds(y, minY, maxY, zoom * 50);
54
+ } else {
55
+ boundedY = -scaledImgHeight / 2;
56
+ }
57
+
58
+ return mat.translate(nextMatrix, boundedX - x, boundedY - y);
35
59
  }
36
60
 
37
- xOffset = xOffset > 0 ? xOffset : 0;
38
- yOffset = yOffset > 0 ? yOffset : 0;
39
- const bounds = {
40
- left: -xOffset,
41
- right: xOffset,
42
- top: -yOffset,
43
- bottom: yOffset
44
- };
45
-
46
- if (rubberband) {
47
- return [rubberbandIfOutOfBounds(x, bounds.left, bounds.right, currentZoom * 50), rubberbandIfOutOfBounds(y, bounds.top, bounds.bottom, currentZoom * 50)];
48
- } else {
49
- return [bound(x, bounds.left, bounds.right), bound(y, bounds.top, bounds.bottom)];
61
+ if (type === 'scale' && last) {
62
+ const [boundedX, boundedY] = [scaledImgWidth > controlSize.width ? bound(x, controlLeft - (scaledImgWidth - controlSize.width), controlLeft) : -scaledImgWidth / 2, scaledImgHeight > controlSize.height ? bound(y, controlTop - (scaledImgHeight - controlSize.height), controlTop) : -scaledImgHeight / 2];
63
+ return mat.translate(nextMatrix, boundedX - x, boundedY - y);
50
64
  }
51
- }
65
+
66
+ return nextMatrix;
67
+ };
52
68
 
53
69
  useDragAndPinch({
54
70
  onDrag: state => {
71
+ if (state.first) return;
72
+ if (state.pinching) return state.cancel();
73
+
55
74
  if (state.tap && state.elapsedTime > 0 && state.elapsedTime < 1000) {
56
75
  // 判断点击时间>0是为了过滤掉非正常操作,例如用户长按选择图片之后的取消操作(也是一次点击)
57
76
  props.onTap();
58
77
  return;
59
78
  }
60
79
 
61
- const currentZoom = zoom.get();
80
+ const currentZoom = mat.getScaleX(matrix.get());
62
81
 
63
82
  if (dragLockRef) {
64
83
  dragLockRef.current = currentZoom !== 1;
@@ -66,24 +85,16 @@ export const Slide = props => {
66
85
 
67
86
  if (!pinchLockRef.current && currentZoom <= 1) {
68
87
  api.start({
69
- x: 0,
70
- y: 0
88
+ matrix: mat.create()
71
89
  });
72
90
  } else {
73
- if (state.last) {
74
- const [x, y] = boundXY([state.offset[0] + state.velocity[0] * state.direction[0] * 200, state.offset[1] + state.velocity[1] * state.direction[1] * 200], false);
75
- api.start({
76
- x,
77
- y
78
- });
79
- } else {
80
- const [x, y] = boundXY(state.offset, true);
81
- api.start({
82
- x,
83
- y,
84
- immediate: true
85
- });
86
- }
91
+ const currentMatrix = matrix.get();
92
+ const offset = [state.offset[0] - mat.getTranslateX(currentMatrix), state.offset[1] - mat.getTranslateY(currentMatrix)];
93
+ const nextMatrix = mat.translate(currentMatrix, ...(state.last ? [offset[0] + state.velocity[0] * state.direction[0] * 200, offset[1] + state.velocity[1] * state.direction[1] * 200] : offset));
94
+ api.start({
95
+ matrix: boundMatrix(nextMatrix, 'translate', state.last),
96
+ immediate: !state.last
97
+ });
87
98
  }
88
99
  },
89
100
  onPinch: state => {
@@ -93,22 +104,30 @@ export const Slide = props => {
93
104
  const [d] = state.offset;
94
105
  if (d < 0) return;
95
106
  const nextZoom = state.last ? bound(d, 1, props.maxZoom) : d;
96
- api.start({
97
- zoom: nextZoom,
98
- immediate: !state.last
99
- });
100
107
  (_a = props.onZoomChange) === null || _a === void 0 ? void 0 : _a.call(props, nextZoom);
101
108
 
102
109
  if (state.last && nextZoom <= 1) {
103
110
  api.start({
104
- x: 0,
105
- y: 0
111
+ matrix: mat.create()
106
112
  });
107
113
 
108
114
  if (dragLockRef) {
109
115
  dragLockRef.current = false;
110
116
  }
111
117
  } else {
118
+ if (!controlSize) return;
119
+ const currentMatrix = matrix.get();
120
+ const currentZoom = mat.getScaleX(currentMatrix);
121
+ const originOffsetX = state.origin[0] - controlSize.width / 2;
122
+ const originOffsetY = state.origin[1] - controlSize.height / 2;
123
+ let nextMatrix = mat.translate(currentMatrix, -originOffsetX, -originOffsetY);
124
+ nextMatrix = mat.scale(nextMatrix, nextZoom / currentZoom);
125
+ nextMatrix = mat.translate(nextMatrix, originOffsetX, originOffsetY);
126
+ api.start({
127
+ matrix: boundMatrix(nextMatrix, 'scale', state.last),
128
+ immediate: !state.last
129
+ });
130
+
112
131
  if (dragLockRef) {
113
132
  dragLockRef.current = true;
114
133
  }
@@ -118,13 +137,13 @@ export const Slide = props => {
118
137
  target: controlRef,
119
138
  drag: {
120
139
  // filterTaps: true,
121
- from: () => [x.get(), y.get()],
140
+ from: () => [mat.getTranslateX(matrix.get()), mat.getTranslateY(matrix.get())],
122
141
  pointer: {
123
142
  touch: true
124
143
  }
125
144
  },
126
145
  pinch: {
127
- from: () => [zoom.get(), 0],
146
+ from: () => [mat.getScaleX(matrix.get()), 0],
128
147
  pointer: {
129
148
  touch: true
130
149
  }
@@ -133,7 +152,7 @@ export const Slide = props => {
133
152
  return React.createElement("div", {
134
153
  className: `${classPrefix}-slide`,
135
154
  onPointerMove: e => {
136
- if (zoom.get() !== 1) {
155
+ if (mat.getScaleX(matrix.get()) !== 1) {
137
156
  e.stopPropagation();
138
157
  }
139
158
  }
@@ -143,9 +162,7 @@ export const Slide = props => {
143
162
  }, React.createElement(animated.div, {
144
163
  className: `${classPrefix}-image-wrapper`,
145
164
  style: {
146
- translateX: x,
147
- translateY: y,
148
- scale: zoom
165
+ matrix
149
166
  }
150
167
  }, React.createElement("img", {
151
168
  ref: imgRef,
@@ -7,6 +7,7 @@ import classNames from 'classnames';
7
7
  import { useIsomorphicLayoutEffect } from 'ahooks';
8
8
  import { bound } from '../../utils/bound';
9
9
  import { isIOS } from '../../utils/validate';
10
+ import { useConfig } from '../config-provider';
10
11
  const classPrefix = `adm-input`;
11
12
  const defaultProps = {
12
13
  defaultValue: '',
@@ -18,6 +19,9 @@ export const Input = forwardRef((p, ref) => {
18
19
  const [hasFocus, setHasFocus] = useState(false);
19
20
  const compositionStartRef = useRef(false);
20
21
  const nativeInputRef = useRef(null);
22
+ const {
23
+ locale
24
+ } = useConfig();
21
25
  useImperativeHandle(ref, () => ({
22
26
  clear: () => {
23
27
  setValue('');
@@ -139,7 +143,8 @@ export const Input = forwardRef((p, ref) => {
139
143
  role: props.role,
140
144
  "aria-valuenow": props['aria-valuenow'],
141
145
  "aria-valuemax": props['aria-valuemax'],
142
- "aria-valuemin": props['aria-valuemin']
146
+ "aria-valuemin": props['aria-valuemin'],
147
+ "aria-label": props['aria-label']
143
148
  }), shouldShowClear && React.createElement("div", {
144
149
  className: `${classPrefix}-clear`,
145
150
  onMouseDown: e => {
@@ -155,6 +160,7 @@ export const Input = forwardRef((p, ref) => {
155
160
  compositionStartRef.current = false;
156
161
  (_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
157
162
  }
158
- }
163
+ },
164
+ "aria-label": locale.Input.clear
159
165
  }, React.createElement(CloseCircleFill, null))));
160
166
  });
@@ -1,5 +1,5 @@
1
1
  import { ModalProps } from './modal';
2
- export declare type ModalShowProps = Omit<ModalProps, 'visible'>;
2
+ export declare type ModalShowProps = Omit<ModalProps, 'visible' | 'destroyOnClose' | 'forceRender'>;
3
3
  export declare type ModalShowHandler = {
4
4
  close: () => void;
5
5
  };
@@ -61,6 +61,14 @@
61
61
  flex-shrink: 0;
62
62
  margin-left: 12px;
63
63
  }
64
+ .adm-notice-bar-close {
65
+ width: 24px;
66
+ height: 24px;
67
+ margin-right: -3px;
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ }
64
72
  .adm-notice-bar-close-icon {
65
73
  font-size: var(--adm-font-size-10);
66
74
  }
@@ -82,13 +82,15 @@ export const NoticeBar = memo(p => {
82
82
  className: `${classPrefix}-content-inner`
83
83
  }, props.content)), (props.closeable || props.extra) && React.createElement("span", {
84
84
  className: `${classPrefix}-right`
85
- }, props.extra, props.closeable && React.createElement(CloseOutline, {
86
- className: `${classPrefix}-close-icon`,
85
+ }, props.extra, props.closeable && React.createElement("div", {
86
+ className: `${classPrefix}-close`,
87
87
  onClick: () => {
88
88
  var _a;
89
89
 
90
90
  setVisible(false);
91
91
  (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
92
92
  }
93
- }))));
93
+ }, React.createElement(CloseOutline, {
94
+ className: `${classPrefix}-close-icon`
95
+ })))));
94
96
  });