antd-mobile 5.8.1 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/cjs/components/button/button.d.ts +18 -2
- package/2x/cjs/components/button/button.js +15 -5
- package/2x/cjs/components/button/index.d.ts +1 -1
- package/2x/cjs/components/form/context.d.ts +1 -0
- package/2x/cjs/components/form/context.js +1 -0
- package/2x/cjs/components/form/form-item.js +6 -4
- package/2x/cjs/components/form/form.js +1 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +2 -1
- package/2x/cjs/components/picker/picker-utils.d.ts +2 -0
- package/2x/cjs/components/picker/picker-utils.js +10 -0
- package/2x/cjs/components/picker/picker.d.ts +1 -0
- package/2x/cjs/components/picker/picker.js +5 -1
- package/2x/cjs/components/picker-view/picker-view.d.ts +2 -1
- package/2x/cjs/components/picker-view/picker-view.js +6 -2
- package/2x/cjs/components/picker-view/wheel.d.ts +4 -3
- package/2x/cjs/components/picker-view/wheel.js +3 -2
- package/2x/cjs/components/popover/popover.js +0 -1
- package/2x/cjs/components/swipe-action/swipe-action.d.ts +3 -0
- package/2x/cjs/components/swipe-action/swipe-action.js +8 -5
- package/2x/cjs/locales/es-ES.d.ts +102 -0
- package/2x/cjs/locales/es-ES.js +115 -0
- package/2x/cjs/utils/measure-css-length.d.ts +1 -1
- package/2x/cjs/utils/measure-css-length.js +8 -0
- package/2x/es/components/button/button.d.ts +18 -2
- package/2x/es/components/button/button.js +11 -3
- package/2x/es/components/button/index.d.ts +1 -1
- package/2x/es/components/form/context.d.ts +1 -0
- package/2x/es/components/form/context.js +1 -0
- package/2x/es/components/form/form-item.js +6 -2
- package/2x/es/components/form/form.js +1 -0
- package/2x/es/components/image-uploader/image-uploader.js +2 -1
- package/2x/es/components/picker/picker-utils.d.ts +2 -0
- package/2x/es/components/picker/picker-utils.js +1 -0
- package/2x/es/components/picker/picker.d.ts +1 -0
- package/2x/es/components/picker/picker.js +4 -1
- package/2x/es/components/picker-view/picker-view.d.ts +2 -1
- package/2x/es/components/picker-view/picker-view.js +5 -2
- package/2x/es/components/picker-view/wheel.d.ts +4 -3
- package/2x/es/components/picker-view/wheel.js +3 -2
- package/2x/es/components/popover/popover.js +0 -1
- package/2x/es/components/swipe-action/swipe-action.d.ts +3 -0
- package/2x/es/components/swipe-action/swipe-action.js +7 -5
- package/2x/es/locales/es-ES.d.ts +102 -0
- package/2x/es/locales/es-ES.js +105 -0
- package/2x/es/utils/measure-css-length.d.ts +1 -1
- package/2x/es/utils/measure-css-length.js +8 -0
- package/2x/package.json +21 -2
- package/bundle/antd-mobile.cjs.js +17909 -0
- package/bundle/antd-mobile.es.js +17823 -0
- package/bundle/style.css +3930 -0
- package/cjs/components/button/button.d.ts +18 -2
- package/cjs/components/button/button.js +15 -5
- package/cjs/components/button/index.d.ts +1 -1
- package/cjs/components/form/context.d.ts +1 -0
- package/cjs/components/form/context.js +1 -0
- package/cjs/components/form/form-item.js +6 -4
- package/cjs/components/form/form.js +1 -0
- package/cjs/components/image-uploader/image-uploader.js +2 -1
- package/cjs/components/picker/picker-utils.d.ts +2 -0
- package/cjs/components/picker/picker-utils.js +10 -0
- package/cjs/components/picker/picker.d.ts +1 -0
- package/cjs/components/picker/picker.js +5 -1
- package/cjs/components/picker-view/picker-view.d.ts +2 -1
- package/cjs/components/picker-view/picker-view.js +6 -2
- package/cjs/components/picker-view/wheel.d.ts +4 -3
- package/cjs/components/picker-view/wheel.js +3 -2
- package/cjs/components/popover/popover.js +0 -1
- package/cjs/components/swipe-action/swipe-action.d.ts +3 -0
- package/cjs/components/swipe-action/swipe-action.js +8 -5
- package/cjs/locales/es-ES.d.ts +102 -0
- package/cjs/locales/es-ES.js +115 -0
- package/cjs/utils/measure-css-length.d.ts +1 -1
- package/cjs/utils/measure-css-length.js +8 -0
- package/es/components/button/button.d.ts +18 -2
- package/es/components/button/button.js +11 -3
- package/es/components/button/index.d.ts +1 -1
- package/es/components/form/context.d.ts +1 -0
- package/es/components/form/context.js +1 -0
- package/es/components/form/form-item.js +6 -2
- package/es/components/form/form.js +1 -0
- package/es/components/image-uploader/image-uploader.js +2 -1
- package/es/components/picker/picker-utils.d.ts +2 -0
- package/es/components/picker/picker-utils.js +1 -0
- package/es/components/picker/picker.d.ts +1 -0
- package/es/components/picker/picker.js +4 -1
- package/es/components/picker-view/picker-view.d.ts +2 -1
- package/es/components/picker-view/picker-view.js +5 -2
- package/es/components/picker-view/wheel.d.ts +4 -3
- package/es/components/picker-view/wheel.js +3 -2
- package/es/components/popover/popover.js +0 -1
- package/es/components/swipe-action/swipe-action.d.ts +3 -0
- package/es/components/swipe-action/swipe-action.js +7 -5
- package/es/locales/es-ES.d.ts +102 -0
- package/es/locales/es-ES.js +105 -0
- package/es/utils/measure-css-length.d.ts +1 -1
- package/es/utils/measure-css-length.js +8 -0
- package/package.json +21 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 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
|
|
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 =
|
|
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;
|
|
@@ -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.
|
|
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
|
|
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.");
|
|
@@ -172,7 +172,8 @@ const ImageUploader = p => {
|
|
|
172
172
|
className: classPrefix
|
|
173
173
|
}, _react.default.createElement(_space.default, {
|
|
174
174
|
className: `${classPrefix}-space`,
|
|
175
|
-
wrap: true
|
|
175
|
+
wrap: true,
|
|
176
|
+
block: true
|
|
176
177
|
}, value.map((fileItem, index) => {
|
|
177
178
|
var _a, _b;
|
|
178
179
|
|
|
@@ -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
|
-
|
|
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
|
|
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 = {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
declare const esES: {
|
|
2
|
+
locale: string;
|
|
3
|
+
common: {
|
|
4
|
+
confirm: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
loading: string;
|
|
7
|
+
};
|
|
8
|
+
Calendar: {
|
|
9
|
+
markItems: string[];
|
|
10
|
+
renderYearAndMonth: (year: number, month: number) => string;
|
|
11
|
+
};
|
|
12
|
+
Cascader: {
|
|
13
|
+
placeholder: string;
|
|
14
|
+
};
|
|
15
|
+
Dialog: {
|
|
16
|
+
ok: string;
|
|
17
|
+
};
|
|
18
|
+
ErrorBlock: {
|
|
19
|
+
default: {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
busy: {
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
disconnected: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
empty: {
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
Form: {
|
|
37
|
+
required: string;
|
|
38
|
+
optional: string;
|
|
39
|
+
defaultValidateMessages: {
|
|
40
|
+
default: string;
|
|
41
|
+
required: string;
|
|
42
|
+
enum: string;
|
|
43
|
+
whitespace: string;
|
|
44
|
+
date: {
|
|
45
|
+
format: string;
|
|
46
|
+
parse: string;
|
|
47
|
+
invalid: string;
|
|
48
|
+
};
|
|
49
|
+
types: {
|
|
50
|
+
string: string;
|
|
51
|
+
method: string;
|
|
52
|
+
array: string;
|
|
53
|
+
object: string;
|
|
54
|
+
number: string;
|
|
55
|
+
date: string;
|
|
56
|
+
boolean: string;
|
|
57
|
+
integer: string;
|
|
58
|
+
float: string;
|
|
59
|
+
regexp: string;
|
|
60
|
+
email: string;
|
|
61
|
+
url: string;
|
|
62
|
+
hex: string;
|
|
63
|
+
};
|
|
64
|
+
string: {
|
|
65
|
+
len: string;
|
|
66
|
+
min: string;
|
|
67
|
+
max: string;
|
|
68
|
+
range: string;
|
|
69
|
+
};
|
|
70
|
+
number: {
|
|
71
|
+
len: string;
|
|
72
|
+
min: string;
|
|
73
|
+
max: string;
|
|
74
|
+
range: string;
|
|
75
|
+
};
|
|
76
|
+
array: {
|
|
77
|
+
len: string;
|
|
78
|
+
min: string;
|
|
79
|
+
max: string;
|
|
80
|
+
range: string;
|
|
81
|
+
};
|
|
82
|
+
pattern: {
|
|
83
|
+
mismatch: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
ImageUploader: {
|
|
88
|
+
uploading: string;
|
|
89
|
+
};
|
|
90
|
+
Mask: {
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
93
|
+
Modal: {
|
|
94
|
+
ok: string;
|
|
95
|
+
};
|
|
96
|
+
PullToRefresh: {
|
|
97
|
+
pulling: string;
|
|
98
|
+
canRelease: string;
|
|
99
|
+
complete: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export default esES;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _mergeLocale = require("../utils/merge-locale");
|
|
9
|
+
|
|
10
|
+
var _base = require("./base");
|
|
11
|
+
|
|
12
|
+
const typeTemplate = '${label} no es un ${type} válido';
|
|
13
|
+
const esES = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
14
|
+
locale: 'es',
|
|
15
|
+
common: {
|
|
16
|
+
confirm: 'Confirmar',
|
|
17
|
+
cancel: 'Cancelar',
|
|
18
|
+
loading: 'Cargando...'
|
|
19
|
+
},
|
|
20
|
+
Calendar: {
|
|
21
|
+
markItems: ['Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab', 'Dom'],
|
|
22
|
+
renderYearAndMonth: (year, month) => `${year}/${month}`
|
|
23
|
+
},
|
|
24
|
+
Cascader: {
|
|
25
|
+
placeholder: 'Seleccionando'
|
|
26
|
+
},
|
|
27
|
+
Dialog: {
|
|
28
|
+
ok: 'OK'
|
|
29
|
+
},
|
|
30
|
+
ErrorBlock: {
|
|
31
|
+
default: {
|
|
32
|
+
title: 'Oops, algo salió mal',
|
|
33
|
+
description: 'Por favor espere un minuto e intente nuevamente'
|
|
34
|
+
},
|
|
35
|
+
busy: {
|
|
36
|
+
title: 'Oops, no está cargando',
|
|
37
|
+
description: 'Intente refrescar la página'
|
|
38
|
+
},
|
|
39
|
+
disconnected: {
|
|
40
|
+
title: 'La red se encuentra ocupada',
|
|
41
|
+
description: 'Intente refrescar la página'
|
|
42
|
+
},
|
|
43
|
+
empty: {
|
|
44
|
+
title: 'Hmm, no pudimos encontrar eso...',
|
|
45
|
+
description: 'Quieres intentar una nueva búsqueda?'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
Form: {
|
|
49
|
+
required: 'Requerido',
|
|
50
|
+
optional: 'Opcional',
|
|
51
|
+
defaultValidateMessages: {
|
|
52
|
+
default: 'Error de validación para el campo ${label}',
|
|
53
|
+
required: 'Por favor ingrese ${label}',
|
|
54
|
+
enum: '${label} debe ser uno de los siguientes [${enum}]',
|
|
55
|
+
whitespace: '${label} no puede ser un caracter en blanco',
|
|
56
|
+
date: {
|
|
57
|
+
format: '${label} el formato de fecha es inválido',
|
|
58
|
+
parse: '${label} no puede ser convertido a fecha',
|
|
59
|
+
invalid: '${label} no es una fecha válida'
|
|
60
|
+
},
|
|
61
|
+
types: {
|
|
62
|
+
string: typeTemplate,
|
|
63
|
+
method: typeTemplate,
|
|
64
|
+
array: typeTemplate,
|
|
65
|
+
object: typeTemplate,
|
|
66
|
+
number: typeTemplate,
|
|
67
|
+
date: typeTemplate,
|
|
68
|
+
boolean: typeTemplate,
|
|
69
|
+
integer: typeTemplate,
|
|
70
|
+
float: typeTemplate,
|
|
71
|
+
regexp: typeTemplate,
|
|
72
|
+
email: typeTemplate,
|
|
73
|
+
url: typeTemplate,
|
|
74
|
+
hex: typeTemplate
|
|
75
|
+
},
|
|
76
|
+
string: {
|
|
77
|
+
len: '${label} debe tener ${len} caracteres',
|
|
78
|
+
min: '${label} debe tener al menos ${min} caracteres',
|
|
79
|
+
max: '${label} debe tener como mucho ${max} caracteres',
|
|
80
|
+
range: '${label} debe tener entre ${min}-${max} caracteres'
|
|
81
|
+
},
|
|
82
|
+
number: {
|
|
83
|
+
len: '${label} debe ser igual a ${len}',
|
|
84
|
+
min: '${label} debe ser mínimo ${min}',
|
|
85
|
+
max: '${label} debe ser máximo ${max}',
|
|
86
|
+
range: '${label} debe ser entre ${min}-${max}'
|
|
87
|
+
},
|
|
88
|
+
array: {
|
|
89
|
+
len: 'Debe ser ${len} ${label}',
|
|
90
|
+
min: 'Al menos ${min} ${label}',
|
|
91
|
+
max: 'Como mucho ${max} ${label}',
|
|
92
|
+
range: 'La cantidad de ${label} debe ser entre ${min}-${max}'
|
|
93
|
+
},
|
|
94
|
+
pattern: {
|
|
95
|
+
mismatch: '${label} no coincide con el patrón ${pattern}'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
ImageUploader: {
|
|
100
|
+
uploading: 'Subiendo...'
|
|
101
|
+
},
|
|
102
|
+
Mask: {
|
|
103
|
+
name: 'Máscara'
|
|
104
|
+
},
|
|
105
|
+
Modal: {
|
|
106
|
+
ok: 'OK'
|
|
107
|
+
},
|
|
108
|
+
PullToRefresh: {
|
|
109
|
+
pulling: 'Desplácese hacia abajo para refrescar',
|
|
110
|
+
canRelease: 'Suelte para refrescar inmediatamente',
|
|
111
|
+
complete: 'Refrescó exitosamente'
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var _default = esES;
|
|
115
|
+
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function measureCSSLength(raw: string): number;
|
|
1
|
+
export declare function measureCSSLength(raw: string | undefined | null): number;
|
|
@@ -10,6 +10,14 @@ var _isDev = require("./is-dev");
|
|
|
10
10
|
var _devLog = require("./dev-log");
|
|
11
11
|
|
|
12
12
|
function measureCSSLength(raw) {
|
|
13
|
+
if (raw === null || raw === undefined) {
|
|
14
|
+
if (_isDev.isDev) {
|
|
15
|
+
(0, _devLog.devError)('Global', 'Seems like the you will encounter a style messed problem. Please check the browser environment to make sure it supports CSS variables.');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
const withUnit = raw.trim();
|
|
14
22
|
|
|
15
23
|
if (withUnit.endsWith('px')) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 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
|
|
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
|
+
});
|