antd-mobile 5.23.0 → 5.24.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 +167 -15
- package/2x/bundle/antd-mobile.cjs.js +8 -8
- package/2x/bundle/antd-mobile.compatible.umd.js +5364 -5241
- package/2x/bundle/antd-mobile.es.development.js +167 -15
- package/2x/bundle/antd-mobile.es.js +4345 -4242
- package/2x/bundle/antd-mobile.umd.development.js +167 -15
- package/2x/bundle/antd-mobile.umd.js +8 -8
- package/2x/bundle/style.css +9 -4
- package/2x/cjs/components/calendar/calendar.d.ts +3 -5
- package/2x/cjs/components/calendar/calendar.js +27 -5
- package/2x/cjs/components/calendar/convert.d.ts +6 -0
- package/2x/cjs/components/calendar/convert.js +9 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +16 -7
- package/2x/cjs/components/form/form-item.css +0 -1
- package/2x/cjs/components/form/form.css +9 -3
- package/2x/cjs/components/form/form.d.ts +2 -2
- package/2x/cjs/components/form/index.css +9 -4
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/popover/popover.js +2 -2
- package/2x/cjs/components/stepper/stepper.js +2 -1
- package/2x/cjs/components/swiper/swiper.js +9 -0
- package/2x/es/components/calendar/calendar.d.ts +3 -5
- package/2x/es/components/calendar/calendar.js +29 -6
- package/2x/es/components/calendar/convert.d.ts +6 -0
- package/2x/es/components/calendar/convert.js +4 -0
- package/2x/es/components/ellipsis/ellipsis.js +14 -8
- package/2x/es/components/form/form-item.css +0 -1
- package/2x/es/components/form/form.css +9 -3
- package/2x/es/components/form/form.d.ts +2 -2
- package/2x/es/components/form/index.css +9 -4
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/popover/popover.js +2 -2
- package/2x/es/components/stepper/stepper.js +2 -1
- package/2x/es/components/swiper/swiper.js +9 -0
- package/2x/package.json +2 -1
- package/2x/umd/antd-mobile.js +5364 -5241
- package/bundle/antd-mobile.cjs.development.js +167 -15
- package/bundle/antd-mobile.cjs.js +8 -8
- package/bundle/antd-mobile.compatible.umd.js +5364 -5241
- package/bundle/antd-mobile.es.development.js +167 -15
- package/bundle/antd-mobile.es.js +4345 -4242
- package/bundle/antd-mobile.umd.development.js +167 -15
- package/bundle/antd-mobile.umd.js +8 -8
- package/bundle/style.css +1 -1
- package/cjs/components/calendar/calendar.d.ts +3 -5
- package/cjs/components/calendar/calendar.js +27 -5
- package/cjs/components/calendar/convert.d.ts +6 -0
- package/cjs/components/calendar/convert.js +9 -0
- package/cjs/components/ellipsis/ellipsis.js +16 -7
- package/cjs/components/form/form-item.css +0 -1
- package/cjs/components/form/form.css +8 -3
- package/cjs/components/form/form.d.ts +2 -2
- package/cjs/components/form/index.css +8 -4
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/popover/popover.js +2 -2
- package/cjs/components/stepper/stepper.js +2 -1
- package/cjs/components/swiper/swiper.js +9 -0
- package/es/components/calendar/calendar.d.ts +3 -5
- package/es/components/calendar/calendar.js +29 -6
- package/es/components/calendar/convert.d.ts +6 -0
- package/es/components/calendar/convert.js +4 -0
- package/es/components/ellipsis/ellipsis.js +14 -8
- package/es/components/form/form-item.css +0 -1
- package/es/components/form/form.css +8 -3
- package/es/components/form/form.d.ts +2 -2
- package/es/components/form/index.css +8 -4
- package/es/components/form/index.d.ts +1 -1
- package/es/components/popover/popover.js +2 -2
- package/es/components/stepper/stepper.js +2 -1
- package/es/components/swiper/swiper.js +9 -0
- package/package.json +2 -1
- package/umd/antd-mobile.js +1 -1
package/2x/bundle/style.css
CHANGED
|
@@ -1912,12 +1912,14 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
|
|
1914
1914
|
.adm-form {
|
|
1915
|
-
--border-inner: solid 2px var(--adm-color
|
|
1916
|
-
--border-top: solid 2px var(--adm-color
|
|
1917
|
-
--border-bottom: solid 2px var(--adm-color
|
|
1915
|
+
--border-inner: solid 2px var(--adm-border-color);
|
|
1916
|
+
--border-top: solid 2px var(--adm-border-color);
|
|
1917
|
+
--border-bottom: solid 2px var(--adm-border-color);
|
|
1918
|
+
--prefix-width: 6.8em;
|
|
1918
1919
|
---border-inner: var(--border-inner);
|
|
1919
1920
|
---border-top: var(--border-top);
|
|
1920
1921
|
---border-bottom: var(--border-bottom);
|
|
1922
|
+
---prefix-width: var(--prefix-width);
|
|
1921
1923
|
}
|
|
1922
1924
|
|
|
1923
1925
|
.adm-form .adm-list.adm-list {
|
|
@@ -1932,6 +1934,10 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
1932
1934
|
padding: 40px 24px;
|
|
1933
1935
|
}
|
|
1934
1936
|
|
|
1937
|
+
.adm-form .adm-form-item-horizontal.adm-list-item {
|
|
1938
|
+
--prefix-width: var(---prefix-width);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1935
1941
|
.adm-form-list-operation {
|
|
1936
1942
|
text-align: center;
|
|
1937
1943
|
color: #1677ff;
|
|
@@ -2006,7 +2012,6 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
2006
2012
|
|
|
2007
2013
|
.adm-form-item.adm-form-item-horizontal.adm-list-item {
|
|
2008
2014
|
--align-items: stretch;
|
|
2009
|
-
--prefix-width: 6.8em;
|
|
2010
2015
|
}
|
|
2011
2016
|
|
|
2012
2017
|
.adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
-
|
|
4
|
-
month: number;
|
|
5
|
-
year: number;
|
|
6
|
-
};
|
|
3
|
+
import { Page } from './convert';
|
|
7
4
|
export declare type CalendarRef = {
|
|
8
5
|
jumpTo: (page: Page | ((page: Page) => Page)) => void;
|
|
9
6
|
jumpToToday: () => void;
|
|
@@ -20,6 +17,8 @@ export declare type CalendarProps = {
|
|
|
20
17
|
max?: Date;
|
|
21
18
|
min?: Date;
|
|
22
19
|
shouldDisableDate?: (date: Date) => boolean;
|
|
20
|
+
minPage?: Page;
|
|
21
|
+
maxPage?: Page;
|
|
23
22
|
} & ({
|
|
24
23
|
selectionMode?: undefined;
|
|
25
24
|
value?: undefined;
|
|
@@ -37,4 +36,3 @@ export declare type CalendarProps = {
|
|
|
37
36
|
onChange?: (val: [Date, Date] | null) => void;
|
|
38
37
|
}) & NativeProps;
|
|
39
38
|
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;
|
|
40
|
-
export {};
|
|
@@ -93,36 +93,58 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
|
93
93
|
page = pageOrPageGenerator;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
setCurrent((0,
|
|
96
|
+
setCurrent((0, _convert.convertPageToDayjs)(page));
|
|
97
97
|
},
|
|
98
98
|
jumpToToday: () => {
|
|
99
99
|
setCurrent((0, _dayjs.default)().date(1));
|
|
100
100
|
}
|
|
101
101
|
}));
|
|
102
102
|
|
|
103
|
+
const handlePageChange = (action, num, type) => {
|
|
104
|
+
const nxtCurrent = current[action](num, type);
|
|
105
|
+
|
|
106
|
+
if (action === 'subtract' && props.minPage) {
|
|
107
|
+
const minPage = (0, _convert.convertPageToDayjs)(props.minPage);
|
|
108
|
+
|
|
109
|
+
if (nxtCurrent.isBefore(minPage, type)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (action === 'add' && props.maxPage) {
|
|
115
|
+
const maxPage = (0, _convert.convertPageToDayjs)(props.maxPage);
|
|
116
|
+
|
|
117
|
+
if (nxtCurrent.isAfter(maxPage, type)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
setCurrent(current[action](num, type));
|
|
123
|
+
};
|
|
124
|
+
|
|
103
125
|
const header = _react.default.createElement("div", {
|
|
104
126
|
className: `${classPrefix}-header`
|
|
105
127
|
}, _react.default.createElement("a", {
|
|
106
128
|
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-year`,
|
|
107
129
|
onClick: () => {
|
|
108
|
-
|
|
130
|
+
handlePageChange('subtract', 1, 'year');
|
|
109
131
|
}
|
|
110
132
|
}, props.prevYearButton), _react.default.createElement("a", {
|
|
111
133
|
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-month`,
|
|
112
134
|
onClick: () => {
|
|
113
|
-
|
|
135
|
+
handlePageChange('subtract', 1, 'month');
|
|
114
136
|
}
|
|
115
137
|
}, props.prevMonthButton), _react.default.createElement("div", {
|
|
116
138
|
className: `${classPrefix}-title`
|
|
117
139
|
}, locale.Calendar.renderYearAndMonth(current.year(), current.month() + 1)), _react.default.createElement("a", {
|
|
118
140
|
className: (0, _classnames.default)(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-month`),
|
|
119
141
|
onClick: () => {
|
|
120
|
-
|
|
142
|
+
handlePageChange('add', 1, 'month');
|
|
121
143
|
}
|
|
122
144
|
}, props.nextMonthButton), _react.default.createElement("a", {
|
|
123
145
|
className: (0, _classnames.default)(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-year`),
|
|
124
146
|
onClick: () => {
|
|
125
|
-
|
|
147
|
+
handlePageChange('add', 1, 'year');
|
|
126
148
|
}
|
|
127
149
|
}, props.nextYearButton));
|
|
128
150
|
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
1
2
|
export declare type DateRange = [Date, Date] | null;
|
|
3
|
+
export declare type Page = {
|
|
4
|
+
month: number;
|
|
5
|
+
year: number;
|
|
6
|
+
};
|
|
2
7
|
export declare function convertValueToRange(selectionMode: 'single' | 'range' | undefined, value: Date | [Date, Date] | null): DateRange;
|
|
8
|
+
export declare function convertPageToDayjs(page: Page): dayjs.Dayjs;
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.convertPageToDayjs = convertPageToDayjs;
|
|
6
7
|
exports.convertValueToRange = convertValueToRange;
|
|
7
8
|
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
8
13
|
function convertValueToRange(selectionMode, value) {
|
|
9
14
|
if (selectionMode === undefined) {
|
|
10
15
|
return null;
|
|
@@ -19,4 +24,8 @@ function convertValueToRange(selectionMode, value) {
|
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
return [value, value];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function convertPageToDayjs(page) {
|
|
30
|
+
return (0, _dayjs.default)().year(page.year).month(page.month - 1).date(1);
|
|
22
31
|
}
|
|
@@ -7,6 +7,8 @@ exports.Ellipsis = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _runes = _interopRequireDefault(require("runes"));
|
|
11
|
+
|
|
10
12
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
11
13
|
|
|
12
14
|
var _nativeProps = require("../../utils/native-props");
|
|
@@ -17,6 +19,8 @@ var _ahooks = require("ahooks");
|
|
|
17
19
|
|
|
18
20
|
var _withStopPropagation = require("../../utils/with-stop-propagation");
|
|
19
21
|
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
20
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); }
|
|
21
25
|
|
|
22
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; }
|
|
@@ -37,6 +41,11 @@ const Ellipsis = p => {
|
|
|
37
41
|
const [ellipsised, setEllipsised] = (0, _react.useState)({});
|
|
38
42
|
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
39
43
|
const [exceeded, setExceeded] = (0, _react.useState)(false);
|
|
44
|
+
const chars = (0, _react.useMemo)(() => (0, _runes.default)(props.content), [props.content]);
|
|
45
|
+
|
|
46
|
+
function getSubString(start, end) {
|
|
47
|
+
return chars.slice(start, end).join('');
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
function calcEllipsised() {
|
|
42
51
|
const root = rootRef.current;
|
|
@@ -75,11 +84,11 @@ const Ellipsis = p => {
|
|
|
75
84
|
if (right - left <= 1) {
|
|
76
85
|
if (props.direction === 'end') {
|
|
77
86
|
return {
|
|
78
|
-
leading:
|
|
87
|
+
leading: getSubString(0, left) + '...'
|
|
79
88
|
};
|
|
80
89
|
} else {
|
|
81
90
|
return {
|
|
82
|
-
tailing: '...' +
|
|
91
|
+
tailing: '...' + getSubString(right, end)
|
|
83
92
|
};
|
|
84
93
|
}
|
|
85
94
|
}
|
|
@@ -87,9 +96,9 @@ const Ellipsis = p => {
|
|
|
87
96
|
const middle = Math.round((left + right) / 2);
|
|
88
97
|
|
|
89
98
|
if (props.direction === 'end') {
|
|
90
|
-
container.innerText =
|
|
99
|
+
container.innerText = getSubString(0, middle) + '...' + actionText;
|
|
91
100
|
} else {
|
|
92
|
-
container.innerText = actionText + '...' +
|
|
101
|
+
container.innerText = actionText + '...' + getSubString(middle, end);
|
|
93
102
|
}
|
|
94
103
|
|
|
95
104
|
if (container.offsetHeight <= maxHeight) {
|
|
@@ -110,14 +119,14 @@ const Ellipsis = p => {
|
|
|
110
119
|
function checkMiddle(leftPart, rightPart) {
|
|
111
120
|
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
|
112
121
|
return {
|
|
113
|
-
leading:
|
|
114
|
-
tailing: '...' +
|
|
122
|
+
leading: getSubString(0, leftPart[0]) + '...',
|
|
123
|
+
tailing: '...' + getSubString(rightPart[1], end)
|
|
115
124
|
};
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
119
128
|
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
120
|
-
container.innerText =
|
|
129
|
+
container.innerText = getSubString(0, leftPartMiddle) + '...' + actionText + '...' + getSubString(rightPartMiddle, end);
|
|
121
130
|
|
|
122
131
|
if (container.offsetHeight <= maxHeight) {
|
|
123
132
|
return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
.adm-form {
|
|
2
|
-
--border-inner: solid 2px var(--adm-color
|
|
3
|
-
--border-top: solid 2px var(--adm-color
|
|
4
|
-
--border-bottom: solid 2px var(--adm-color
|
|
2
|
+
--border-inner: solid 2px var(--adm-border-color);
|
|
3
|
+
--border-top: solid 2px var(--adm-border-color);
|
|
4
|
+
--border-bottom: solid 2px var(--adm-border-color);
|
|
5
|
+
--prefix-width: 6.8em;
|
|
5
6
|
---border-inner: var(--border-inner);
|
|
6
7
|
---border-top: var(--border-top);
|
|
7
8
|
---border-bottom: var(--border-bottom);
|
|
9
|
+
---prefix-width: var(--prefix-width);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.adm-form .adm-list.adm-list {
|
|
@@ -19,6 +21,10 @@
|
|
|
19
21
|
padding: 40px 24px;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
.adm-form .adm-form-item-horizontal.adm-list-item {
|
|
25
|
+
--prefix-width: var(---prefix-width);
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
.adm-form-list-operation {
|
|
23
29
|
text-align: center;
|
|
24
30
|
color: #1677ff;
|
|
@@ -4,13 +4,13 @@ import { ListProps } from '../list';
|
|
|
4
4
|
import type { FormProps as RcFormProps, FormInstance as RCFormInstance } from 'rc-field-form';
|
|
5
5
|
import { FormContextType } from './context';
|
|
6
6
|
export declare type FormInstance = Pick<RCFormInstance, 'getFieldValue' | 'getFieldsValue' | 'getFieldError' | 'getFieldsError' | 'isFieldTouched' | 'isFieldsTouched' | 'resetFields' | 'setFields' | 'setFieldsValue' | 'submit' | 'validateFields'>;
|
|
7
|
-
export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'name' | 'preserve' | 'validateMessages' | 'validateTrigger' | 'onFieldsChange' | 'onFinish' | 'onFinishFailed' | 'onValuesChange' | 'children'> & NativeProps<'--border-inner' | '--border-top' | '--border-bottom'> & Partial<FormContextType> & {
|
|
7
|
+
export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'name' | 'preserve' | 'validateMessages' | 'validateTrigger' | 'onFieldsChange' | 'onFinish' | 'onFinishFailed' | 'onValuesChange' | 'children'> & NativeProps<'--border-inner' | '--border-top' | '--border-bottom' | '--prefix-width'> & Partial<FormContextType> & {
|
|
8
8
|
footer?: ReactNode;
|
|
9
9
|
mode?: ListProps['mode'];
|
|
10
10
|
};
|
|
11
11
|
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
12
12
|
className?: string | undefined;
|
|
13
|
-
style?: (React.CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top", string>>) | undefined;
|
|
13
|
+
style?: (React.CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top" | "--prefix-width", string>>) | undefined;
|
|
14
14
|
tabIndex?: number | undefined;
|
|
15
15
|
} & React.AriaAttributes & Partial<FormContextType> & {
|
|
16
16
|
footer?: ReactNode;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
.adm-form {
|
|
2
|
-
--border-inner: solid 2px var(--adm-color
|
|
3
|
-
--border-top: solid 2px var(--adm-color
|
|
4
|
-
--border-bottom: solid 2px var(--adm-color
|
|
2
|
+
--border-inner: solid 2px var(--adm-border-color);
|
|
3
|
+
--border-top: solid 2px var(--adm-border-color);
|
|
4
|
+
--border-bottom: solid 2px var(--adm-border-color);
|
|
5
|
+
--prefix-width: 6.8em;
|
|
5
6
|
---border-inner: var(--border-inner);
|
|
6
7
|
---border-top: var(--border-top);
|
|
7
8
|
---border-bottom: var(--border-bottom);
|
|
9
|
+
---prefix-width: var(--prefix-width);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.adm-form .adm-list.adm-list {
|
|
@@ -19,6 +21,10 @@
|
|
|
19
21
|
padding: 40px 24px;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
.adm-form .adm-form-item-horizontal.adm-list-item {
|
|
25
|
+
--prefix-width: var(---prefix-width);
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
.adm-form-list-operation {
|
|
23
29
|
text-align: center;
|
|
24
30
|
color: #1677ff;
|
|
@@ -93,7 +99,6 @@
|
|
|
93
99
|
|
|
94
100
|
.adm-form-item.adm-form-item-horizontal.adm-list-item {
|
|
95
101
|
--align-items: stretch;
|
|
96
|
-
--prefix-width: 6.8em;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
.adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
|
|
@@ -9,7 +9,7 @@ export type { ValidateMessages, FieldData, NamePath, } from 'rc-field-form/es/in
|
|
|
9
9
|
export type { FormArrayField, FormArrayOperation, FormArrayProps, } from './form-array';
|
|
10
10
|
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
11
11
|
className?: string | undefined;
|
|
12
|
-
style?: (import("react").CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top", string>>) | undefined;
|
|
12
|
+
style?: (import("react").CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top" | "--prefix-width", string>>) | undefined;
|
|
13
13
|
tabIndex?: number | undefined;
|
|
14
14
|
} & import("react").AriaAttributes & Partial<import("./context").FormContextType> & {
|
|
15
15
|
footer?: import("react").ReactNode;
|
|
@@ -167,11 +167,11 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
167
167
|
(0, _ahooks.useClickAway)(() => {
|
|
168
168
|
if (!props.trigger) return;
|
|
169
169
|
setVisible(false);
|
|
170
|
-
}, () => {
|
|
170
|
+
}, [() => {
|
|
171
171
|
var _a;
|
|
172
172
|
|
|
173
173
|
return (_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.element;
|
|
174
|
-
});
|
|
174
|
+
}, floatingRef], ['click', 'touchmove']);
|
|
175
175
|
const shouldRender = (0, _shouldRender.useShouldRender)(visible, false, props.destroyOnHide);
|
|
176
176
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_wrapper.Wrapper, {
|
|
177
177
|
ref: targetRef
|
|
@@ -161,7 +161,8 @@ const Stepper = p => {
|
|
|
161
161
|
role: 'spinbutton',
|
|
162
162
|
"aria-valuenow": Number(inputValue),
|
|
163
163
|
"aria-valuemax": max,
|
|
164
|
-
"aria-valuemin": min
|
|
164
|
+
"aria-valuemin": min,
|
|
165
|
+
inputMode: 'decimal'
|
|
165
166
|
})), _react.default.createElement(_button.default, {
|
|
166
167
|
className: `${classPrefix}-plus`,
|
|
167
168
|
onClick: handlePlus,
|
|
@@ -50,8 +50,10 @@ const defaultProps = {
|
|
|
50
50
|
stuckAtBoundary: true,
|
|
51
51
|
rubberband: true
|
|
52
52
|
};
|
|
53
|
+
let currentUid;
|
|
53
54
|
const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) => {
|
|
54
55
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
56
|
+
const [uid] = (0, _react.useState)({});
|
|
55
57
|
const isVertical = props.direction === 'vertical';
|
|
56
58
|
const slideRatio = props.slideSize / 100;
|
|
57
59
|
const offsetRatio = props.trackOffset / 100;
|
|
@@ -153,6 +155,13 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
153
155
|
const bind = (0, _react2.useDrag)(state => {
|
|
154
156
|
dragCancelRef.current = state.cancel;
|
|
155
157
|
if (!state.intentional) return;
|
|
158
|
+
|
|
159
|
+
if (state.first && !currentUid) {
|
|
160
|
+
currentUid = uid;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (currentUid !== uid) return;
|
|
164
|
+
currentUid = state.last ? undefined : uid;
|
|
156
165
|
const slidePixels = getSlidePixels();
|
|
157
166
|
if (!slidePixels) return;
|
|
158
167
|
const paramIndex = isVertical ? 1 : 0;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
-
|
|
4
|
-
month: number;
|
|
5
|
-
year: number;
|
|
6
|
-
};
|
|
3
|
+
import { Page } from './convert';
|
|
7
4
|
export declare type CalendarRef = {
|
|
8
5
|
jumpTo: (page: Page | ((page: Page) => Page)) => void;
|
|
9
6
|
jumpToToday: () => void;
|
|
@@ -20,6 +17,8 @@ export declare type CalendarProps = {
|
|
|
20
17
|
max?: Date;
|
|
21
18
|
min?: Date;
|
|
22
19
|
shouldDisableDate?: (date: Date) => boolean;
|
|
20
|
+
minPage?: Page;
|
|
21
|
+
maxPage?: Page;
|
|
23
22
|
} & ({
|
|
24
23
|
selectionMode?: undefined;
|
|
25
24
|
value?: undefined;
|
|
@@ -37,4 +36,3 @@ export declare type CalendarProps = {
|
|
|
37
36
|
onChange?: (val: [Date, Date] | null) => void;
|
|
38
37
|
}) & NativeProps;
|
|
39
38
|
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;
|
|
40
|
-
export {};
|
|
@@ -9,7 +9,7 @@ import { useConfig } from '../config-provider';
|
|
|
9
9
|
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
10
10
|
import { useUpdateEffect } from 'ahooks';
|
|
11
11
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
12
|
-
import { convertValueToRange } from './convert';
|
|
12
|
+
import { convertValueToRange, convertPageToDayjs } from './convert';
|
|
13
13
|
dayjs.extend(isoWeek);
|
|
14
14
|
const classPrefix = 'adm-calendar';
|
|
15
15
|
const defaultProps = {
|
|
@@ -67,35 +67,58 @@ export const Calendar = forwardRef((p, ref) => {
|
|
|
67
67
|
page = pageOrPageGenerator;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
setCurrent(
|
|
70
|
+
setCurrent(convertPageToDayjs(page));
|
|
71
71
|
},
|
|
72
72
|
jumpToToday: () => {
|
|
73
73
|
setCurrent(dayjs().date(1));
|
|
74
74
|
}
|
|
75
75
|
}));
|
|
76
|
+
|
|
77
|
+
const handlePageChange = (action, num, type) => {
|
|
78
|
+
const nxtCurrent = current[action](num, type);
|
|
79
|
+
|
|
80
|
+
if (action === 'subtract' && props.minPage) {
|
|
81
|
+
const minPage = convertPageToDayjs(props.minPage);
|
|
82
|
+
|
|
83
|
+
if (nxtCurrent.isBefore(minPage, type)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (action === 'add' && props.maxPage) {
|
|
89
|
+
const maxPage = convertPageToDayjs(props.maxPage);
|
|
90
|
+
|
|
91
|
+
if (nxtCurrent.isAfter(maxPage, type)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setCurrent(current[action](num, type));
|
|
97
|
+
};
|
|
98
|
+
|
|
76
99
|
const header = React.createElement("div", {
|
|
77
100
|
className: `${classPrefix}-header`
|
|
78
101
|
}, React.createElement("a", {
|
|
79
102
|
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-year`,
|
|
80
103
|
onClick: () => {
|
|
81
|
-
|
|
104
|
+
handlePageChange('subtract', 1, 'year');
|
|
82
105
|
}
|
|
83
106
|
}, props.prevYearButton), React.createElement("a", {
|
|
84
107
|
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-month`,
|
|
85
108
|
onClick: () => {
|
|
86
|
-
|
|
109
|
+
handlePageChange('subtract', 1, 'month');
|
|
87
110
|
}
|
|
88
111
|
}, props.prevMonthButton), React.createElement("div", {
|
|
89
112
|
className: `${classPrefix}-title`
|
|
90
113
|
}, locale.Calendar.renderYearAndMonth(current.year(), current.month() + 1)), React.createElement("a", {
|
|
91
114
|
className: classNames(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-month`),
|
|
92
115
|
onClick: () => {
|
|
93
|
-
|
|
116
|
+
handlePageChange('add', 1, 'month');
|
|
94
117
|
}
|
|
95
118
|
}, props.nextMonthButton), React.createElement("a", {
|
|
96
119
|
className: classNames(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-year`),
|
|
97
120
|
onClick: () => {
|
|
98
|
-
|
|
121
|
+
handlePageChange('add', 1, 'year');
|
|
99
122
|
}
|
|
100
123
|
}, props.nextYearButton));
|
|
101
124
|
const maxDay = useMemo(() => props.max && dayjs(props.max), [props.max]);
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
1
2
|
export declare type DateRange = [Date, Date] | null;
|
|
3
|
+
export declare type Page = {
|
|
4
|
+
month: number;
|
|
5
|
+
year: number;
|
|
6
|
+
};
|
|
2
7
|
export declare function convertValueToRange(selectionMode: 'single' | 'range' | undefined, value: Date | [Date, Date] | null): DateRange;
|
|
8
|
+
export declare function convertPageToDayjs(page: Page): dayjs.Dayjs;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
1
2
|
export function convertValueToRange(selectionMode, value) {
|
|
2
3
|
if (selectionMode === undefined) {
|
|
3
4
|
return null;
|
|
@@ -12,4 +13,7 @@ export function convertValueToRange(selectionMode, value) {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
return [value, value];
|
|
16
|
+
}
|
|
17
|
+
export function convertPageToDayjs(page) {
|
|
18
|
+
return dayjs().year(page.year).month(page.month - 1).date(1);
|
|
15
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
+
import runes from 'runes';
|
|
2
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
3
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
5
|
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
@@ -19,6 +20,11 @@ export const Ellipsis = p => {
|
|
|
19
20
|
const [ellipsised, setEllipsised] = useState({});
|
|
20
21
|
const [expanded, setExpanded] = useState(false);
|
|
21
22
|
const [exceeded, setExceeded] = useState(false);
|
|
23
|
+
const chars = useMemo(() => runes(props.content), [props.content]);
|
|
24
|
+
|
|
25
|
+
function getSubString(start, end) {
|
|
26
|
+
return chars.slice(start, end).join('');
|
|
27
|
+
}
|
|
22
28
|
|
|
23
29
|
function calcEllipsised() {
|
|
24
30
|
const root = rootRef.current;
|
|
@@ -57,11 +63,11 @@ export const Ellipsis = p => {
|
|
|
57
63
|
if (right - left <= 1) {
|
|
58
64
|
if (props.direction === 'end') {
|
|
59
65
|
return {
|
|
60
|
-
leading:
|
|
66
|
+
leading: getSubString(0, left) + '...'
|
|
61
67
|
};
|
|
62
68
|
} else {
|
|
63
69
|
return {
|
|
64
|
-
tailing: '...' +
|
|
70
|
+
tailing: '...' + getSubString(right, end)
|
|
65
71
|
};
|
|
66
72
|
}
|
|
67
73
|
}
|
|
@@ -69,9 +75,9 @@ export const Ellipsis = p => {
|
|
|
69
75
|
const middle = Math.round((left + right) / 2);
|
|
70
76
|
|
|
71
77
|
if (props.direction === 'end') {
|
|
72
|
-
container.innerText =
|
|
78
|
+
container.innerText = getSubString(0, middle) + '...' + actionText;
|
|
73
79
|
} else {
|
|
74
|
-
container.innerText = actionText + '...' +
|
|
80
|
+
container.innerText = actionText + '...' + getSubString(middle, end);
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
if (container.offsetHeight <= maxHeight) {
|
|
@@ -92,14 +98,14 @@ export const Ellipsis = p => {
|
|
|
92
98
|
function checkMiddle(leftPart, rightPart) {
|
|
93
99
|
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
|
94
100
|
return {
|
|
95
|
-
leading:
|
|
96
|
-
tailing: '...' +
|
|
101
|
+
leading: getSubString(0, leftPart[0]) + '...',
|
|
102
|
+
tailing: '...' + getSubString(rightPart[1], end)
|
|
97
103
|
};
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
101
107
|
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
102
|
-
container.innerText =
|
|
108
|
+
container.innerText = getSubString(0, leftPartMiddle) + '...' + actionText + '...' + getSubString(rightPartMiddle, end);
|
|
103
109
|
|
|
104
110
|
if (container.offsetHeight <= maxHeight) {
|
|
105
111
|
return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
.adm-form {
|
|
2
|
-
--border-inner: solid 2px var(--adm-color
|
|
3
|
-
--border-top: solid 2px var(--adm-color
|
|
4
|
-
--border-bottom: solid 2px var(--adm-color
|
|
2
|
+
--border-inner: solid 2px var(--adm-border-color);
|
|
3
|
+
--border-top: solid 2px var(--adm-border-color);
|
|
4
|
+
--border-bottom: solid 2px var(--adm-border-color);
|
|
5
|
+
--prefix-width: 6.8em;
|
|
5
6
|
---border-inner: var(--border-inner);
|
|
6
7
|
---border-top: var(--border-top);
|
|
7
8
|
---border-bottom: var(--border-bottom);
|
|
9
|
+
---prefix-width: var(--prefix-width);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.adm-form .adm-list.adm-list {
|
|
@@ -19,6 +21,10 @@
|
|
|
19
21
|
padding: 40px 24px;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
.adm-form .adm-form-item-horizontal.adm-list-item {
|
|
25
|
+
--prefix-width: var(---prefix-width);
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
.adm-form-list-operation {
|
|
23
29
|
text-align: center;
|
|
24
30
|
color: #1677ff;
|
|
@@ -4,13 +4,13 @@ import { ListProps } from '../list';
|
|
|
4
4
|
import type { FormProps as RcFormProps, FormInstance as RCFormInstance } from 'rc-field-form';
|
|
5
5
|
import { FormContextType } from './context';
|
|
6
6
|
export declare type FormInstance = Pick<RCFormInstance, 'getFieldValue' | 'getFieldsValue' | 'getFieldError' | 'getFieldsError' | 'isFieldTouched' | 'isFieldsTouched' | 'resetFields' | 'setFields' | 'setFieldsValue' | 'submit' | 'validateFields'>;
|
|
7
|
-
export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'name' | 'preserve' | 'validateMessages' | 'validateTrigger' | 'onFieldsChange' | 'onFinish' | 'onFinishFailed' | 'onValuesChange' | 'children'> & NativeProps<'--border-inner' | '--border-top' | '--border-bottom'> & Partial<FormContextType> & {
|
|
7
|
+
export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'name' | 'preserve' | 'validateMessages' | 'validateTrigger' | 'onFieldsChange' | 'onFinish' | 'onFinishFailed' | 'onValuesChange' | 'children'> & NativeProps<'--border-inner' | '--border-top' | '--border-bottom' | '--prefix-width'> & Partial<FormContextType> & {
|
|
8
8
|
footer?: ReactNode;
|
|
9
9
|
mode?: ListProps['mode'];
|
|
10
10
|
};
|
|
11
11
|
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
12
12
|
className?: string | undefined;
|
|
13
|
-
style?: (React.CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top", string>>) | undefined;
|
|
13
|
+
style?: (React.CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top" | "--prefix-width", string>>) | undefined;
|
|
14
14
|
tabIndex?: number | undefined;
|
|
15
15
|
} & React.AriaAttributes & Partial<FormContextType> & {
|
|
16
16
|
footer?: ReactNode;
|