antd-mobile 5.18.0 → 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 (155) hide show
  1. package/2x/bundle/antd-mobile.cjs.js +47 -18976
  2. package/2x/bundle/antd-mobile.compatible.umd.js +25752 -0
  3. package/2x/bundle/antd-mobile.es.js +16123 -16565
  4. package/2x/bundle/antd-mobile.umd.js +64 -0
  5. package/2x/bundle/style.css +227 -273
  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 +1 -1
  9. package/2x/cjs/components/cascader/cascader.d.ts +2 -0
  10. package/2x/cjs/components/cascader/index.d.ts +1 -0
  11. package/2x/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  12. package/2x/cjs/components/cascader-view/cascader-view.js +2 -1
  13. package/2x/cjs/components/dialog/show.d.ts +1 -1
  14. package/2x/cjs/components/image-viewer/slide.js +75 -56
  15. package/2x/cjs/components/input/input.js +9 -2
  16. package/2x/cjs/components/modal/show.d.ts +1 -1
  17. package/2x/cjs/components/number-keyboard/number-keyboard.css +11 -15
  18. package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  19. package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
  20. package/2x/cjs/components/passcode-input/index.d.ts +1 -1
  21. package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
  22. package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
  23. package/2x/cjs/components/result/result.d.ts +1 -1
  24. package/2x/cjs/components/result/result.js +7 -1
  25. package/2x/cjs/components/search-bar/search-bar.js +12 -2
  26. package/2x/cjs/locales/base.d.ts +9 -0
  27. package/2x/cjs/locales/base.js +9 -0
  28. package/2x/cjs/locales/en-US.d.ts +9 -0
  29. package/2x/cjs/locales/es-ES.d.ts +9 -0
  30. package/2x/cjs/locales/fa-IR.d.ts +9 -0
  31. package/2x/cjs/locales/fr-FR.d.ts +9 -0
  32. package/2x/cjs/locales/id-ID.d.ts +9 -0
  33. package/2x/cjs/locales/kk-KZ.d.ts +9 -0
  34. package/2x/cjs/locales/ko-KR.d.ts +9 -0
  35. package/2x/cjs/locales/zh-CN.d.ts +9 -0
  36. package/2x/cjs/locales/zh-CN.js +9 -0
  37. package/2x/cjs/locales/zh-HK.d.ts +9 -0
  38. package/2x/cjs/locales/zh-TW.d.ts +9 -0
  39. package/2x/cjs/utils/matrix.d.ts +10 -0
  40. package/2x/cjs/utils/matrix.js +60 -0
  41. package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
  42. package/2x/es/components/button/button.js +1 -1
  43. package/2x/es/components/calendar/calendar.d.ts +1 -1
  44. package/2x/es/components/cascader/cascader.d.ts +2 -0
  45. package/2x/es/components/cascader/index.d.ts +1 -0
  46. package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
  47. package/2x/es/components/cascader-view/cascader-view.js +2 -1
  48. package/2x/es/components/dialog/show.d.ts +1 -1
  49. package/2x/es/components/image-viewer/slide.js +73 -56
  50. package/2x/es/components/input/input.js +8 -2
  51. package/2x/es/components/modal/show.d.ts +1 -1
  52. package/2x/es/components/number-keyboard/number-keyboard.css +11 -15
  53. package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  54. package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
  55. package/2x/es/components/passcode-input/index.d.ts +1 -1
  56. package/2x/es/components/passcode-input/passcode-input.css +12 -12
  57. package/2x/es/components/passcode-input/passcode-input.js +15 -8
  58. package/2x/es/components/result/result.d.ts +1 -1
  59. package/2x/es/components/result/result.js +6 -1
  60. package/2x/es/components/search-bar/search-bar.js +12 -2
  61. package/2x/es/locales/base.d.ts +9 -0
  62. package/2x/es/locales/base.js +9 -0
  63. package/2x/es/locales/en-US.d.ts +9 -0
  64. package/2x/es/locales/es-ES.d.ts +9 -0
  65. package/2x/es/locales/fa-IR.d.ts +9 -0
  66. package/2x/es/locales/fr-FR.d.ts +9 -0
  67. package/2x/es/locales/id-ID.d.ts +9 -0
  68. package/2x/es/locales/kk-KZ.d.ts +9 -0
  69. package/2x/es/locales/ko-KR.d.ts +9 -0
  70. package/2x/es/locales/zh-CN.d.ts +9 -0
  71. package/2x/es/locales/zh-CN.js +9 -0
  72. package/2x/es/locales/zh-HK.d.ts +9 -0
  73. package/2x/es/locales/zh-TW.d.ts +9 -0
  74. package/2x/es/utils/matrix.d.ts +10 -0
  75. package/2x/es/utils/matrix.js +27 -0
  76. package/2x/package.json +1 -1
  77. package/2x/umd/antd-mobile.js +25752 -2
  78. package/bundle/antd-mobile.cjs.js +47 -18976
  79. package/bundle/antd-mobile.compatible.umd.js +25752 -0
  80. package/bundle/antd-mobile.es.js +16123 -16565
  81. package/bundle/antd-mobile.umd.js +64 -0
  82. package/bundle/style.css +1 -4088
  83. package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
  84. package/cjs/components/button/button.js +1 -1
  85. package/cjs/components/calendar/calendar.d.ts +1 -1
  86. package/cjs/components/cascader/cascader.d.ts +2 -0
  87. package/cjs/components/cascader/index.d.ts +1 -0
  88. package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
  89. package/cjs/components/cascader-view/cascader-view.js +2 -1
  90. package/cjs/components/dialog/show.d.ts +1 -1
  91. package/cjs/components/image-viewer/slide.js +75 -56
  92. package/cjs/components/input/input.js +9 -2
  93. package/cjs/components/modal/show.d.ts +1 -1
  94. package/cjs/components/number-keyboard/number-keyboard.css +11 -14
  95. package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
  96. package/cjs/components/number-keyboard/number-keyboard.js +19 -17
  97. package/cjs/components/passcode-input/index.d.ts +1 -1
  98. package/cjs/components/passcode-input/passcode-input.css +12 -12
  99. package/cjs/components/passcode-input/passcode-input.js +16 -8
  100. package/cjs/components/result/result.d.ts +1 -1
  101. package/cjs/components/result/result.js +7 -1
  102. package/cjs/components/search-bar/search-bar.js +12 -2
  103. package/cjs/locales/base.d.ts +9 -0
  104. package/cjs/locales/base.js +9 -0
  105. package/cjs/locales/en-US.d.ts +9 -0
  106. package/cjs/locales/es-ES.d.ts +9 -0
  107. package/cjs/locales/fa-IR.d.ts +9 -0
  108. package/cjs/locales/fr-FR.d.ts +9 -0
  109. package/cjs/locales/id-ID.d.ts +9 -0
  110. package/cjs/locales/kk-KZ.d.ts +9 -0
  111. package/cjs/locales/ko-KR.d.ts +9 -0
  112. package/cjs/locales/zh-CN.d.ts +9 -0
  113. package/cjs/locales/zh-CN.js +9 -0
  114. package/cjs/locales/zh-HK.d.ts +9 -0
  115. package/cjs/locales/zh-TW.d.ts +9 -0
  116. package/cjs/utils/matrix.d.ts +10 -0
  117. package/cjs/utils/matrix.js +60 -0
  118. package/es/components/action-sheet/action-sheet.d.ts +1 -1
  119. package/es/components/button/button.js +1 -1
  120. package/es/components/calendar/calendar.d.ts +1 -1
  121. package/es/components/cascader/cascader.d.ts +2 -0
  122. package/es/components/cascader/index.d.ts +1 -0
  123. package/es/components/cascader-view/cascader-view.d.ts +2 -1
  124. package/es/components/cascader-view/cascader-view.js +2 -1
  125. package/es/components/dialog/show.d.ts +1 -1
  126. package/es/components/image-viewer/slide.js +73 -56
  127. package/es/components/input/input.js +8 -2
  128. package/es/components/modal/show.d.ts +1 -1
  129. package/es/components/number-keyboard/number-keyboard.css +11 -14
  130. package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
  131. package/es/components/number-keyboard/number-keyboard.js +19 -17
  132. package/es/components/passcode-input/index.d.ts +1 -1
  133. package/es/components/passcode-input/passcode-input.css +12 -12
  134. package/es/components/passcode-input/passcode-input.js +15 -8
  135. package/es/components/result/result.d.ts +1 -1
  136. package/es/components/result/result.js +6 -1
  137. package/es/components/search-bar/search-bar.js +12 -2
  138. package/es/locales/base.d.ts +9 -0
  139. package/es/locales/base.js +9 -0
  140. package/es/locales/en-US.d.ts +9 -0
  141. package/es/locales/es-ES.d.ts +9 -0
  142. package/es/locales/fa-IR.d.ts +9 -0
  143. package/es/locales/fr-FR.d.ts +9 -0
  144. package/es/locales/id-ID.d.ts +9 -0
  145. package/es/locales/kk-KZ.d.ts +9 -0
  146. package/es/locales/ko-KR.d.ts +9 -0
  147. package/es/locales/zh-CN.d.ts +9 -0
  148. package/es/locales/zh-CN.js +9 -0
  149. package/es/locales/zh-HK.d.ts +9 -0
  150. package/es/locales/zh-TW.d.ts +9 -0
  151. package/es/utils/matrix.d.ts +10 -0
  152. package/es/utils/matrix.js +27 -0
  153. package/package.json +1 -1
  154. package/umd/antd-mobile.js +1 -1
  155. package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
@@ -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;
@@ -88,6 +88,6 @@ const Button = (0, _react.forwardRef)((p, ref) => {
88
88
  onTouchEnd: props.onTouchEnd
89
89
  }, loading ? _react.default.createElement("div", {
90
90
  className: `${classPrefix}-loading-wrapper`
91
- }, props.loadingIcon, props.loadingText) : props.children));
91
+ }, props.loadingIcon, props.loadingText) : _react.default.createElement("span", null, props.children)));
92
92
  });
93
93
  exports.Button = Button;
@@ -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;
@@ -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>;
@@ -147,7 +147,8 @@ const CascaderView = p => {
147
147
  animated: true
148
148
  })) : _react.default.createElement(_checkList.default, {
149
149
  value: [value[index]],
150
- onChange: selectValue => onItemSelect(selectValue[0], index)
150
+ onChange: selectValue => onItemSelect(selectValue[0], index),
151
+ activeIcon: props.activeIcon
151
152
  }, level.options.map(option => {
152
153
  const active = value[index] === option.value;
153
154
  return _react.default.createElement(_checkList.default.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
  };
@@ -9,12 +9,16 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _web = require("@react-spring/web");
11
11
 
12
+ var _ahooks = require("ahooks");
13
+
12
14
  var _rubberband = require("../../utils/rubberband");
13
15
 
14
16
  var _useDragAndPinch = require("../../utils/use-drag-and-pinch");
15
17
 
16
18
  var _bound = require("../../utils/bound");
17
19
 
20
+ var mat = _interopRequireWildcard(require("../../utils/matrix"));
21
+
18
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
23
 
20
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -28,54 +32,71 @@ const Slide = props => {
28
32
  const controlRef = (0, _react.useRef)(null);
29
33
  const imgRef = (0, _react.useRef)(null);
30
34
  const [{
31
- zoom,
32
- x,
33
- y
35
+ matrix
34
36
  }, api] = (0, _web.useSpring)(() => ({
35
- zoom: 1,
36
- x: 0,
37
- y: 0,
37
+ matrix: mat.create(),
38
38
  config: {
39
39
  tension: 200
40
40
  }
41
41
  }));
42
+ const controlSize = (0, _ahooks.useSize)(controlRef);
43
+ const imgSize = (0, _ahooks.useSize)(imgRef);
42
44
  const pinchLockRef = (0, _react.useRef)(false);
43
45
 
44
- function boundXY([x, y], rubberband) {
45
- const currentZoom = zoom.get();
46
- let xOffset = 0,
47
- yOffset = 0;
46
+ const boundMatrix = (nextMatrix, type, last = false) => {
47
+ if (!controlSize || !imgSize) return nextMatrix;
48
+ const controlLeft = -controlSize.width / 2;
49
+ const controlTop = -controlSize.height / 2;
50
+ const imgLeft = -imgSize.width / 2;
51
+ const imgTop = -imgSize.height / 2;
52
+ const zoom = mat.getScaleX(nextMatrix);
53
+ const scaledImgWidth = zoom * imgSize.width;
54
+ const scaledImgHeight = zoom * imgSize.height;
55
+ const [x, y] = mat.apply(nextMatrix, [imgLeft, imgTop]);
56
+
57
+ if (type === 'translate') {
58
+ let boundedX = x;
59
+ let boundedY = y;
60
+
61
+ if (scaledImgWidth > controlSize.width) {
62
+ const minX = controlLeft - (scaledImgWidth - controlSize.width);
63
+ const maxX = controlLeft;
64
+ boundedX = last ? (0, _bound.bound)(x, minX, maxX) : (0, _rubberband.rubberbandIfOutOfBounds)(x, minX, maxX, zoom * 50);
65
+ } else {
66
+ boundedX = -scaledImgWidth / 2;
67
+ }
68
+
69
+ if (scaledImgHeight > controlSize.height) {
70
+ const minY = controlTop - (scaledImgHeight - controlSize.height);
71
+ const maxY = controlTop;
72
+ boundedY = last ? (0, _bound.bound)(y, minY, maxY) : (0, _rubberband.rubberbandIfOutOfBounds)(y, minY, maxY, zoom * 50);
73
+ } else {
74
+ boundedY = -scaledImgHeight / 2;
75
+ }
48
76
 
49
- if (imgRef.current && controlRef.current) {
50
- xOffset = ((currentZoom * imgRef.current.width || 0) - controlRef.current.clientWidth) / 2;
51
- yOffset = ((currentZoom * imgRef.current.height || 0) - controlRef.current.clientHeight) / 2;
77
+ return mat.translate(nextMatrix, boundedX - x, boundedY - y);
52
78
  }
53
79
 
54
- xOffset = xOffset > 0 ? xOffset : 0;
55
- yOffset = yOffset > 0 ? yOffset : 0;
56
- const bounds = {
57
- left: -xOffset,
58
- right: xOffset,
59
- top: -yOffset,
60
- bottom: yOffset
61
- };
62
-
63
- if (rubberband) {
64
- return [(0, _rubberband.rubberbandIfOutOfBounds)(x, bounds.left, bounds.right, currentZoom * 50), (0, _rubberband.rubberbandIfOutOfBounds)(y, bounds.top, bounds.bottom, currentZoom * 50)];
65
- } else {
66
- return [(0, _bound.bound)(x, bounds.left, bounds.right), (0, _bound.bound)(y, bounds.top, bounds.bottom)];
80
+ if (type === 'scale' && last) {
81
+ const [boundedX, boundedY] = [scaledImgWidth > controlSize.width ? (0, _bound.bound)(x, controlLeft - (scaledImgWidth - controlSize.width), controlLeft) : -scaledImgWidth / 2, scaledImgHeight > controlSize.height ? (0, _bound.bound)(y, controlTop - (scaledImgHeight - controlSize.height), controlTop) : -scaledImgHeight / 2];
82
+ return mat.translate(nextMatrix, boundedX - x, boundedY - y);
67
83
  }
68
- }
84
+
85
+ return nextMatrix;
86
+ };
69
87
 
70
88
  (0, _useDragAndPinch.useDragAndPinch)({
71
89
  onDrag: state => {
90
+ if (state.first) return;
91
+ if (state.pinching) return state.cancel();
92
+
72
93
  if (state.tap && state.elapsedTime > 0 && state.elapsedTime < 1000) {
73
94
  // 判断点击时间>0是为了过滤掉非正常操作,例如用户长按选择图片之后的取消操作(也是一次点击)
74
95
  props.onTap();
75
96
  return;
76
97
  }
77
98
 
78
- const currentZoom = zoom.get();
99
+ const currentZoom = mat.getScaleX(matrix.get());
79
100
 
80
101
  if (dragLockRef) {
81
102
  dragLockRef.current = currentZoom !== 1;
@@ -83,24 +104,16 @@ const Slide = props => {
83
104
 
84
105
  if (!pinchLockRef.current && currentZoom <= 1) {
85
106
  api.start({
86
- x: 0,
87
- y: 0
107
+ matrix: mat.create()
88
108
  });
89
109
  } else {
90
- if (state.last) {
91
- 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);
92
- api.start({
93
- x,
94
- y
95
- });
96
- } else {
97
- const [x, y] = boundXY(state.offset, true);
98
- api.start({
99
- x,
100
- y,
101
- immediate: true
102
- });
103
- }
110
+ const currentMatrix = matrix.get();
111
+ const offset = [state.offset[0] - mat.getTranslateX(currentMatrix), state.offset[1] - mat.getTranslateY(currentMatrix)];
112
+ 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));
113
+ api.start({
114
+ matrix: boundMatrix(nextMatrix, 'translate', state.last),
115
+ immediate: !state.last
116
+ });
104
117
  }
105
118
  },
106
119
  onPinch: state => {
@@ -110,22 +123,30 @@ const Slide = props => {
110
123
  const [d] = state.offset;
111
124
  if (d < 0) return;
112
125
  const nextZoom = state.last ? (0, _bound.bound)(d, 1, props.maxZoom) : d;
113
- api.start({
114
- zoom: nextZoom,
115
- immediate: !state.last
116
- });
117
126
  (_a = props.onZoomChange) === null || _a === void 0 ? void 0 : _a.call(props, nextZoom);
118
127
 
119
128
  if (state.last && nextZoom <= 1) {
120
129
  api.start({
121
- x: 0,
122
- y: 0
130
+ matrix: mat.create()
123
131
  });
124
132
 
125
133
  if (dragLockRef) {
126
134
  dragLockRef.current = false;
127
135
  }
128
136
  } else {
137
+ if (!controlSize) return;
138
+ const currentMatrix = matrix.get();
139
+ const currentZoom = mat.getScaleX(currentMatrix);
140
+ const originOffsetX = state.origin[0] - controlSize.width / 2;
141
+ const originOffsetY = state.origin[1] - controlSize.height / 2;
142
+ let nextMatrix = mat.translate(currentMatrix, -originOffsetX, -originOffsetY);
143
+ nextMatrix = mat.scale(nextMatrix, nextZoom / currentZoom);
144
+ nextMatrix = mat.translate(nextMatrix, originOffsetX, originOffsetY);
145
+ api.start({
146
+ matrix: boundMatrix(nextMatrix, 'scale', state.last),
147
+ immediate: !state.last
148
+ });
149
+
129
150
  if (dragLockRef) {
130
151
  dragLockRef.current = true;
131
152
  }
@@ -135,13 +156,13 @@ const Slide = props => {
135
156
  target: controlRef,
136
157
  drag: {
137
158
  // filterTaps: true,
138
- from: () => [x.get(), y.get()],
159
+ from: () => [mat.getTranslateX(matrix.get()), mat.getTranslateY(matrix.get())],
139
160
  pointer: {
140
161
  touch: true
141
162
  }
142
163
  },
143
164
  pinch: {
144
- from: () => [zoom.get(), 0],
165
+ from: () => [mat.getScaleX(matrix.get()), 0],
145
166
  pointer: {
146
167
  touch: true
147
168
  }
@@ -150,7 +171,7 @@ const Slide = props => {
150
171
  return _react.default.createElement("div", {
151
172
  className: `${classPrefix}-slide`,
152
173
  onPointerMove: e => {
153
- if (zoom.get() !== 1) {
174
+ if (mat.getScaleX(matrix.get()) !== 1) {
154
175
  e.stopPropagation();
155
176
  }
156
177
  }
@@ -160,9 +181,7 @@ const Slide = props => {
160
181
  }, _react.default.createElement(_web.animated.div, {
161
182
  className: `${classPrefix}-image-wrapper`,
162
183
  style: {
163
- translateX: x,
164
- translateY: y,
165
- scale: zoom
184
+ matrix
166
185
  }
167
186
  }, _react.default.createElement("img", {
168
187
  ref: imgRef,
@@ -23,6 +23,8 @@ var _bound = require("../../utils/bound");
23
23
 
24
24
  var _validate = require("../../utils/validate");
25
25
 
26
+ var _configProvider = require("../config-provider");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -40,6 +42,9 @@ const Input = (0, _react.forwardRef)((p, ref) => {
40
42
  const [hasFocus, setHasFocus] = (0, _react.useState)(false);
41
43
  const compositionStartRef = (0, _react.useRef)(false);
42
44
  const nativeInputRef = (0, _react.useRef)(null);
45
+ const {
46
+ locale
47
+ } = (0, _configProvider.useConfig)();
43
48
  (0, _react.useImperativeHandle)(ref, () => ({
44
49
  clear: () => {
45
50
  setValue('');
@@ -161,7 +166,8 @@ const Input = (0, _react.forwardRef)((p, ref) => {
161
166
  role: props.role,
162
167
  "aria-valuenow": props['aria-valuenow'],
163
168
  "aria-valuemax": props['aria-valuemax'],
164
- "aria-valuemin": props['aria-valuemin']
169
+ "aria-valuemin": props['aria-valuemin'],
170
+ "aria-label": props['aria-label']
165
171
  }), shouldShowClear && _react.default.createElement("div", {
166
172
  className: `${classPrefix}-clear`,
167
173
  onMouseDown: e => {
@@ -177,7 +183,8 @@ const Input = (0, _react.forwardRef)((p, ref) => {
177
183
  compositionStartRef.current = false;
178
184
  (_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
179
185
  }
180
- }
186
+ },
187
+ "aria-label": locale.Input.clear
181
188
  }, _react.default.createElement(_antdMobileIcons.CloseCircleFill, null))));
182
189
  });
183
190
  exports.Input = Input;
@@ -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
  };
@@ -4,7 +4,7 @@
4
4
  flex: 1;
5
5
  }
6
6
 
7
- .adm-number-keyboard-main.confirmed-style .sign-key {
7
+ .adm-number-keyboard-main.adm-number-keyboard-main-confirmed-style .adm-number-keyboard-key-sign {
8
8
  background-color: var(--adm-color-white);
9
9
  }
10
10
 
@@ -40,11 +40,11 @@
40
40
  font-size: 32px;
41
41
  }
42
42
 
43
- .adm-number-keyboard-header.with-title {
43
+ .adm-number-keyboard-header.adm-number-keyboard-header-with-title {
44
44
  justify-content: space-between;
45
45
  }
46
46
 
47
- .adm-number-keyboard-header.with-title .adm-number-keyboard-header-close-button {
47
+ .adm-number-keyboard-header.adm-number-keyboard-header-with-title .adm-number-keyboard-header-close-button {
48
48
  padding-right: 0;
49
49
  }
50
50
 
@@ -97,37 +97,33 @@
97
97
  box-sizing: content-box;
98
98
  }
99
99
 
100
- .adm-number-keyboard-key.mid-key {
100
+ .adm-number-keyboard-key.adm-number-keyboard-key-mid {
101
101
  flex-basis: 66.67%;
102
102
  }
103
103
 
104
- .adm-number-keyboard-key.sign-key:active::before {
104
+ .adm-number-keyboard-key.adm-number-keyboard-key-sign:active::before {
105
105
  opacity: 0.1;
106
106
  }
107
107
 
108
- .adm-number-keyboard-key.extra-key {
108
+ .adm-number-keyboard-key.adm-number-keyboard-key-extra {
109
109
  border-left: solid 2px var(--adm-color-border);
110
110
  border-right: none;
111
111
  }
112
112
 
113
- .adm-number-keyboard-key.extra-key,
114
- .adm-number-keyboard-key.number-key {
113
+ .adm-number-keyboard-key.adm-number-keyboard-key-extra,
114
+ .adm-number-keyboard-key.adm-number-keyboard-key-number {
115
115
  background-color: var(--adm-color-background);
116
116
  }
117
117
 
118
- .adm-number-keyboard-key.extra-key:active::before,
119
- .adm-number-keyboard-key.number-key:active::before {
118
+ .adm-number-keyboard-key.adm-number-keyboard-key-extra:active::before,
119
+ .adm-number-keyboard-key.adm-number-keyboard-key-number:active::before {
120
120
  opacity: 0.1;
121
121
  }
122
122
 
123
- .adm-number-keyboard-key.ok-key {
123
+ .adm-number-keyboard-key.adm-number-keyboard-key-ok {
124
124
  background-color: var(--adm-color-primary);
125
125
  color: var(--adm-color-white);
126
126
  height: 288px;
127
127
  font-size: 32px;
128
128
  border: none;
129
- }
130
-
131
- .adm-number-keyboard-bs-key {
132
- height: 40px;
133
129
  }
@@ -5,7 +5,7 @@ export declare type NumberKeyboardProps = {
5
5
  visible?: boolean;
6
6
  title?: string;
7
7
  confirmText?: string | null;
8
- customKey?: '-' | '.' | 'X';
8
+ customKey?: string | [string, string];
9
9
  randomOrder?: boolean;
10
10
  showCloseButton?: boolean;
11
11
  onInput?: (v: string) => void;
@@ -57,13 +57,18 @@ const NumberKeyboard = p => {
57
57
  const keys = (0, _react.useMemo)(() => {
58
58
  const defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
59
59
  const keyList = randomOrder ? (0, _shuffle.shuffle)(defaultKeys) : defaultKeys;
60
+ const customKeys = Array.isArray(customKey) ? customKey : [customKey];
60
61
  keyList.push('0');
61
62
 
62
63
  if (confirmText) {
63
- keyList.push(customKey || '');
64
+ if (customKeys.length === 2) {
65
+ keyList.splice(9, 0, customKeys.pop());
66
+ }
67
+
68
+ keyList.push(customKeys[0] || '');
64
69
  } else {
65
- keyList.splice(9, 0, customKey || '');
66
- keyList.push('BACKSPACE');
70
+ keyList.splice(9, 0, customKeys[0] || '');
71
+ keyList.push(customKeys[1] || 'BACKSPACE');
67
72
  }
68
73
 
69
74
  return keyList;
@@ -86,8 +91,7 @@ const NumberKeyboard = p => {
86
91
  const onBackspacePressEnd = () => {
87
92
  clearTimeout(timeoutRef.current);
88
93
  clearInterval(intervalRef.current);
89
- }; // 点击键盘按键
90
-
94
+ };
91
95
 
92
96
  const onKeyPress = (e, key) => {
93
97
  var _a, _b;
@@ -109,18 +113,17 @@ const NumberKeyboard = p => {
109
113
  break;
110
114
 
111
115
  default:
112
- // customKey 不存在时,点击该键不应该触发 onInput
116
+ // onInput should't be called when customKey doesn't exist
113
117
  if (key !== '') onInput === null || onInput === void 0 ? void 0 : onInput(key);
114
118
  break;
115
119
  }
116
- }; // 渲染 title 和 close button
117
-
120
+ };
118
121
 
119
122
  const renderHeader = () => {
120
123
  if (!showCloseButton && !title) return null;
121
124
  return _react.default.createElement("div", {
122
125
  className: (0, _classnames.default)(`${classPrefix}-header`, {
123
- 'with-title': !!title
126
+ [`${classPrefix}-header-with-title`]: !!title
124
127
  })
125
128
  }, title && _react.default.createElement("div", {
126
129
  className: `${classPrefix}-title`
@@ -134,15 +137,14 @@ const NumberKeyboard = p => {
134
137
  role: 'button',
135
138
  title: 'CLOSE'
136
139
  }, _react.default.createElement(_antdMobileIcons.DownOutline, null)));
137
- }; // 渲染基础键盘按键
138
-
140
+ };
139
141
 
140
142
  const renderKey = (key, index) => {
141
143
  const isNumberKey = /^\d$/.test(key);
142
144
  const className = (0, _classnames.default)(`${classPrefix}-key`, {
143
- 'number-key': isNumberKey,
144
- 'sign-key': !isNumberKey && key,
145
- 'mid-key': index === 9 && !!confirmText
145
+ [`${classPrefix}-key-number`]: isNumberKey,
146
+ [`${classPrefix}-key-sign`]: !isNumberKey && key,
147
+ [`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
146
148
  });
147
149
  const ariaProps = key ? {
148
150
  role: 'button',
@@ -186,12 +188,12 @@ const NumberKeyboard = p => {
186
188
  className: `${classPrefix}-wrapper`
187
189
  }, _react.default.createElement("div", {
188
190
  className: (0, _classnames.default)(`${classPrefix}-main`, {
189
- 'confirmed-style': !!confirmText
191
+ [`${classPrefix}-main-confirmed-style`]: !!confirmText
190
192
  })
191
193
  }, keys.map(renderKey)), !!confirmText && _react.default.createElement("div", {
192
194
  className: `${classPrefix}-confirm`
193
195
  }, _react.default.createElement("div", {
194
- className: `${classPrefix}-key extra-key bs-key`,
196
+ className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-bs`,
195
197
  onTouchStart: () => {
196
198
  onBackspacePressStart();
197
199
  },
@@ -202,7 +204,7 @@ const NumberKeyboard = p => {
202
204
  title: 'BACKSPACE',
203
205
  role: 'button'
204
206
  }, _react.default.createElement(_antdMobileIcons.TextDeletionOutline, null)), _react.default.createElement("div", {
205
- className: `${classPrefix}-key extra-key ok-key`,
207
+ className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
206
208
  onTouchEnd: e => onKeyPress(e, 'OK'),
207
209
  role: 'button'
208
210
  }, confirmText))), props.safeArea && _react.default.createElement("div", {
@@ -1,4 +1,4 @@
1
1
  import './passcode-input.less';
2
2
  import { PasscodeInput } from './passcode-input';
3
- export type { PasscodeInputProps } from './passcode-input';
3
+ export type { PasscodeInputProps, PasscodeInputRef } from './passcode-input';
4
4
  export default PasscodeInput;
@@ -25,56 +25,56 @@
25
25
  background: var(--adm-color-background);
26
26
  }
27
27
 
28
- .adm-passcode-input:not(.seperated) {
28
+ .adm-passcode-input:not(.adm-passcode-input-seperated) {
29
29
  border-radius: var(--border-radius);
30
30
  overflow: hidden;
31
31
  border: 2px solid var(--border-color);
32
32
  }
33
33
 
34
- .adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
34
+ .adm-passcode-input:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:not(:last-child) {
35
35
  border-right: 2px solid var(--border-color);
36
36
  }
37
37
 
38
- .adm-passcode-input:not(.seperated).focused {
38
+ .adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-focused {
39
39
  border-color: var(--adm-color-primary);
40
40
  box-shadow: 0 0 4px 0 var(--adm-color-primary);
41
41
  outline: none;
42
42
  }
43
43
 
44
- .adm-passcode-input:not(.seperated).error {
44
+ .adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-error {
45
45
  border-color: var(--adm-color-danger);
46
46
  box-shadow: 0 0 4px 0 var(--adm-color-danger);
47
47
  animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
48
48
  }
49
49
 
50
- .adm-passcode-input.seperated .adm-passcode-input-cell {
50
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell {
51
51
  border-radius: var(--border-radius);
52
52
  border: 2px solid var(--border-color);
53
53
  }
54
54
 
55
- .adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
55
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:not(:last-child) {
56
56
  margin-right: var(--cell-gap);
57
57
  }
58
58
 
59
- .adm-passcode-input.seperated .adm-passcode-input-cell.focused {
59
+ .adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell-focused {
60
60
  border-color: var(--adm-color-primary);
61
61
  box-shadow: 0 0 4px 0 var(--adm-color-primary);
62
62
  }
63
63
 
64
- .adm-passcode-input.seperated.focused {
64
+ .adm-passcode-input-seperated.adm-passcode-input-focused {
65
65
  outline: none;
66
66
  }
67
67
 
68
- .adm-passcode-input.seperated.error {
68
+ .adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error {
69
69
  animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
70
70
  }
71
71
 
72
- .adm-passcode-input.seperated.error .adm-passcode-input-cell {
72
+ .adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error .adm-passcode-input-cell {
73
73
  border-color: var(--adm-color-danger);
74
74
  box-shadow: 0 0 4px 0 var(--adm-color-danger);
75
75
  }
76
76
 
77
- .adm-passcode-input-cell.dot::before {
77
+ .adm-passcode-input-cell-dot::before {
78
78
  content: '';
79
79
  width: var(--dot-size);
80
80
  height: var(--dot-size);
@@ -82,7 +82,7 @@
82
82
  background: var(--adm-color-text);
83
83
  }
84
84
 
85
- .adm-passcode-input-cell.caret::after {
85
+ .adm-passcode-input-cell-caret::after {
86
86
  content: '';
87
87
  width: 4px;
88
88
  height: 1.1em;