antd-mobile 5.8.2 → 5.9.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 (78) hide show
  1. package/2x/cjs/components/button/button.d.ts +18 -2
  2. package/2x/cjs/components/button/button.js +15 -5
  3. package/2x/cjs/components/button/index.d.ts +1 -1
  4. package/2x/cjs/components/form/context.d.ts +1 -0
  5. package/2x/cjs/components/form/context.js +1 -0
  6. package/2x/cjs/components/form/form-item.js +6 -4
  7. package/2x/cjs/components/form/form.js +1 -0
  8. package/2x/cjs/components/picker/picker-utils.d.ts +2 -0
  9. package/2x/cjs/components/picker/picker-utils.js +10 -0
  10. package/2x/cjs/components/picker/picker.d.ts +1 -0
  11. package/2x/cjs/components/picker/picker.js +5 -1
  12. package/2x/cjs/components/picker-view/picker-view.d.ts +2 -1
  13. package/2x/cjs/components/picker-view/picker-view.js +6 -2
  14. package/2x/cjs/components/picker-view/wheel.d.ts +4 -3
  15. package/2x/cjs/components/picker-view/wheel.js +3 -2
  16. package/2x/cjs/components/swipe-action/swipe-action.d.ts +3 -0
  17. package/2x/cjs/components/swipe-action/swipe-action.js +8 -5
  18. package/2x/cjs/locales/es-ES.js +1 -1
  19. package/2x/es/components/button/button.d.ts +18 -2
  20. package/2x/es/components/button/button.js +11 -3
  21. package/2x/es/components/button/index.d.ts +1 -1
  22. package/2x/es/components/form/context.d.ts +1 -0
  23. package/2x/es/components/form/context.js +1 -0
  24. package/2x/es/components/form/form-item.js +6 -2
  25. package/2x/es/components/form/form.js +1 -0
  26. package/2x/es/components/picker/picker-utils.d.ts +2 -0
  27. package/2x/es/components/picker/picker-utils.js +1 -0
  28. package/2x/es/components/picker/picker.d.ts +1 -0
  29. package/2x/es/components/picker/picker.js +4 -1
  30. package/2x/es/components/picker-view/picker-view.d.ts +2 -1
  31. package/2x/es/components/picker-view/picker-view.js +5 -2
  32. package/2x/es/components/picker-view/wheel.d.ts +4 -3
  33. package/2x/es/components/picker-view/wheel.js +3 -2
  34. package/2x/es/components/swipe-action/swipe-action.d.ts +3 -0
  35. package/2x/es/components/swipe-action/swipe-action.js +7 -5
  36. package/2x/es/locales/es-ES.js +1 -1
  37. package/2x/package.json +19 -2
  38. package/bundle/antd-mobile.cjs.js +17909 -0
  39. package/bundle/antd-mobile.es.js +17823 -0
  40. package/bundle/style.css +3930 -0
  41. package/cjs/components/button/button.d.ts +18 -2
  42. package/cjs/components/button/button.js +15 -5
  43. package/cjs/components/button/index.d.ts +1 -1
  44. package/cjs/components/form/context.d.ts +1 -0
  45. package/cjs/components/form/context.js +1 -0
  46. package/cjs/components/form/form-item.js +6 -4
  47. package/cjs/components/form/form.js +1 -0
  48. package/cjs/components/picker/picker-utils.d.ts +2 -0
  49. package/cjs/components/picker/picker-utils.js +10 -0
  50. package/cjs/components/picker/picker.d.ts +1 -0
  51. package/cjs/components/picker/picker.js +5 -1
  52. package/cjs/components/picker-view/picker-view.d.ts +2 -1
  53. package/cjs/components/picker-view/picker-view.js +6 -2
  54. package/cjs/components/picker-view/wheel.d.ts +4 -3
  55. package/cjs/components/picker-view/wheel.js +3 -2
  56. package/cjs/components/swipe-action/swipe-action.d.ts +3 -0
  57. package/cjs/components/swipe-action/swipe-action.js +8 -5
  58. package/cjs/locales/es-ES.js +1 -1
  59. package/es/components/button/button.d.ts +18 -2
  60. package/es/components/button/button.js +11 -3
  61. package/es/components/button/index.d.ts +1 -1
  62. package/es/components/form/context.d.ts +1 -0
  63. package/es/components/form/context.js +1 -0
  64. package/es/components/form/form-item.js +6 -2
  65. package/es/components/form/form.js +1 -0
  66. package/es/components/picker/picker-utils.d.ts +2 -0
  67. package/es/components/picker/picker-utils.js +1 -0
  68. package/es/components/picker/picker.d.ts +1 -0
  69. package/es/components/picker/picker.js +4 -1
  70. package/es/components/picker-view/picker-view.d.ts +2 -1
  71. package/es/components/picker-view/picker-view.js +5 -2
  72. package/es/components/picker-view/wheel.d.ts +4 -3
  73. package/es/components/picker-view/wheel.js +3 -2
  74. package/es/components/swipe-action/swipe-action.d.ts +3 -0
  75. package/es/components/swipe-action/swipe-action.js +7 -5
  76. package/es/locales/es-ES.js +1 -1
  77. package/package.json +19 -2
  78. package/umd/antd-mobile.js +1 -1
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type ButtonProps = {
4
4
  color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
@@ -11,5 +11,21 @@ export declare type ButtonProps = {
11
11
  onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
12
12
  type?: 'submit' | 'reset' | 'button';
13
13
  shape?: 'default' | 'rounded' | 'rectangular';
14
+ children?: React.ReactNode;
14
15
  } & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
15
- export declare const Button: FC<ButtonProps>;
16
+ export declare type ButtonRef = {
17
+ nativeElement: HTMLButtonElement | null;
18
+ };
19
+ export declare const Button: React.ForwardRefExoticComponent<{
20
+ color?: "default" | "primary" | "success" | "warning" | "danger" | undefined;
21
+ fill?: "none" | "solid" | "outline" | undefined;
22
+ size?: "small" | "large" | "middle" | "mini" | undefined;
23
+ block?: boolean | undefined;
24
+ loading?: boolean | undefined;
25
+ loadingText?: string | undefined;
26
+ disabled?: boolean | undefined;
27
+ onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined;
28
+ type?: "reset" | "submit" | "button" | undefined;
29
+ shape?: "default" | "rounded" | "rectangular" | undefined;
30
+ children?: React.ReactNode;
31
+ } & NativeProps<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Button = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
@@ -17,6 +17,10 @@ var _nativeProps = require("../../utils/native-props");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
+ 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); }
21
+
22
+ 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; }
23
+
20
24
  const classPrefix = `adm-button`;
21
25
  const defaultProps = {
22
26
  color: 'default',
@@ -27,11 +31,18 @@ const defaultProps = {
27
31
  shape: 'default',
28
32
  size: 'middle'
29
33
  };
30
-
31
- const Button = p => {
34
+ const Button = (0, _react.forwardRef)((p, ref) => {
32
35
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
33
36
  const disabled = props.disabled || props.loading;
37
+ const nativeButtonRef = (0, _react.useRef)(null);
38
+ (0, _react.useImperativeHandle)(ref, () => ({
39
+ get nativeElement() {
40
+ return nativeButtonRef.current;
41
+ }
42
+
43
+ }));
34
44
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("button", {
45
+ ref: nativeButtonRef,
35
46
  type: props.type,
36
47
  onClick: props.onClick,
37
48
  className: (0, _classnames.default)(classPrefix, props.color ? `${classPrefix}-${props.color}` : null, {
@@ -50,6 +61,5 @@ const Button = p => {
50
61
  }, _react.default.createElement(_dotLoading.default, {
51
62
  color: 'currentColor'
52
63
  }), props.loadingText) : props.children));
53
- };
54
-
64
+ });
55
65
  exports.Button = Button;
@@ -1,4 +1,4 @@
1
1
  import './button.less';
2
2
  import { Button } from './button';
3
- export type { ButtonProps } from './button';
3
+ export type { ButtonProps, ButtonRef } from './button';
4
4
  export default Button;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { FormLayout } from '.';
3
3
  import type { Meta, InternalNamePath } from 'rc-field-form/lib/interface';
4
4
  export declare type FormContextType = {
5
+ name?: string;
5
6
  hasFeedback: boolean;
6
7
  layout: FormLayout;
7
8
  requiredMarkStyle: 'asterisk' | 'text-required' | 'text-optional';
@@ -10,6 +10,7 @@ var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  const defaultFormContext = {
13
+ name: undefined,
13
14
  hasFeedback: true,
14
15
  layout: 'vertical',
15
16
  requiredMarkStyle: 'asterisk'
@@ -163,11 +163,12 @@ const FormItem = props => {
163
163
  arrow
164
164
  } = props,
165
165
  fieldProps = (0, _tslib.__rest)(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow"]);
166
-
166
+ const {
167
+ name: formName
168
+ } = (0, _react.useContext)(_context.FormContext);
167
169
  const {
168
170
  validateTrigger: contextValidateTrigger
169
- } = _react.default.useContext(_FieldContext.default);
170
-
171
+ } = (0, _react.useContext)(_FieldContext.default);
171
172
  const mergedValidateTrigger = validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;
172
173
 
173
174
  const updateRef = _react.default.useRef(0);
@@ -281,7 +282,8 @@ const FormItem = props => {
281
282
  }), (control, meta, context) => {
282
283
  let childNode = null;
283
284
  const isRequired = required !== undefined ? required : rules && rules.some(rule => !!(rule && typeof rule === 'object' && rule.required));
284
- const fieldId = ((0, _utils.toArray)(name).length && meta ? meta.name : []).join('_');
285
+ const nameList = (0, _utils.toArray)(name).length && meta ? meta.name : [];
286
+ const fieldId = (nameList.length > 0 && formName ? [formName, ...nameList] : nameList).join('_');
285
287
 
286
288
  if (shouldUpdate && dependencies) {
287
289
  (0, _devLog.devWarning)('Form.Item', "`shouldUpdate` and `dependencies` shouldn't be used together.");
@@ -95,6 +95,7 @@ const Form = (0, _react.forwardRef)((p, ref) => {
95
95
  validateMessages: validateMessages
96
96
  }), _react.default.createElement(_context.FormContext.Provider, {
97
97
  value: {
98
+ name: formProps.name,
98
99
  hasFeedback,
99
100
  layout,
100
101
  requiredMarkStyle
@@ -0,0 +1,2 @@
1
+ import { PickerColumnItem } from '../picker-view';
2
+ export declare const defaultRenderLabel: (item: PickerColumnItem) => import("react").ReactNode;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultRenderLabel = void 0;
7
+
8
+ const defaultRenderLabel = item => item.label;
9
+
10
+ exports.defaultRenderLabel = defaultRenderLabel;
@@ -16,5 +16,6 @@ export declare type PickerProps = {
16
16
  confirmText?: ReactNode;
17
17
  cancelText?: ReactNode;
18
18
  children?: (items: (PickerColumnItem | null)[]) => ReactNode;
19
+ renderLabel?: (item: PickerColumnItem) => ReactNode;
19
20
  } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size' | '--item-height'>;
20
21
  export declare const Picker: React.NamedExoticComponent<PickerProps>;
@@ -25,6 +25,8 @@ var _ahooks = require("ahooks");
25
25
 
26
26
  var _safeArea = _interopRequireDefault(require("../safe-area"));
27
27
 
28
+ var _pickerUtils = require("./picker-utils");
29
+
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
31
 
30
32
  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); }
@@ -34,7 +36,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
36
  const classPrefix = `adm-picker`;
35
37
  const defaultProps = {
36
38
  defaultValue: [],
37
- closeOnMaskClick: true
39
+ closeOnMaskClick: true,
40
+ renderLabel: _pickerUtils.defaultRenderLabel
38
41
  };
39
42
  const Picker = (0, _react.memo)(p => {
40
43
  var _a;
@@ -101,6 +104,7 @@ const Picker = (0, _react.memo)(p => {
101
104
  className: `${classPrefix}-body`
102
105
  }, _react.default.createElement(_pickerView.default, {
103
106
  columns: props.columns,
107
+ renderLabel: props.renderLabel,
104
108
  value: innerValue,
105
109
  onChange: onChange
106
110
  }))));
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PickerProps } from '../picker';
3
4
  export declare type PickerValue = string | null;
4
5
  export declare type PickerValueExtend = {
5
6
  columns: PickerColumnItem[][];
@@ -15,5 +16,5 @@ export declare type PickerViewProps = {
15
16
  value?: PickerValue[];
16
17
  defaultValue?: PickerValue[];
17
18
  onChange?: (value: PickerValue[], extend: PickerValueExtend) => void;
18
- } & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
+ } & Pick<PickerProps, 'renderLabel'> & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
20
  export declare const PickerView: React.NamedExoticComponent<PickerViewProps>;
@@ -17,13 +17,16 @@ var _nativeProps = require("../../utils/native-props");
17
17
 
18
18
  var _ahooks = require("ahooks");
19
19
 
20
+ var _pickerUtils = require("../picker/picker-utils");
21
+
20
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); }
21
23
 
22
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; }
23
25
 
24
26
  const classPrefix = `adm-picker-view`;
25
27
  const defaultProps = {
26
- defaultValue: []
28
+ defaultValue: [],
29
+ renderLabel: _pickerUtils.defaultRenderLabel
27
30
  };
28
31
  const PickerView = (0, _react.memo)(p => {
29
32
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
@@ -72,7 +75,8 @@ const PickerView = (0, _react.memo)(p => {
72
75
  index: index,
73
76
  column: column,
74
77
  value: innerValue[index],
75
- onSelect: handleSelect
78
+ onSelect: handleSelect,
79
+ renderLabel: props.renderLabel
76
80
  })), _react.default.createElement("div", {
77
81
  className: `${classPrefix}-mask`
78
82
  }, _react.default.createElement("div", {
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PickerColumnItem, PickerValue } from './index';
3
- interface Props {
3
+ declare type Props = {
4
4
  index: number;
5
5
  column: PickerColumnItem[];
6
6
  value: PickerValue;
7
7
  onSelect: (value: PickerValue, index: number) => void;
8
- }
8
+ renderLabel: (item: PickerColumnItem) => ReactNode;
9
+ };
9
10
  export declare const Wheel: React.NamedExoticComponent<Props>;
10
11
  export {};
@@ -31,7 +31,8 @@ const classPrefix = `adm-picker-view`;
31
31
  const Wheel = (0, _react.memo)(props => {
32
32
  const {
33
33
  value,
34
- column
34
+ column,
35
+ renderLabel
35
36
  } = props;
36
37
 
37
38
  function onSelect(val) {
@@ -177,7 +178,7 @@ const Wheel = (0, _react.memo)(props => {
177
178
  "aria-label": selected ? 'active' : ''
178
179
  }, _react.default.createElement("div", {
179
180
  className: `${classPrefix}-column-item-label`
180
- }, item.label));
181
+ }, renderLabel(item)));
181
182
  })), renderAccessible());
182
183
  }, (prev, next) => {
183
184
  if (prev.index !== next.index) return false;
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PropagationEvent } from '../../utils/with-stop-propagation';
3
4
  export declare type SwipeActionRef = {
4
5
  close: () => void;
5
6
  show: (side?: 'left' | 'right') => void;
@@ -18,6 +19,7 @@ export declare type SwipeActionProps = {
18
19
  closeOnTouchOutside?: boolean;
19
20
  closeOnAction?: boolean;
20
21
  children: ReactNode;
22
+ stopPropagation?: PropagationEvent[];
21
23
  } & NativeProps<'--background'>;
22
24
  export declare const SwipeAction: React.ForwardRefExoticComponent<{
23
25
  rightActions?: Action[] | undefined;
@@ -26,5 +28,6 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
26
28
  closeOnTouchOutside?: boolean | undefined;
27
29
  closeOnAction?: boolean | undefined;
28
30
  children: ReactNode;
31
+ stopPropagation?: "click"[] | undefined;
29
32
  } & NativeProps<"--background"> & React.RefAttributes<SwipeActionRef>>;
30
33
  export {};
@@ -19,6 +19,8 @@ var _nearest = require("../../utils/nearest");
19
19
 
20
20
  var _nativeProps = require("../../utils/native-props");
21
21
 
22
+ var _withStopPropagation = require("../../utils/with-stop-propagation");
23
+
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
26
  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); }
@@ -29,7 +31,8 @@ const defaultProps = {
29
31
  rightActions: [],
30
32
  leftActions: [],
31
33
  closeOnTouchOutside: true,
32
- closeOnAction: true
34
+ closeOnAction: true,
35
+ stopPropagation: []
33
36
  };
34
37
  const SwipeAction = (0, _react.forwardRef)((p, ref) => {
35
38
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
@@ -187,10 +190,10 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
187
190
  style: {
188
191
  x
189
192
  }
190
- }, _react.default.createElement("div", {
193
+ }, (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, _react.default.createElement("div", {
191
194
  className: 'adm-swipe-action-actions adm-swipe-action-actions-left',
192
195
  ref: leftRef
193
- }, props.leftActions.map(renderAction)), _react.default.createElement("div", {
196
+ }, props.leftActions.map(renderAction))), _react.default.createElement("div", {
194
197
  className: 'adm-swipe-action-content',
195
198
  onClickCapture: e => {
196
199
  if (x.goal !== 0) {
@@ -205,10 +208,10 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
205
208
  style: {
206
209
  pointerEvents: x.to(v => v !== 0 && x.goal !== 0 ? 'none' : 'unset')
207
210
  }
208
- }, props.children)), _react.default.createElement("div", {
211
+ }, props.children)), (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, _react.default.createElement("div", {
209
212
  className: 'adm-swipe-action-actions adm-swipe-action-actions-right',
210
213
  ref: rightRef
211
- }, props.rightActions.map(renderAction)))));
214
+ }, props.rightActions.map(renderAction))))));
212
215
  });
213
216
  exports.SwipeAction = SwipeAction;
214
217
  const colorRecord = {
@@ -41,7 +41,7 @@ const esES = (0, _mergeLocale.mergeLocale)(_base.base, {
41
41
  description: 'Intente refrescar la página'
42
42
  },
43
43
  empty: {
44
- title: "Hmm, no pudimos encontrar eso...",
44
+ title: 'Hmm, no pudimos encontrar eso...',
45
45
  description: 'Quieres intentar una nueva búsqueda?'
46
46
  }
47
47
  },
@@ -1,4 +1,4 @@
1
- import React, { FC } from 'react';
1
+ import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type ButtonProps = {
4
4
  color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
@@ -11,5 +11,21 @@ export declare type ButtonProps = {
11
11
  onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
12
12
  type?: 'submit' | 'reset' | 'button';
13
13
  shape?: 'default' | 'rounded' | 'rectangular';
14
+ children?: React.ReactNode;
14
15
  } & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
15
- export declare const Button: FC<ButtonProps>;
16
+ export declare type ButtonRef = {
17
+ nativeElement: HTMLButtonElement | null;
18
+ };
19
+ export declare const Button: React.ForwardRefExoticComponent<{
20
+ color?: "default" | "primary" | "success" | "warning" | "danger" | undefined;
21
+ fill?: "none" | "solid" | "outline" | undefined;
22
+ size?: "small" | "large" | "middle" | "mini" | undefined;
23
+ block?: boolean | undefined;
24
+ loading?: boolean | undefined;
25
+ loadingText?: string | undefined;
26
+ disabled?: boolean | undefined;
27
+ onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined;
28
+ type?: "reset" | "submit" | "button" | undefined;
29
+ shape?: "default" | "rounded" | "rectangular" | undefined;
30
+ children?: React.ReactNode;
31
+ } & NativeProps<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef, useImperativeHandle, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import DotLoading from '../dot-loading';
4
4
  import { mergeProps } from '../../utils/with-default-props';
@@ -13,10 +13,18 @@ const defaultProps = {
13
13
  shape: 'default',
14
14
  size: 'middle'
15
15
  };
16
- export const Button = p => {
16
+ export const Button = forwardRef((p, ref) => {
17
17
  const props = mergeProps(defaultProps, p);
18
18
  const disabled = props.disabled || props.loading;
19
+ const nativeButtonRef = useRef(null);
20
+ useImperativeHandle(ref, () => ({
21
+ get nativeElement() {
22
+ return nativeButtonRef.current;
23
+ }
24
+
25
+ }));
19
26
  return withNativeProps(props, React.createElement("button", {
27
+ ref: nativeButtonRef,
20
28
  type: props.type,
21
29
  onClick: props.onClick,
22
30
  className: classNames(classPrefix, props.color ? `${classPrefix}-${props.color}` : null, {
@@ -35,4 +43,4 @@ export const Button = p => {
35
43
  }, React.createElement(DotLoading, {
36
44
  color: 'currentColor'
37
45
  }), props.loadingText) : props.children));
38
- };
46
+ });
@@ -1,4 +1,4 @@
1
1
  import './button.less';
2
2
  import { Button } from './button';
3
- export type { ButtonProps } from './button';
3
+ export type { ButtonProps, ButtonRef } from './button';
4
4
  export default Button;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { FormLayout } from '.';
3
3
  import type { Meta, InternalNamePath } from 'rc-field-form/lib/interface';
4
4
  export declare type FormContextType = {
5
+ name?: string;
5
6
  hasFeedback: boolean;
6
7
  layout: FormLayout;
7
8
  requiredMarkStyle: 'asterisk' | 'text-required' | 'text-optional';
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export const defaultFormContext = {
3
+ name: undefined,
3
4
  hasFeedback: true,
4
5
  layout: 'vertical',
5
6
  requiredMarkStyle: 'asterisk'
@@ -136,9 +136,12 @@ export const FormItem = props => {
136
136
  } = props,
137
137
  fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow"]);
138
138
 
139
+ const {
140
+ name: formName
141
+ } = useContext(FormContext);
139
142
  const {
140
143
  validateTrigger: contextValidateTrigger
141
- } = React.useContext(FieldContext);
144
+ } = useContext(FieldContext);
142
145
  const mergedValidateTrigger = validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;
143
146
  const updateRef = React.useRef(0);
144
147
  updateRef.current += 1;
@@ -250,7 +253,8 @@ export const FormItem = props => {
250
253
  }), (control, meta, context) => {
251
254
  let childNode = null;
252
255
  const isRequired = required !== undefined ? required : rules && rules.some(rule => !!(rule && typeof rule === 'object' && rule.required));
253
- const fieldId = (toArray(name).length && meta ? meta.name : []).join('_');
256
+ const nameList = toArray(name).length && meta ? meta.name : [];
257
+ const fieldId = (nameList.length > 0 && formName ? [formName, ...nameList] : nameList).join('_');
254
258
 
255
259
  if (shouldUpdate && dependencies) {
256
260
  devWarning('Form.Item', "`shouldUpdate` and `dependencies` shouldn't be used together.");
@@ -72,6 +72,7 @@ export const Form = forwardRef((p, ref) => {
72
72
  validateMessages: validateMessages
73
73
  }), React.createElement(FormContext.Provider, {
74
74
  value: {
75
+ name: formProps.name,
75
76
  hasFeedback,
76
77
  layout,
77
78
  requiredMarkStyle
@@ -0,0 +1,2 @@
1
+ import { PickerColumnItem } from '../picker-view';
2
+ export declare const defaultRenderLabel: (item: PickerColumnItem) => import("react").ReactNode;
@@ -0,0 +1 @@
1
+ export const defaultRenderLabel = item => item.label;
@@ -16,5 +16,6 @@ export declare type PickerProps = {
16
16
  confirmText?: ReactNode;
17
17
  cancelText?: ReactNode;
18
18
  children?: (items: (PickerColumnItem | null)[]) => ReactNode;
19
+ renderLabel?: (item: PickerColumnItem) => ReactNode;
19
20
  } & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size' | '--item-height'>;
20
21
  export declare const Picker: React.NamedExoticComponent<PickerProps>;
@@ -8,10 +8,12 @@ import { generateColumnsExtend, useColumnsExtend } from '../picker-view/columns-
8
8
  import { useConfig } from '../config-provider';
9
9
  import { useMemoizedFn } from 'ahooks';
10
10
  import SafeArea from '../safe-area';
11
+ import { defaultRenderLabel } from './picker-utils';
11
12
  const classPrefix = `adm-picker`;
12
13
  const defaultProps = {
13
14
  defaultValue: [],
14
- closeOnMaskClick: true
15
+ closeOnMaskClick: true,
16
+ renderLabel: defaultRenderLabel
15
17
  };
16
18
  export const Picker = memo(p => {
17
19
  var _a;
@@ -78,6 +80,7 @@ export const Picker = memo(p => {
78
80
  className: `${classPrefix}-body`
79
81
  }, React.createElement(PickerView, {
80
82
  columns: props.columns,
83
+ renderLabel: props.renderLabel,
81
84
  value: innerValue,
82
85
  onChange: onChange
83
86
  }))));
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PickerProps } from '../picker';
3
4
  export declare type PickerValue = string | null;
4
5
  export declare type PickerValueExtend = {
5
6
  columns: PickerColumnItem[][];
@@ -15,5 +16,5 @@ export declare type PickerViewProps = {
15
16
  value?: PickerValue[];
16
17
  defaultValue?: PickerValue[];
17
18
  onChange?: (value: PickerValue[], extend: PickerValueExtend) => void;
18
- } & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
+ } & Pick<PickerProps, 'renderLabel'> & NativeProps<'--height' | '--item-height' | '--item-font-size'>;
19
20
  export declare const PickerView: React.NamedExoticComponent<PickerViewProps>;
@@ -4,9 +4,11 @@ import { Wheel } from './wheel';
4
4
  import { useColumnsExtend } from './columns-extend';
5
5
  import { withNativeProps } from '../../utils/native-props';
6
6
  import { useDebounceEffect } from 'ahooks';
7
+ import { defaultRenderLabel } from '../picker/picker-utils';
7
8
  const classPrefix = `adm-picker-view`;
8
9
  const defaultProps = {
9
- defaultValue: []
10
+ defaultValue: [],
11
+ renderLabel: defaultRenderLabel
10
12
  };
11
13
  export const PickerView = memo(p => {
12
14
  const props = mergeProps(defaultProps, p);
@@ -55,7 +57,8 @@ export const PickerView = memo(p => {
55
57
  index: index,
56
58
  column: column,
57
59
  value: innerValue[index],
58
- onSelect: handleSelect
60
+ onSelect: handleSelect,
61
+ renderLabel: props.renderLabel
59
62
  })), React.createElement("div", {
60
63
  className: `${classPrefix}-mask`
61
64
  }, React.createElement("div", {
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PickerColumnItem, PickerValue } from './index';
3
- interface Props {
3
+ declare type Props = {
4
4
  index: number;
5
5
  column: PickerColumnItem[];
6
6
  value: PickerValue;
7
7
  onSelect: (value: PickerValue, index: number) => void;
8
- }
8
+ renderLabel: (item: PickerColumnItem) => ReactNode;
9
+ };
9
10
  export declare const Wheel: React.NamedExoticComponent<Props>;
10
11
  export {};
@@ -10,7 +10,8 @@ const classPrefix = `adm-picker-view`;
10
10
  export const Wheel = memo(props => {
11
11
  const {
12
12
  value,
13
- column
13
+ column,
14
+ renderLabel
14
15
  } = props;
15
16
 
16
17
  function onSelect(val) {
@@ -156,7 +157,7 @@ export const Wheel = memo(props => {
156
157
  "aria-label": selected ? 'active' : ''
157
158
  }, React.createElement("div", {
158
159
  className: `${classPrefix}-column-item-label`
159
- }, item.label));
160
+ }, renderLabel(item)));
160
161
  })), renderAccessible());
161
162
  }, (prev, next) => {
162
163
  if (prev.index !== next.index) return false;
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import { PropagationEvent } from '../../utils/with-stop-propagation';
3
4
  export declare type SwipeActionRef = {
4
5
  close: () => void;
5
6
  show: (side?: 'left' | 'right') => void;
@@ -18,6 +19,7 @@ export declare type SwipeActionProps = {
18
19
  closeOnTouchOutside?: boolean;
19
20
  closeOnAction?: boolean;
20
21
  children: ReactNode;
22
+ stopPropagation?: PropagationEvent[];
21
23
  } & NativeProps<'--background'>;
22
24
  export declare const SwipeAction: React.ForwardRefExoticComponent<{
23
25
  rightActions?: Action[] | undefined;
@@ -26,5 +28,6 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
26
28
  closeOnTouchOutside?: boolean | undefined;
27
29
  closeOnAction?: boolean | undefined;
28
30
  children: ReactNode;
31
+ stopPropagation?: "click"[] | undefined;
29
32
  } & NativeProps<"--background"> & React.RefAttributes<SwipeActionRef>>;
30
33
  export {};