antd-mobile 5.12.6 → 5.13.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.
- package/2x/README.md +10 -8
- package/2x/cjs/components/dialog/dialog.d.ts +2 -0
- package/2x/cjs/components/dialog/dialog.js +24 -13
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -1
- package/2x/cjs/components/error-block/create-error-block.d.ts +12 -0
- package/2x/cjs/components/error-block/create-error-block.js +59 -0
- package/2x/cjs/components/error-block/error-block.d.ts +2 -11
- package/2x/cjs/components/error-block/error-block.js +7 -53
- package/2x/cjs/components/error-block/images/index.d.ts +4 -2
- package/2x/cjs/components/error-block/images/index.js +25 -10
- package/2x/cjs/components/error-block/index.d.ts +5 -1
- package/2x/cjs/components/error-block/index.js +8 -0
- package/2x/cjs/components/image-viewer/image-viewer.css +7 -1
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +5 -2
- package/2x/cjs/components/image-viewer/image-viewer.js +24 -4
- package/2x/cjs/components/image-viewer/index.d.ts +2 -1
- package/2x/cjs/components/index-bar/index-bar.d.ts +2 -0
- package/2x/cjs/components/index-bar/index-bar.js +6 -0
- package/2x/cjs/components/index-bar/index.d.ts +1 -0
- package/2x/cjs/components/input/input.js +22 -4
- package/2x/cjs/components/mask/mask.js +9 -7
- package/2x/cjs/components/modal/modal.d.ts +2 -0
- package/2x/cjs/components/modal/modal.js +24 -11
- package/2x/cjs/components/side-bar/side-bar.js +1 -0
- package/2x/cjs/components/spin-loading/spin-loading.js +6 -2
- package/2x/cjs/components/tab-bar/tab-bar.js +1 -0
- package/2x/cjs/index.d.ts +2 -0
- package/2x/cjs/index.js +21 -1
- package/2x/cjs/locales/fr-FR.d.ts +106 -0
- package/2x/cjs/locales/fr-FR.js +119 -0
- package/2x/cjs/utils/measure-css-length.js +2 -2
- package/2x/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
- package/2x/cjs/utils/reduce-and-restore-motion.js +53 -0
- package/2x/cjs/utils/use-inner-visible.d.ts +1 -0
- package/2x/cjs/utils/use-inner-visible.js +18 -0
- package/2x/es/components/dialog/dialog.d.ts +2 -0
- package/2x/es/components/dialog/dialog.js +23 -14
- package/2x/es/components/ellipsis/ellipsis.js +1 -1
- package/2x/es/components/error-block/create-error-block.d.ts +12 -0
- package/2x/es/components/error-block/create-error-block.js +44 -0
- package/2x/es/components/error-block/error-block.d.ts +2 -11
- package/2x/es/components/error-block/error-block.js +8 -46
- package/2x/es/components/error-block/images/index.d.ts +4 -2
- package/2x/es/components/error-block/images/index.js +4 -10
- package/2x/es/components/error-block/index.d.ts +5 -1
- package/2x/es/components/error-block/index.js +1 -0
- package/2x/es/components/image-viewer/image-viewer.css +7 -1
- package/2x/es/components/image-viewer/image-viewer.d.ts +5 -2
- package/2x/es/components/image-viewer/image-viewer.js +24 -5
- package/2x/es/components/image-viewer/index.d.ts +2 -1
- package/2x/es/components/index-bar/index-bar.d.ts +2 -0
- package/2x/es/components/index-bar/index-bar.js +6 -0
- package/2x/es/components/index-bar/index.d.ts +1 -0
- package/2x/es/components/input/input.js +21 -4
- package/2x/es/components/mask/mask.js +10 -8
- package/2x/es/components/modal/modal.d.ts +2 -0
- package/2x/es/components/modal/modal.js +23 -12
- package/2x/es/components/side-bar/side-bar.js +2 -0
- package/2x/es/components/spin-loading/spin-loading.js +5 -2
- package/2x/es/components/tab-bar/tab-bar.js +2 -0
- package/2x/es/index.d.ts +2 -0
- package/2x/es/index.js +3 -1
- package/2x/es/locales/fr-FR.d.ts +106 -0
- package/2x/es/locales/fr-FR.js +109 -0
- package/2x/es/utils/measure-css-length.js +2 -2
- package/2x/es/utils/reduce-and-restore-motion.d.ts +4 -0
- package/2x/es/utils/reduce-and-restore-motion.js +36 -0
- package/2x/es/utils/use-inner-visible.d.ts +1 -0
- package/2x/es/utils/use-inner-visible.js +9 -0
- package/2x/package.json +8 -7
- package/README.md +10 -8
- package/bundle/antd-mobile.cjs.js +1551 -1405
- package/bundle/antd-mobile.es.js +1547 -1404
- package/bundle/style.css +6 -1
- package/cjs/components/dialog/dialog.d.ts +2 -0
- package/cjs/components/dialog/dialog.js +24 -13
- package/cjs/components/ellipsis/ellipsis.js +1 -1
- package/cjs/components/error-block/create-error-block.d.ts +12 -0
- package/cjs/components/error-block/create-error-block.js +59 -0
- package/cjs/components/error-block/error-block.d.ts +2 -11
- package/cjs/components/error-block/error-block.js +7 -53
- package/cjs/components/error-block/images/index.d.ts +4 -2
- package/cjs/components/error-block/images/index.js +25 -10
- package/cjs/components/error-block/index.d.ts +5 -1
- package/cjs/components/error-block/index.js +8 -0
- package/cjs/components/image-viewer/image-viewer.css +6 -1
- package/cjs/components/image-viewer/image-viewer.d.ts +5 -2
- package/cjs/components/image-viewer/image-viewer.js +24 -4
- package/cjs/components/image-viewer/index.d.ts +2 -1
- package/cjs/components/index-bar/index-bar.d.ts +2 -0
- package/cjs/components/index-bar/index-bar.js +6 -0
- package/cjs/components/index-bar/index.d.ts +1 -0
- package/cjs/components/input/input.js +22 -4
- package/cjs/components/mask/mask.js +9 -7
- package/cjs/components/modal/modal.d.ts +2 -0
- package/cjs/components/modal/modal.js +24 -11
- package/cjs/components/side-bar/side-bar.js +1 -0
- package/cjs/components/spin-loading/spin-loading.js +6 -2
- package/cjs/components/tab-bar/tab-bar.js +1 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +21 -1
- package/cjs/locales/fr-FR.d.ts +106 -0
- package/cjs/locales/fr-FR.js +119 -0
- package/cjs/utils/measure-css-length.js +2 -2
- package/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
- package/cjs/utils/reduce-and-restore-motion.js +53 -0
- package/cjs/utils/use-inner-visible.d.ts +1 -0
- package/cjs/utils/use-inner-visible.js +18 -0
- package/es/components/dialog/dialog.d.ts +2 -0
- package/es/components/dialog/dialog.js +23 -14
- package/es/components/ellipsis/ellipsis.js +1 -1
- package/es/components/error-block/create-error-block.d.ts +12 -0
- package/es/components/error-block/create-error-block.js +44 -0
- package/es/components/error-block/error-block.d.ts +2 -11
- package/es/components/error-block/error-block.js +8 -46
- package/es/components/error-block/images/index.d.ts +4 -2
- package/es/components/error-block/images/index.js +4 -10
- package/es/components/error-block/index.d.ts +5 -1
- package/es/components/error-block/index.js +1 -0
- package/es/components/image-viewer/image-viewer.css +6 -1
- package/es/components/image-viewer/image-viewer.d.ts +5 -2
- package/es/components/image-viewer/image-viewer.js +24 -5
- package/es/components/image-viewer/index.d.ts +2 -1
- package/es/components/index-bar/index-bar.d.ts +2 -0
- package/es/components/index-bar/index-bar.js +6 -0
- package/es/components/index-bar/index.d.ts +1 -0
- package/es/components/input/input.js +21 -4
- package/es/components/mask/mask.js +10 -8
- package/es/components/modal/modal.d.ts +2 -0
- package/es/components/modal/modal.js +23 -12
- package/es/components/side-bar/side-bar.js +2 -0
- package/es/components/spin-loading/spin-loading.js +5 -2
- package/es/components/tab-bar/tab-bar.js +2 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/locales/fr-FR.d.ts +106 -0
- package/es/locales/fr-FR.js +109 -0
- package/es/utils/measure-css-length.js +2 -2
- package/es/utils/reduce-and-restore-motion.d.ts +4 -0
- package/es/utils/reduce-and-restore-motion.js +36 -0
- package/es/utils/use-inner-visible.d.ts +1 -0
- package/es/utils/use-inner-visible.js +9 -0
- package/package.json +8 -7
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +12 -0
|
@@ -69,7 +69,7 @@ const Mask = p => {
|
|
|
69
69
|
config: {
|
|
70
70
|
precision: 0.01,
|
|
71
71
|
mass: 1,
|
|
72
|
-
tension:
|
|
72
|
+
tension: 250,
|
|
73
73
|
friction: 30,
|
|
74
74
|
clamp: true
|
|
75
75
|
},
|
|
@@ -89,14 +89,12 @@ const Mask = p => {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
const shouldRender = (0, _shouldRender.useShouldRender)(active, props.forceRender, props.destroyOnClose);
|
|
93
92
|
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_web.animated.div, {
|
|
94
93
|
className: classPrefix,
|
|
95
94
|
ref: ref,
|
|
96
|
-
style: Object.assign(Object.assign({
|
|
95
|
+
style: Object.assign(Object.assign({}, props.style), {
|
|
97
96
|
background,
|
|
98
|
-
opacity
|
|
99
|
-
}, props.style), {
|
|
97
|
+
opacity,
|
|
100
98
|
display: active ? undefined : 'none'
|
|
101
99
|
}),
|
|
102
100
|
onClick: e => {
|
|
@@ -113,8 +111,12 @@ const Mask = p => {
|
|
|
113
111
|
onClick: props.onMaskClick
|
|
114
112
|
}), _react.default.createElement("div", {
|
|
115
113
|
className: `${classPrefix}-content`
|
|
116
|
-
},
|
|
117
|
-
return
|
|
114
|
+
}, props.children))));
|
|
115
|
+
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
116
|
+
active: active,
|
|
117
|
+
forceRender: props.forceRender,
|
|
118
|
+
destroyOnClose: props.destroyOnClose
|
|
119
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
exports.Mask = Mask;
|
|
@@ -35,6 +35,10 @@ var _nativeProps = require("../../utils/native-props");
|
|
|
35
35
|
|
|
36
36
|
var _antdMobileIcons = require("antd-mobile-icons");
|
|
37
37
|
|
|
38
|
+
var _shouldRender = require("../../utils/should-render");
|
|
39
|
+
|
|
40
|
+
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
41
|
+
|
|
38
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
43
|
|
|
40
44
|
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); }
|
|
@@ -49,7 +53,9 @@ const defaultProps = {
|
|
|
49
53
|
stopPropagation: ['click'],
|
|
50
54
|
showCloseButton: false,
|
|
51
55
|
getContainer: null,
|
|
52
|
-
disableBodyScroll: true
|
|
56
|
+
disableBodyScroll: true,
|
|
57
|
+
destroyOnClose: false,
|
|
58
|
+
forceRender: false
|
|
53
59
|
};
|
|
54
60
|
|
|
55
61
|
const Modal = p => {
|
|
@@ -64,9 +70,6 @@ const Modal = p => {
|
|
|
64
70
|
friction: 25,
|
|
65
71
|
clamp: true
|
|
66
72
|
},
|
|
67
|
-
onStart: () => {
|
|
68
|
-
setActive(true);
|
|
69
|
-
},
|
|
70
73
|
onRest: () => {
|
|
71
74
|
var _a, _b;
|
|
72
75
|
|
|
@@ -81,6 +84,12 @@ const Modal = p => {
|
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
86
|
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
87
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
88
|
+
if (props.visible) {
|
|
89
|
+
setActive(true);
|
|
90
|
+
}
|
|
91
|
+
}, [props.visible]);
|
|
92
|
+
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
|
|
84
93
|
|
|
85
94
|
const body = _react.default.createElement("div", {
|
|
86
95
|
className: (0, _classnames.default)(cls('body'), props.image && cls('with-image'), props.bodyClassName),
|
|
@@ -123,23 +132,27 @@ const Modal = p => {
|
|
|
123
132
|
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
124
133
|
className: cls(),
|
|
125
134
|
style: {
|
|
126
|
-
display: active ? undefined : 'none'
|
|
135
|
+
display: active ? undefined : 'none',
|
|
136
|
+
pointerEvents: active ? undefined : 'none'
|
|
127
137
|
}
|
|
128
138
|
}, _react.default.createElement(_mask.default, {
|
|
129
|
-
visible:
|
|
139
|
+
visible: maskVisible,
|
|
140
|
+
forceRender: props.forceRender,
|
|
141
|
+
destroyOnClose: props.destroyOnClose,
|
|
130
142
|
onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
|
|
131
143
|
style: props.maskStyle,
|
|
132
144
|
className: (0, _classnames.default)(cls('mask'), props.maskClassName),
|
|
133
145
|
disableBodyScroll: props.disableBodyScroll
|
|
134
146
|
}), _react.default.createElement("div", {
|
|
135
|
-
className: cls('wrap')
|
|
136
|
-
style: {
|
|
137
|
-
pointerEvents: props.visible ? undefined : 'none'
|
|
138
|
-
}
|
|
147
|
+
className: cls('wrap')
|
|
139
148
|
}, _react.default.createElement(_web.animated.div, {
|
|
140
149
|
style: style
|
|
141
150
|
}, body)))));
|
|
142
|
-
return
|
|
151
|
+
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
152
|
+
active: active,
|
|
153
|
+
forceRender: props.forceRender,
|
|
154
|
+
destroyOnClose: props.destroyOnClose
|
|
155
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
143
156
|
};
|
|
144
157
|
|
|
145
158
|
exports.Modal = Modal;
|
|
@@ -22,6 +22,7 @@ var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
24
|
const classPrefix = `adm-side-bar`;
|
|
25
|
+
/* istanbul ignore next */
|
|
25
26
|
|
|
26
27
|
const SideBarItem = () => {
|
|
27
28
|
return null;
|
|
@@ -13,6 +13,8 @@ var _withDefaultProps = require("../../utils/with-default-props");
|
|
|
13
13
|
|
|
14
14
|
var _web = require("@react-spring/web");
|
|
15
15
|
|
|
16
|
+
var _reduceAndRestoreMotion = require("../../utils/reduce-and-restore-motion");
|
|
17
|
+
|
|
16
18
|
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); }
|
|
17
19
|
|
|
18
20
|
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; }
|
|
@@ -31,17 +33,19 @@ const SpinLoading = (0, _react.memo)(p => {
|
|
|
31
33
|
var _a;
|
|
32
34
|
|
|
33
35
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
36
|
+
const motionReduced = (0, _reduceAndRestoreMotion.useMotionReduced)();
|
|
34
37
|
const {
|
|
35
38
|
percent
|
|
36
39
|
} = (0, _web.useSpring)({
|
|
40
|
+
cancel: motionReduced,
|
|
37
41
|
loop: {
|
|
38
42
|
reverse: true
|
|
39
43
|
},
|
|
40
44
|
from: {
|
|
41
|
-
percent:
|
|
45
|
+
percent: 80
|
|
42
46
|
},
|
|
43
47
|
to: {
|
|
44
|
-
percent:
|
|
48
|
+
percent: 30
|
|
45
49
|
},
|
|
46
50
|
config: {
|
|
47
51
|
duration: 1200
|
package/2x/cjs/index.d.ts
CHANGED
|
@@ -77,3 +77,5 @@ export { default as Toast } from './components/toast';
|
|
|
77
77
|
export { default as TreeSelect } from './components/tree-select';
|
|
78
78
|
export { default as VirtualInput } from './components/virtual-input';
|
|
79
79
|
export { default as WaterMark } from './components/water-mark';
|
|
80
|
+
export { createErrorBlock } from './components/error-block';
|
|
81
|
+
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
package/2x/cjs/index.js
CHANGED
|
@@ -465,6 +465,24 @@ Object.defineProperty(exports, "WaterMark", {
|
|
|
465
465
|
return _waterMark.default;
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
|
+
Object.defineProperty(exports, "createErrorBlock", {
|
|
469
|
+
enumerable: true,
|
|
470
|
+
get: function () {
|
|
471
|
+
return _errorBlock.createErrorBlock;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
Object.defineProperty(exports, "reduceMotion", {
|
|
475
|
+
enumerable: true,
|
|
476
|
+
get: function () {
|
|
477
|
+
return _reduceAndRestoreMotion.reduceMotion;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
Object.defineProperty(exports, "restoreMotion", {
|
|
481
|
+
enumerable: true,
|
|
482
|
+
get: function () {
|
|
483
|
+
return _reduceAndRestoreMotion.restoreMotion;
|
|
484
|
+
}
|
|
485
|
+
});
|
|
468
486
|
Object.defineProperty(exports, "setDefaultConfig", {
|
|
469
487
|
enumerable: true,
|
|
470
488
|
get: function () {
|
|
@@ -522,7 +540,7 @@ var _ellipsis = _interopRequireDefault(require("./components/ellipsis"));
|
|
|
522
540
|
|
|
523
541
|
var _empty = _interopRequireDefault(require("./components/empty"));
|
|
524
542
|
|
|
525
|
-
var _errorBlock =
|
|
543
|
+
var _errorBlock = _interopRequireWildcard(require("./components/error-block"));
|
|
526
544
|
|
|
527
545
|
var _floatingBubble = _interopRequireDefault(require("./components/floating-bubble"));
|
|
528
546
|
|
|
@@ -628,6 +646,8 @@ var _virtualInput = _interopRequireDefault(require("./components/virtual-input")
|
|
|
628
646
|
|
|
629
647
|
var _waterMark = _interopRequireDefault(require("./components/water-mark"));
|
|
630
648
|
|
|
649
|
+
var _reduceAndRestoreMotion = require("./utils/reduce-and-restore-motion");
|
|
650
|
+
|
|
631
651
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
632
652
|
|
|
633
653
|
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); }
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare const frFR: {
|
|
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
|
+
upload: string;
|
|
90
|
+
};
|
|
91
|
+
InfiniteScroll: {
|
|
92
|
+
noMore: string;
|
|
93
|
+
};
|
|
94
|
+
Mask: {
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
Modal: {
|
|
98
|
+
ok: string;
|
|
99
|
+
};
|
|
100
|
+
PullToRefresh: {
|
|
101
|
+
pulling: string;
|
|
102
|
+
canRelease: string;
|
|
103
|
+
complete: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export default frFR;
|
|
@@ -0,0 +1,119 @@
|
|
|
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}Pas un valide${type}';
|
|
13
|
+
const frFR = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
14
|
+
locale: 'fr-FR',
|
|
15
|
+
common: {
|
|
16
|
+
confirm: 'Valider',
|
|
17
|
+
cancel: 'Annuler',
|
|
18
|
+
loading: 'Chargement'
|
|
19
|
+
},
|
|
20
|
+
Calendar: {
|
|
21
|
+
markItems: ['un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept'],
|
|
22
|
+
renderYearAndMonth: (year, month) => `${year}Année ${month}Mois`
|
|
23
|
+
},
|
|
24
|
+
Cascader: {
|
|
25
|
+
placeholder: 'Veuillez sélectionner'
|
|
26
|
+
},
|
|
27
|
+
Dialog: {
|
|
28
|
+
ok: 'Je l’ai compris'
|
|
29
|
+
},
|
|
30
|
+
ErrorBlock: {
|
|
31
|
+
default: {
|
|
32
|
+
title: 'La page rencontre des problèmes mineurs',
|
|
33
|
+
description: 'Venez essayer plus tard'
|
|
34
|
+
},
|
|
35
|
+
busy: {
|
|
36
|
+
title: 'Pas chargé.',
|
|
37
|
+
description: 'Tentative de rafraîchir la page'
|
|
38
|
+
},
|
|
39
|
+
disconnected: {
|
|
40
|
+
title: 'Le réseau est occupé',
|
|
41
|
+
description: 'Tentative de rafraîchir la page'
|
|
42
|
+
},
|
|
43
|
+
empty: {
|
|
44
|
+
title: 'Vous n’avez pas trouvé ce que vous cherchez',
|
|
45
|
+
description: 'Trouvez les autres'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
Form: {
|
|
49
|
+
required: 'Qu’il remplit',
|
|
50
|
+
optional: 'Décharge sélectionnés',
|
|
51
|
+
defaultValidateMessages: {
|
|
52
|
+
default: 'Erreur de validation de champ${label}',
|
|
53
|
+
required: 'Veuillez entrer le${label}',
|
|
54
|
+
enum: '${label}doit être l’un des[${enum}]',
|
|
55
|
+
whitespace: '${label}Ne peut pas être un caractère vide',
|
|
56
|
+
date: {
|
|
57
|
+
format: '${label}Format de date invalide',
|
|
58
|
+
parse: '${label}Non convertible en date',
|
|
59
|
+
invalid: '${label}Est une date non valide'
|
|
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}pour${len}Un caractère',
|
|
78
|
+
min: '${label}Au moins${min}Un caractère',
|
|
79
|
+
max: '${label}Un maximum de${max}Un caractère',
|
|
80
|
+
range: '${label}Dans les${min}-${max}Entre les caractères'
|
|
81
|
+
},
|
|
82
|
+
number: {
|
|
83
|
+
len: '${label}Doit être égal à${len}',
|
|
84
|
+
min: '${label}La valeur minimale est${min}',
|
|
85
|
+
max: '${label}La valeur maximale est${max}',
|
|
86
|
+
range: '${label}Dans les${min}-${max}entre'
|
|
87
|
+
},
|
|
88
|
+
array: {
|
|
89
|
+
len: 'pour${len}个${label}',
|
|
90
|
+
min: 'Au moins${min}个${label}',
|
|
91
|
+
max: 'Un maximum de${max}个${label}',
|
|
92
|
+
range: '${label}Montant de${min}-${max}entre'
|
|
93
|
+
},
|
|
94
|
+
pattern: {
|
|
95
|
+
mismatch: '${label}Ne correspond pas au modèle${pattern}'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
ImageUploader: {
|
|
100
|
+
uploading: 'Téléchargement...',
|
|
101
|
+
upload: 'Télécharger'
|
|
102
|
+
},
|
|
103
|
+
InfiniteScroll: {
|
|
104
|
+
noMore: 'Non, plus maintenant.'
|
|
105
|
+
},
|
|
106
|
+
Mask: {
|
|
107
|
+
name: 'Masques'
|
|
108
|
+
},
|
|
109
|
+
Modal: {
|
|
110
|
+
ok: 'Je l’ai compris'
|
|
111
|
+
},
|
|
112
|
+
PullToRefresh: {
|
|
113
|
+
pulling: 'Rafraîchir la liste déroulante',
|
|
114
|
+
canRelease: 'Libérez instantanément rafraîchir',
|
|
115
|
+
complete: 'Rafraîchir avec succès'
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var _default = frFR;
|
|
119
|
+
exports.default = _default;
|
|
@@ -10,7 +10,7 @@ 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) {
|
|
13
|
+
if (raw === null || raw === undefined || raw === '') {
|
|
14
14
|
if (_isDev.isDev) {
|
|
15
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
16
|
}
|
|
@@ -28,7 +28,7 @@ function measureCSSLength(raw) {
|
|
|
28
28
|
return parseFloat(withUnit) * window.innerWidth / 100;
|
|
29
29
|
} else {
|
|
30
30
|
if (_isDev.isDev) {
|
|
31
|
-
(0, _devLog.devError)('Global',
|
|
31
|
+
(0, _devLog.devError)('Global', `You are using a not supported CSS unit in \`${raw}\`. Only \`px\` \`rem\` and \`vw\` are supported.`);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return 0;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isMotionReduced = isMotionReduced;
|
|
7
|
+
exports.reduceMotion = reduceMotion;
|
|
8
|
+
exports.restoreMotion = restoreMotion;
|
|
9
|
+
exports.useMotionReduced = useMotionReduced;
|
|
10
|
+
|
|
11
|
+
var _web = require("@react-spring/web");
|
|
12
|
+
|
|
13
|
+
var _shim = require("use-sync-external-store/shim");
|
|
14
|
+
|
|
15
|
+
let reduced = false;
|
|
16
|
+
const subscribers = new Set();
|
|
17
|
+
|
|
18
|
+
function notify() {
|
|
19
|
+
subscribers.forEach(subscriber => {
|
|
20
|
+
subscriber();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function reduceMotion() {
|
|
25
|
+
reduced = true;
|
|
26
|
+
notify();
|
|
27
|
+
|
|
28
|
+
_web.Globals.assign({
|
|
29
|
+
skipAnimation: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function restoreMotion() {
|
|
34
|
+
reduced = false;
|
|
35
|
+
notify();
|
|
36
|
+
|
|
37
|
+
_web.Globals.assign({
|
|
38
|
+
skipAnimation: false
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function isMotionReduced() {
|
|
43
|
+
return reduced;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function useMotionReduced() {
|
|
47
|
+
return (0, _shim.useSyncExternalStore)(onStoreChange => {
|
|
48
|
+
subscribers.add(onStoreChange);
|
|
49
|
+
return () => {
|
|
50
|
+
subscribers.delete(onStoreChange);
|
|
51
|
+
};
|
|
52
|
+
}, isMotionReduced);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useInnerVisible(outerVisible: boolean): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useInnerVisible = useInnerVisible;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _ahooks = require("ahooks");
|
|
11
|
+
|
|
12
|
+
function useInnerVisible(outerVisible) {
|
|
13
|
+
const [innerVisible, setInnerVisible] = (0, _react.useState)(outerVisible);
|
|
14
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
15
|
+
setInnerVisible(outerVisible);
|
|
16
|
+
}, [outerVisible]);
|
|
17
|
+
return innerVisible;
|
|
18
|
+
}
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import { useUnmountedRef } from 'ahooks';
|
|
5
|
+
import { useIsomorphicLayoutEffect, useUnmountedRef } from 'ahooks';
|
|
6
6
|
import Mask from '../mask';
|
|
7
7
|
import { DialogActionButton } from './dialog-action-button';
|
|
8
8
|
import Image from '../image';
|
|
@@ -11,6 +11,8 @@ import { withStopPropagation } from '../../utils/with-stop-propagation';
|
|
|
11
11
|
import AutoCenter from '../auto-center';
|
|
12
12
|
import { useSpring, animated } from '@react-spring/web';
|
|
13
13
|
import { withNativeProps } from '../../utils/native-props';
|
|
14
|
+
import { ShouldRender } from '../../utils/should-render';
|
|
15
|
+
import { useInnerVisible } from '../../utils/use-inner-visible';
|
|
14
16
|
const defaultProps = {
|
|
15
17
|
visible: false,
|
|
16
18
|
actions: [],
|
|
@@ -18,7 +20,9 @@ const defaultProps = {
|
|
|
18
20
|
closeOnMaskClick: false,
|
|
19
21
|
stopPropagation: ['click'],
|
|
20
22
|
getContainer: null,
|
|
21
|
-
disableBodyScroll: true
|
|
23
|
+
disableBodyScroll: true,
|
|
24
|
+
destroyOnClose: false,
|
|
25
|
+
forceRender: false
|
|
22
26
|
};
|
|
23
27
|
export const Dialog = p => {
|
|
24
28
|
const props = mergeProps(defaultProps, p);
|
|
@@ -32,9 +36,6 @@ export const Dialog = p => {
|
|
|
32
36
|
friction: 25,
|
|
33
37
|
clamp: true
|
|
34
38
|
},
|
|
35
|
-
onStart: () => {
|
|
36
|
-
setActive(true);
|
|
37
|
-
},
|
|
38
39
|
onRest: () => {
|
|
39
40
|
var _a, _b;
|
|
40
41
|
|
|
@@ -49,6 +50,12 @@ export const Dialog = p => {
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
const [active, setActive] = useState(props.visible);
|
|
53
|
+
useIsomorphicLayoutEffect(() => {
|
|
54
|
+
if (props.visible) {
|
|
55
|
+
setActive(true);
|
|
56
|
+
}
|
|
57
|
+
}, [props.visible]);
|
|
58
|
+
const maskVisible = useInnerVisible(active && props.visible);
|
|
52
59
|
const body = React.createElement("div", {
|
|
53
60
|
className: classNames(cls('body'), props.image && cls('with-image'), props.bodyClassName),
|
|
54
61
|
style: props.bodyStyle
|
|
@@ -85,26 +92,28 @@ export const Dialog = p => {
|
|
|
85
92
|
})
|
|
86
93
|
})));
|
|
87
94
|
})));
|
|
88
|
-
const node = withNativeProps(props, React.createElement("div", {
|
|
95
|
+
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
|
|
89
96
|
className: cls(),
|
|
90
97
|
style: {
|
|
91
|
-
display: active ? undefined : 'none'
|
|
98
|
+
display: active ? undefined : 'none',
|
|
99
|
+
pointerEvents: active ? undefined : 'none'
|
|
92
100
|
}
|
|
93
101
|
}, React.createElement(Mask, {
|
|
94
|
-
visible:
|
|
102
|
+
visible: maskVisible,
|
|
95
103
|
onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
|
|
96
104
|
style: props.maskStyle,
|
|
97
105
|
className: classNames(cls('mask'), props.maskClassName),
|
|
98
106
|
disableBodyScroll: props.disableBodyScroll
|
|
99
107
|
}), React.createElement("div", {
|
|
100
|
-
className: cls('wrap')
|
|
101
|
-
style: {
|
|
102
|
-
pointerEvents: props.visible ? undefined : 'none'
|
|
103
|
-
}
|
|
108
|
+
className: cls('wrap')
|
|
104
109
|
}, React.createElement(animated.div, {
|
|
105
110
|
style: style
|
|
106
|
-
}, body))));
|
|
107
|
-
return
|
|
111
|
+
}, body)))));
|
|
112
|
+
return React.createElement(ShouldRender, {
|
|
113
|
+
active: active,
|
|
114
|
+
forceRender: props.forceRender,
|
|
115
|
+
destroyOnClose: props.destroyOnClose
|
|
116
|
+
}, renderToContainer(props.getContainer, node));
|
|
108
117
|
};
|
|
109
118
|
|
|
110
119
|
function cls(name = '') {
|
|
@@ -98,7 +98,7 @@ export const Ellipsis = p => {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
101
|
-
const rightPartMiddle = Math.
|
|
101
|
+
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
102
102
|
container.innerText = props.content.slice(0, leftPartMiddle) + '...' + actionText + '...' + props.content.slice(rightPartMiddle, end);
|
|
103
103
|
|
|
104
104
|
if (container.offsetHeight <= maxHeight) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { ErrorBlockStatus, ImageRecord } from '.';
|
|
4
|
+
export declare type ErrorBlockProps = {
|
|
5
|
+
status?: ErrorBlockStatus;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
image?: string | ReactElement;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
fullPage?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & NativeProps<'--image-height' | '--image-height-full-page' | '--image-width' | '--image-width-full-page'>;
|
|
12
|
+
export declare function createErrorBlock(imageRecord: ImageRecord): React.FC<ErrorBlockProps>;
|