antd-mobile 5.19.0 → 5.22.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/bundle/antd-mobile.cjs.development.js +25724 -0
- package/2x/bundle/antd-mobile.cjs.js +8 -32
- package/2x/bundle/antd-mobile.compatible.umd.js +10464 -10860
- package/2x/bundle/antd-mobile.es.development.js +25704 -0
- package/2x/bundle/antd-mobile.es.js +8381 -8615
- package/2x/bundle/antd-mobile.umd.development.js +25726 -0
- package/2x/bundle/antd-mobile.umd.js +8 -32
- package/2x/bundle/style.css +153 -7
- package/2x/cjs/components/action-sheet/action-sheet.css +6 -2
- package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -0
- package/2x/cjs/components/action-sheet/action-sheet.js +2 -1
- package/2x/cjs/components/check-list/check-list.css +1 -1
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -0
- package/2x/cjs/components/floating-panel/floating-panel.js +2 -2
- package/2x/cjs/components/form/context.d.ts +1 -1
- package/2x/cjs/components/form/form-item.d.ts +1 -1
- package/2x/cjs/components/form/form-item.js +3 -0
- package/2x/cjs/components/image/test/image.test.js +57 -8
- package/2x/cjs/components/image-viewer/image-viewer.js +4 -2
- package/2x/cjs/components/index-bar/index-bar.css +1 -1
- package/2x/cjs/components/page-indicator/page-indicator.css +1 -1
- package/2x/cjs/components/picker-view/wheel.js +2 -0
- package/2x/cjs/components/rate/rate.css +4 -0
- package/2x/cjs/components/rate/rate.js +42 -13
- package/2x/cjs/components/result-page/index.d.ts +7 -0
- package/2x/cjs/components/result-page/index.js +20 -0
- package/2x/cjs/components/result-page/result-page-card.d.ts +6 -0
- package/2x/cjs/components/result-page/result-page-card.js +24 -0
- package/2x/cjs/components/result-page/result-page.css +130 -0
- package/2x/cjs/components/result-page/result-page.d.ts +23 -0
- package/2x/cjs/components/result-page/result-page.js +108 -0
- package/2x/cjs/components/selector/selector.css +10 -0
- package/2x/cjs/components/selector/selector.d.ts +3 -2
- package/2x/cjs/components/selector/selector.js +1 -4
- package/2x/cjs/components/swipe-action/swipe-action.d.ts +2 -0
- package/2x/cjs/components/swipe-action/swipe-action.js +34 -6
- package/2x/cjs/components/swiper/swiper.js +15 -1
- package/2x/cjs/components/tab-bar/tab-bar.css +2 -2
- package/2x/cjs/index.d.ts +1 -0
- package/2x/cjs/index.js +8 -0
- package/2x/cjs/locales/id-ID.js +13 -0
- package/2x/cjs/utils/use-resize-effect.js +3 -1
- package/2x/es/components/action-sheet/action-sheet.css +6 -2
- package/2x/es/components/action-sheet/action-sheet.d.ts +1 -0
- package/2x/es/components/action-sheet/action-sheet.js +2 -1
- package/2x/es/components/check-list/check-list.css +1 -1
- package/2x/es/components/ellipsis/ellipsis.js +1 -0
- package/2x/es/components/floating-panel/floating-panel.js +2 -2
- package/2x/es/components/form/context.d.ts +1 -1
- package/2x/es/components/form/form-item.d.ts +1 -1
- package/2x/es/components/form/form-item.js +3 -0
- package/2x/es/components/image/test/image.test.js +54 -8
- package/2x/es/components/image-viewer/image-viewer.js +4 -2
- package/2x/es/components/index-bar/index-bar.css +1 -1
- package/2x/es/components/page-indicator/page-indicator.css +1 -1
- package/2x/es/components/picker-view/wheel.js +2 -0
- package/2x/es/components/rate/rate.css +4 -0
- package/2x/es/components/rate/rate.js +36 -13
- package/2x/es/components/result-page/index.d.ts +7 -0
- package/2x/es/components/result-page/index.js +7 -0
- package/2x/es/components/result-page/result-page-card.d.ts +6 -0
- package/2x/es/components/result-page/result-page-card.js +9 -0
- package/2x/es/components/result-page/result-page.css +130 -0
- package/2x/es/components/result-page/result-page.d.ts +23 -0
- package/2x/es/components/result-page/result-page.js +83 -0
- package/2x/es/components/selector/selector.css +10 -0
- package/2x/es/components/selector/selector.d.ts +3 -2
- package/2x/es/components/selector/selector.js +1 -3
- package/2x/es/components/swipe-action/swipe-action.d.ts +2 -0
- package/2x/es/components/swipe-action/swipe-action.js +34 -6
- package/2x/es/components/swiper/swiper.js +15 -1
- package/2x/es/components/tab-bar/tab-bar.css +2 -2
- package/2x/es/index.d.ts +1 -0
- package/2x/es/index.js +1 -0
- package/2x/es/locales/id-ID.js +13 -0
- package/2x/es/utils/use-resize-effect.js +3 -1
- package/2x/package.json +6 -6
- package/2x/umd/antd-mobile.js +10464 -10860
- package/bundle/antd-mobile.cjs.development.js +25724 -0
- package/bundle/antd-mobile.cjs.js +8 -32
- package/bundle/antd-mobile.compatible.umd.js +10464 -10860
- package/bundle/antd-mobile.es.development.js +25704 -0
- package/bundle/antd-mobile.es.js +8381 -8615
- package/bundle/antd-mobile.umd.development.js +25726 -0
- package/bundle/antd-mobile.umd.js +8 -32
- package/bundle/style.css +1 -1
- package/cjs/components/action-sheet/action-sheet.css +5 -2
- package/cjs/components/action-sheet/action-sheet.d.ts +1 -0
- package/cjs/components/action-sheet/action-sheet.js +2 -1
- package/cjs/components/check-list/check-list.css +1 -1
- package/cjs/components/ellipsis/ellipsis.js +1 -0
- package/cjs/components/floating-panel/floating-panel.js +2 -2
- package/cjs/components/form/context.d.ts +1 -1
- package/cjs/components/form/form-item.d.ts +1 -1
- package/cjs/components/form/form-item.js +3 -0
- package/cjs/components/image/test/image.test.js +57 -8
- package/cjs/components/image-viewer/image-viewer.js +4 -2
- package/cjs/components/index-bar/index-bar.css +1 -1
- package/cjs/components/page-indicator/page-indicator.css +1 -1
- package/cjs/components/picker-view/wheel.js +2 -0
- package/cjs/components/rate/rate.css +4 -0
- package/cjs/components/rate/rate.js +42 -13
- package/cjs/components/result-page/index.d.ts +7 -0
- package/cjs/components/result-page/index.js +20 -0
- package/cjs/components/result-page/result-page-card.d.ts +6 -0
- package/cjs/components/result-page/result-page-card.js +24 -0
- package/cjs/components/result-page/result-page.css +113 -0
- package/cjs/components/result-page/result-page.d.ts +23 -0
- package/cjs/components/result-page/result-page.js +108 -0
- package/cjs/components/selector/selector.css +9 -0
- package/cjs/components/selector/selector.d.ts +3 -2
- package/cjs/components/selector/selector.js +1 -4
- package/cjs/components/swipe-action/swipe-action.d.ts +2 -0
- package/cjs/components/swipe-action/swipe-action.js +34 -6
- package/cjs/components/swiper/swiper.js +15 -1
- package/cjs/components/tab-bar/tab-bar.css +2 -2
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +8 -0
- package/cjs/locales/id-ID.js +13 -0
- package/cjs/utils/use-resize-effect.js +3 -1
- package/es/components/action-sheet/action-sheet.css +5 -2
- package/es/components/action-sheet/action-sheet.d.ts +1 -0
- package/es/components/action-sheet/action-sheet.js +2 -1
- package/es/components/check-list/check-list.css +1 -1
- package/es/components/ellipsis/ellipsis.js +1 -0
- package/es/components/floating-panel/floating-panel.js +2 -2
- package/es/components/form/context.d.ts +1 -1
- package/es/components/form/form-item.d.ts +1 -1
- package/es/components/form/form-item.js +3 -0
- package/es/components/image/test/image.test.js +54 -8
- package/es/components/image-viewer/image-viewer.js +4 -2
- package/es/components/index-bar/index-bar.css +1 -1
- package/es/components/page-indicator/page-indicator.css +1 -1
- package/es/components/picker-view/wheel.js +2 -0
- package/es/components/rate/rate.css +4 -0
- package/es/components/rate/rate.js +36 -13
- package/es/components/result-page/index.d.ts +7 -0
- package/es/components/result-page/index.js +7 -0
- package/es/components/result-page/result-page-card.d.ts +6 -0
- package/es/components/result-page/result-page-card.js +9 -0
- package/es/components/result-page/result-page.css +113 -0
- package/es/components/result-page/result-page.d.ts +23 -0
- package/es/components/result-page/result-page.js +83 -0
- package/es/components/selector/selector.css +9 -0
- package/es/components/selector/selector.d.ts +3 -2
- package/es/components/selector/selector.js +1 -3
- package/es/components/swipe-action/swipe-action.d.ts +2 -0
- package/es/components/swipe-action/swipe-action.js +34 -6
- package/es/components/swiper/swiper.js +15 -1
- package/es/components/tab-bar/tab-bar.css +2 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales/id-ID.js +13 -0
- package/es/utils/use-resize-effect.js +3 -1
- package/package.json +6 -6
- package/umd/antd-mobile.js +1 -1
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
--active-color: #ffd21e;
|
|
4
4
|
--inactive-color: var(--adm-color-border);
|
|
5
5
|
display: inline-flex;
|
|
6
|
+
touch-action: pan-y;
|
|
7
|
+
-webkit-user-select: none;
|
|
8
|
+
user-select: none;
|
|
6
9
|
}
|
|
7
10
|
.adm-rate-box {
|
|
8
11
|
position: relative;
|
|
@@ -16,6 +19,7 @@
|
|
|
16
19
|
overflow: hidden;
|
|
17
20
|
cursor: pointer;
|
|
18
21
|
box-sizing: border-box;
|
|
22
|
+
transition: all 0.3s;
|
|
19
23
|
}
|
|
20
24
|
.adm-rate-star-half {
|
|
21
25
|
padding-right: 0;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Rate = 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,8 +17,16 @@ var _usePropsValue = require("../../utils/use-props-value");
|
|
|
17
17
|
|
|
18
18
|
var _star = require("./star");
|
|
19
19
|
|
|
20
|
+
var _react2 = require("@use-gesture/react");
|
|
21
|
+
|
|
22
|
+
var _bound = require("../../utils/bound");
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
22
30
|
const classPrefix = `adm-rate`;
|
|
23
31
|
const defaultProps = {
|
|
24
32
|
count: 5,
|
|
@@ -32,6 +40,7 @@ const defaultProps = {
|
|
|
32
40
|
const Rate = p => {
|
|
33
41
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
34
42
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
43
|
+
const containerRef = (0, _react.useRef)(null);
|
|
35
44
|
const starList = Array(props.count).fill(null);
|
|
36
45
|
|
|
37
46
|
function renderStar(v, half) {
|
|
@@ -41,26 +50,46 @@ const Rate = p => {
|
|
|
41
50
|
[`${classPrefix}-star-half`]: half,
|
|
42
51
|
[`${classPrefix}-star-readonly`]: props.readOnly
|
|
43
52
|
}),
|
|
44
|
-
onClick: () => {
|
|
45
|
-
if (props.readOnly) return;
|
|
46
|
-
|
|
47
|
-
if (props.allowClear && value === v) {
|
|
48
|
-
setValue(0);
|
|
49
|
-
} else {
|
|
50
|
-
setValue(v);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
53
|
role: 'radio',
|
|
54
54
|
"aria-checked": value >= v,
|
|
55
55
|
"aria-label": '' + v
|
|
56
56
|
}, props.character);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const bind = (0, _react2.useDrag)(state => {
|
|
60
|
+
if (props.readOnly) return;
|
|
61
|
+
const {
|
|
62
|
+
xy: [clientX],
|
|
63
|
+
tap
|
|
64
|
+
} = state;
|
|
65
|
+
const container = containerRef.current;
|
|
66
|
+
if (!container) return;
|
|
67
|
+
const rect = container.getBoundingClientRect();
|
|
68
|
+
const rawValue = (clientX - rect.left) / rect.width * props.count;
|
|
69
|
+
const ceiledValue = props.allowHalf ? Math.ceil(rawValue * 2) / 2 : Math.ceil(rawValue);
|
|
70
|
+
const boundValue = (0, _bound.bound)(ceiledValue, 0, props.count);
|
|
71
|
+
|
|
72
|
+
if (tap) {
|
|
73
|
+
if (props.allowClear && boundValue === value) {
|
|
74
|
+
setValue(0);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setValue(boundValue);
|
|
80
|
+
}, {
|
|
81
|
+
axis: 'x',
|
|
82
|
+
pointer: {
|
|
83
|
+
touch: true
|
|
84
|
+
},
|
|
85
|
+
filterTaps: true
|
|
86
|
+
});
|
|
87
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", Object.assign({
|
|
60
88
|
className: classPrefix,
|
|
61
89
|
role: 'radiogroup',
|
|
62
|
-
"aria-readonly": props.readOnly
|
|
63
|
-
|
|
90
|
+
"aria-readonly": props.readOnly,
|
|
91
|
+
ref: containerRef
|
|
92
|
+
}, bind()), starList.map((_, i) => _react.default.createElement("div", {
|
|
64
93
|
key: i,
|
|
65
94
|
className: (0, _classnames.default)(`${classPrefix}-box`)
|
|
66
95
|
}, props.allowHalf && renderStar(i + 0.5, true), renderStar(i + 1, false)))));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './result-page.less';
|
|
3
|
+
export type { ResultPageProps } from './result-page';
|
|
4
|
+
declare const _default: import("react").FC<import("./result-page").ResultPageProps> & {
|
|
5
|
+
Card: import("react").FC<import("./result-page-card").ResultPageCardProps>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
require("./result-page.css");
|
|
9
|
+
|
|
10
|
+
var _resultPage2 = require("./result-page");
|
|
11
|
+
|
|
12
|
+
var _attachPropertiesToComponent = require("../../utils/attach-properties-to-component");
|
|
13
|
+
|
|
14
|
+
var _resultPageCard = require("./result-page-card");
|
|
15
|
+
|
|
16
|
+
var _default = (0, _attachPropertiesToComponent.attachPropertiesToComponent)(_resultPage2.ResultPage, {
|
|
17
|
+
Card: _resultPageCard.ResultPageCard
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.default = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResultPageCard = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _nativeProps = require("../../utils/native-props");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const classPrefix = `adm-result-page-card`;
|
|
17
|
+
|
|
18
|
+
const ResultPageCard = props => {
|
|
19
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement('div', {
|
|
20
|
+
className: (0, _classnames.default)(`${classPrefix}`)
|
|
21
|
+
}, props.children));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.ResultPageCard = ResultPageCard;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
.adm-result-page {
|
|
2
|
+
--background-color: var(--adm-color-primary);
|
|
3
|
+
position: relative;
|
|
4
|
+
background-color: var(--adm-color-box);
|
|
5
|
+
min-height: 100vh;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
.adm-result-page-header {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
position: relative;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
padding-bottom: 100px;
|
|
16
|
+
z-index: 1;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
.adm-result-page-icon {
|
|
20
|
+
color: var(--adm-color-background);
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
padding: 2px;
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
}
|
|
25
|
+
.adm-result-page-icon .antd-mobile-icon {
|
|
26
|
+
font-size: 32px;
|
|
27
|
+
}
|
|
28
|
+
.adm-result-page-title {
|
|
29
|
+
font-size: var(--adm-font-size-10);
|
|
30
|
+
color: var(--adm-color-background);
|
|
31
|
+
line-height: 1.4;
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
.adm-result-page-description {
|
|
35
|
+
margin-top: 8px;
|
|
36
|
+
margin-bottom: 24px;
|
|
37
|
+
font-size: var(--adm-font-size-6);
|
|
38
|
+
color: rgba(255, 255, 255, 0.6);
|
|
39
|
+
line-height: 1.4;
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
.adm-result-page-details {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
.adm-result-page-detail {
|
|
46
|
+
width: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
margin-bottom: 5px;
|
|
51
|
+
color: var(--adm-color-background);
|
|
52
|
+
font-size: var(--adm-font-size-6);
|
|
53
|
+
}
|
|
54
|
+
.adm-result-page-detail-bold {
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
}
|
|
57
|
+
.adm-result-page-collapse {
|
|
58
|
+
opacity: 0.6;
|
|
59
|
+
width: 10px;
|
|
60
|
+
height: 10px;
|
|
61
|
+
margin: auto;
|
|
62
|
+
margin-bottom: 5px;
|
|
63
|
+
border-top: 2px solid var(--adm-color-background);
|
|
64
|
+
border-right: 2px solid var(--adm-color-background);
|
|
65
|
+
transform: rotate(135deg);
|
|
66
|
+
}
|
|
67
|
+
.adm-result-page-collapse-active {
|
|
68
|
+
transform: rotate(-45deg);
|
|
69
|
+
}
|
|
70
|
+
.adm-result-page-bgWrapper {
|
|
71
|
+
position: relative;
|
|
72
|
+
align-self: flex-start;
|
|
73
|
+
top: 54px;
|
|
74
|
+
}
|
|
75
|
+
.adm-result-page-bg {
|
|
76
|
+
--width: 440vw;
|
|
77
|
+
position: absolute;
|
|
78
|
+
height: var(--width);
|
|
79
|
+
width: var(--width);
|
|
80
|
+
left: calc((var(--width) - 100vw) * -1 / 2 - 20px);
|
|
81
|
+
top: calc(var(--width) * -1 + 1vw);
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
background-color: var(--background-color);
|
|
84
|
+
z-index: -1;
|
|
85
|
+
}
|
|
86
|
+
.adm-result-page-content {
|
|
87
|
+
position: relative;
|
|
88
|
+
padding: 12px;
|
|
89
|
+
top: -104px;
|
|
90
|
+
z-index: 2;
|
|
91
|
+
}
|
|
92
|
+
.adm-result-page-footer {
|
|
93
|
+
position: fixed;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
width: 100%;
|
|
96
|
+
padding: 12px;
|
|
97
|
+
padding-bottom: 24px;
|
|
98
|
+
display: flex;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
background-color: var(--adm-color-box);
|
|
101
|
+
z-index: 3;
|
|
102
|
+
}
|
|
103
|
+
.adm-result-page-footer-btn {
|
|
104
|
+
flex: 1;
|
|
105
|
+
max-width: calc((100vw - 36px) / 2);
|
|
106
|
+
}
|
|
107
|
+
.adm-result-page-footer-space {
|
|
108
|
+
width: 12px;
|
|
109
|
+
}
|
|
110
|
+
.adm-result-page-card {
|
|
111
|
+
border-radius: 8px;
|
|
112
|
+
background-color: var(--adm-color-background);
|
|
113
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
interface ResultPageDetail {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
bold?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare type ResultPageDetails = ResultPageDetail[];
|
|
9
|
+
declare type OnClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void> | unknown;
|
|
10
|
+
export declare type ResultPageProps = {
|
|
11
|
+
status?: 'success' | 'error' | 'info' | 'waiting' | 'warning';
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
details?: ResultPageDetails;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
primaryButtonText?: ReactNode;
|
|
18
|
+
secondaryButtonText?: ReactNode;
|
|
19
|
+
onPrimaryButtonClick?: OnClick;
|
|
20
|
+
onSecondaryButtonClick?: OnClick;
|
|
21
|
+
} & NativeProps<'--background-color'>;
|
|
22
|
+
export declare const ResultPage: FC<ResultPageProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResultPage = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _antdMobileIcons = require("antd-mobile-icons");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _nativeProps = require("../../utils/native-props");
|
|
15
|
+
|
|
16
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
17
|
+
|
|
18
|
+
var _isNodeWithContent = require("../../utils/is-node-with-content");
|
|
19
|
+
|
|
20
|
+
var _button = _interopRequireDefault(require("../button"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
const classPrefix = `adm-result-page`;
|
|
29
|
+
const iconRecord = {
|
|
30
|
+
success: _antdMobileIcons.CheckCircleFill,
|
|
31
|
+
error: _antdMobileIcons.CloseCircleFill,
|
|
32
|
+
info: _antdMobileIcons.InformationCircleFill,
|
|
33
|
+
waiting: _antdMobileIcons.ClockCircleFill,
|
|
34
|
+
warning: _antdMobileIcons.ExclamationCircleFill
|
|
35
|
+
};
|
|
36
|
+
const defaultProps = {
|
|
37
|
+
status: 'info',
|
|
38
|
+
details: []
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ResultPage = p => {
|
|
42
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
43
|
+
const {
|
|
44
|
+
status,
|
|
45
|
+
title,
|
|
46
|
+
description,
|
|
47
|
+
details,
|
|
48
|
+
icon,
|
|
49
|
+
primaryButtonText,
|
|
50
|
+
secondaryButtonText,
|
|
51
|
+
onPrimaryButtonClick,
|
|
52
|
+
onSecondaryButtonClick
|
|
53
|
+
} = props;
|
|
54
|
+
|
|
55
|
+
const resultIcon = icon || _react.default.createElement(iconRecord[status]);
|
|
56
|
+
|
|
57
|
+
const [collapse, setCollapse] = (0, _react.useState)(true);
|
|
58
|
+
const showSecondaryButton = (0, _isNodeWithContent.isNodeWithContent)(secondaryButtonText);
|
|
59
|
+
const showPrimaryButton = (0, _isNodeWithContent.isNodeWithContent)(primaryButtonText);
|
|
60
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
61
|
+
className: classPrefix
|
|
62
|
+
}, _react.default.createElement("div", {
|
|
63
|
+
className: `${classPrefix}-header`
|
|
64
|
+
}, _react.default.createElement("div", {
|
|
65
|
+
className: `${classPrefix}-icon`
|
|
66
|
+
}, resultIcon), _react.default.createElement("div", {
|
|
67
|
+
className: `${classPrefix}-title`
|
|
68
|
+
}, title), (0, _isNodeWithContent.isNodeWithContent)(description) ? _react.default.createElement("div", {
|
|
69
|
+
className: `${classPrefix}-description`
|
|
70
|
+
}, description) : null, details.length ? _react.default.createElement("div", {
|
|
71
|
+
className: `${classPrefix}-details`
|
|
72
|
+
}, (collapse ? details.slice(0, 3) : details).map((detail, index) => {
|
|
73
|
+
return _react.default.createElement("div", {
|
|
74
|
+
className: (0, _classnames.default)(`${classPrefix}-detail`, detail.bold && `${classPrefix}-detail-bold`),
|
|
75
|
+
key: index
|
|
76
|
+
}, _react.default.createElement("span", null, detail.label), _react.default.createElement("span", null, detail.value));
|
|
77
|
+
}), details.length > 3 && _react.default.createElement("div", {
|
|
78
|
+
onClick: () => setCollapse(prev => !prev)
|
|
79
|
+
}, _react.default.createElement("div", {
|
|
80
|
+
className: (0, _classnames.default)(`${classPrefix}-collapse`, !collapse && `${classPrefix}-collapse-active`)
|
|
81
|
+
}))) : null, _react.default.createElement("div", {
|
|
82
|
+
className: `${classPrefix}-bgWrapper`
|
|
83
|
+
}, _react.default.createElement("div", {
|
|
84
|
+
className: `${classPrefix}-bg`
|
|
85
|
+
}))), _react.default.createElement("div", {
|
|
86
|
+
className: `${classPrefix}-content`
|
|
87
|
+
}, props.children), _react.default.createElement("div", {
|
|
88
|
+
className: `${classPrefix}-footer`
|
|
89
|
+
}, showSecondaryButton && _react.default.createElement(_button.default, {
|
|
90
|
+
block: true,
|
|
91
|
+
color: 'default',
|
|
92
|
+
fill: 'solid',
|
|
93
|
+
size: 'large',
|
|
94
|
+
onClick: onSecondaryButtonClick,
|
|
95
|
+
className: `${classPrefix}-footer-btn`
|
|
96
|
+
}, secondaryButtonText), showPrimaryButton && showSecondaryButton && _react.default.createElement("div", {
|
|
97
|
+
className: `${classPrefix}-footer-space`
|
|
98
|
+
}), showPrimaryButton && _react.default.createElement(_button.default, {
|
|
99
|
+
block: true,
|
|
100
|
+
color: 'primary',
|
|
101
|
+
fill: 'solid',
|
|
102
|
+
size: 'large',
|
|
103
|
+
onClick: onPrimaryButtonClick,
|
|
104
|
+
className: `${classPrefix}-footer-btn`
|
|
105
|
+
}, primaryButtonText))));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.ResultPage = ResultPage;
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
--checked-border: none;
|
|
8
8
|
--border-radius: 2px;
|
|
9
9
|
--padding: 8px 16px;
|
|
10
|
+
--gap: 8px;
|
|
11
|
+
---gap: var(--gap);
|
|
12
|
+
---gap-horizontal: var(--gap-horizontal, var(--gap));
|
|
13
|
+
---gap-vertical: var(--gap-vertical, var(--gap));
|
|
10
14
|
overflow: hidden;
|
|
11
15
|
font-size: var(--adm-font-size-7);
|
|
12
16
|
line-height: 1.4;
|
|
@@ -14,6 +18,11 @@
|
|
|
14
18
|
.adm-selector .adm-space.adm-space {
|
|
15
19
|
--gap: 12px;
|
|
16
20
|
}
|
|
21
|
+
.adm-selector .adm-grid {
|
|
22
|
+
--gap: var(---gap);
|
|
23
|
+
--gap-horizontal: var(---gap-horizontal);
|
|
24
|
+
--gap-vertical: var(---gap-vertical);
|
|
25
|
+
}
|
|
17
26
|
.adm-selector-item {
|
|
18
27
|
padding: var(--padding);
|
|
19
28
|
position: relative;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { GridProps } from '../grid';
|
|
3
4
|
declare type SelectorValue = string | number;
|
|
4
5
|
export interface SelectorOption<V> {
|
|
5
6
|
label: ReactNode;
|
|
@@ -9,7 +10,7 @@ export interface SelectorOption<V> {
|
|
|
9
10
|
}
|
|
10
11
|
export declare type SelectorProps<V> = {
|
|
11
12
|
options: SelectorOption<V>[];
|
|
12
|
-
columns?:
|
|
13
|
+
columns?: GridProps['columns'];
|
|
13
14
|
multiple?: boolean;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
defaultValue?: V[];
|
|
@@ -18,6 +19,6 @@ export declare type SelectorProps<V> = {
|
|
|
18
19
|
items: SelectorOption<V>[];
|
|
19
20
|
}) => void;
|
|
20
21
|
showCheckMark?: boolean;
|
|
21
|
-
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding'>;
|
|
22
|
+
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding' | '--gap' | '--gap-vertical' | '--gap-horizontal'>;
|
|
22
23
|
export declare const Selector: <V extends SelectorValue>(p: SelectorProps<V>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
23
24
|
export {};
|
|
@@ -17,8 +17,6 @@ var _space = _interopRequireDefault(require("../space"));
|
|
|
17
17
|
|
|
18
18
|
var _grid = _interopRequireDefault(require("../grid"));
|
|
19
19
|
|
|
20
|
-
var _convertPx = require("../../utils/convert-px");
|
|
21
|
-
|
|
22
20
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
23
21
|
|
|
24
22
|
var _checkMark = require("./check-mark");
|
|
@@ -84,8 +82,7 @@ const Selector = p => {
|
|
|
84
82
|
}, !props.columns && _react.default.createElement(_space.default, {
|
|
85
83
|
wrap: true
|
|
86
84
|
}, items), props.columns && _react.default.createElement(_grid.default, {
|
|
87
|
-
columns: props.columns
|
|
88
|
-
gap: (0, _convertPx.convertPx)(8)
|
|
85
|
+
columns: props.columns
|
|
89
86
|
}, items)));
|
|
90
87
|
};
|
|
91
88
|
|
|
@@ -20,6 +20,7 @@ export declare type SwipeActionProps = {
|
|
|
20
20
|
closeOnAction?: boolean;
|
|
21
21
|
children: ReactNode;
|
|
22
22
|
stopPropagation?: PropagationEvent[];
|
|
23
|
+
onActionsReveal?: (side: 'left' | 'right') => void;
|
|
23
24
|
} & NativeProps<'--background'>;
|
|
24
25
|
export declare const SwipeAction: React.ForwardRefExoticComponent<{
|
|
25
26
|
rightActions?: Action[] | undefined;
|
|
@@ -29,6 +30,7 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
|
|
|
29
30
|
closeOnAction?: boolean | undefined;
|
|
30
31
|
children: ReactNode;
|
|
31
32
|
stopPropagation?: "click"[] | undefined;
|
|
33
|
+
onActionsReveal?: ((side: 'left' | 'right') => void) | undefined;
|
|
32
34
|
} & {
|
|
33
35
|
className?: string | undefined;
|
|
34
36
|
style?: (React.CSSProperties & Partial<Record<"--background", string>>) | undefined;
|
|
@@ -65,8 +65,26 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
65
65
|
}
|
|
66
66
|
}), []);
|
|
67
67
|
const draggingRef = (0, _react.useRef)(false);
|
|
68
|
+
const dragCancelRef = (0, _react.useRef)(null);
|
|
69
|
+
|
|
70
|
+
function forceCancelDrag() {
|
|
71
|
+
var _a;
|
|
72
|
+
|
|
73
|
+
(_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
|
|
74
|
+
draggingRef.current = false;
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
const bind = (0, _react2.useDrag)(state => {
|
|
69
|
-
|
|
78
|
+
var _a;
|
|
79
|
+
|
|
80
|
+
dragCancelRef.current = state.cancel;
|
|
81
|
+
if (!state.intentional) return;
|
|
82
|
+
|
|
83
|
+
if (state.down) {
|
|
84
|
+
draggingRef.current = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!draggingRef.current) return;
|
|
70
88
|
const [offsetX] = state.offset;
|
|
71
89
|
|
|
72
90
|
if (state.last) {
|
|
@@ -82,9 +100,15 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
82
100
|
position = 0;
|
|
83
101
|
}
|
|
84
102
|
|
|
103
|
+
const targetX = (0, _nearest.nearest)([-rightWidth, 0, leftWidth], position);
|
|
85
104
|
api.start({
|
|
86
|
-
x:
|
|
105
|
+
x: targetX
|
|
87
106
|
});
|
|
107
|
+
|
|
108
|
+
if (targetX !== 0) {
|
|
109
|
+
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, targetX > 0 ? 'left' : 'right');
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
window.setTimeout(() => {
|
|
89
113
|
draggingRef.current = false;
|
|
90
114
|
});
|
|
@@ -109,17 +133,21 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
109
133
|
preventScroll: true,
|
|
110
134
|
pointer: {
|
|
111
135
|
touch: true
|
|
112
|
-
}
|
|
136
|
+
},
|
|
137
|
+
triggerAllEvents: true
|
|
113
138
|
});
|
|
114
139
|
|
|
115
140
|
function close() {
|
|
116
141
|
api.start({
|
|
117
142
|
x: 0
|
|
118
143
|
});
|
|
144
|
+
forceCancelDrag();
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
122
148
|
show: (side = 'right') => {
|
|
149
|
+
var _a;
|
|
150
|
+
|
|
123
151
|
if (side === 'right') {
|
|
124
152
|
api.start({
|
|
125
153
|
x: -getRightWidth()
|
|
@@ -129,6 +157,8 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
129
157
|
x: getLeftWidth()
|
|
130
158
|
});
|
|
131
159
|
}
|
|
160
|
+
|
|
161
|
+
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, side);
|
|
132
162
|
},
|
|
133
163
|
close
|
|
134
164
|
}));
|
|
@@ -200,9 +230,7 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
200
230
|
if (x.goal !== 0) {
|
|
201
231
|
e.preventDefault();
|
|
202
232
|
e.stopPropagation();
|
|
203
|
-
|
|
204
|
-
x: 0
|
|
205
|
-
});
|
|
233
|
+
close();
|
|
206
234
|
}
|
|
207
235
|
}
|
|
208
236
|
}, _react.default.createElement(_web.animated.div, {
|
|
@@ -141,7 +141,18 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
}), [count]);
|
|
144
|
+
const dragCancelRef = (0, _react.useRef)(null);
|
|
145
|
+
|
|
146
|
+
function forceCancelDrag() {
|
|
147
|
+
var _a;
|
|
148
|
+
|
|
149
|
+
(_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
|
|
150
|
+
draggingRef.current = false;
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
const bind = (0, _react2.useDrag)(state => {
|
|
154
|
+
dragCancelRef.current = state.cancel;
|
|
155
|
+
if (!state.intentional) return;
|
|
145
156
|
const slidePixels = getSlidePixels();
|
|
146
157
|
if (!slidePixels) return;
|
|
147
158
|
const paramIndex = isVertical ? 1 : 0;
|
|
@@ -170,6 +181,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
170
181
|
const slidePixels = getSlidePixels();
|
|
171
182
|
return [position.get() / 100 * slidePixels, position.get() / 100 * slidePixels];
|
|
172
183
|
},
|
|
184
|
+
triggerAllEvents: true,
|
|
173
185
|
bounds: () => {
|
|
174
186
|
if (loop) return {};
|
|
175
187
|
const slidePixels = getSlidePixels();
|
|
@@ -233,7 +245,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
233
245
|
return () => {
|
|
234
246
|
window.clearInterval(interval);
|
|
235
247
|
};
|
|
236
|
-
}, [autoplay, autoplayInterval, dragging]);
|
|
248
|
+
}, [autoplay, autoplayInterval, dragging, count]);
|
|
237
249
|
|
|
238
250
|
function renderTrackInner() {
|
|
239
251
|
if (loop) {
|
|
@@ -284,6 +296,8 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
284
296
|
if (draggingRef.current) {
|
|
285
297
|
e.stopPropagation();
|
|
286
298
|
}
|
|
299
|
+
|
|
300
|
+
forceCancelDrag();
|
|
287
301
|
}
|
|
288
302
|
}, props.allowTouchMove ? bind() : {}), renderTrackInner()), props.indicator === undefined ? _react.default.createElement("div", {
|
|
289
303
|
className: `${classPrefix}-indicator`
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
.adm-tab-bar-item {
|
|
10
10
|
flex: 1;
|
|
11
|
-
color: var(--adm-color-
|
|
11
|
+
color: var(--adm-color-text-secondary);
|
|
12
12
|
white-space: nowrap;
|
|
13
13
|
padding: 4px 8px;
|
|
14
14
|
width: -webkit-min-content;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
line-height: 1;
|
|
27
27
|
}
|
|
28
28
|
.adm-tab-bar-item-title {
|
|
29
|
-
font-size: var(--adm-font-size-
|
|
29
|
+
font-size: var(--adm-font-size-2);
|
|
30
30
|
line-height: 15px;
|
|
31
31
|
}
|
|
32
32
|
.adm-tab-bar-item-title-with-icon {
|
package/cjs/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { default as PullToRefresh } from './components/pull-to-refresh';
|
|
|
56
56
|
export { default as Radio } from './components/radio';
|
|
57
57
|
export { default as Rate } from './components/rate';
|
|
58
58
|
export { default as Result } from './components/result';
|
|
59
|
+
export { default as ResultPage } from './components/result-page';
|
|
59
60
|
export { default as SafeArea } from './components/safe-area';
|
|
60
61
|
export { default as ScrollMask } from './components/scroll-mask';
|
|
61
62
|
export { default as SearchBar } from './components/search-bar';
|